Quantcast
Channel: ASP.NET Core
Viewing all 9386 articles
Browse latest View live

How to limit access code attemtpts?

$
0
0

Hi, i have made a form where the already logged in users have to write an additional code in order to proceed (like a two-factor auth but without an external app/generator).

But currently a user can use as many attempts as possible. The number is an int that they must match.

How can i make sure they get no more than 5 attempts before being locked out? 


Oracle connectivity issue for asp.net core 2.1 web api from docker container

$
0
0
Hi All,
I am trying to connect oracle database using Oracle.ManagedDataAccess.Core 2.18.3 ; i am using asp.net core 2.1 web api. When i run this code on my local machin it works fine but when dockerised it and deployed it under container it fails with below error

ORA-00604 : error occured at recursive SQL level 1
ORA-01882 : timezone region not found

I searched on internet and found below solutions but both of them are not working for me ; Please help asap.

1. Set timezone in docket file as below
ENV TZ=America/New_York
2. Also setup timezone to open oracle connection as below
Oracle globalization info = con.GetSession();
info.TimeZone = "America/New_York";
con.SetSessionInfo(info);


Please help

how to create poko class for JObject Data

$
0
0

Title 1

         Key : Value 

         Key :  Value 

Title 2

         Key :  Value 

         Key : Value 

Title 3

        Key : Value 

        Key : Value 

Kestrel Restart on wwwroot folder deletion

$
0
0

I am using the Vue Cli  3 with ASP.Net Core 2.2.  I have the Vue Cli set to output files to the wwwroot folder. The Vue Cli will delete the folder and then recreate the files and this causes Kestrel to restart. Is there any way to prevent this during development?

binding issue

$
0
0

Bonjour

Je ne comprends pas pourquoi le binding ne fonctionne pas c'est a dire pourquoi quand j'appuie sur submit j'ai null dans EmailAdress (OnPost)

Je regarde sur les forums et ca semble la bonne facon de faire

merci de me debloquer svp :)

VUE

@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}

<form method="post">

<input value="Export to Excel" type="submit" />
</form>

CONTROLLER

public class IndexModel : PageModel
{
private readonly IStockList stocksService;
private readonly IExportData exportDataService;
public List<Stock> StockPrices;

[BindProperty]
public string EmailAddress { get; set; }


public IndexModel(IStockList stocks, IExportData export)
{
stocksService = stocks;
exportDataService = export;
EmailAddress = "prix 1";


}

public IActionResult OnPost(string EmailAddress)
{

return exportDataService.Save(stocksService.GetStocks());

}
public void OnGet()
{
StockPrices = stocksService.GetStocks();
EmailAddress = "Prix 2";
}
}

Migrating MVC 5 to .net core 2.1

$
0
0

What are steps for Migrating MVC 5  application into .net core 2.1.

I have different areas and multiple project file(BAL,DAL,UI) in the  solution

Filtering data when export a db view to excel

$
0
0

Hi

I'm trying to filter the data when export some view in the database to excel file.

I'm using this code in the Visit controller:

public IActionResult Excel(decimal? sid, int? MrId)
        {
            var viContext = _context.Query<VisitHeader>().AsQueryable();
            ViewData["TxtIdF"] = sid;
            ViewData["MrIdF"] = MrId;
            if (sid != null || sid.GetValueOrDefault() != 0)
            {
                viContext = viContext.Where(s => s.NzeelId.ToString().Contains(sid.ToString()));
            }
            if (MrId != null || MrId.GetValueOrDefault() != 0)
            {
                viContext = viContext.Where(s => s.MrkzId.ToString().Equals(MrId.ToString()));
            }

            var comlumHeadrs = new string[]
            {
                "Name","Center","Visit Type","Visit Date","Notes"
            };

            byte[] result;

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Visit Worksheet"); 
                using (var cells = worksheet.Cells[1, 1, 1, 5]) //(1,1) (1,5)
                {
                    cells.Style.Font.Bold = true;
                }
                for (var i = 0; i < comlumHeadrs.Count(); i++)
                {
                    worksheet.Cells[1, i + 1].Value = comlumHeadrs[i];
                }
                var j = 2;
                foreach (var visit in viContext)
                {
                    viContext = viContext.OrderByDescending(s => s.Id);
                    worksheet.Cells["A" + j].Value = visit.FullName;
                    worksheet.Cells["B" + j].Value = visit.MrkzName;
                    worksheet.Cells["C" + j].Value = visit.VisitType;
                    worksheet.Cells["D" + j].Value = visit.VisitDate.ToString("dd/MM/yyyy");
                    worksheet.Cells["E" + j].Value = visit.Notes;

                    j++;
                }
                result = package.GetAsByteArray();
            }

            return File(result, "application/ms-excel", $"Visit.xlsx");
        }

where VisitHeader is a view in the database and mapped in the context.

and in the Visit/Index view:

@model IEnumerable<VisitHeader>
@*Some code here*@
<form asp-action="index"><div class="form-actions no-color"><p><div class="form-group row"><div class="col-xs-2"><label for="ex2">ID</label><input class="form-control" id="idd" type="text" name="sid"></div><div class="col-xs-3"><label for="ex1">Name</label><input class="form-control" id="namee" type="text" readonly></div><div class="col-xs-2"><label>Center</label><select class="form-control" asp-items="ViewBag.MrkzId" name="MrId" value="@ViewData["MrIdF"]"><option selected value=""> </option></select></div><div class="col-xs-4"><br /><input type="submit" value="Seatch" class="btn btn-default"><a asp-action="Excel" asp-controller="Visit" class="btn btn-primary">Excel</a></div></div></p></div></form>

When I press search button after choose a value from MrkzId Select, the data is filterred in the view it self but when press Excel button the data is not filtered!

Why? and How to solve please?

Migrating MVC 5 to .net core 2.1

$
0
0

What are steps for Migrating MVC 5  application into .net core 2.1.

I have different areas and multiple project file(BAL,DAL,UI) in the  solution


beginner question

$
0
0

I am following this page https://docs.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-2.2

and I have added the line  app.UseStaticFiles(); to my configuration, but the address "~/images/myfile.jpeg does not find the images folder.  However, the address "~/../../images/myfile.jpeg" does find it on my local server, but not on my website.

It say in the link that "~/" is supposed to represent www.root but it appears to behave like regular file system addresses. 

How can I relatively address my path?

src=@Model.Styles[j].ImageFileName />
private List<ResumeStyle> UpdateImagePathForStyles(List<ResumeStyle> styles, string folder)
        { 
            for (int i = 0; i < styles.Count; i++)
            {
                styles[i].ImageFileName = $"~/images/{styles[i].ImageFileName}";
            }
            return styles;
        }

thanks

Blazor Server Side - UI not update

$
0
0

Hello,

i  write a simple service class and want to show a loading spinner if the scout is running. 

<button class="btn btn-primary" type="button" @onclick="@(() => service.Scout.Start())">
@if (service.Scout.IsRunning)
{<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span><span>Loading...</span>
}
else
{<span>Scout</span>
}</button>
<div> public class Scout</div> <div>  {</div> <div>         public bool IsRunning { get; set; }</div> <div>}</div>



Download and Save Video With A Link In Asp.net Core

$
0
0

Hi, 
I want download and save video in host with get link from user 

but i get link and download it with below code and its save in my folders but the windows media palyer is cant show video
and its show error cant render file , how to download and save it correctly ?

 string path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/Files/FileManage", "tsst.mp4");

                byte[] bytes = new byte[0];
                using (var client = new HttpClient())
                {

                    using (var result = await client.GetAsync(link))
                    {
                        if (result.IsSuccessStatusCode)
                        {
                            bytes = await result.Content.ReadAsByteArrayAsync();
                        }

                    }
                    using (MemoryStream ms = new MemoryStream())
                    using (FileStream file = new FileStream(path, FileMode.Create, System.IO.FileAccess.Write))
                    {
                        ms.Read(bytes, 0, (int)ms.Length);
                        file.Write(bytes, 0, bytes.Length);
                        ms.Close();
                    }
                }



