Example #1
0
        private void DownloadSurveyInfoButton_Click(object sender, RoutedEventArgs e)
        {
            SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient();

            Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest();

            if (!string.IsNullOrEmpty(this.SurveyCriteria_SurveyId.Text.Trim()))
            {
                Request.Criteria.SurveyIdList.Add(this.SurveyCriteria_SurveyId.Text);
            }

            if ((bool)this.SurveyCriteria_CurrentlyOpenCheckBox.IsChecked)
            {
                Request.Criteria.ClosingDate = DateTime.Now;
            }

            if (this.SurveyInfoCriteria_SurveyTypeListBox.SelectedIndex > -1)
            {
                Request.Criteria.SurveyType = int.Parse(((ListBoxItem)this.SurveyInfoCriteria_SurveyTypeListBox.Items[this.SurveyInfoCriteria_SurveyTypeListBox.SelectedIndex]).Tag.ToString());
            }


            SurveyInfoResponseTextBox.Document.Blocks.Clear();
            try
            {
                Epi.Web.Common.Message.SurveyInfoResponse Result = client.GetSurveyInfo(Request);

                SurveyInfoResponseTextBox.AppendText(string.Format("{0} - records. \n\n", Result.SurveyInfoList.Count));
                foreach (Epi.Web.Common.DTO.SurveyInfoDTO SurveyInfo in Result.SurveyInfoList)
                {
                    SurveyInfoResponseTextBox.AppendText(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate));
                }
            }
            catch (FaultException <CustomFaultException> cfe)
            {
                SurveyInfoResponseTextBox.AppendText("FaultException<CustomFaultException>:\n");
                SurveyInfoResponseTextBox.AppendText(cfe.ToString());
            }
            catch (FaultException fe)
            {
                SurveyInfoResponseTextBox.AppendText("FaultException:\n");
                SurveyInfoResponseTextBox.AppendText(fe.ToString());
            }
            catch (CommunicationException ce)
            {
                SurveyInfoResponseTextBox.AppendText("CommunicationException:\n");
                SurveyInfoResponseTextBox.AppendText(ce.ToString());
            }
            catch (TimeoutException te)
            {
                SurveyInfoResponseTextBox.AppendText("TimeoutException:\n");
                SurveyInfoResponseTextBox.AppendText(te.ToString());
            }
            catch (Exception ex)
            {
                SurveyInfoResponseTextBox.AppendText("Exception:\n");
                SurveyInfoResponseTextBox.AppendText(ex.ToString());
            }
        }
Example #2
0
        private void DoGetSurveyInfo()
        {
            try
            {
                Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest();

                //Request.Criteria.OrganizationKey = new Guid(this.OrganizationKey);
                Request.Criteria.OrganizationKey = new Guid(this.OrgKeytextBox.Text.ToString());
                //Request.Criteria.UserPublishKey = new Guid(this.UserPublishKey);
                Request.Criteria.ReturnSizeInfoOnly = false;

                Request.Criteria.SurveyIdList.Add(this.SurveyId);
                lock (syncLock)
                {
                    Epi.Web.Common.Message.SurveyInfoResponse Result = new Epi.Web.Common.Message.SurveyInfoResponse();
                    this.Cursor      = Cursors.WaitCursor;
                    SurveyInfoWorker = new BackgroundWorker();
                    SurveyInfoWorker.WorkerSupportsCancellation = true;
                    SurveyInfoWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(SurveyInfoworker_DoWork);

                    SurveyInfoWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(worker_WorkerCompleted);
                    object[] args = new object[2];
                    args[0] = Request;
                    args[1] = Result;
                    SurveyInfoWorker.RunWorkerAsync(args);
                }
            }
            catch (FaultException <CustomFaultException> cfe)
            {
                //  SurveyInfoResponseTextBox.AppendText("FaultException<CustomFaultException>:\n");
                /// SurveyInfoResponseTextBox.AppendText(cfe.ToString());
            }
            catch (FaultException fe)
            {
                // SurveyInfoResponseTextBox.AppendText("FaultException:\n");
                // SurveyInfoResponseTextBox.AppendText(fe.ToString());
            }
            catch (CommunicationException ce)
            {
                //  SurveyInfoResponseTextBox.AppendText("CommunicationException:\n");
                // SurveyInfoResponseTextBox.AppendText(ce.ToString());
            }
            catch (TimeoutException te)
            {
                // SurveyInfoResponseTextBox.AppendText("TimeoutException:\n");
                // SurveyInfoResponseTextBox.AppendText(te.ToString());
            }
            catch (Exception ex)
            {
                //  SurveyInfoResponseTextBox.AppendText("Exception:\n");
                //  SurveyInfoResponseTextBox.AppendText(ex.ToString());
            }
        }
