Exemplo n.º 1
0
        private void QueryForExistingSurveyInfo()
        {
            SurveyManagerService.ManagerServiceClient client  = Epi.Core.ServiceClient.ServiceClient.GetClient();
            SurveyManagerService.SurveyInfoRequest    Request = new SurveyManagerService.SurveyInfoRequest();
            Request.Criteria.SurveyIdList    = new string[] { this.view.WebSurveyId };
            Request.Criteria.OrganizationKey = new Guid(this.OrganizationKey);
            SurveyManagerService.SurveyInfoResponse response = client.GetSurveyInfo(Request);

            if (response.SurveyInfoList.Length > 0)
            {
                this.currentSurveyInfoDTO = response.SurveyInfoList[0];
            }
        }
Exemplo n.º 2
0
        private void UpdateSurveyInfoworker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            try
            {
                SurveyManagerService.ManagerServiceClient client;
                Configuration config = Configuration.GetNewInstance();
                client = Epi.Core.ServiceClient.ServiceClient.GetClient();
                SurveyManagerService.SurveyInfoRequest  Request = (SurveyManagerService.SurveyInfoRequest)((object[])e.Argument)[0];
                SurveyManagerService.SurveyInfoResponse Result  = (SurveyManagerService.SurveyInfoResponse)((object[])e.Argument)[1];

                Request.Criteria.ClosingDate     = this.CloseDate;
                Request.Criteria.OrganizationKey = new Guid(this.OrganizationKey);
                Request.Criteria.UserPublishKey  = new Guid(this.UserPublishKey);
                Request.Criteria.SurveyIdList    = new string[] { this.SurveyId };
                Request.Action = "Update";

                SurveyManagerService.SurveyInfoDTO SurveyInfoDTO = new SurveyManagerService.SurveyInfoDTO();

                SurveyInfoDTO.ClosingDate  = this.CloseDate;
                SurveyInfoDTO.StartDate    = this.StartDate;
                SurveyInfoDTO.SurveyId     = new Guid(this.SurveyId).ToString();
                SurveyInfoDTO.SurveyType   = this.SurveyType;
                SurveyInfoDTO.SurveyNumber = this.SurveyNumber;
                SurveyInfoDTO.SurveyName   = this.SurveyName;
                //  SurveyInfoDTO.OrganizationKey = new Guid(this.OrganizationKey);
                SurveyInfoDTO.OrganizationKey  = new Guid(this.OrgKeytextBox.Text.ToString());
                SurveyInfoDTO.UserPublishKey   = new Guid(this.SecurityKeytextBox.Text.ToString());
                SurveyInfoDTO.OrganizationName = this.OrganizationName;
                SurveyInfoDTO.XML              = this.TemplateXML;
                SurveyInfoDTO.ExitText         = this.ExitText;
                SurveyInfoDTO.IntroductionText = this.IntroductionText;
                SurveyInfoDTO.DepartmentName   = this.DepartmentName;

                Request.Criteria.SurveyType = this.SurveyType;

                if (this.DraftRadioButton.Checked)
                {
                    Request.Criteria.IsDraftMode = true;
                    SurveyInfoDTO.IsDraftMode    = true;
                }
                else
                {
                    Request.Criteria.IsDraftMode = false;
                    SurveyInfoDTO.IsDraftMode    = false;
                }
                Request.SurveyInfoList = new SurveyManagerService.SurveyInfoDTO[] { SurveyInfoDTO };

                Result = client.SetSurveyInfo(Request);
            }
            catch (FaultException <CustomFaultException> cfe)
            {
                // this.BeginInvoke(new FinishWithCustomFaultExceptionDelegate(FinishWithCustomFaultException), cfe);
            }
            catch (FaultException fe)
            {
                //this.BeginInvoke(new FinishWithFaultExceptionDelegate(FinishWithFaultException), fe);
            }
            catch (SecurityNegotiationException sne)
            {
                //this.BeginInvoke(new FinishWithSecurityNegotiationExceptionDelegate(FinishWithSecurityNegotiationException), sne);
            }
            catch (CommunicationException ce)
            {
                //this.BeginInvoke(new FinishWithCommunicationExceptionDelegate(FinishWithCommunicationException), ce);
            }
            catch (TimeoutException te)
            {
                // this.BeginInvoke(new FinishWithTimeoutExceptionDelegate(FinishWithTimeoutException), te);
            }
            catch (Exception ex)
            {
                //this.BeginInvoke(new FinishWithExceptionDelegate(FinishWithException), ex);
            }
        }
