private void PluginForm_Load(object sender, EventArgs e) { try { //Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); //config.AppSettings.Settings["IP"].Value = "10.0.0.2"; //config.Save(ConfigurationSaveMode.Modified); //ConfigurationManager.RefreshSection("appSettings"); //Open the configuration file using the dll location Configuration myDllConfig = System.Configuration.ConfigurationManager.OpenExeConfiguration(this.GetType().Assembly.Location); // Get the appSettings section AppSettingsSection myDllConfigAppSettings = (AppSettingsSection)myDllConfig.GetSection("appSettings"); // return the desired field string defaultGroup = myDllConfigAppSettings.Settings["DefaultGroup"].Value; string defaultAgent = myDllConfigAppSettings.Settings["DefaultAgent"].Value; BasicHttpBinding binding = new BasicHttpBinding(); binding.Name = "svcOrganizationSoap"; // load the group combo box // create a new Organization client organizationClient = new svcOrganizationSoapClient(binding , organizationEndpoint ); // fill the group dictionary GroupInfoArrayResult giResult = new GroupInfoArrayResult(); giResult = organizationClient.GetAllGroups(pluginUser , pluginPassword ); for (int i = 0; i < giResult.Groups.Length; i++) { GroupInfo info = giResult.Groups[i]; dictGroup.Add(info.Name, info.ID); } // fill the box foreach (KeyValuePair<string, int> pair in dictGroup) { cboGroupName.Items.Add(pair.Key); } // set the default group cboGroupName.SelectedItem = defaultGroup; // get the slelected group id from the dictionary if (dictGroup.ContainsKey(cboGroupName.SelectedItem.ToString())) { groupId = dictGroup[cboGroupName.SelectedItem.ToString()]; } // get a list of agents for the group AgentInfoArrayResult agentResult = organizationClient.GetAgentsForGroup(pluginUser, pluginPassword, groupId); // clear any previous dictionary items dictAgent = new Dictionary<string, int>(); dictUser = new Dictionary<int, string>(); // load the list to the agents dictionary for (int i = 0; i < agentResult.Agents.Length; i++) { AgentInfo agent = agentResult.Agents[i]; dictAgent.Add(agent.DisplayName, agent.ID); dictUser.Add(agent.ID, agent.UserName); } // load the agents combo box cboAgent.Items.Clear(); foreach (KeyValuePair<string, int> pair in dictAgent) { cboAgent.Items.Add(pair.Key); } // set the default agent cboAgent.SelectedItem = defaultAgent; // fill the call boxes this.txtPhone.Text = phone; this.dtpFromDate.Value = fromDate; this.dtpFromTime.Value = fromDate; this.dtpDateTo.Value = toDate; this.dtpTimeTo.Value = toDate; } catch (Exception ex) { MessageBox.Show("An error occurred loading the CyberSharksPlugin CallLog form..." + Environment.NewLine + ex.ToString() , "CyberShark Plugin Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CallLogForm_Load(object sender, EventArgs e) { try { this.dtpFromDate.Format = DateTimePickerFormat.Custom; this.dtpFromDate.CustomFormat = "MM/ dd / yyyy hh : mm "; this.dtpDateTo.Format = DateTimePickerFormat.Custom; this.dtpDateTo.CustomFormat = "MM/ dd / yyyy hh : mm "; pluginUser = ConfigurationManager.AppSettings["User"]; pluginPassword = ConfigurationManager.AppSettings["Password"]; defaultGroup = ConfigurationManager.AppSettings["DefaultGroup"]; defaultAgent = ConfigurationManager.AppSettings["DefaultAgent"]; BasicHttpBinding binding = new BasicHttpBinding(); binding.Name = "svcOrganizationSoap"; // load the group combo box // create a new Organization client organizationClient = new svcOrganizationSoapClient(binding, organizationEndpoint); GroupInfoArrayResult giResult = new GroupInfoArrayResult(); giResult = organizationClient.GetAllGroups(pluginUser, pluginPassword); for (int i = 0; i < giResult.Groups.Length; i++) { GroupInfo info = giResult.Groups[i]; dictGroup.Add(info.Name, info.ID); } // fill the box foreach (KeyValuePair<string, int> pair in dictGroup) { cboGroupName.Items.Add(pair.Key); } // set the default group cboGroupName.SelectedItem = defaultGroup; // get the slelected group id from the dictionary if (dictGroup.ContainsKey(cboGroupName.SelectedItem.ToString())) { groupId = dictGroup[cboGroupName.SelectedItem.ToString()]; } // get a list of agents for the group AgentInfoArrayResult agentResult = organizationClient.GetAgentsForGroup(pluginUser, pluginPassword, groupId); // clear any previous dictionary items dictAgent = new Dictionary<string, int>(); dictUser = new Dictionary<int, string>(); // load the list to the agents dictionary for (int i = 0; i < agentResult.Agents.Length; i++) { AgentInfo agent = agentResult.Agents[i]; dictAgent.Add(agent.DisplayName, agent.ID); dictUser.Add(agent.ID, agent.UserName); } // load the agents combo box cboAgent.Items.Clear(); foreach (KeyValuePair<string, int> pair in dictAgent) { cboAgent.Items.Add(pair.Key); } // set the default agent cboAgent.SelectedItem = defaultAgent; // fill the call boxes this.txtPhone.Text = phone; this.dtpFromDate.Value = DateTime.Now; this.dtpDateTo.Value = DateTime.Now; } catch (Exception ex) { MessageBox.Show("An error occurred loading the CyberSharksPlugin CallLog form..." + Environment.NewLine + ex.ToString(), "CyberShark Plugin Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private string createCallLog() { string w = ""; string user = "******"; string password = "******"; try { /* // create a test entry var parameters = new CyberSharkService.ArrayOfString { pfxSubject + this.txtSubject .Text , pfxPhoneNumber + this.txtPhoneNumber.Text, pfxCustomerName + this.txtCustomerName .Text, pfxDateStart + this.txtStart .Text, pfxDateEnd + this.txtEnd.Text , pfxGroupID + this.txtGroupId .Text, pfxUserID + this.txtUserId .Text }; MessageBox.Show(parameters.ToString()); // create a service client CyberSharkService.svcCallLogsSoapClient client = new CyberSharkService.svcCallLogsSoapClient(); // open the client client.Open(); // invoke create call log CyberSharkService.CallLogIdResult result = client.CreateCallLog2(user, password, parameters); // display the result in a message box MessageBox.Show(result.CallLogId.ToString() + "|" + result.CallNumber + "|" + result.Message.ToString() + "|" + result.Result.ToString() + "|" + result.ResultCode.ToString() + "|" ); // close the client client.Close */ CyberSharkService2.svcOrganizationSoapClient orgClient = new CyberSharkService2.svcOrganizationSoapClient(); CyberSharkService2.GroupInfoArrayResult giresult = new GroupInfoArrayResult(); giresult = orgClient.GetAllGroups("George", "pants#1"); for (int i = 0; i < giresult.Groups.Length; i++) { GroupInfo info = giresult.Groups[i]; MessageBox.Show (info.Name); } } catch (Exception e) { // display the exception MessageBox.Show(e.ToString(), "Exception..."); } return w; }