Example #3
0
        private void DoUpDate()
        {
            try
            {
                Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest();


                lock (syncLock)
                {
                    Epi.Web.Common.Message.SurveyInfoResponse Result = new Epi.Web.Common.Message.SurveyInfoResponse();
                    //this.Cursor = Cursors.WaitCursor;
                    UpdateWorker = new BackgroundWorker();
                    UpdateWorker.WorkerSupportsCancellation = true;

                    UpdateWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(UpdateSurveyInfoworker_DoWork);
                    // UpdateWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(worker_WorkerCompleted);
                    object[] args = new object[2];
                    args[0] = Request;
                    args[1] = Result;
                    UpdateWorker.RunWorkerAsync(args);
                }
            }
            catch (FaultException <CustomFaultException> cfe)
            {
                //  SurveyInfoResponseTextBox.AppendText("FaultException<CustomFaultException>:\n");
                /// SurveyInfoResponseTextBox.AppendText(cfe.ToString());
            }
            catch (FaultException fe)
            {
                // SurveyInfoResponseTextBox.AppendText("FaultException:\n");
                // SurveyInfoResponseTextBox.AppendText(fe.ToString());
            }
            catch (CommunicationException ce)
            {
                //  SurveyInfoResponseTextBox.AppendText("CommunicationException:\n");
                // SurveyInfoResponseTextBox.AppendText(ce.ToString());
            }
            catch (TimeoutException te)
            {
                // SurveyInfoResponseTextBox.AppendText("TimeoutException:\n");
                // SurveyInfoResponseTextBox.AppendText(te.ToString());
            }
            catch (Exception ex)
            {
                //  SurveyInfoResponseTextBox.AppendText("Exception:\n");
                //  SurveyInfoResponseTextBox.AppendText(ex.ToString());
            }
        }
Example #4
0
        private void DoUpDate()
        {
            try
            {

                Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest();

                lock (syncLock)
                {
                    Epi.Web.Common.Message.SurveyInfoResponse Result = new Epi.Web.Common.Message.SurveyInfoResponse();
                    //this.Cursor = Cursors.WaitCursor;
                    UpdateWorker = new BackgroundWorker();
                    UpdateWorker.WorkerSupportsCancellation = true;

                    UpdateWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(UpdateSurveyInfoworker_DoWork);
                   // UpdateWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(worker_WorkerCompleted);
                    object[] args = new object[2];
                    args[0] = Request;
                    args[1] = Result;
                    UpdateWorker.RunWorkerAsync(args);
                }
            }
            catch (FaultException<CustomFaultException> cfe)
            {
                //  SurveyInfoResponseTextBox.AppendText("FaultException<CustomFaultException>:\n");
                /// SurveyInfoResponseTextBox.AppendText(cfe.ToString());
            }
            catch (FaultException fe)
            {
                // SurveyInfoResponseTextBox.AppendText("FaultException:\n");
                // SurveyInfoResponseTextBox.AppendText(fe.ToString());
            }
            catch (CommunicationException ce)
            {
                //  SurveyInfoResponseTextBox.AppendText("CommunicationException:\n");
                // SurveyInfoResponseTextBox.AppendText(ce.ToString());
            }
            catch (TimeoutException te)
            {
                // SurveyInfoResponseTextBox.AppendText("TimeoutException:\n");
                // SurveyInfoResponseTextBox.AppendText(te.ToString());
            }
            catch (Exception ex)
            {
                //  SurveyInfoResponseTextBox.AppendText("Exception:\n");
                //  SurveyInfoResponseTextBox.AppendText(ex.ToString());
            }
        }
