/// <summary> /// This is the general method to handle the message and send along as appopriate /// </summary> /// <param name="channel">The serialized channel information object.</param> /// <returns>A message the service wishes to return</returns> public string SendMessage(string channel) { ChannelInformation channelInformation = null; try { ChannelInformation ci = (ChannelInformation)GeneralFunctions.Deserialize <ChannelInformation>(channel); if (ci == null) { Logging.Error("MailChannel", "ChannelInformation is null"); } // Call out to get data CustomerClient customer = new CustomerClient(); CustomerProviderCustomerRecord custrec = customer.GetCustomerByID(ci.CustomerID); customer.Close(); ci.City = custrec.City; // = "Redmond"; ci.Country = custrec.Country; // = "USA"; ci.CustomerID = custrec.CustomerID; // = "1"; ci.FirstName = custrec.FirstName; // = "Maeve"; ci.LastName = custrec.LastName; // = "Elizabeth"; ci.PhoneHome = custrec.PhoneHome; // = "4252210456"; ci.PhoneMobile = custrec.PhoneMobile; // = "4252210456"; ci.PhoneWork = custrec.PhoneWork; // = "4252210456"; ci.State = custrec.State; // = "WA"; ci.Street = custrec.Street; // = "Rainy Street"; ci.ZipCode = custrec.ZipCode; // = "98008"; AgentClientData agent = RetrieveAgentClient(ci.Agent); Uri toUri = new Uri(String.Format("http://{0}:{1}/", agent.IPAddress.Trim(), agent.Port.Trim())); EndpointAddress address = new EndpointAddress(toUri.ToString()); string retValue = string.Empty; MultichannelSubsystemClient mcssclient = new MultichannelSubsystemClient(); try { mcssclient.Endpoint.Address = address; mcssclient.ClientCredentials.Windows.ClientCredential = AgentCredentialUtilities.GetCurrentCredential(); retValue = mcssclient.Call(GeneralFunctions.Serialize <ChannelInformation>(ci)); } catch (Exception ex) { Console.Write(ex.Message); } } catch (Exception ex) { Logging.Error(this.ToString(), ex.Message); return(ex.Message); } return(GeneralFunctions.Serialize(channelInformation)); } // SendMessage
public override void Initialize() { //wc.Url = this.configurationReader.ReadSettings("Microsoft_Ccf_Samples_InstantMessaging_WebchatServer_WebchatServer"); //wc.Credentials = System.Net.CredentialCache.DefaultCredentials; //wc.PreAuthenticate = true; string Url = this.configurationReader.ReadSettings("Microsoft_Ccf_Samples_InstantMessaging_WebchatServer_WebchatServer"); System.ServiceModel.EndpointAddress wcAddress = new System.ServiceModel.EndpointAddress(Url); wc.Endpoint.Address = wcAddress; wc.ClientCredentials.Windows.ClientCredential = AgentCredentialUtilities.GetCurrentCredential(); this.timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); //this.timer.Tick+=new EventHandler(timer_Tick); this.timer.Enabled = false; this.timer.Interval = 2000; base.Initialize(); }
private void AddressBookDlg_Load(object sender, System.EventArgs e) { bool defaultSearch = false; try { //book = new AddressBook.AddressBook(); client = new AddressBook.AddressBookClient(); string Url = UIConfiguration.ConfigurationReader.ReadSettings("AgentDesktop_AddressBook_AddressBook"); System.ServiceModel.EndpointAddress addressBookServiceAddress = new System.ServiceModel.EndpointAddress(Url); client.Endpoint.Address = addressBookServiceAddress; client.ClientCredentials.Windows.ClientCredential = AgentCredentialUtilities.GetCurrentCredential(); //book.Url = UIConfiguration.ConfigurationReader.ReadSettings("AgentDesktop_AddressBook_AddressBook"); //book.Credentials = Utils.GetCredentials(); //book.PreAuthenticate = true; // Either init to the last search or to the first entries alphabetically if (lastNameSearchedFor != null) { nameToFind.Text = lastNameSearchedFor; } else { defaultSearch = true; nameToFind.Text = localize.AGENT_DESKTOP_ADDR_BOOK_DLG_NAME_TO_FIND; } find_Click(this, null); // remove text if using default search if (defaultSearch) { nameToFind.Text = ""; } tip.Active = false; tip.SetToolTip(addressList, ""); } catch (Exception exp) { Logging.Error(Application.ProductName, localize.AGENT_DESKTOP_ADDR_BOOK_DLG_ERR_INITIALIZING_ADDR_BOOK, exp); } }