Exemplo n.º 3
0
        private void UpdateSurveyMode(bool IsDraftMode)
        {
            try
            {
            SurveyManagerService.ManagerServiceV3Client client = Epi.Core.ServiceClient.ServiceClient.GetClient();
                Configuration config = Configuration.GetNewInstance();

                SurveyManagerService.SurveyInfoRequest Request = new SurveyManagerService.SurveyInfoRequest();//(Epi.Web.Common.Message.SurveyInfoRequest)((object[])e.Argument)[0];
                SurveyManagerService.SurveyInfoResponse Result = new SurveyManagerService.SurveyInfoResponse();//(Epi.Web.Common.Message.SurveyInfoResponse)((object[])e.Argument)[1];
                Request.Criteria = new SurveyManagerService.SurveyInfoCriteria();
                Request.Criteria.ClosingDate = this.CloseDate;
                Request.Criteria.OrganizationKey = new Guid(this.OrganizationKey);
                Request.Criteria.UserPublishKey = new Guid(this.UserPublishKey);
                Request.Criteria.SurveyIdList = new string[]{this.SurveyId};

                SurveyManagerService.SurveyInfoDTO SurveyInfoDTO = new SurveyManagerService.SurveyInfoDTO();

                SurveyInfoDTO.ClosingDate = this.CloseDate;
                SurveyInfoDTO.StartDate = this.StartDate;
                SurveyInfoDTO.SurveyId = new Guid(this.CurrentView.WebSurveyId).ToString();
                SurveyInfoDTO.SurveyType = this.SurveyType;
                SurveyInfoDTO.SurveyNumber = this.SurveyNumber;
                SurveyInfoDTO.SurveyName = this.SurveyName;
                SurveyInfoDTO.OrganizationKey = new Guid(OrganizationKey);
                SurveyInfoDTO.UserPublishKey = new Guid(this.UserPublishKey);
                SurveyInfoDTO.OrganizationName = this.OrganizationName;
                SurveyInfoDTO.XML = this.TemplateXML;
                SurveyInfoDTO.ExitText = this.ExitText;
                SurveyInfoDTO.IntroductionText = this.IntroductionText;
                SurveyInfoDTO.DepartmentName = this.DepartmentName;

                Request.Criteria.SurveyType = this.SurveyType;

                if (IsDraftMode)
                {
                    Request.Action = "Update";
                    Request.Criteria.IsDraftMode = true;
                    SurveyInfoDTO.IsDraftMode = true;
                }
                else
                {
                    Request.Action = "UpdateMode";
                    Request.Criteria.IsDraftMode = false;
                    SurveyInfoDTO.IsDraftMode = false;
                }

                Request.SurveyInfoList = new SurveyManagerService.SurveyInfoDTO[]{SurveyInfoDTO};
                Result = client.SetSurveyInfo(Request);

                if (Result != null && Result.SurveyInfoList.Length > 0)
                {
                //this.UpdateStatus("Survey mode was successfully updated!");
                if (IsDraftMode)
                    {
                    MessageBox.Show("Survey mode was successfully changed to DRAFT.", "", MessageBoxButtons.OK);
                    }
                else
                    {
                    MessageBox.Show("Survey mode was successfully changed to FINAL.", "", MessageBoxButtons.OK);
                    }
                }
            }
            catch
            {
                //this.BeginInvoke(new FinishWithExceptionDelegate(FinishWithException), ex);

            }
        }
