Exemplo n.º 1
0
        private DataTable GetReportData(string folderName, string reportName, customReportCriteria criteria)
        {
            DataTable reportTable = new DataTable();

            try
            {
                string reportID = adminClient.runReport(folderName, reportName, criteria);

                bool isReportRunning = true;
                while (isReportRunning)
                {
                    try
                    {
                        isReportRunning = adminClient.isReportRunning(reportID, 600);
                    }
                    catch (Exception ex)
                    {
                        isReportRunning = true;
                    }
                }

                if (!isReportRunning)
                {
                    string reportData = adminClient.getReportResultCsv(reportID);
                    reportTable = FillDataTable(reportData);
                }
                AppLogger.Instance.Warn("HistoricalAdapterService.cs", "GetReportData", "Successfully Processed Report : " + reportName);
            }
            catch (Exception ex)
            {
                AppLogger.Instance.Error("HistoricalAdapterService.cs", "GetReportData", ex);
            }

            return(reportTable);
        }
Exemplo n.º 2
0
        private void AgentProductivityDataProcessing()
        {
            DataTable rptTable       = new DataTable();
            var       skillTable     = new DataTable();
            DataTable agentDataTable = GetAgentDataTable();

            inserter          = new AuthHeaderInserter();
            inserter.Username = userName;
            inserter.Password = password;

            adminClient = new WsAdminClient();
            adminClient.Endpoint.EndpointBehaviors.Add(new AuthHeaderBehavior(inserter));

            // All reports require a start and end date!
            customReportCriteria reportCriteria = new customReportCriteria();

            reportCriteria.time                = new reportTimeCriteria();
            reportCriteria.time.start          = GetProductivityReportStartTime();
            reportCriteria.time.end            = GetProductivityReportEndTime();
            reportCriteria.time.startSpecified = true;
            reportCriteria.time.endSpecified   = true;

            rptTable   = GetReportData(AdapterConstants.HISTORICAL_REPORT_FOLDER, AdapterConstants.HISTORICAL_CUSTOM_AGENT_STATE_REPORT, reportCriteria);
            skillTable = GetReportData(AdapterConstants.HISTORICAL_REPORT_FOLDER, AdapterConstants.HISTORICAL_CUSTOM_AGENT_SKILL_LOGIN_TIME, reportCriteria);

            try
            {
                string[]  distinctColumns = { "AGENTID", "AGENT", "SKILL" };
                DataTable dtable          = rptTable.DefaultView.ToTable(true, distinctColumns);

                DataRow dataRow;

                foreach (DataRow row in dtable.Rows)
                {
                    if ((row["SKILL"] != null) && (row["SKILL"].ToString() != "[None]"))
                    {
                        dataRow = agentDataTable.NewRow();

                        dataRow["ID"]        = Utils.GetAgentID(row["AGENTID"]); //Last 7 Character
                        dataRow["ACD Group"] = Utils.GetACDGroup(row["SKILL"]);  //Max 30 Character
                        dataRow["SIT"]       = Utils.GetSignInTime(row["AGENTID"], row["SKILL"], rptTable);
                        dataRow["SOT"]       = Utils.GetSignOutTime(row["AGENTID"], row["SKILL"], rptTable);

                        int NCH = Utils.GetNCHCount(row["AGENTID"], row["SKILL"], rptTable);
                        dataRow["NCH"] = NCH;

                        dataRow["ATT"] = Utils.GetAverageTalkTime(row["AGENTID"], row["SKILL"], rptTable, NCH);
                        dataRow["AWT"] = Utils.GetContactWorkTime(row["AGENTID"], row["SKILL"], rptTable, NCH);

                        string LoginTime    = Utils.GetLoginTime(row["AGENT"], row["SKILL"], skillTable);
                        string NotReadyTime = Utils.GetNotReadyTime(row["AGENT"], row["SKILL"], rptTable);
                        string WaitTime     = Utils.GetWaitTime(row["AGENT"], row["SKILL"], rptTable);

                        dataRow["PIP"]   = Utils.GetPluggedInPercentage(LoginTime, WaitTime);
                        dataRow["NOC"]   = Utils.GetOutboundContactNumber(row["AGENTID"], row["SKILL"], rptTable);
                        dataRow["AOTT"]  = Utils.GetAverageOutboundTalkTime(row["AGENTID"], row["SKILL"], rptTable, NCH);
                        dataRow["AOWT"]  = Utils.GetAverageOutboundWorkTime(row["AGENTID"], row["SKILL"], rptTable, NCH);
                        dataRow["AVL"]   = Utils.GetAvailableTime(LoginTime, NotReadyTime);
                        dataRow["UNAVL"] = Utils.GetUnAvailableTime(NotReadyTime);

                        agentDataTable.Rows.Add(dataRow);
                    }
                }

                GenerateITFOutputFile(agentDataTable, AdapterConstants.FILE_HISTORICAL_AGENT_PRDUCTIVITY);
                //CSV Output
                //GenerateOutputFile(agentDataTable, AdapterConstants.FILE_HISTORICAL_AGENT_PRDUCTIVITY);
            }
            catch (Exception ex)
            {
                AppLogger.Instance.Error("HistoricalAdapterService.cs", "AgentProductivityDataProcessing", ex);
            }
        }