Force logoff users at fxed time.

$
0
0

I want to logoff all users in my ASP.NET core 2.2 web application everyday at 9 pm.  We use Microsoft Identity.

Any suggestions?

Thanks in advance.

AutoMapper convention wise

$
0
0

Hello guys,

I have a ASP.NET Core 2.2 Web API with Angular front-end. I've been told that AutoMapper isn't meant for ViewModel -> Persistence/Domain Model conversions. In addition to that, there was a post from the creactor of AutoMapper: https://lostechies.com/jimmybogard/2009/09/18/the-case-for-two-way-mapping-in-automapper/and one more: https://rogerjohansson.blog/2013/12/01/why-mapping-dtos-to-entities-using-automapper-and-entityframework-is-horrible/.

I'm posting this because I'm not quite sure if that's what they meant.

Question 1) According to my understanding, those posts mean that AutoMapper isn't meanttwo-way mapping. If it was not intended for two-way mapping, then why doesReverseMap() exist? Or did they mean that it was not intended for Dto model -> Domain modelif any of the properties that have to be mapped are involved with Entity Framework as such asvar cryptoPair = await _context.CryptoPairs.FirstOrDefaultAsync(e=> e.Symbol== botDto.Symbol);?

I have two of my services linked below. I think what I did in `GetAllAsync()` and `GetByIdAsync()` is alright in both services.

What about CreateAsync() andUpdateAsync()? The first service has two properties (cryptoPairand timeInterval in CreateAsync() and UpdateAsync()) that should be queried fromDbContext which basically means that EF is involved in that situation and in fact, I didn't use AutoMapper in my service. The second service of mine doesDto -> Domain model (what they basically said that AutoMapper wasn't intended for) inCreateAsync() and UpdateAsync() but it doesn't involve EF. Can you please tell me if what I did in my code is alright with an explanation.

Quote from the second article: AutoMapper knows nothing about EF and ID’s so it will simply recreate every object in the .Details collection. This might lead to consequences with bigger Dto models.

Service 1: https://pastebin.com/W8vdDPxK

Service 2: https://pastebin.com/7hjAnUsA

Question 2) In the first service, if I wanted to return a different Dto model only inGetAllAsync() (the model below), would it be acceptable if that service had used multiple Dto models (in this case two Dto models)?

public class BotDisplayDto
{
	public int Id { get; set; }
	public string Name { get; set; }
	public bool Status { get; set; }
	public CryptoPair CryptoPair { get; set; }
	public TimeInterval TimeInterval { get; set; }
}

How can I set dynamic ConfigureApplicationCookie

$
0
0

Hi,

How can I set dynamic ConfigureApplicationCookie, I mean:

            services.ConfigureApplicationCookie(options =>
            {
                options.ExpireTimeSpan = TimeSpan.FromMinutes(10);
                // Cookie settings
                options.Cookie.HttpOnly = true;
                options.ExpireTimeSpan = TimeSpan.FromMinutes(5);options.LoginPath = "/GetLogin";//options.ReturnUrlParameter = "loginReturnUrl";options.LogoutPath = "/GetLogout";
                options.AccessDeniedPath = "/GetAccessDenied";
                options.SlidingExpiration = true;
            });

where can I set it ? in custom route in culture middleware ? 

Can you give any advise ?

I wanna set it with localization for language ?

English

options.LoginPath = "/Login";

Español

options.LoginPath = "/iniciar sesion;

etc.. 

I want to separate the view CSQs in 3 for pages

$
0
0

I want to separete the CSQ 3 for page

<% 

//**************************************************************************************//
//	UCGuru.com wallboard v1.42							//
//	file - default.asp								//
//	updated 2014-08-05								//
//											//
//	Updated script to work with UCCX 10					        //
// 	This script will use the wallboard user to pull general queue stats		//
//	This was built on the work of others, namely the guys on the official		//
//	Cisco forum									//
//											//
//	Updated by the guys at ucguru.com						//
//  ----------------------------------------------------------------------------------	//
//											//
//**************************************************************************************//


//  Historical notes:
//**********************************************************************************************//
//	IPCC wallboard.asp version 2.4(beta)							//
//												//
//	This ASP script is developed using the input of several individuals at the		//
// 	Cisco Netpro Forum.	You are invited to develop this script urther, make changes, 	//
//	add items, et cetera. This script is open source, no copyrights, and may never be 	//
//	used commercially. If making changes/additions or introducing new features, you 	//
//	agree that you will post back to the Cisco Netpro Forum community.			//
//  ----------------------------------------------------------------------------------		//
//   FILE:    wallboard.asp									//
//	 Build:	  20080218.003									//
//   PURPOSE: Retrieves CSQ stats from IPCC and formats for display in HTML Browsers.		//
//   AUTHORS: 	Leo Mourits		(l.mourits)						//
//				Mat Melbourne	(mmelbourne)					//
//				Joe Conger		(joe.conger)				//
//				Peso								//
//				Robby Butler							//
//				Jeremy Fielder 	(fielderj)					//
//        Daniel Sobrinho (dsobrinho-Added Computer & Telephony) //
//**********************************************************************************************//

Dim objCN, objRS, strSQL, selectSQL, whereSQL, orderbySQL, strAgentStatus, strArray, NextStats, TextColor, TableColor
Dim AgentStatusBlink, CurrentDateTime, EventHappenedDateTime, StatusDateTime
Dim intStatusSeconds, intStatusMinutes, intStatusHours, intStatusDays
Dim strStatusSeconds, strStatusMinutes, strStatusHours, strStatusDays
Dim teamsToTrack
Dim prettyCSQname
Dim callsDequeued
Dim csqSpecificOrder
Dim sOffset, cTime, tDiff

%><!--#include file="parameters.cfg"--><%

//*******************************START SELECT MODULE************************************//

//**************************************************************************************//
//   Module:  	Select Stats Display													//
//   AUTHOR:  	Leo Mourits & Jeremy Fielder											//
//   PURPOSE: 	Checks parameters for enabled stats and redirects to stats based on 	//
//				where you were, and where you want to go.								//
//**************************************************************************************//

Select Case Request.QueryString("Stats")
  Case ""
    If DisplayCSQStatsTrue = 1 Then
      	Response.Redirect("default.asp?Stats=CSQ")
    ElseIf DisplayAgentsStatsTrue = 1 Then
        Response.Redirect("default.asp?Stats=Agent")
	ElseIf DisplayICDStatsTrue = 1 Then
        Response.Redirect("default.asp?Stats=ICD")
    Else
        Response.Write "Your parameters are configured to not display any statistics"
    End If
  Case "Agent"
    If DisplayICDStatsTrue = 1 Then
      NextStats = "ICD"
    ElseIf DisplayCSQStatsTrue = 1 Then
      NextStats = "CSQ"
	Else
      NextStats = "Agent"
    End If
    If DisplayAgentsStatsTrue = 1 Then
      Call PrintPageHeader_AgentStats
      Call PrintTableHeader_AgentStats
      Call DisplayAgentStatistics
      Call PrintTableFooter_Agent
    End If
  Case "CSQ"
    If DisplayAgentsStatsTrue = 1 Then
      NextStats = "Agent"
	ElseIf DisplayICDStatsTrue = 1 Then
      NextStats = "ICD"
    Else
      NextStats = "CSQ"
    End If
    If DisplayCSQStatsTrue = 1 Then
      Call PrintPageHeader_CSQStats
      Call PrintTableHeader_CSQStats
      Call DisplayCSQStatistics
      Call PrintTableFooter_CSQ
    End If
  Case "ICD"
    If DisplayCSQStatsTrue = 1 Then
      NextStats = "CSQ"
    ElseIf DisplayAgentsStatsTrue = 1 Then
      NextStats = "Agent"
	Else
	  NextStats = "ICD"
    End If
    If DisplayICDStatsTrue = 1 Then
      Call PrintPageHeader_ICDStats
      Call PrintTableHeader_ICDStats
      Call DisplayICDStatistics
      Call PrintTableFooter_ICD
    End If
  Case "AgentHeld"
  	  NextStats = "AgentHeld&PageHeld=YES"
      Call PrintPageHeader_AgentStats
      Call PrintTableHeader_AgentStats
      Call DisplayAgentStatistics
      Call PrintTableFooter_Agent
  Case "CSQHeld"
  	  NextStats = "CSQHeld&PageHeld=YES"
      Call PrintPageHeader_CSQStats
      Call PrintTableHeader_CSQStats
      Call DisplayCSQStatistics
      Call PrintTableFooter_CSQ
  Case "ICDHeld"
   	  NextStats = "ICDHeld&PageHeld=YES"
      Call PrintPageHeader_ICDStats
      Call PrintTableHeader_ICDStats
      Call DisplayICDStatistics
      Call PrintTableFooter_ICD