Exemplo n.º 4
0
        private void QuickSurveyInfoUpdate()
        {
            try
            {
                Template template = new Template(this.mediator);
                SurveyManagerService.ManagerServiceV3Client client = Epi.Core.ServiceClient.ServiceClient.GetClient();
                Configuration config = Configuration.GetNewInstance();

                SurveyManagerService.SurveyInfoRequest Request = new SurveyManagerService.SurveyInfoRequest();//(Epi.Web.Common.Message.SurveyInfoRequest)((object[])e.Argument)[0];
                SurveyManagerService.SurveyInfoResponse Result = new SurveyManagerService.SurveyInfoResponse();//(Epi.Web.Common.Message.SurveyInfoResponse)((object[])e.Argument)[1];

                Request.Criteria = new SurveyManagerService.SurveyInfoCriteria();
                Request.Criteria.ClosingDate = this.CloseDate;
                Request.Criteria.OrganizationKey = new Guid(this.OrganizationKey);
                Request.Criteria.UserPublishKey = new Guid(this.UserPublishKey);
                Request.Criteria.SurveyIdList = new string[]{this.SurveyId};
                Request.Action = "Update";

                SurveyManagerService.SurveyInfoDTO SurveyInfoDTO = new SurveyManagerService.SurveyInfoDTO();

                SurveyInfoDTO.ClosingDate = this.CloseDate;
                SurveyInfoDTO.StartDate = this.StartDate;
                SurveyInfoDTO.SurveyId = new Guid(this.CurrentView.WebSurveyId).ToString();
                SurveyInfoDTO.SurveyType = this.SurveyType;
                SurveyInfoDTO.SurveyNumber = this.SurveyNumber;
                SurveyInfoDTO.SurveyName = this.SurveyName;
                SurveyInfoDTO.OrganizationKey = new Guid(OrganizationKey);
                SurveyInfoDTO.OrganizationName = this.OrganizationName;
                SurveyInfoDTO.UserPublishKey = new Guid(this.UserPublishKey);
                SurveyInfoDTO.XML = template.CreateWebSurveyTemplate();
                SurveyInfoDTO.ExitText = this.ExitText;
                SurveyInfoDTO.IntroductionText = this.IntroductionText;
                SurveyInfoDTO.DepartmentName = this.DepartmentName;
                  if (this.mediator.Project.CollectedData.GetDbDriver().ConnectionDescription.ToString().Contains("Microsoft SQL Server:"))
                        {
                        SurveyInfoDTO.IsSqlProject  = true;
                        }

                Request.Criteria.SurveyType = this.SurveyType;
                Request.Criteria.IsDraftMode = true;
                SurveyInfoDTO.IsDraftMode = this.IsDraftMode;
                Request.SurveyInfoList = new SurveyManagerService.SurveyInfoDTO[] { SurveyInfoDTO };

                Result = client.SetSurveyInfo(Request);

                if (Result != null && Result.SurveyInfoList.Length > 0)
                {
                    //this.UpdateStatus("Survey was successfully updated!");

                MessageBox.Show("Survey was successfully updated.","",MessageBoxButtons.OK);
                }
            }
            catch (FaultException<CustomFaultException> cfe)
            {
                // this.BeginInvoke(new FinishWithCustomFaultExceptionDelegate(FinishWithCustomFaultException), cfe);

            }
            catch (FaultException fe)
            {
                //this.BeginInvoke(new FinishWithFaultExceptionDelegate(FinishWithFaultException), fe);

            }
            catch (SecurityNegotiationException sne)
            {
                //this.BeginInvoke(new FinishWithSecurityNegotiationExceptionDelegate(FinishWithSecurityNegotiationException), sne);

            }
            catch (CommunicationException ce)
            {
                //this.BeginInvoke(new FinishWithCommunicationExceptionDelegate(FinishWithCommunicationException), ce);

            }
            catch (TimeoutException te)
            {
                // this.BeginInvoke(new FinishWithTimeoutExceptionDelegate(FinishWithTimeoutException), te);

            }
            catch (Exception ex)
            {
                //this.BeginInvoke(new FinishWithExceptionDelegate(FinishWithException), ex);

            }
        }