Example #5
0
        private void DoGetSurveyInfo()
        {
            try
            {

                Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest();

                //Request.Criteria.OrganizationKey = new Guid(this.OrganizationKey);
                Request.Criteria.OrganizationKey = new Guid(this.OrgKeytextBox.Text.ToString());
                //Request.Criteria.UserPublishKey = new Guid(this.UserPublishKey);
                Request.Criteria.ReturnSizeInfoOnly = false;

                Request.Criteria.SurveyIdList.Add(this.SurveyId);
                lock (syncLock)
                {
                    Epi.Web.Common.Message.SurveyInfoResponse Result = new Epi.Web.Common.Message.SurveyInfoResponse();
                    this.Cursor = Cursors.WaitCursor;
                    SurveyInfoWorker = new BackgroundWorker();
                    SurveyInfoWorker.WorkerSupportsCancellation = true;
                    SurveyInfoWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(SurveyInfoworker_DoWork);

                    SurveyInfoWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(worker_WorkerCompleted);
                    object[] args = new object[2];
                    args[0] = Request;
                    args[1] = Result;
                    SurveyInfoWorker.RunWorkerAsync(args);
                }

            }
            catch (FaultException<CustomFaultException> cfe)
            {
              //  SurveyInfoResponseTextBox.AppendText("FaultException<CustomFaultException>:\n");
               /// SurveyInfoResponseTextBox.AppendText(cfe.ToString());
            }
            catch (FaultException fe)
            {
               // SurveyInfoResponseTextBox.AppendText("FaultException:\n");
               // SurveyInfoResponseTextBox.AppendText(fe.ToString());
            }
            catch (CommunicationException ce)
            {
              //  SurveyInfoResponseTextBox.AppendText("CommunicationException:\n");
               // SurveyInfoResponseTextBox.AppendText(ce.ToString());
            }
            catch (TimeoutException te)
            {
               // SurveyInfoResponseTextBox.AppendText("TimeoutException:\n");
               // SurveyInfoResponseTextBox.AppendText(te.ToString());
            }
            catch (Exception ex)
            {
              //  SurveyInfoResponseTextBox.AppendText("Exception:\n");
              //  SurveyInfoResponseTextBox.AppendText(ex.ToString());
            }
        }
