コード例 #1
0
        public void Then_singlelineTextBox_Should_Display_on_Screen()
        {
            //SetUp

            Epi.Web.MVC.Facade.ISurveyFacade         iSurveyFacade;
            Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest;

            //Arrange

            surveyInfoRequest = new Epi.Web.Common.Message.SurveyInfoRequest();
            List <string> SurveyIdList = new List <string>();

            SurveyIdList.Add("1");
            surveyInfoRequest.Criteria.SurveyIdList = SurveyIdList;
            iSurveyFacade = new TestSurveyFacade(surveyInfoRequest);
            var surveyId    = "7696d742-e42d-45d1-8352-ec8c3f0db3c2";
            int CurrentPage = 1;



            //Act

            var form = iSurveyFacade.GetSurveyFormData(surveyId, CurrentPage, null);

            //Assert
            Assert.NotNull(form);
            Assert.Greater(form.Fields.Count, 0);
        }
コード例 #2
0
ファイル: Page_Download.xaml.cs プロジェクト: fgma75/epiinfo
        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());
            }
        }
コード例 #3
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());
            }
        }
コード例 #4
0
 /// <summary>
 /// Injectinting ISurveyInfoRepository through Constructor
 /// </summary>
 /// <param name="iSurveyInfoRepository"></param>
 public TestSurveyFacade(ISurveyInfoRepository iSurveyInfoRepository, ISurveyAnswerRepository iSurveyResponseRepository,
                         Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest, Epi.Web.Common.Message.SurveyAnswerRequest surveyResponseRequest,
                         Common.DTO.SurveyAnswerDTO surveyAnswerDTO,
                         SurveyResponseXML surveyResponseXML)
 {
     _iSurveyInfoRepository     = iSurveyInfoRepository;
     _iSurveyResponseRepository = iSurveyResponseRepository;
     _surveyInfoRequest         = surveyInfoRequest;
     _surveyAnswerRequest       = surveyResponseRequest;
     _surveyAnswerDTO           = surveyAnswerDTO;
     _surveyResponseXML         = surveyResponseXML;
 }
コード例 #5
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());
            }
        }
コード例 #6
0
        public void Then_Show_Finalized_Page()
        {
            //Setup
            Epi.Web.MVC.Facade.ISurveyFacade         iSurveyFacade;
            Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest;
            //Arrange
            SurveyInfoModel surveyInfoModel = new TestSurveyFacade().GetSurveyInfoModel("");

            surveyInfoRequest = new Epi.Web.Common.Message.SurveyInfoRequest();
            surveyInfoRequest.Criteria.SurveyIdList = "1";
            iSurveyFacade = new TestSurveyFacade(surveyInfoRequest);
            var        controller = new Epi.Web.MVC.Controllers.FinalController(iSurveyFacade);
            ViewResult c          = controller.Index("1", "final") as ViewResult;

            //Assert
            Assert.AreEqual("PostSubmit", c.ViewName);                                 /*Is it returning the right view name?*/
            Assert.AreEqual("Epi.Web.MVC.Models.SurveyInfoModel", c.Model.ToString()); /*Is it returning the right view to the final view?*/
        }
コード例 #7
0
        public void Then_See_First_Data_Entry_Page()
        {
            //SetUp

            Epi.Web.MVC.Facade.ISurveyFacade         iSurveyFacade;
            Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest;

            //Arrange
            surveyInfoRequest = new Epi.Web.Common.Message.SurveyInfoRequest();
            surveyInfoRequest.Criteria.SurveyIdList = "1";
            iSurveyFacade = new TestSurveyFacade(surveyInfoRequest);
            var        controller = new Epi.Web.MVC.Controllers.HomeController(iSurveyFacade);
            ViewResult c          = controller.Index("1") as ViewResult;

            //MvcDynamicForms.Form F = c.Model as MvcDynamicForms.Form;

            //Assert
            Assert.AreEqual("Index", c.ViewName); /*Is it returning the right view name?*/
            //Assert.AreEqual("MvcDynamicField_", F.FieldPrefix);  /*Is it rendering form prefix*/
        }
