protected void checkReservations() { Hashtable tableToClear = new Hashtable(); foreach (AgentAccount agent in table.Values) { if (agent.HasIncident) { TimeSpan max = new TimeSpan(0, 0, 15); if (TimeSpan.Compare(agent.Reserved, max) > 0) { Int32 incidentId = agent.IncidentId; Int32 incidentStatusId = BllProxyIncidentHelper.GetIncidentStatus(incidentId); if (incidentStatusId == 1) { BllProxyIncidentHelper.SetIncidentReservation(incidentId, 0); agent.IsBusy = false; tableToClear.Add(agent.AgentId, null); } } } } foreach (Int32 agentId in tableToClear.Keys) { //this.UnRegisterAgent(agentId); this.SetAgentAvailable(agentId, false); } }
protected void timerRefresh_Tick(object sender, EventArgs e) { DateTime t = DateTime.Now; DateTime last = new DateTime(t.Subtract(startTime).Ticks); TimeSpan span = t.Subtract(startTime); // //ltTimeSpan.Text = string.Format("{0:00}:{1:00}:{2:00}", (int)span.TotalHours, span.Minutes, span.Seconds); ltTimeSpan.Text = this.getTimeLeftText(span.Seconds); //====================================================================== bool isSessionFinished = false; Int32 currentStatusId = BllProxyIncidentHelper.GetIncidentStatus(incidentId); if (currentStatusId != statusId) { UcControlArgs args = new UcControlArgs(); switch (currentStatusId) { case 1: //New break; case 2: //In-Progress goNext(args); break; case 3: //Canceled isSessionFinished = true; goBack(args); break; case 4: //Closed isSessionFinished = true; goBack(args); break; } statusId = currentStatusId; } //====================================================================== TimeSpan max0 = new TimeSpan(0, 0, timeOut); TimeSpan max1 = new TimeSpan(0, 1, 0); if (TimeSpan.Compare(span, max0) > 0) { if (mode == 0) { pnlWait.Visible = false; pnlAgentsBusy.Visible = true; upWork.Update(); mode = 1; } } if (TimeSpan.Compare(span, max1) > 0) { BllProxyIncidentHelper.SetIncidentStatus(incidentId, 3); isSessionFinished = true; } if (isSessionFinished) { BllProxyIncident.UpdateIncident(incidentId, 0, 0, 3, "[_EXPIRED_]"); UcControlArgs args = new UcControlArgs(); goBack(args); } }