示例#1
0
        private void UpdateSurveyMode(bool IsDraftMode)
        {
            try
            {
                SurveyManagerService.ManagerServiceClient client = Epi.Windows.MakeView.Utils.ServiceClient.GetClient();
                Configuration config = Configuration.GetNewInstance();

                Epi.Web.Common.Message.SurveyInfoRequest Request = new Web.Common.Message.SurveyInfoRequest();//(Epi.Web.Common.Message.SurveyInfoRequest)((object[])e.Argument)[0];
                Epi.Web.Common.Message.SurveyInfoResponse Result = new Web.Common.Message.SurveyInfoResponse();//(Epi.Web.Common.Message.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.Add(this.SurveyId);

                Epi.Web.Common.DTO.SurveyInfoDTO SurveyInfoDTO = new Web.Common.DTO.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.Add(SurveyInfoDTO);

                Result = client.SetSurveyInfo(Request);
                if (Result != null && Result.SurveyInfoList.Count > 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 (Exception ex)
            {
                //this.BeginInvoke(new FinishWithExceptionDelegate(FinishWithException), ex);

            }
        }
示例#2
0
        private void UpdateSurveyInfoworker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            try
            {
                SurveyManagerService.ManagerServiceClient client;
                Configuration config = Configuration.GetNewInstance();
                client = GetClient();
                Epi.Web.Common.Message.SurveyInfoRequest Request = (Epi.Web.Common.Message.SurveyInfoRequest)((object[])e.Argument)[0];
                Epi.Web.Common.Message.SurveyInfoResponse Result = (Epi.Web.Common.Message.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.Add(this.SurveyId);
                Request.Action = "Update";

                Epi.Web.Common.DTO.SurveyInfoDTO SurveyInfoDTO = new Web.Common.DTO.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.Add(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);

            }
        }
示例#3
0
        private void QuickSurveyInfoUpdate()
        {
            try
            {
                Template template = new Template(this.mediator);
                SurveyManagerService.ManagerServiceClient client = Epi.Windows.MakeView.Utils.ServiceClient.GetClient();
                Configuration config = Configuration.GetNewInstance();

                Epi.Web.Common.Message.SurveyInfoRequest Request = new Web.Common.Message.SurveyInfoRequest();//(Epi.Web.Common.Message.SurveyInfoRequest)((object[])e.Argument)[0];
                Epi.Web.Common.Message.SurveyInfoResponse Result = new Web.Common.Message.SurveyInfoResponse();//(Epi.Web.Common.Message.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.Add(this.SurveyId);
                Request.Action = "Update";

                Epi.Web.Common.DTO.SurveyInfoDTO SurveyInfoDTO = new Web.Common.DTO.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;

                Request.Criteria.SurveyType = this.SurveyType;
                Request.Criteria.IsDraftMode = true;
                SurveyInfoDTO.IsDraftMode = this.IsDraftMode;
                Request.SurveyInfoList.Add(SurveyInfoDTO);
                Result = client.SetSurveyInfo(Request);
                if (Result != null && Result.SurveyInfoList.Count > 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);

            }
        }