End Select

Response.AddHeader "Refresh", RefreshTime & "; URL=" & ServerURL & "default.asp?Stats=" & NextStats

//********************************END SELECT MODULE************************************//


Call PrintPageFooter


//*******************************START AGENT MODULE*************************************//

//**************************************************************************************//
//   Module:  	Display Agent Stats														//
//   AUTHOR:  	Leo Mourits																//
//   PURPOSE: 	Displays Agent Statistics												//
//**************************************************************************************//

Sub PrintPageHeader_AgentStats
  Response.Write "<HTML><BODY BGCOLOR='#FFFFFF'><HEAD><TITLE>" & strPageTitle & "</TITLE>"
  Response.Write "<STYLE><!--  @media screen  { blink { behavior:url(blink.htc);} } --></STYLE>"
  Response.Write "<link rel='icon'type='image/ico' href='" & ServerURL & "favicon.ico' />"
  Response.Write "<link type=text/css href=./style.css rel=stylesheet />"
  Response.Write "</HEAD>"
End Sub

Sub PrintTableHeader_AgentStats

  If displayPageHeader = 1 Then
  Response.Write "<table id='csqPageHeader'><tr>"
  Response.Write "<td id='csqPageHeaderLeft'>" & strPageHeader_AgentStats & "</td>"
  Response.Write "<td id='csqPageHeaderRight'>" 

	sOffset = +0 'The time offset from GMT at the server 
	cTime = i + sOffset 
	tDiff = (DateAdd("h",cTime,Now)) 
	Response.write FormatDateTime(tDiff,3)

  Response.Write "</td>"
  Response.Write "</tr></table>"
  End If
  IF holdPageLink = 1 Then
	  Response.Write "<div id='holdPage'>"
	  If Request.QueryString("PageHeld") = "YES" Then
	  Response.Write "<a href='" & serverURL & "default.asp'>(click here to unhold page)</a>"
	  Else
	  Response.Write "<a href='" & serverURL & "default.asp?Stats=CSQHeld&PageHeld=YES'>(click here to hold page)</a>"
	  End If
	  Response.Write "</div>"
  End If
  If LogoOn = 1 Then
  	Response.Write "<IMG BORDER='0' ALIGN='left' SRC='" & ServerURL & LogoFile & "'<br>"
  End If

  If Request.QueryString("PageHeld") = "YES" Then
  Response.Write "<CENTER><a href='" & serverURL & "default.asp'><FONT SIZE ='2' COLOR='red'>(click here to unhold page)</FONT></a></CENTER><BR>"
  Else
  Response.Write "<CENTER><a href='" & serverURL & "default.asp?Stats=AgentHeld&PageHeld=YES'><FONT SIZE ='2' COLOR='black'>(click here to hold page)</FONT></a></CENTER>"
  End If
  'Response.Write "<IMG BORDER='0' ALIGN='left' SRC='" & ServerURL & LogoFile & "'<br>"

  Response.Write "<TABLE class='csqWrapper' bgcolor=" & TextColor & ">"
  Response.Write "<tr>"
  Response.Write "<TD class='agentColumnHeader'>" & TableColumnHeader_AgentStats_Column1 & "</TD>"
  Response.Write "<TD class='agentColumnHeader'>" & TableColumnHeader_AgentStats_Column2 & "</TD>"
  Response.Write "<TD class='agentColumnHeader'>" & TableColumnHeader_AgentStats_Column3 & "</TD>"
  Response.Write "</tr>"

End Sub

// Criando conexão com o database CCX para realizar as buscas via Query //

Sub DisplayAgentStatistics
  Set objCN = Server.CreateObject("ADODB.Connection")
  If IPCCversion = 3 Then
    objCN.Open "Provider=SQLOLEDB; Data Source = " & DBsource & "; Initial Catalog = " & DBdatabase & "; User Id = " & DBuserID & "; Password = " & DBpass
  ElseIf IPCCversion = 4 Then
    objCN.Open "Provider=SQLOLEDB; Data Source = " & DBsource & "\CRSSQL; Initial Catalog = db_cra; Integrated Security=SSPI;" 
  ElseIf IPCCversion = 8 Then
    If PullAgentStatsFromSecondary = 1 Then
      objCN.Open "Dsn="& DSNSecondary &"; Host= " & DBsourceSecondary & "; Server= "& DBServerSecondary & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
    Else
      objCN.Open "Dsn="& DSN &"; Host= " & DBsource & "; Server= "& DBServer & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
    End if
  ElseIf IPCCversion = 9 Then
    If PullAgentStatsFromSecondary = 1 Then
      objCN.Open "Dsn="& DSNSecondary &"; Host= " & DBsourceSecondary & "; Server= "& DBServerSecondary & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
    Else
      objCN.Open "Dsn="& DSN &"; Host= " & DBsource & "; Server= "& DBServer & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
    End if
  ElseIf IPCCversion = 10 Then
    If PullAgentStatsFromSecondary = 1 Then
      objCN.Open "Dsn="& DSNSecondary &"; Host= " & DBsourceSecondary & "; Server= "& DBServerSecondary & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
    Else
      objCN.Open "Dsn="& DSN &"; Host= " & DBsource & "; Server= "& DBServer & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
    End if
  ElseIf IPCCversion = 11 Then
   If PullAgentStatsFromSecondary = 1 Then
      objCN.Open "Dsn="& DSNSecondary &"; Host= " & DBsourceSecondary & "; Server= "& DBServerSecondary & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
    Else
      objCN.Open "Dsn="& DSN &"; Host= " & DBsource & "; Server= "& DBServer & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
    End if
  Else
      Response.Write "<TD><FONT SIZE ='16' COLOR='RED'>The database connection is not configured correctly.  Please update the IPCCversion variable in parameters.cfg.<br>IPCCversion is currently set to: " & IPCCversion & " <br>Acceptable values are 3, 4, 8, 9, 10 or 11</FONT></TD>" 
  End If

  If UCCXTeamID1 <> "" Then
	teamsToTrack = " WHERE x.assignedTeamID =" & UCCXTeamID1 & " "
    Else
	Response.Write "<FONT SIZE ='50' color='red'>You have not set any teams to track.  Please set the UCCXTeamID1 variable in the parameters.cfg</FONT></TD>" 
	teamsToTrack = " WHERE x.assignedTeamID ='1'"
  End if
  If UCCXTeamID2 <> "" Then
	teamsToTrack = teamsToTrack & " OR x.assignedTeamID =" & UCCXTeamID2 & " "
  End if
  If UCCXTeamID3 <> "" Then
	teamsToTrack = teamsToTrack & " OR x.assignedTeamID =" & UCCXTeamID3 & " "
  End if
  If UCCXTeamID4 <> "" Then
	teamsToTrack = teamsToTrack & " OR x.assignedTeamID =" & UCCXTeamID4 & " "
  End if
  If UCCXTeamID5 <> "" Then
	teamsToTrack = teamsToTrack & " OR x.assignedTeamID =" & UCCXTeamID5 & " "
  End if