Exemplo n.º 3
0
        private void HistoricalTCSDataProcessing()
        {
            var       callLogTable = new DataTable();
            var       skillTable   = new DataTable();
            var       stateTable   = new DataTable();
            DataTable tcsDataTable = GetTCSDataTable();

            inserter          = new AuthHeaderInserter();
            inserter.Username = userName;
            inserter.Password = password;

            adminClient = new WsAdminClient();
            adminClient.Endpoint.EndpointBehaviors.Add(new AuthHeaderBehavior(inserter));

            // All reports require a start and end date!
            customReportCriteria reportCriteria = new customReportCriteria();

            reportCriteria.time = new reportTimeCriteria();


            if ((System.DateTime.Now.Minute >= 0) && (System.DateTime.Now.Minute < 30))
            {
                reportCriteria.time.start = System.DateTime.Now.AddMinutes(-(30 + DateTime.Now.Minute)).AddSeconds(-DateTime.Now.Second);
                reportCriteria.time.end   = System.DateTime.Now.AddMinutes(-(System.DateTime.Now.Minute + 1)).AddSeconds(59 - DateTime.Now.Second);
            }
            else
            {
                reportCriteria.time.start = System.DateTime.Now.AddMinutes(-System.DateTime.Now.Minute).AddSeconds(-DateTime.Now.Second);
                reportCriteria.time.end   = System.DateTime.Now.AddMinutes(-(System.DateTime.Now.Minute - 29)).AddSeconds(59 - DateTime.Now.Second);
            }
            reportCriteria.time.startSpecified = true;
            reportCriteria.time.endSpecified   = true;

            callLogTable = GetReportData(AdapterConstants.HISTORICAL_REPORT_FOLDER, AdapterConstants.HISTORICAL_CUSTOM_CALL_LOG, reportCriteria);
            skillTable   = GetReportData(AdapterConstants.HISTORICAL_REPORT_FOLDER, AdapterConstants.HISTORICAL_CUSTOM_AGENT_SKILL_LOGIN_TIME, reportCriteria);
            stateTable   = GetReportData(AdapterConstants.HISTORICAL_REPORT_FOLDER, AdapterConstants.HISTORICAL_CUSTOM_AGENT_STATE_REPORT, reportCriteria);

            try
            {
                var      zone             = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
                DateTime timeFilter       = TimeZoneInfo.ConvertTimeFromUtc(reportCriteria.time.start.ToUniversalTime(), zone);
                string   filterExpression = "(HALFHOUR = '" + timeFilter.ToString("HH") + ":" + timeFilter.ToString("mm") + "'" + ")";
                callLogTable = callLogTable.Select(filterExpression).CopyToDataTable();

                DateTime zoneTime = TimeZoneInfo.ConvertTimeFromUtc(reportCriteria.time.start.ToUniversalTime(), TimeZoneInfo.FindSystemTimeZoneById(HistoricalReportTimeZone));
                string   HalfHour = zoneTime.ToString("HH") + ":" + zoneTime.ToString("mm");

                DataTable dtable = callLogTable.DefaultView.ToTable(true, "SKILL");
                DataRow   dataRow;

                foreach (DataRow row in dtable.Rows)
                {
                    if ((row["SKILL"] != null) && (row["SKILL"].ToString() != "[None]"))
                    {
                        dataRow = tcsDataTable.NewRow();

                        dataRow["Date"]         = Utils.GetDate(row["SKILL"], callLogTable, HistoricalReportTimeZone);
                        dataRow["Interval End"] = HalfHour;
                        //dataRow["Interval End"] = Utils.GetIntervalTime(row["SKILL"], callLogTable);
                        dataRow["Identifier"] = "TCSDATA";

                        dataRow["Contact Group ID"] = row["SKILL"];
                        int NCO = Utils.GetNCO(row["SKILL"], callLogTable);
                        dataRow["Contacts Offered (NCO)"] = NCO;
                        int NCH = Utils.GetContactsHandled(row["SKILL"], callLogTable);
                        dataRow["Contacts Handled (NCH)"]  = NCH;
                        dataRow["Average Talk Time (ATT)"] = Utils.GetAverageTalkTime(row["SKILL"], NCH, callLogTable);
                        dataRow["Average After Contact Work Time (ACWT)"] = Utils.GetAverageAfterCallWorkTime(row["SKILL"], NCH, callLogTable);
                        dataRow["Average Delay (ASA)"]             = Utils.GetAverageDelayTime(row["SKILL"], NCH, callLogTable);
                        dataRow["Percent Service Level (%SL)"]     = Utils.GetPercentServiceLevel(row["SKILL"], NCO, callLogTable);
                        dataRow["Average Positions Staffed (APS)"] = Utils.GetAveragePositionsStaffed(row["SKILL"], skillTable, stateTable);
                        dataRow["Actual Abandons (ABD)"]           = Utils.GetActualAbandons(row["SKILL"], callLogTable);

                        tcsDataTable.Rows.Add(dataRow);
                    }
                }
                GenerateITFOutputFile(tcsDataTable, AdapterConstants.FILE_HISTORICAL_TCS_DATA);
                //CSV Output
                //GenerateOutputFile(tcsDataTable, AdapterConstants.FILE_HISTORICAL_TCS_DATA);
            }
            catch (Exception ex)
            {
                AppLogger.Instance.Error("HistoricalAdapterService.cs", "HistoricalTCSDataProcessing", ex);
            }
        }