Exemplo n.º 5
0
        //  private void GetSurveyInfo (object sender, System.ComponentModel.DoWorkEventArgs e)
        public void SetSurveyInfo()
        {
            try
            {
               SurveyManagerService.ManagerServiceV3Client client = Epi.Core.ServiceClient.ServiceClient.GetClient();
                Configuration config = Configuration.GetNewInstance();

                SurveyManagerService.SurveyInfoRequest Request = new SurveyManagerService.SurveyInfoRequest();//(Epi.Web.Common.Message.SurveyInfoRequest)((object[])e.Argument)[0];
                SurveyManagerService.SurveyInfoResponse Result = new SurveyManagerService.SurveyInfoResponse();//(Epi.Web.Common.Message.SurveyInfoResponse)((object[])e.Argument)[1];

                if (!string.IsNullOrWhiteSpace(this.CurrentView.WebSurveyId))
                {
                    Request.Criteria = new SurveyManagerService.SurveyInfoCriteria();
                    Request.Criteria.OrganizationKey =  new Guid(this.OrganizationKey); //new Guid(this.OrganizationKey);
                    Request.Criteria.ReturnSizeInfoOnly = false;
                    Request.Criteria.SurveyIdList = new string[]{this.CurrentView.WebSurveyId};
                    Request.Criteria.SurveyType = -1;

                    Result = client.GetSurveyInfo(Request);

                }

                if (Result != null && Result.SurveyInfoList.Length > 0)
                {

                    SurveyName = Result.SurveyInfoList[0].SurveyName;
                    DepartmentName = Result.SurveyInfoList[0].DepartmentName;
                    SurveyNumber = Result.SurveyInfoList[0].SurveyNumber;
                    OrganizationName = Result.SurveyInfoList[0].OrganizationName;
                    StartDate = Result.SurveyInfoList[0].StartDate;
                    CloseDate = Result.SurveyInfoList[0].ClosingDate;
                    IsDraftMode = Result.SurveyInfoList[0].IsDraftMode;
                    IntroductionText = Result.SurveyInfoList[0].IntroductionText;
                    ExitText = Result.SurveyInfoList[0].ExitText;
                    TemplateXML = Result.SurveyInfoList[0].XML;
                    //this.OrganizationKey = Result.SurveyInfoList[0].OrganizationKey.ToString();
                    SurveyType = Result.SurveyInfoList[0].SurveyType;
                    this.UserPublishKey = Result.SurveyInfoList[0].UserPublishKey.ToString();
                    //SurveyId = Result.SurveyInfoList[0].SurveyId;
                    //ChangeModetoolStripDropDownButton
                    SetModetoolStripDropDown(IsDraftMode);
                }

            }
            catch (FaultException<CustomFaultException> cfe)
            {
                // this.BeginInvoke(new FinishWithCustomFaultExceptionDelegate(FinishWithCustomFaultException), cfe);

            }
            catch (FaultException fe)
            {
                //this.BeginInvoke(new FinishWithFaultExceptionDelegate(FinishWithFaultException), fe);

            }
            catch (SecurityNegotiationException sne)
            {
                //this.BeginInvoke(new FinishWithSecurityNegotiationExceptionDelegate(FinishWithSecurityNegotiationException), sne);

            }
            catch (CommunicationException ce)
            {
                //this.BeginInvoke(new FinishWithCommunicationExceptionDelegate(FinishWithCommunicationException), ce);

            }
            catch (TimeoutException te)
            {
                // this.BeginInvoke(new FinishWithTimeoutExceptionDelegate(FinishWithTimeoutException), te);

            }
            catch (Exception ex)
            {
                //this.BeginInvoke(new FinishWithExceptionDelegate(FinishWithException), ex);

            }
        }