/// <summary> /// Gets the newest customer-related thread and returns it. This includes customer entries and custom proxy entries /// </summary> /// <returns>the newest thread from the incident</returns> private string GetLatestCustomerThreadEntry() { try { //pull the newest customer created thread if (incidentWorkspaceRecord != null && incidentWorkspaceRecord.Threads != null && incidentWorkspaceRecord.Threads.Count > 0) { var threadLookup = from t in incidentWorkspaceRecord.Threads where t.EntryType == 2 || //agent response t.EntryType == 3 || //customer entry t.EntryType == 4 //customer proxy orderby t.Entered descending select t.Note; if (threadLookup.Count() > 0) { return(threadLookup.FirstOrDefault()); } else { return(""); } } else { return(""); } } catch (Exception ex) { globalContext.LogMessage("IncidentCopy - Failed to get thread: " + ex); return(""); } }
public bool Initialize(IGlobalContext context) { _globalContext = context; var baseCatalog = new AggregateCatalog(); baseCatalog.Catalogs.Add(new AssemblyCatalog(typeof(CtiAdministrationNavigationItem).Assembly)); _container = new CompositionContainer(baseCatalog); try { _container.ComposeParts(this); return(true); } catch (CompositionException exc) { context.LogMessage(exc.ToString()); return(false); } }
public bool Initialize(IGlobalContext context) { _globalContext = context; Global.Context = context; var baseCatalog = new AggregateCatalog(); var info = Directory.GetParent(Path.GetDirectoryName(typeof(ScreenPopConfigurationNavigationItem).Assembly.Location)); AddDirectoryToCatalog(info.Parent, baseCatalog); _container = new CompositionContainer(baseCatalog); try { _container.ComposeParts(this); return(true); } catch (CompositionException exc) { context.LogMessage(exc.ToString()); return(false); } }
public void RuleActionInvoked(string ActionName) { try { Init(); if (ActionName == "CalculateTotal") { string Quantity = "1"; string UnitCost = "0"; double Ticket = 0; Payable = _recordContext.GetWorkspaceRecord("CO$Payables") as IGenericObject; IList <IGenericField> genericFields; genericFields = Payable.GenericFields; foreach (IGenericField gen in genericFields) { if (gen.Name == "Quantity") { Quantity = gen.DataValue.Value.ToString(); } if (gen.Name == "UnitCost") { UnitCost = gen.DataValue.Value.ToString(); } } Ticket = Math.Round(Convert.ToDouble(Quantity) * Convert.ToDouble(UnitCost), 2); foreach (IGenericField gen in genericFields) { if (gen.Name == "TicketAmount") { gen.DataValue.Value = Ticket; } } } if (ActionName == "ChangeOUM") { string OUM = ""; string Quantity = "1"; string services = "0"; //Incident = (IIncident)_recordContext.GetWorkspaceRecord(WorkspaceRecordType.Incident); //IncidentID = Incident.ID; Payable = _recordContext.GetWorkspaceRecord("CO$Payables") as IGenericObject; IList <IGenericField> genericFields; genericFields = Payable.GenericFields; foreach (IGenericField gen in genericFields) { if (gen.Name == "UOM_Menu") { OUM = gen.DataValue.Value.ToString(); } if (gen.Name == "Services") { services = gen.DataValue.Value.ToString(); } } IncidentID = GetIncidentId(services); if (OUM == "1" || OUM == "118") { Quantity = ""; } if (OUM == "2") { string ICAOId = getICAODesi(IncidentID); Quantity = GetMTOW(ICAOId); } if (OUM == "3" || OUM == "4" || OUM == "5") { double minover = 0; double antelacion = 0; double extension = 0; string itinerary = getItinerary(services); if (!AirportOpen24(itinerary)) { int arrival = getArrivalAirport(itinerary); if (arrival != 0) { DateTime openDate; DateTime closeDate; string open = getOpenArrivalAirport(arrival); string close = getCloseArrivalAirport(arrival); DateTime ATA = getATAItinerary(Convert.ToInt32(itinerary)); DateTime ATD = getATDItinerary(Convert.ToInt32(itinerary)); openDate = DateTime.Parse(ATA.Date.ToShortDateString() + " " + open); closeDate = DateTime.Parse(ATA.Date.ToShortDateString() + " " + close); if (IsBetween(ATA, openDate, closeDate)) { antelacion = (ATA - openDate).TotalMinutes; } extension = ((ATD - openDate).TotalMinutes) + 15; if (ATA.Date != ATD.Date) { openDate = DateTime.Parse(ATD.Date.ToShortDateString() + " " + open); closeDate = DateTime.Parse(ATD.Date.ToShortDateString() + " " + close); if (IsBetween(ATD, openDate, closeDate)) { extension = ((ATD - openDate).TotalMinutes) + 15; } else { extension = 0; } } if (extension > 0) { minover = extension < 0 ? 0 : extension; } if (ATA.Date != ATD.Date) { minover = (antelacion < 0 ? 0 : antelacion) + (extension < 0 ? 0 : extension); } } TimeSpan t = TimeSpan.FromMinutes(minover); //HR// if (OUM == "3") { Quantity = (Math.Ceiling(t.TotalHours)).ToString(); } //HHR// if (OUM == "4") { Quantity = Math.Ceiling((t.TotalMinutes / 60) * 2).ToString(); } //MIN/ if (OUM == "5") { Quantity = Math.Ceiling(t.TotalMinutes).ToString(); } } } foreach (IGenericField gen in genericFields) { if (gen.Name == "Quantity") { gen.DataValue.Value = Quantity; } } } } catch (Exception e) { gcontext.LogMessage(e.Message + "Det" + e.StackTrace); } }
public static void displaymsg(string action) { System.Diagnostics.Stopwatch timer = new Stopwatch(); if (extns.Length == 0) { extns = getExtension(agentid); } ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return(true); }); string url = "https://rntp.goepson.com/mitel/XISOAPAdapter/MessageServlet?senderParty=&senderService=BS_NA_3PRightnow_P&receiverParty=&receiverService=&interface=Agent_Async_Out&interfaceNamespace=http://SVM/Mitel/CallRecording"; //string url = "https://rntn.goepson.com/mitel/XISOAPAdapter/MessageServlet?senderParty=&senderService=BS_NA_3PRightnow_Q&receiverParty=&receiverService=&interface=Agent_Async_Out&interfaceNamespace=http://SVM/Mitel/CallRecording"; //string url = "https://rntn.goepson.com/mitel/XISOAPAdapter/MessageServlet?senderParty=&senderService=BS_NA_3PRIGHTNOW_D&receiverParty=&receiverService=&interface=Agent_Async_Out&interfaceNamespace=http://SVM/Mitel/CallRecording"; //string url = "https://rntn.goepson.com/tst/XISOAPAdapter/MessageServlet?senderParty=&senderService=BS_NA_3PRIGHTNOW_D&receiverParty=&receiverService=&interface=Agent_Async_Out&interfaceNamespace=http://SVM/Mitel/CallRecording"; XmlDocument soapEnvelopeXml = new XmlDocument(); soapEnvelopeXml.LoadXml(@"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:cal='http://SVM/Mitel/CallRecording'><soapenv:Header/><soapenv:Body><cal:MT_Agent><Agent><AgentID>" + extns + "</AgentID><Action>" + action + "</Action></Agent></cal:MT_Agent></soapenv:Body></soapenv:Envelope>"); try { HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); //webRequest.Headers.Add("SOAPAction", action); //String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes("RNT_PO_MITEL:Epson@123")); String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes("RNT_PO_MITEL:Epson$2017")); //String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes("RNT_PO_MITEL:Wrep5$P0R")); webRequest.Headers.Add("Authorization", "Basic " + encoded); webRequest.ContentType = "text/xml;charset=\"utf-8\""; webRequest.Accept = "text/xml"; webRequest.Method = "POST"; timer.Start(); using (Stream stream = webRequest.GetRequestStream()) { soapEnvelopeXml.Save(stream); } // begin async call to web request. IAsyncResult asyncResult = webRequest.BeginGetResponse(null, null); // suspend this thread until call is complete. You might want to // do something usefull here like update your UI. asyncResult.AsyncWaitHandle.WaitOne(); // get the response from the completed web request. string soapResult; using (WebResponse webResponse = webRequest.EndGetResponse(asyncResult)) { //_globalContext.LogMessage("before triggering"); //_recordContext.TriggerNamedEvent("response"); //_globalContext.LogMessage("After triggering"); //Thread.Sleep(3000); response = true; using (StreamReader rd = new StreamReader(webResponse.GetResponseStream())) { soapResult = rd.ReadToEnd(); } timer.Stop(); } //TimeSpan timeTaken = timer.Elapsed; //string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",timeTaken.Hours, timeTaken.Minutes, timeTaken.Seconds,timeTaken.Milliseconds / 10); //_globalContext.LogMessage("elapsed time btw request and response " + elapsedTime); } catch (Exception e) { _globalContext.LogMessage("bad request"); response = true; } }