Example #6
0
        private void DownloadSurveyInfoButton_Click(object sender, RoutedEventArgs e)
        {
            SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient();

            Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest();


            //Checking the Organization key guid is in correct format
            if (!IsGuid(passOrganizationKey.Password))
            {
                MessageBox.Show("Organization key is not in correct format");
                return;
            }
            //Assign the organization key
            Request.Criteria.OrganizationKey = new Guid(passOrganizationKey.Password);



            if (!string.IsNullOrEmpty(this.SurveyCriteria_SurveyId.Text.Trim()))
            {
                Request.Criteria.SurveyIdList.Add(this.SurveyCriteria_SurveyId.Text);
            }

            if ((bool)this.SurveyCriteria_CurrentlyOpenCheckBox.IsChecked)
            {
                Request.Criteria.ClosingDate = DateTime.Now;
            }

            if (this.SurveyInfoCriteria_SurveyTypeListBox.SelectedIndex > -1)
            {
                Request.Criteria.SurveyType = int.Parse(((ListBoxItem)this.SurveyInfoCriteria_SurveyTypeListBox.Items[this.SurveyInfoCriteria_SurveyTypeListBox.SelectedIndex]).Tag.ToString());
            }


            SurveyInfoResponseTextBox.Document.Blocks.Clear();

            int PageNumber = 0;
            int PageSize   = 0;

            try
            {
                if (this.chkIsSizeRequestSurveyInfo.IsChecked == true)
                {
                    Request.Criteria.ReturnSizeInfoOnly = true;
                    Epi.Web.Common.Message.SurveyInfoResponse Result = client.GetSurveyInfo(Request);
                    if (!string.IsNullOrEmpty(Result.Message))
                    {
                        SurveyInfoResponseTextBox.AppendText(string.Format(Result.Message));
                    }
                    else
                    {
                        SurveyInfoResponseTextBox.AppendText(string.Format(" - Number of Pages: {0}   \n\n", Result.NumberOfPages));
                        SurveyInfoResponseTextBox.AppendText(string.Format(" - Pages Size:   {0} \n ", Result.PageSize));
                    }
                }
                else
                {
                    // 2 Step process:
                    //      1 - get sizing information.
                    //      2 - Loop thru calls for query results


                    // 1 - get sizing information
                    Request.Criteria.ReturnSizeInfoOnly = true;
                    Epi.Web.Common.Message.SurveyInfoResponse SizeResult = client.GetSurveyInfo(Request);


                    if (!string.IsNullOrEmpty(SizeResult.Message))
                    {
                        SurveyInfoResponseTextBox.AppendText(string.Format(SizeResult.Message));
                    }
                    else
                    {
                        SurveyInfoResponseTextBox.AppendText(string.Format(" - Number of Pages: {0}   \n\n", SizeResult.NumberOfPages));
                        SurveyInfoResponseTextBox.AppendText(string.Format(" - Pages Size:   {0}  \n", SizeResult.PageSize));

                        // 2 - loop thru calls for query results
                        PageSize   = SizeResult.PageSize;
                        PageNumber = SizeResult.NumberOfPages;
                        Request.Criteria.ReturnSizeInfoOnly = false;

                        for (int i = 1; i <= PageNumber; i++)
                        {
                            Request.Criteria.PageNumber = i;

                            Epi.Web.Common.Message.SurveyInfoResponse Result = client.GetSurveyInfo(Request);

                            foreach (Epi.Web.Common.DTO.SurveyInfoDTO SurveyInfo in Result.SurveyInfoList)
                            {
                                SurveyInfoResponseTextBox.AppendText(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate));
                            }
                        }
                    }
                }
            }
            catch (FaultException <CustomFaultException> cfe)
            {
                SurveyInfoResponseTextBox.AppendText("FaultException<CustomFaultException>:\n");
                SurveyInfoResponseTextBox.AppendText(cfe.ToString());
            }
            catch (FaultException fe)
            {
                SurveyInfoResponseTextBox.AppendText("FaultException:\n");
                SurveyInfoResponseTextBox.AppendText(fe.ToString());
            }
            catch (CommunicationException ce)
            {
                SurveyInfoResponseTextBox.AppendText("CommunicationException:\n");
                SurveyInfoResponseTextBox.AppendText(ce.ToString());
            }
            catch (TimeoutException te)
            {
                SurveyInfoResponseTextBox.AppendText("TimeoutException:\n");
                SurveyInfoResponseTextBox.AppendText(te.ToString());
            }
            catch (Exception ex)
            {
                SurveyInfoResponseTextBox.AppendText("Exception:\n");
                SurveyInfoResponseTextBox.AppendText(ex.ToString());
            }
        }
        private void DownloadSurveyInfoButton_Click(object sender, RoutedEventArgs e)
        {
            //if (ServiceVersion == "V1")
            //    {
            //    SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient();
            //    }

            //else if (ServiceVersion == "V2")
            //    {
            //    SurveyManagerServiceV2.ManagerServiceV2Client client = ServiceClient.GetClientV2();
            //    }
            Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest();

            if (!string.IsNullOrEmpty(this.SurveyCriteria_SurveyId.Text.Trim()))
            {
                Request.Criteria.SurveyIdList.Add(this.SurveyCriteria_SurveyId.Text);
            }

            if ((bool)this.SurveyCriteria_CurrentlyOpenCheckBox.IsChecked)
            {
                Request.Criteria.ClosingDate = DateTime.Now;
            }

            if (this.SurveyInfoCriteria_SurveyTypeListBox.SelectedIndex > -1)
            {
                Request.Criteria.SurveyType = int.Parse(((ListBoxItem)this.SurveyInfoCriteria_SurveyTypeListBox.Items[this.SurveyInfoCriteria_SurveyTypeListBox.SelectedIndex]).Tag.ToString());
            }

            if (!string.IsNullOrEmpty(this.OrgTextBox1.Text))
            {
                Request.Criteria.OrganizationKey = new Guid(OrgTextBox1.Text);
            }
            else
            {
            }
            if (!string.IsNullOrEmpty(this.TextBoxPublish.Text))
            {
                Request.Criteria.UserPublishKey = new Guid(this.TextBoxPublish.Text);
            }
            else
            {
            }
            SurveyInfoResponseTextBox.Document.Blocks.Clear();
            SearchResultListBox.Items.Clear();

            this.selectedIndex = -1;

            this.SurveyNameTextBox.Text             = "";
            this.DepartmentTextBox.Text             = "";
            this.SurveyNumberTextBox.Text           = "";
            this.OrganizationTextBox.Text           = "";
            this.datePicker1.SelectedDate           = DateTime.Now;
            this.IsSingleResponseCheckBox.IsChecked = false;
            this.IsTestMode.IsChecked = false;
            this.IntroductionTextBox.Document.Blocks.Clear();
            this.ExitTextTextBox.Document.Blocks.Clear();
            this.TemplateXMLTextBox.Document.Blocks.Clear();
            this.datePicker2.SelectedDate = DateTime.Now;
            try
            {
                int ServiceVersion = ServiceClient.GetServiceVersion();

                if (ServiceVersion == 1)
                {
                    SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient();
                    Epi.Web.Common.Message.SurveyInfoResponse Result = client.GetSurveyInfo(Request);
                    SurveyInfoList = Result.SurveyInfoList;
                    SearchResultListBox.Items.Clear();



                    SurveyInfoResponseTextBox.AppendText(string.Format("{0} - records. \n\n", Result.SurveyInfoList.Count));
                    foreach (Epi.Web.Common.DTO.SurveyInfoDTO SurveyInfo in SurveyInfoList)
                    {
                        //SurveyInfoResponseTextBox.AppendText(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate));
                        //System.Collections.Generic.KeyValuePair<string, string> kvp = new KeyValuePair<string, string>(SurveyInfo.SurveyId,string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate));

                        SearchResultListBox.Items.Add(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate));
                    }
                }

                else if (ServiceVersion == 2)
                {
                    SurveyManagerServiceV2.ManagerServiceV2Client client = ServiceClient.GetClientV2();
                    Epi.Web.Common.Message.SurveyInfoResponse     Result = client.GetSurveyInfo(Request);
                    SurveyInfoList = Result.SurveyInfoList;
                    SearchResultListBox.Items.Clear();



                    SurveyInfoResponseTextBox.AppendText(string.Format("{0} - records. \n\n", Result.SurveyInfoList.Count));
                    foreach (Epi.Web.Common.DTO.SurveyInfoDTO SurveyInfo in SurveyInfoList)
                    {
                        //SurveyInfoResponseTextBox.AppendText(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate));
                        //System.Collections.Generic.KeyValuePair<string, string> kvp = new KeyValuePair<string, string>(SurveyInfo.SurveyId,string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate));

                        SearchResultListBox.Items.Add(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate));
                    }
                }


                else if (ServiceVersion == 3)
                {
                    SurveyManagerServiceV3.ManagerServiceV3Client client = ServiceClient.GetClientV3();
                    Epi.Web.Common.Message.SurveyInfoResponse     Result = client.GetSurveyInfo(Request);
                    SurveyInfoList = Result.SurveyInfoList;
                    SearchResultListBox.Items.Clear();



                    SurveyInfoResponseTextBox.AppendText(string.Format("{0} - records. \n\n", Result.SurveyInfoList.Count));
                    foreach (Epi.Web.Common.DTO.SurveyInfoDTO SurveyInfo in SurveyInfoList)
                    {
                        //SurveyInfoResponseTextBox.AppendText(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate));
                        //System.Collections.Generic.KeyValuePair<string, string> kvp = new KeyValuePair<string, string>(SurveyInfo.SurveyId,string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate));

                        SearchResultListBox.Items.Add(string.Format("{0} - {1} - {2}\n", SurveyInfo.SurveyId, SurveyInfo.SurveyName, SurveyInfo.ClosingDate));
                    }
                }
            }
            catch (FaultException <CustomFaultException> cfe)
            {
                SurveyInfoResponseTextBox.AppendText("FaultException<CustomFaultException>:\n");
                SurveyInfoResponseTextBox.AppendText(cfe.ToString());
            }
            catch (FaultException fe)
            {
                SurveyInfoResponseTextBox.AppendText("FaultException:\n");
                SurveyInfoResponseTextBox.AppendText(fe.ToString());
            }
            catch (CommunicationException ce)
            {
                SurveyInfoResponseTextBox.AppendText("CommunicationException:\n");
                SurveyInfoResponseTextBox.AppendText(ce.ToString());
            }
            catch (TimeoutException te)
            {
                SurveyInfoResponseTextBox.AppendText("TimeoutException:\n");
                SurveyInfoResponseTextBox.AppendText(te.ToString());
            }
            catch (Exception ex)
            {
                SurveyInfoResponseTextBox.AppendText("Exception:\n");
                SurveyInfoResponseTextBox.AppendText(ex.ToString());
            }
        }
        private void UpdateSurveyButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.selectedIndex > -1)
            {
                SurveyInfoResponseTextBox.Document.Blocks.Clear();



                Epi.Web.Common.Message.SurveyInfoRequest Request = new Epi.Web.Common.Message.SurveyInfoRequest();
                Request.Action = "Update";
                if (this.datePicker1.SelectedDate == null)
                {
                    TimeSpan t = new TimeSpan(10, 0, 0, 0);
                    this.SurveyInfoList[this.selectedIndex].ClosingDate = DateTime.Now + t;
                }
                else
                {
                    this.SurveyInfoList[this.selectedIndex].ClosingDate = (DateTime)this.datePicker1.SelectedDate;
                }

                this.SurveyInfoList[this.selectedIndex].DepartmentName   = this.DepartmentTextBox.Text;
                this.SurveyInfoList[this.selectedIndex].IntroductionText = new TextRange(this.IntroductionTextBox.Document.ContentStart, this.IntroductionTextBox.Document.ContentEnd).Text;
                this.SurveyInfoList[this.selectedIndex].ExitText         = new TextRange(this.ExitTextTextBox.Document.ContentStart, this.ExitTextTextBox.Document.ContentEnd).Text;
                if ((bool)this.IsSingleResponseCheckBox.IsChecked)
                {
                    this.SurveyInfoList[this.selectedIndex].SurveyType = 1;
                }
                else
                {
                    this.SurveyInfoList[this.selectedIndex].SurveyType = 2;
                }

                this.SurveyInfoList[this.selectedIndex].OrganizationName = this.OrganizationTextBox.Text;
                this.SurveyInfoList[this.selectedIndex].SurveyName       = this.SurveyNameTextBox.Text;
                this.SurveyInfoList[this.selectedIndex].SurveyNumber     = this.SurveyNumberTextBox.Text;

                if (this.IsTestMode.IsChecked == true)
                {
                    this.SurveyInfoList[this.selectedIndex].IsDraftMode = true;
                }
                else
                {
                    this.SurveyInfoList[this.selectedIndex].IsDraftMode = false;
                }
                this.SurveyInfoList[this.selectedIndex].XML = new TextRange(this.TemplateXMLTextBox.Document.ContentStart, this.TemplateXMLTextBox.Document.ContentEnd).Text;
                if (!string.IsNullOrEmpty(this.OrgTextBox1.Text))
                {
                    this.SurveyInfoList[this.selectedIndex].OrganizationKey = new Guid(OrgTextBox1.Text);
                }
                else
                {
                }
                if (!string.IsNullOrEmpty(this.TextBoxPublish.Text))
                {
                    this.SurveyInfoList[this.selectedIndex].UserPublishKey = new Guid(this.TextBoxPublish.Text);
                }
                else
                {
                }
                Request.SurveyInfoList.Add(this.SurveyInfoList[this.selectedIndex]);

                try
                {
                    int ServiceVersion = ServiceClient.GetServiceVersion();

                    if (ServiceVersion == 1)
                    {
                        SurveyManagerService.ManagerServiceClient client = ServiceClient.GetClient();
                        Epi.Web.Common.Message.SurveyInfoResponse Result = client.SetSurveyInfo(Request);

                        SurveyInfoResponseTextBox.AppendText(Result.Message);
                    }

                    else if (ServiceVersion == 2)
                    {
                        SurveyManagerServiceV2.ManagerServiceV2Client client = ServiceClient.GetClientV2();
                        Epi.Web.Common.Message.SurveyInfoResponse     Result = client.SetSurveyInfo(Request);

                        SurveyInfoResponseTextBox.AppendText(Result.Message);
                    }

                    else if (ServiceVersion == 3)
                    {
                        SurveyManagerServiceV3.ManagerServiceV3Client client = ServiceClient.GetClientV3();
                        Epi.Web.Common.Message.SurveyInfoResponse     Result = client.SetSurveyInfo(Request);

                        SurveyInfoResponseTextBox.AppendText(Result.Message);
                    }
                }
                catch (FaultException <CustomFaultException> cfe)
                {
                    SurveyInfoResponseTextBox.AppendText("FaultException<CustomFaultException>:\n");
                    SurveyInfoResponseTextBox.AppendText(cfe.ToString());
                }
                catch (FaultException fe)
                {
                    SurveyInfoResponseTextBox.AppendText("FaultException:\n");
                    SurveyInfoResponseTextBox.AppendText(fe.ToString());
                }
                catch (CommunicationException ce)
                {
                    SurveyInfoResponseTextBox.AppendText("CommunicationException:\n");
                    SurveyInfoResponseTextBox.AppendText(ce.ToString());
                }
                catch (TimeoutException te)
                {
                    SurveyInfoResponseTextBox.AppendText("TimeoutException:\n");
                    SurveyInfoResponseTextBox.AppendText(te.ToString());
                }
                catch (Exception ex)
                {
                    SurveyInfoResponseTextBox.AppendText("Exception:\n");
                    SurveyInfoResponseTextBox.AppendText(ex.ToString());
                }
            }
        }