コード例 #8
0
        public void Then_Open_The_Survey()
        {
            //SetUp

            Epi.Web.MVC.Facade.ISurveyFacade         iSurveyFacade;
            Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest;

            //Arrange
            surveyInfoRequest = new Epi.Web.Common.Message.SurveyInfoRequest();
            surveyInfoRequest.Criteria.SurveyIdList = "1";
            iSurveyFacade = new TestSurveyFacade(surveyInfoRequest);
            var        controller = new Epi.Web.MVC.Controllers.SurveyController(iSurveyFacade);
            ViewResult c          = controller.Notify("1", "page") as ViewResult;

            //MvcDynamicForms.Form f = c.Model as MvcDynamicForms.Form;
            MvcDynamicForms.Form f = iSurveyFacade.GetSurveyFormData("1", 1, null);
            //Assert.AreEqual(typeof(MvcDynamicForms.Form), c.Model);//test to make sure it is returning field prefix
            //Does it render all the controls?
            //Assert
            Assert.AreEqual(7, f.Fields.Count);                                                  //test to make sure it is returning correct number of items
            // Does it render the text box?
            Assert.AreEqual("MvcDynamicForms.Fields.TextBox", f.Fields[0].GetType().ToString()); //end item in the forms collection is a textbox
        }
コード例 #9
0
        public void Then_Submit_Survey()
        {
            //SetUp

            Epi.Web.MVC.Facade.ISurveyFacade         iSurveyFacade;
            Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest;

            //Arrange
            SurveyInfoModel surveyInfoModel = new TestSurveyFacade().GetSurveyInfoModel("");

            surveyInfoRequest = new Epi.Web.Common.Message.SurveyInfoRequest();
            surveyInfoRequest.Criteria.SurveyIdList = "1";
            iSurveyFacade = new TestSurveyFacade(surveyInfoRequest);
            var        controller = new Epi.Web.MVC.Controllers.SurveyController(iSurveyFacade);
            ViewResult c          = controller.Index(surveyInfoModel, "Submit") as ViewResult;

            //Assert

            /*
             * It goes to the, surveyController's Index method of type post. As simulating form with posted value
             * requires more work, at this point we can safely assume that the survey submits the data.
             */
        }
コード例 #10
0
 public TestSurveyFacade(Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest)
 {
     _surveyInfoRequest = surveyInfoRequest;
 }
コード例 #11
0
ファイル: Reference.cs プロジェクト: cdc-jtmiller/Epi-Info-R
 public Epi.Web.Common.Message.SurveyInfoResponse GetSurveyInfo(Epi.Web.Common.Message.SurveyInfoRequest pRequest)
 {
     return(base.Channel.GetSurveyInfo(pRequest));
 }
コード例 #12
0
        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());
                }
            }
        }
コード例 #13
0
ファイル: PublishMode.cs プロジェクト: NALSS/epiinfo-82474
        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());
            }
        }
コード例 #14
0
ファイル: PublishMode.cs プロジェクト: NALSS/epiinfo-82474
        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());
            }
        }
コード例 #15
0
        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());
            }
        }
コード例 #16
0
 public System.Threading.Tasks.Task <Epi.Web.Common.Message.SurveyInfoResponse> GetFormChildInfoAsync(Epi.Web.Common.Message.SurveyInfoRequest SurveyInfoRequest)
 {
     return(base.Channel.GetFormChildInfoAsync(SurveyInfoRequest));
 }
コード例 #17
0
 public bool IsValidOrgKey(Epi.Web.Common.Message.SurveyInfoRequest pRequest)
 {
     return(base.Channel.IsValidOrgKey(pRequest));
 }
コード例 #18
0
ファイル: DownLoad.xaml.cs プロジェクト: fgma75/epiinfo
        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());
            }
        }
コード例 #19
0
ファイル: Reference.cs プロジェクト: fgma75/epiinfo
 public System.Threading.Tasks.Task <Epi.Web.Common.Message.SurveyInfoResponse> SetSurveyInfoAsync(Epi.Web.Common.Message.SurveyInfoRequest pRequest)
 {
     return(base.Channel.SetSurveyInfoAsync(pRequest));
 }
コード例 #20
0
ファイル: Reference.cs プロジェクト: fgma75/epiinfo
 public System.Threading.Tasks.Task <bool> IsValidOrgKeyAsync(Epi.Web.Common.Message.SurveyInfoRequest pRequest)
 {
     return(base.Channel.IsValidOrgKeyAsync(pRequest));
 }