private void PingButton_Click(object sender, RoutedEventArgs e)
        {
            this.PingResultTextBox.Text = "";
            string pEndPointAddress = this.EndPointURLTextBox.Text;
            bool   pIsAuthenticated = false;
            bool   pIsWsHTTPBinding = true;

            if ((bool)this.YesRadioButton.IsChecked)
            {
                pIsAuthenticated = true;
            }

            if ((bool)this.wsHTTPRadioButton.IsChecked)
            {
                pIsWsHTTPBinding = true;
            }
            else
            {
                pIsWsHTTPBinding = false;
            }


            try
            {
                int ServiceVersion = ServiceClient.GetServiceVersion();

                if (ServiceVersion == 1)
                {
                    SurveyManagerServiceV4.ManagerServiceV4Client Client  = ServiceClient.GetClientV4(pEndPointAddress, pIsAuthenticated, pIsWsHTTPBinding);
                    Epi.Web.Common.Message.OrganizationRequest    Request = new Epi.Web.Common.Message.OrganizationRequest();
                    var Result = Client.GetOrganization(Request);
                }
                else if (ServiceVersion == 2)
                {
                    SurveyManagerServiceV2.ManagerServiceV2Client Client  = ServiceClient.GetClientV2(pEndPointAddress, pIsAuthenticated, pIsWsHTTPBinding);
                    Epi.Web.Common.Message.OrganizationRequest    Request = new Epi.Web.Common.Message.OrganizationRequest();
                    var Result = Client.GetOrganization(Request);
                }
                else if (ServiceVersion == 3)
                {
                    SurveyManagerServiceV3.ManagerServiceV3Client Client  = ServiceClient.GetClientV3(pEndPointAddress, pIsAuthenticated, pIsWsHTTPBinding);
                    Epi.Web.Common.Message.OrganizationRequest    Request = new Epi.Web.Common.Message.OrganizationRequest();
                    var Result = Client.GetOrganization(Request);
                }
                else if (ServiceVersion == 4)
                {
                    SurveyManagerServiceV4.ManagerServiceV4Client Client  = ServiceClient.GetClientV4(pEndPointAddress, pIsAuthenticated, pIsWsHTTPBinding);
                    Epi.Web.Common.Message.OrganizationRequest    Request = new Epi.Web.Common.Message.OrganizationRequest();
                    var Result = Client.GetOrganization(Request);
                }
                this.PingResultTextBox.Text = "Successfully Created Service Client";

                this.PingResultTextBox.Text = "Successfully Created Service Client";
            }
            catch (Exception ex)
            {
                this.PingResultTextBox.Text = "Failed to create Service Client:\n\n" + ex.Message;
            }
        }
Example #2
0
        private void GetKey_Clik(object sender, RoutedEventArgs e)
        {
            //SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient();
            //Epi.Web.Common.Message.OrganizationRequest Request = new Epi.Web.Common.Message.OrganizationRequest();

            this.ONameEditTextBox1.Clear();
            this.checkBox1.IsChecked = false;
            richTextBox1.Document.Blocks.Clear();
            try
            {
                if (!string.IsNullOrEmpty(passwordBox1.Password.ToString()) && IsGuid(passwordBox1.Password.ToString()))
                {
                    if (OnamelistBox1.Items.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(OnamelistBox1.SelectedItem.ToString()))
                        {
                            int ServiceVersion = ServiceClient.GetServiceVersion();


                            SurveyManagerServiceV4.ManagerServiceV4Client client  = ServiceClient.GetClientV4();
                            Epi.Web.Common.Message.OrganizationRequest    Request = new Epi.Web.Common.Message.OrganizationRequest();
                            Request.Organization.Organization = this.OnamelistBox1.SelectedItem.ToString().Remove(OnamelistBox1.SelectedItem.ToString().IndexOf("___"));
                            Request.AdminSecurityKey          = new Guid(passwordBox1.Password);
                            Epi.Web.Common.Message.OrganizationResponse Result = client.GetOrganization(Request);
                            EditOtextBox1.Clear();
                            ONameEditTextBox1.Clear();
                            if (Result.Message != null)
                            {
                                richTextBox1.AppendText(Result.Message.ToString());
                            }

                            if (Result.OrganizationList != null)
                            {
                                for (int i = 0; i < Result.OrganizationList.Count; i++)
                                {
                                    // EditOtextBox1.Text = Cryptography.Decrypt(Result.OrganizationList[i].OrganizationKey.ToString());
                                    EditOtextBox1.Text          = Result.OrganizationList[i].OrganizationKey.ToString();
                                    this.ONameEditTextBox1.Text = Result.OrganizationList[i].Organization;
                                    this.checkBox1.IsChecked    = Result.OrganizationList[i].IsEnabled;
                                }
                            }
                        }
                    }

                    else
                    {
                        richTextBox1.AppendText("Please selet a organization name.");
                    }
                }
                else
                {
                    richTextBox1.AppendText("Please selet a organization name. And admin key is required and Should be a Guid. ");
                }
                // }
                //  else
                //  {

                //     richTextBox1.AppendText("Admin pass  is required and Should be a Guid.");

                // }

                GetOrgUsers();
            }
            catch (Exception ex)
            {
                richTextBox1.AppendText("Error occurred while trying to get new organization keys.  ");
            }
        }