Response.Write teamsToTrack
  strSQL = "SELECT x.resourceName, t.eventType, x.assignedTeamID, x.datetime FROM (SELECT t1.resourceID, t1.resourceName, t1.assignedTeamID, MAX(t2.eventDateTime) AS datetime FROM Resource AS t1 INNER JOIN AgentStateDetail AS t2 ON t2.agentID = t1.resourceID GROUP BY t1.resourceID, t1.resourceName, t1.assignedTeamID ) AS x INNER JOIN AgentStateDetail AS t ON t.agentID = x.resourceID AND t.eventDateTime = x.datetime " & teamsToTrack & " ORDER BY x.resourceName"

  Set objRS = objCN.Execute(strSQL)

  While Not objRS.EOF
    If objRS("eventType") = 7 Then 
     strAgentStatus = "Logged Out"
     TableColor = TableColor_LoggedOut
     TextColor = TextColor_AgentStats_LoggedOut
    End If
    If objRS("eventType") = 6 Then 
     strAgentStatus = "Working"
     TableColor = TableColor_Working
     TextColor = TextColor_AgentStats_Working
    End If
    If objRS("eventType") = 5 Then 
     strAgentStatus = "Talking"
     TableColor = TableColor_Talking
     TextColor = TextColor_AgentStats_Talking
    End If
    If objRS("eventType") = 4 Then 
     strAgentStatus = "Reserved"
     TableColor = TableColor_Reserved
     TextColor = TextColor_AgentStats_Reserved
    End If
    If objRS("eventType") = 3 Then 
     strAgentStatus = "Ready"
     TableColor = TableColor_Ready
     TextColor = TextColor_AgentStats_Ready
    End If
    If objRS("eventType") = 2 Then 
     strAgentStatus = "Not Ready"
     TableColor = TableColor_NotReady
     TextColor = TextColor_AgentStats_NotReady
    End If
    If objRS("eventType") = 1 Then 
     strAgentStatus = "Logged In"
     TableColor = TableColor_LoggedIn
     TextColor = TextColor_AgentStats_LoggedIn
    End If
    Call CalculateStatusTime (objRS("datetime"))
    Call CheckAgentStatusBlinking
    'Response.Write objRS("resourceName")
    'Response.Write objRS("datetime")
    'Response.Write CurrentDateTime
    If intAgentStatsMaxDays = 0 Then
      Response.Write "<TR>"
      Response.Write "<TD BGCOLOR='" & TableColor & "'><FONT SIZE =' " & TextSize_AgentStats & " ' COLOR='" & TextColor & "'>"  & objRS("resourceName") & "</FONT></TD>" 
      Response.Write "<TD BGCOLOR='" & TableColor & "' ALIGN='CENTER'><FONT SIZE =' " & TextSize_AgentStats & " ' COLOR='" & TextColor & "'>" & strAgentStatus & "</FONT></TD>" 
      Response.Write "<TD BGCOLOR='" & TableColor & "' ALIGN='CENTER'><FONT SIZE =' " & TextSize_AgentStats & " ' COLOR='" & TextColor & "'>" & strStatusDays & " days / " & strStatusHours & ":" & strStatusMinutes & ":" & strStatusSeconds & "</FONT></TD>"
      Response.Write "</TR>" & VbCrLf
    End If
    If intAgentStatsMaxDays = 1 And intStatusDays < intAgentStatsMaxDays And intStatusHours < intAgentStatsMaxHours Then
        Response.Write "<TR>"
        If AgentStatusBlink = 1 And strAgentStatus = "Not Ready" then
          Response.Write "<TD BGCOLOR='" & TableColor & "'><BLINK SPEED=1000><FONT SIZE =' " & TextSize_AgentStats & " ' COLOR='" & TextColor & "'>"  & objRS("resourceName") & "</FONT></BLINK></TD>" 
          Response.Write "<TD BGCOLOR='" & TableColor & "' ALIGN='CENTER'><BLINK SPEED=1000><FONT SIZE =' " & TextSize_AgentStats & " ' COLOR='" & TextColor & "'>" & strAgentStatus & "</FONT></BLINK></TD>" 
          Response.Write "<TD BGCOLOR='" & TableColor & "' ALIGN='CENTER'><BLINK SPEED=1000><FONT SIZE =' " & TextSize_AgentStats & " ' COLOR='" & TextColor & "'>" & strStatusHours & ":" & strStatusMinutes & ":" & strStatusSeconds & "</FONT></BLINK></TD>"
        Else
          Response.Write "<TD BGCOLOR='" & TableColor & "'><FONT SIZE =' " & TextSize_AgentStats & " ' COLOR='" & TextColor & "'>"  & objRS("resourceName") & "</FONT></TD>" 
          Response.Write "<TD BGCOLOR='" & TableColor & "' ALIGN='CENTER'><FONT SIZE =' " & TextSize_AgentStats & " ' COLOR='" & TextColor & "'>" & strAgentStatus & "</FONT></TD>" 
          Response.Write "<TD BGCOLOR='" & TableColor & "' ALIGN='CENTER'><FONT SIZE =' " & TextSize_AgentStats & " ' COLOR='" & TextColor & "'>" & strStatusHours & ":" & strStatusMinutes & ":" & strStatusSeconds & "</FONT></TD>"
        End If
        Response.Write "</TR>" & VbCrLf
    End If
    If intAgentStatsMaxDays > 1 And intStatusDays < intAgentStatsMaxDays Then
        Response.Write "<TR>"
        Response.Write "<TD BGCOLOR='" & TableColor & "'><FONT SIZE =' " & TextSize_AgentStats & " ' COLOR='" & TextColor & "'>"  & objRS("resourceName") & "</FONT></TD>" 
        Response.Write "<TD BGCOLOR='" & TableColor & "' ALIGN='CENTER'><FONT SIZE =' " & TextSize_AgentStats & " ' COLOR='" & TextColor & "'>" & strAgentStatus & "</FONT></TD>" 
        Response.Write "<TD BGCOLOR='" & TableColor & "' ALIGN='CENTER'><FONT SIZE =' " & TextSize_AgentStats & " ' COLOR='" & TextColor & "'>" & strStatusDays & " days / " & strStatusHours & ":" & strStatusMinutes & ":" & strStatusSeconds & "</FONT></TD>"
        Response.Write "</TR>" & VbCrLf
    End If
   objRS.MoveNext
  Wend
  objRS.Close
  objCN.Close
  Set objCN = Nothing
  Set objRS = Nothing
End Sub

Sub PrintTableFooter_Agent
  Response.Write "</TABLE>"
End Sub

//********************************END AGENT MODULE**************************************//



//********************************START CSQ MODULE**************************************//

//**************************************************************************************//
//   Module:  	Display CSQ Stats														//
//   AUTHOR:  	Leo Mourits																//
//   PURPOSE: 	Displays CSQ Statistics													//
//**************************************************************************************//


Sub PrintPageHeader_CSQStats
  Response.Write "<HTML><BODY BGCOLOR='#FFFFFF'><HEAD><TITLE>" & strPageTitle & "</TITLE>"
  Response.Write "<STYLE><!--  @media screen  { blink { behavior:url(blink.htc);} } --></STYLE>"
  Response.Write "<link rel='shortcut icon' type='image/x-icon' href='" & ServerURL & "favicon.ico' />"
  Response.Write "<link type=text/css href=./style.css rel=stylesheet />"
  Response.Write "</HEAD>"
End Sub

Sub PrintTableHeader_CSQStats

End Sub

