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); } }
// private void GetSurveyInfo (object sender, System.ComponentModel.DoWorkEventArgs e) public void SetSurveyInfo() { 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]; if (!string.IsNullOrWhiteSpace(this.CurrentView.WebSurveyId)) { Request.Criteria.OrganizationKey = new Guid(this.OrganizationKey); //new Guid(this.OrganizationKey); Request.Criteria.ReturnSizeInfoOnly = false; Request.Criteria.SurveyIdList.Add(this.CurrentView.WebSurveyId); Result = client.GetSurveyInfo(Request); } if (Result != null && Result.SurveyInfoList.Count > 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); } }
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); } }