Sub DisplayCSQStatistics
  Set objCN = Server.CreateObject("ADODB.Connection")
  If IPCCversion = 3 Then
    objCN.Open "Provider=SQLOLEDB; Data Source = " & DBsource & "; Initial Catalog = " & DBdatabase & "; User Id = " & DBuserID & "; Password = " & DBpass
  ElseIf IPCCversion = 4 Then
    objCN.Open "Provider=SQLOLEDB; Data Source = " & DBsource & "\CRSSQL; Initial Catalog = db_cra; Integrated Security=SSPI;" 
  ElseIf IPCCversion = 8 Then
    objCN.Open "Dsn="& DSN &"; Host= " & DBsource & "; Server= "& DBServer & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
  ElseIf IPCCversion = 9 Then
    objCN.Open "Dsn="& DSN &"; Host= " & DBsource & "; Server= "& DBServer & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
  ElseIf IPCCversion = 10 Then
    objCN.Open "Dsn="& DSN &"; Host= " & DBsource & "; Server= "& DBServer & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
  ElseIf IPCCversion = 11 Then
    objCN.Open "Dsn="& DSN &"; Host= " & DBsource & "; Server= "& DBServer & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
  Else
      Response.Write "<TD><FONT SIZE ='16' COLOR='RED'>The database connection is not configured correctly.  Please update the IPCCversion variable in parameters.cfg.<br>IPCCversion is currently set to: " & IPCCversion & " <br>Acceptable values are 3, 4, 8, 9, 10 or 11</FONT></TD>" 
  End If


  If DisplaySpecificCSQ = 1 Then

  If not (UCCXCSQ1 = "") Then
    csqSpecificOrder = "(Case When CSQName = '" & UCCXCSQ1 & "' then 0 "
  End If
  If not (UCCXCSQ2 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ2 & "' then 1 "
  End If
  If not (UCCXCSQ3 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ3 & "' then 2 "
  End If
  If not (UCCXCSQ4 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ4 & "' then 3 "
  End If
  If not (UCCXCSQ5 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ5 & "' then 4 "
  End If
  If not (UCCXCSQ6 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ6 & "' then 5 "
  End If
  If not (UCCXCSQ7 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ7 & "' then 6 "
  End If
  If not (UCCXCSQ8 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ8 & "' then 7 "
  End If
  If not (UCCXCSQ9 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ9 & "' then 8 "
  End If
  If not (UCCXCSQ10 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ10 & "' then 9 "
  End If
  If not (UCCXCSQ11 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ11 & "' then 10 "
  End If
  If not (UCCXCSQ12 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ12 & "' then 11 "
  End If
  If not (UCCXCSQ13 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ13 & "' then 12 "
  End If
  If not (UCCXCSQ14 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ14 & "' then 13 "
  End If
  If not (UCCXCSQ15 = "") Then
    csqSpecificOrder = csqSpecificOrder & " When CSQName = '" & UCCXCSQ15 & "' then 14 "
  End If
  csqSpecificOrder = csqSpecificOrder & " End)"

  selectSQL  = "SELECT CSQName, loggedInAgents, availableAgents, callsWaiting, callsHandled, totalCalls, callsAbandoned, convoldestContact, convLongestWaitDuration, endDateTime, talkingagents, startdatetime FROM RtCSQsSummary "
  whereSQL   = "where (CSQName = '" & UCCXCSQ1 & "') or (CSQName = '" & UCCXCSQ2 & "') or (CSQName = '" & UCCXCSQ3 & "') or (CSQName = '" & UCCXCSQ4 & "') or (CSQName = '" & UCCXCSQ5 & "')  or (CSQName = '" & UCCXCSQ6 & "') or (CSQName = '" & UCCXCSQ7 & "') or (CSQName = '" & UCCXCSQ8 & "') or (CSQName = '" & UCCXCSQ9 & "') or (CSQName = '" & UCCXCSQ10 & "') or (CSQName = '" & UCCXCSQ11 & "') or (CSQName = '" & UCCXCSQ12 & "') or (CSQName = '" & UCCXCSQ13 & "') or (CSQName = '" & UCCXCSQ14 & "') or (CSQName = '" & UCCXCSQ15 & "') " 
  orderbySQL = "ORDER BY " & csqSpecificOrder
  strsql = selectSQL & whereSQL & orderbySQL

  Else
  strsql = "SELECT CSQName, loggedInAgents, availableAgents, callsWaiting, callsHandled, totalCalls, callsAbandoned, convoldestContact, convLongestWaitDuration, endDateTime, talkingagents, startdatetime FROM RtCSQsSummary ORDER BY CSQName"
  End If

  Set objRS = objCN.Execute(strSQL)

  If displayPageHeader = 1 Then
  Response.Write "<table id='csqPageHeader'><tr>"
  Response.Write "<td id='csqPageHeaderLeft'>stats began at " & objRS("startdatetime") & " EST</td>"
  Response.Write "<td id='csqPageHeaderRight'>" 

	sOffset = +0 'The time offset from GMT at the server 
	cTime = i + sOffset 
	tDiff = (DateAdd("h",cTime,Now)) 
	Response.write FormatDateTime(tDiff,3)

  Response.Write "</td>"
  Response.Write "</tr></table>"
  End If
  IF holdPageLink = 1 Then
	  Response.Write "<div id='holdPage'>"
	  If Request.QueryString("PageHeld") = "YES" Then
	  Response.Write "<a href='" & serverURL & "default.asp'>(click here to unhold page)</a>"
	  Else
	  Response.Write "<a href='" & serverURL & "default.asp?Stats=CSQHeld&PageHeld=YES'>(click here to hold page)</a>"
	  End If
	  Response.Write "</div>"
  End If
  If LogoOn = 1 Then
  	Response.Write "<IMG BORDER='0' ALIGN='left' SRC='" & ServerURL & LogoFile & "'<br>"
  End If


  While Not objRS.EOF
    If objRS("availableAgents") < intCSQStatsMinAgentsAvailable Then
      If objRS("callsWaiting") > intCSQStatsMaxQueuedCalls Then
        TextColor = TextColor_CSQStats_ArtNoAgentsAndCallsInQueue
        TableColor = TableColor_CSQStats_ArtNoAgentsAndCallsInQueue
      Else 
        TextColor = TextColor_CSQStats_AlertNoAgents
        TableColor = TableColor_CSQStats_AlertNoAgents
      End If
    Else
        TextColor = TextColor_CSQStats_StatusOkay 
        TableColor = TableColor_CSQStats_StatusOkay 
    End If

    If usePrettyNamesIfDefined = 1 Then
	    If objRS("CSQName") = UCCXCSQ1 Then
		prettyCSQname = UCCXCSQ1friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ2 Then
		prettyCSQname = UCCXCSQ2friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ3 Then
		prettyCSQname = UCCXCSQ3friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ4 Then
		prettyCSQname = UCCXCSQ4friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ5 Then
		prettyCSQname = UCCXCSQ5friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ6 Then
		prettyCSQname = UCCXCSQ6friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ7 Then
		prettyCSQname = UCCXCSQ7friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ8 Then
		prettyCSQname = UCCXCSQ8friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ9 Then
		prettyCSQname = UCCXCSQ9friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ10 Then
		prettyCSQname = UCCXCSQ10friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ11 Then
		prettyCSQname = UCCXCSQ11friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ12 Then
		prettyCSQname = UCCXCSQ12friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ13 Then
		prettyCSQname = UCCXCSQ13friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ14 Then
		prettyCSQname = UCCXCSQ14friendlyName
	    ElseIf  objRS("CSQName") = UCCXCSQ15 Then
		prettyCSQname = UCCXCSQ15friendlyName
	    Else
		prettyCSQname = objRS("CSQName")
	    End If
    Else
	prettyCSQname = objRS("CSQName")
    End If

    callsDequeued = 0
    callsDequeued = objRS("totalCalls") - objRS("callsHandled") - objRS("callsAbandoned") - objRS("callsWaiting")


If OnlyOneQueue = 1 Then

    Response.Write "<TABLE class='csqWrapper' bgcolor=" & TextColor & ">"
    Response.Write "<tr>"

    Response.Write "<td colspan='2' class='csqNameSingle'>" & prettyCSQname & "</td>"

      Response.Write "<td><table class='csqContainer' >"
    If DisplayCSQloggedInAgents = 1 Then
      Response.Write "<tr><TD class='csqColumnHeaderSingle'>" & TableColumnHeader_CSQStats_Column2 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnDataSingle' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("loggedInAgents") & "</FONT></TD></tr>" 
    End If
      Response.Write "</table></td>" 

      Response.Write "</tr><tr>"

      Response.Write "<td><table class='csqContainer'>"
    If DisplayCSQavailableAgents = 1 Then
      Response.Write "<tr><TD class='csqColumnHeaderSingle'>" & TableColumnHeader_CSQStats_Column3 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnDataSingle' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("availableAgents") & "</FONT></TD></tr>" 
    End If
      Response.Write "</table></td>" 

      Response.Write "<td><table class='csqContainer'>"
    If DisplayCSQtalkingAgents = 1 Then
      Response.Write "<tr><TD class='csqColumnHeaderSingle'>" & TableColumnHeader_CSQStats_Column4 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnDataSingle' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("talkingAgents") & "</FONT></TD></tr>" 
    End If
      Response.Write "</table></td>" 

      Response.Write "<td><table class='csqContainer'>"
    If DisplayCSQcallsWaiting = 1 Then
      Response.Write "<tr><TD class='csqColumnHeaderSingle'>" & TableColumnHeader_CSQStats_Column5 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnDataSingle' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("callsWaiting") & "</FONT></TD></tr>" 
    End If
      Response.Write "</table></td>"

      Response.Write "</tr><tr>"

      Response.Write "<td><table class='csqContainer'>"
    If DisplayCSQcallsHandled = 1 Then
      Response.Write "<tr><TD class='csqColumnHeaderSingle'>" & TableColumnHeader_CSQStats_Column6 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnDataSingle' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("callsHandled") & "</FONT></TD></tr>" 
    End If
      Response.Write "</table></td>"

      Response.Write "<td><table class='csqContainer'>"
    If DisplayCSQcallsDequeued = 1 Then
      Response.Write "<tr><TD class='csqColumnHeaderSingle'>" & TableColumnHeader_CSQStats_Column11 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnDataSingle' BGCOLOR='" & TableColor_CSQStats & "'>" & callsDequeued & "</FONT></TD></tr>" 
    End If
      Response.Write "</table></td>"

      Response.Write "<td><table class='csqContainer'>"
    If DisplayCSQlongestWaitCurrent = 1 Then
      Response.Write "<tr><TD class='csqColumnHeaderSingle'>" & TableColumnHeader_CSQStats_Column9 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnDataSingle' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("convoldestContact") & "</FONT></TD></tr>" 
    End If
      Response.Write "</table></td>"

      Response.Write "</tr><tr>"

      Response.Write "<td><table class='csqContainer'>"
    If DisplayCSQcallsAbandoned = 1 Then
      Response.Write "<tr><TD class='csqColumnHeaderSingle'>" & TableColumnHeader_CSQStats_Column8 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnDataSingle' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("callsAbandoned") & "</FONT></TD></tr>" 
    End If
      Response.Write "</table></td>"

      Response.Write "<td><table class='csqContainer'>"
    If DisplayCSQtotalCalls = 1 Then
      Response.Write "<tr><TD class='csqColumnHeaderSingle'>" & TableColumnHeader_CSQStats_Column7 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnDataSingle' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("totalCalls") & "</FONT></TD></tr>" 
    End If
      Response.Write "</table></td>"

     Response.Write "<td><table class='csqContainer'>"
    If DisplayCSQlongestWaitDuration = 1 Then
      Response.Write "<tr><TD class='csqColumnHeaderSingle'>" & TableColumnHeader_CSQStats_Column10 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnDataSingle' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("convLongestWaitDuration") & "</FONT></TD></TR>"
    End If
      Response.Write "</table></td>"

      Response.Write "</tr></table>" & VbCrLf

Else

    Response.Write "<TABLE class='csqWrapper' bgcolor=" & TextColor & ">"
    Response.Write "<tr><TD class='csqName' colspan='4'>" & prettyCSQname & "</TD></tr>"
    Response.Write "<tr>"

    If DisplayCSQloggedInAgents = 1 Then
      Response.Write "<td><table class='csqContainer' >"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_CSQStats_Column2 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("loggedInAgents") & "</FONT></TD></tr>" 
      Response.Write "</table></td>" 
    End If
    If DisplayCSQavailableAgents = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_CSQStats_Column3 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("availableAgents") & "</FONT></TD></tr>" 
      Response.Write "</table></td>" 
    End If
    If DisplayCSQtalkingAgents = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_CSQStats_Column4 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("talkingAgents") & "</FONT></TD></tr>" 
      Response.Write "</table></td>" 
    End If
    If DisplayCSQcallsWaiting = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_CSQStats_Column5 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("callsWaiting") & "</FONT></TD></tr>" 
      Response.Write "</table></td>"
    End If
    If DisplayCSQcallsHandled = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_CSQStats_Column6 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("callsHandled") & "</FONT></TD></tr>" 
      Response.Write "</table></td>"
    End If
    If DisplayCSQcallsDequeued = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_CSQStats_Column11 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData' BGCOLOR='" & TableColor_CSQStats & "'>" & callsDequeued & "</FONT></TD></tr>" 
      Response.Write "</table></td>"
    End If
    If DisplayCSQcallsAbandoned = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_CSQStats_Column8 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("callsAbandoned") & "</FONT></TD></tr>" 
      Response.Write "</table></td>"
    End If
    If DisplayCSQlongestWaitCurrent = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_CSQStats_Column9 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("convoldestContact") & "</FONT></TD></tr>" 
      Response.Write "</table></td>"
    End If
    If DisplayCSQlongestWaitDuration = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_CSQStats_Column10 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("convLongestWaitDuration") & "</FONT></TD></TR>"
      Response.Write "</table></td>"
    End If
    If DisplayCSQtotalCalls = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_CSQStats_Column7 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData' BGCOLOR='" & TableColor_CSQStats & "'>" & objRS("totalCalls") & "</FONT></TD></tr>" 
      Response.Write "</table></td>"
    End If
      Response.Write "</tr></table>" & VbCrLf


End If

    lastupdate = objRS("endDateTime")
    objRS.MoveNext
  Wend
  objRS.Close
  objCN.Close
  Set objCN = Nothing
  Set objRS = Nothing
End Sub

Sub PrintTableFooter_CSQ
  Response.Write "</TABLE>"
End Sub

//*********************************END CSQ MODULE***************************************//



//********************************START ICD MODULE**************************************//

//**************************************************************************************//
//   Module:  	Displays ICD Stats														//
//   AUTHOR:  	Jeremy Fielder															//
//   PURPOSE: 	Displays ICD Statistics													//
//**************************************************************************************//


Sub PrintPageHeader_ICDStats
  Response.Write "<HTML><BODY BGCOLOR='#FFFFFF'><HEAD><TITLE>" & strPageTitle & "</TITLE>"
  Response.Write "<STYLE><!--  @media screen  { blink { behavior:url(blink.htc);} } --></STYLE>"
  Response.Write "<link rel='shortcut icon' href='" & ServerURL & "favicon.ico' />"
  Response.Write "<link type=text/css href=./style.css rel=stylesheet />"
  Response.Write "</HEAD>"
End Sub

Sub PrintTableHeader_ICDStats

End Sub

Sub DisplayICDStatistics
  Set objCN = Server.CreateObject("ADODB.Connection")
  If IPCCversion = 3 Then
    objCN.Open "Provider=SQLOLEDB; Data Source = " & DBsource & "; Initial Catalog = " & DBdatabase & "; User Id = " & DBuserID & "; Password = " & DBpass
  ElseIf IPCCversion = 4 Then
    objCN.Open "Provider=SQLOLEDB; Data Source = " & DBsource & "\CRSSQL; Initial Catalog = db_cra; Integrated Security=SSPI;" 
  ElseIf IPCCversion = 8 Then
    objCN.Open "Dsn="& DSN &"; Host= " & DBsource & "; Server= "& DBServer & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
  ElseIf IPCCversion = 9 Then
    objCN.Open "Dsn="& DSN &"; Host= " & DBsource & "; Server= "& DBServer & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
  ElseIf IPCCversion = 10 Then
    objCN.Open "Dsn="& DSN &"; Host= " & DBsource & "; Server= "& DBServer & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
  ElseIf IPCCversion = 11 Then
    objCN.Open "Dsn="& DSN &"; Host= " & DBsource & "; Server= "& DBServer & "; Service=1504; Protocol=onsoctcp; Database= " & DBdatabase & "; Uid= " & DBuserID & "; Pwd= " & DBpass
  Else
      Response.Write "<TD><FONT SIZE ='16' COLOR='RED'>The database connection is not configured correctly.  Please update the IPCCversion variable in parameters.cfg.<br>IPCCversion is currently set to: " & IPCCversion & " <br>Acceptable values are 3, 4, 8, 9, 10 or 11</FONT></TD>" 
  End If
  strsql = "SELECT * FROM RtICDStatistics"
  Set objRS = objCN.Execute(strSQL)



  If displayPageHeader = 1 Then
  Response.Write "<table id='csqPageHeader'><tr>"
  Response.Write "<td id='csqPageHeaderLeft'>stats began at " & objRS("startdatetime") & " EST</td>"
  Response.Write "<td id='csqPageHeaderRight'>" 

	sOffset = +0 'The time offset from GMT at the server 
	cTime = i + sOffset 
	tDiff = (DateAdd("h",cTime,Now)) 
	Response.write FormatDateTime(tDiff,3)

  Response.Write "</td>"
  Response.Write "</tr></table>"
  End If
  IF holdPageLink = 1 Then
	  Response.Write "<div id='holdPage'>"
	  If Request.QueryString("PageHeld") = "YES" Then
	  Response.Write "<a href='" & serverURL & "default.asp'>(click here to unhold page)</a>"
	  Else
	  Response.Write "<a href='" & serverURL & "default.asp?Stats=ICDHeld&PageHeld=YES'>(click here to hold page)</a>"
	  End If
	  Response.Write "</div>"
  End If
  If LogoOn = 1 Then
  	Response.Write "<IMG BORDER='0' ALIGN='left' SRC='" & ServerURL & LogoFile & "'<br>"
  End If





  While Not objRS.EOF

        TextColor = TextColor_ICDStats
        TableColor = TableColor_ICDStats

    Response.Write "<TABLE class='csqWrapper' bgcolor=" & TextColor & ">"
    Response.Write "<tr><TD class='csqName' colspan='4'>" & prettyCSQname & "</TD></tr>"
    Response.Write "<tr>"

		
	If DisplayICDTotalCSQs = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_ICDStats_Column1 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData'>" & objRS("totalCSQs") & "</FONT></TD></tr>" 
      Response.Write "</table></td>" 
    End IF
	If DisplayICDloggedInAgents = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_ICDStats_Column2 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData'>" & objRS("loggedInAgents") & "</FONT></TD></tr>" 
      Response.Write "</table></td>" 
    End If
    If DisplayICDavailableAgents = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_ICDStats_Column3 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData'>" & objRS("availableAgents") & "</FONT></TD></tr>" 
      Response.Write "</table></td>" 
    End If
    If DisplayICDcallsWaiting = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_ICDStats_Column4 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData'>" & objRS("callsWaiting") & "</FONT></TD></tr>" 
      Response.Write "</table></td>" 
    End If
    If DisplayICDcallsHandled = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_ICDStats_Column5 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData'>" & objRS("callsHandled") & "</FONT></TD></tr>" 
      Response.Write "</table></td>" 
    End If
    If DisplayICDtotalCalls = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_ICDStats_Column6 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData'>" & objRS("totalCalls") & "</FONT></TD></tr>" 
      Response.Write "</table></td>" 
    End If
    If DisplayICDcallsAbandoned = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_ICDStats_Column7 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData'>" & objRS("callsAbandoned") & "</FONT></TD></tr>" 
      Response.Write "</table></td>" 
    End If
    If DisplayICDlongestWaitCurrent = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_ICDStats_Column8 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData'>" & objRS("convoldestContact") & "</FONT></TD></tr>" 
      Response.Write "</table></td>" 
    End If
    If DisplayICDlongestWaitDuration = 1 Then
      Response.Write "<td><table class='csqContainer'>"
      Response.Write "<tr><TD class='csqColumnHeader'>" & TableColumnHeader_ICDStats_Column9 & " </TD></tr>"
      Response.Write "<tr><TD class='csqColumnData'>" & objRS("convLongestWaitDuration") & "</FONT></TD></tr>" 
      Response.Write "</table></td></tr>"
      Response.Write "</table>" & VbCrLf
    End If
    lastupdate = objRS("endDateTime")
    objRS.MoveNext
  Wend
  objRS.Close
  objCN.Close
  Set objCN = Nothing
  Set objRS = Nothing
End Sub

Sub PrintTableFooter_ICD

End Sub

//*********************************END ICD MODULE***************************************//



//*****************************START PAGE FOOTER MODULE*********************************//

//**************************************************************************************//
//   Module:  	Print Page Footer														//
//   AUTHOR:  	Leo Mourits																//
//   PURPOSE: 	Adds the update and refresh info to the page footer.					//
//**************************************************************************************//


Sub PrintPageFooter
  CurrentDateTime = CDate(Date() & " " & Time())
  If wallboardFooterCredit = 1 Then
    Response.Write "<P id='footer'>"
    Response.Write "Added Wallboard v1.42"
    Response.Write "</P></BODY></HTML>"
  End If
End Sub


//******************************END PAGE FOOTER MODULE**********************************//



//***************************START STATUS BLINKING MODULE*******************************//

//**************************************************************************************//
//   Module:  	Status Blinking															//
//   AUTHOR:  	Leo Mourits																//
//   PURPOSE: 	Enables Blinking Text when user defined thresholds have been exceeded.	//
//**************************************************************************************//

Sub CheckAgentStatusBlinking
  If intAgentStatsMaxNotReady = 0 Or intAgentStatsMaxNotReady > 59 Then
    AgentStatusBlink = 0
  Else
    If intStatusMinutes >= intAgentStatsMaxNotReady Then
      AgentStatusBlink = 1
    Else
      AgentStatusBlink = 0
    End If
  End If
  If intStatusHours > 0 Then
    AgentStatusblink = 1
  End If
End Sub

//****************************END STATUS BLINKING MODULE********************************//



//***************************START CALC STATUS TIME MODULE******************************//

//**************************************************************************************//
//   Module:  	Calculate Status Time													//
//   AUTHOR:  	Leo Mourits																//
//   PURPOSE: 	Calculates the time an agent has been in the reported state.			//
//**************************************************************************************//


Sub CalculateStatusTime (eventDateTimeIn)
  ' The string returned in eventDateTime is a string of the form "MM/DD/YYYY HH:MM:SS [AM/PM]"
  ' The difference between current date/time and event date/time give the time that the agent is in the current status
  ' dateDiff calculates the difference between two date values and can return this in seconds, minutes, hours, et cetera
  strArray = split(eventDateTimeIn," ")
  EventHappenedDateTime = CDate(strArray(0) & " " & strArray(1) & " " & strArray(2))
  ' get the current date and time
  CurrentDateTime = CDate(Date() & " " & Time())
  ' calculate the difference between current date/time and date/time of the last event change
  intStatusSeconds = DateDiff("s",(EventHappenedDateTime - .20833),CurrentDateTime)
  ' we will need not only seconds, but also minutes, hours and days
  intStatusMinutes = Round((intStatusSeconds / 60),0)
  intStatusHours = Round((intStatusSeconds / 3600),0)
  intStatusDays = Round((intStatusSeconds / 86400),0)
  intStatusSeconds = intStatusSeconds - (intStatusMinutes * 60)
  ' because of the roun function used, we will need to fix some miscalculations because of rounding differences
  If intStatusSeconds < 0 Then intStatusSeconds = intStatusSeconds + (1 * 60) 
  intStatusMinutes = intStatusMinutes - (intStatusHours * 60)
  If intStatusMinutes < 0 Then intStatusMinutes = intStatusMinutes + (1 * 60) 
  intStatusHours = intStatusHours - (intStatusDays * 24)
  If intStatusSeconds > 30 Then intStatusMinutes = intStatusMinutes - 1
  If intStatusMinutes > 30 Then intStatusHours = intStatusHours - 1
  If intStatusHours < 0 Then intStatusHours = intStatushours + (1 * 24)
  If intStatusHours > 12 Then intStatusDays = intStatusDays - 1
  ' next we convert the integers to strings to be displayed on the page
  If intStatusMinutes < 10 Then
    If intStatusMinutes = 0 Then strStatusMinutes = "00"
    If intStatusMinutes = 1 Then strStatusMinutes = "01"
    If intStatusMinutes = 2 Then strStatusMinutes = "02"
    If intStatusMinutes = 3 Then strStatusMinutes = "03"
    If intStatusMinutes = 4 Then strStatusMinutes = "04"
    If intStatusMinutes = 5 Then strStatusMinutes = "05"
    If intStatusMinutes = 6 Then strStatusMinutes = "06"
    If intStatusMinutes = 7 Then strStatusMinutes = "07"
    If intStatusMinutes = 8 Then strStatusMinutes = "08"
    If intStatusMinutes = 9 Then strStatusMinutes = "09"
  Else
    strStatusMinutes = CStr(intStatusMinutes)
  End If
  If intStatusSeconds < 10 Then
    If intStatusSeconds = 0 Then strStatusSeconds = "00"
    If intStatusSeconds = 1 Then strStatusSeconds = "01"
    If intStatusSeconds = 2 Then strStatusSeconds = "02"
    If intStatusSeconds = 3 Then strStatusSeconds = "03"
    If intStatusSeconds = 4 Then strStatusSeconds = "04"
    If intStatusSeconds = 5 Then strStatusSeconds = "05"
    If intStatusSeconds = 6 Then strStatusSeconds = "06"
    If intStatusSeconds = 7 Then strStatusSeconds = "07"
    If intStatusSeconds = 8 Then strStatusSeconds = "08"
    If intStatusSeconds = 9 Then strStatusSeconds = "09"
  Else
    strStatusSeconds = CStr(intStatusSeconds)
  End If
  strStatusHours = CStr(intStatusHours)
  strStatusDays = CStr(intStatusDays)
End Sub

//****************************END CALC STATUS TIME MODULE*******************************//

'EOF

%>


Same route different views and different table queries - Need help ?

$
0
0

hi guys

I am trying to create a root URL which would display records from different tables and also be able to display username preferences e.g.

  1. www.xyz.com/clothing The first url should display records from the sub category tables, 
  2. www.xyz.com/afrika The second url should display records from the usernames tables, 
  3. www.xyz.com/mens The first url should display records from the category tables, 

I have two senarios in my Home Controller e.g. (but dont know how to return to 2 or 3 different views based on search results

// Home controller 
[Route("{C}")]
public async Task<IActionResult> Product(String C)// value c could be the decider of 3 values, either username, category or sub category
{


//first query is sub category return View(await _context.Departments_SubCategory.Include(c => c.Departments_Category) .Where(d => d.Departments_Category.Category_Name.Contains(C)) .Where(r => r.IsEnabled == true).Select(u => new Departments_SubCategory { CategoryID = u.CategoryID, SubCategory_Name = u.SubCategory_Name, EntryDate = u.EntryDate, Description_Detailed = u.Description_Detailed, Description_Short = u.Description_Short, ProductCount = u.Products.Count() }).ToListAsync()); //second query is category return View(await _context.Departments_Category.Include(c => c.Departments) .Where(d => d.Category_Name.Contains(C)) .Where(r => r.IsEnabled == true).Select(u => new Categories_ViewModel { CategoryID = u.CategoryID, Category_Name = u.Category_Name, EntryDate = u.EntryDate, Description_Detail = u.Description_Detail, Description = u.Description, Count = u.Departments_SubCategory.Count() }).ToListAsync()); //3rd query would just return the username from the aspnet identity table


//FINAL My razor view is just suited for one value

@model IList<X.Models.Department.Departments_SubCategory>
<table class="table">
<thead>
<tr>
<th>

</th>
<th>

</th>
<th>

</th>
<th>

</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.SubCategory_Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Description_Detailed)
</td>
<td>
@Html.DisplayFor(modelItem => item.Description_Short)
</td>
<td>
@Html.DisplayFor(modelItem => item.IsEnabled)
</td>
<td>
<a asp-action="Edit" asp-route-id="@item.SubCategoryID">Edit</a> |
<a asp-action="Details" asp-route-id="@item.SubCategoryID">Details</a> |
<a asp-action="Delete" asp-route-id="@item.SubCategoryID">Delete</a>
</td>
</tr>
}
</tbody>
</table>

Error Sending an Event Invite: Invitee is in inviter tenant

$
0
0

I'm getting the error in this post's title. The only suggestion I found that addressed this directly stated this:

  1. You're attempting to invite someone with an address from one of the verified domains. In other words, if your tenant lists company.onmicrosoft.com and company.com as verified domains, attempting to invite an address ending in @company.onmicrosoft.com or @company.com will fail.

  2. The external email address you supplied already exists in the tenant (typically because they've already accepted a previous invitation).

Both of these boil down to the same root cause: you cannot send an invitation to an email address that has already been assigned to an existing user.

I don't understand this. What does it mean for someone to already exist in the tenant? Just accepting an invite to the event? That's my assumption, but I have no idea what it means to send an invite to an email address assigned to an existing user. Does that mean essentially the same thing as #1? I thought that meant since my user account was the one used to set up an event, I couldn't invite myself to the same event, but I sent an invite to someone else, and got the exact same error.  This is the code I'm using: 

public async Task<Invitation> SendInvitation(string invitee, string redirectUrl)
{
    var graphClient = GetAuthenticatedClient();

    var invitation = new Invitation
    {
        InvitedUserEmailAddress = invitee,
        InviteRedirectUrl = redirectUrl
    };

    var invite = await graphClient.Invitations.Request().AddAsync(invitation);

    return invite;
}

With this, how does it even know what Event it's sending an invitation for? Is the InviteRedirectUrl generated unique? Any help would be greatly appreciated.

Redirect views to different route

$
0
0

I find that the views that are used to do Create, Delete, Details, Edit canbe used from other views but they always go back to the Index view.

I would like to re-route these back to the view that called them.

I would like to know what is the best and easyiest way to do this.

Thank you

Help: HttpContext.Current in .Net Core

$
0
0

Hi All,

May I know any one able to convert this script to be .NET core version?
https://blog.csdn.net/weixin_30767921/article/details/97923409

I am stuck on this portion HttpContext.Currentto be convert into .NET core code:-

publicstatic ProfilerContext Current {
get {
var context = HttpContext.Current;
if (context == null) return null;
InitCurrentProfiler();
return context.Items[ProfilerItemKey] as ProfilerContext;
}

privateset {
var context = HttpContext.Current;
if (context == null) return; context.Items[ProfilerItemKey]= value;
}
}

Anyone have idea?

Please advise.

Thanks

Regards,

Micheale

Kestrel Restart on wwwroot folder deletion

$
0
0

I am using the Vue Cli  3 with ASP.Net Core 2.2.  I have the Vue Cli set to output files to the wwwroot folder. The Vue Cli will delete the folder and then recreate the files and this causes Kestrel to restart. Is there any way to prevent this during development?

Viewing all 9386 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>