static public IsValidOrganizationKeyEnum IsValidOrgKey(string pOrganizationKey, string pSurveyId = null) { try { EWEManagerService.EWEManagerServiceV2Client client = EWEServiceClient.GetClient(); Configuration config = Configuration.GetNewInstance(); var Request = new EWEManagerService.SurveyInfoRequest(); EWEManagerService.SurveyInfoCriteria Criteria = new EWEManagerService.SurveyInfoCriteria(); if (!string.IsNullOrEmpty(pOrganizationKey)) { Criteria.OrganizationKey = new Guid(pOrganizationKey); Request.Criteria = Criteria; } if (!string.IsNullOrWhiteSpace(pSurveyId)) { Criteria.SurveyIdList = new string[1]; Criteria.SurveyIdList[0] = pSurveyId.ToString(); Request.Criteria = Criteria; } if (client.IsValidOrgKey(Request)) { return(IsValidOrganizationKeyEnum.Yes); } else { return(IsValidOrganizationKeyEnum.No); } } catch (System.ServiceModel.EndpointNotFoundException) { return(IsValidOrganizationKeyEnum.EndPointNotFound); } catch { return(IsValidOrganizationKeyEnum.GeneralException); } }
//private void txtSurveyName_TextChanged(object sender, EventArgs e) //{ // txtSurveyNameMirror.Text = txtSurveyName.Text; //} //private void txtSurveyID_TextChanged(object sender, EventArgs e) //{ // txtSurveyIDMirror.Text = txtSurveyID.Text; //} //private void txtOrganization_TextChanged(object sender, EventArgs e) //{ // txtOrganizationMirror.Text = txtOrganization.Text; //} //private void txtDepartment_TextChanged(object sender, EventArgs e) //{ // this.txtDepartmentMirror.Text = txtDepartment.Text; //} private void WebPublishDialog_Load(object sender, EventArgs e) { // string WebSurveyId = this.mediater.Project.views[this.mediater.Project.Name].EWEFormId; DataTable table = mediater.Project.Metadata.GetPublishedViewKeys(this.mediater.ProjectExplorer.CurrentView.Id); DataRow ViewRow = table.Rows[0]; string WebSurveyId = ViewRow.ItemArray[3].ToString(); try { if (!string.IsNullOrEmpty(this.OrganizationKey)) { this.txtOrganizationKey.Text = this.OrganizationKey; } // if (!this.isRepublishableConfig || string.IsNullOrWhiteSpace(this.view.WebSurveyId)) if (!this.isRepublishableConfig || string.IsNullOrWhiteSpace(WebSurveyId)) { TimeSpan t = new TimeSpan(10, 23, 59, 59); //dtpSurveyClosingDate.Value = DateTime.Now.Date + t; //this.txtSurveyName.SelectAll(); //txtSurveyName.Text = SharedStrings.WEBFORM_TITLE; //txtSurveyName.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtSurveyNameMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtSurveyID.Text = SharedStrings.WEBFORM_SURVEYID; //txtSurveyID.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtSurveyIDMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtSurveyIDMirror.Text = SharedStrings.WEBFORM_SURVEYID; //txtOrganization.Text = SharedStrings.WEBFORM_ORGANIZATION; //txtOrganization.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtOrganizationMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtOrganizationMirror.Text = SharedStrings.WEBFORM_ORGANIZATION; //txtDepartment.Text = SharedStrings.WEBFORM_DEPARTMENT; //txtDepartment.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtDepartmentMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtDepartmentMirror.Text = SharedStrings.WEBFORM_DEPARTMENT; //txtIntroductionText.Text = SharedStrings.WEBFORM_INTRODUCTIONTEXT; //txtIntroductionText.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtExitText.Text = SharedStrings.WEBFORM_EXITTEXT; //txtExitText.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; if (!this.isRepublishableConfig) { //this.lblSurveyStartDate.Visible = false; //this.StartDateDatePicker.Visible = false; //this.StartTimecomboBox.Visible = false; //this.StartTimelabel.Visible = false; this.OrganizationKeyLinkLabel.Visible = false; this.OrganizationKeyValueLabel.Visible = false; this.WebSurveyOptionsLinkLabel.Visible = false; this.DividerLabel.Visible = false; this.btnPublishForm.Enabled = true; lblPublishModeStatus.Visible = false; label1.Visible = false; //lblClosingDate.Left = 18; //dtpSurveyClosingDate.Left = 18; // this.ClosingTimecomboBox.Left = 240; // this.closingTimelabel.Left = 240; //ClosingTimecomboBox.SelectedIndex = 0; //ClosingTimecomboBox.Visible = false; //closingTimelabel.Visible = false; } else { // this.txtDepartment.Visible = false; // this.lblDepartment.Visible = false; // this.txtOrganization.Left = 381; // this.txtOrganization.Size = new System.Drawing.Size(453, 23); // this.lblOrganization.Left = 300; // this.lblDepMirr.Visible = false; // this.txtDepartmentMirror.Visible = false; // this.txtOrganizationMirror.Left = 381; // this.txtOrganizationMirror.Size = new System.Drawing.Size(453, 23); // this.lblOrgMirr.Left = 300; //ClosingTimecomboBox.SelectedIndex = 0; //StartTimecomboBox.SelectedIndex = 0; } } else { EWEManagerService.EWEManagerServiceV2Client client = Epi.Core.ServiceClient.EWEServiceClient.GetClient(); //this.txtDepartment.Visible = false; //this.lblDepartment.Visible = false; //this.txtOrganization.Left = 381; //this.txtOrganization.Size = new System.Drawing.Size(453,23); //this.lblOrganization.Left = 300; //this.lblDepMirr.Visible = false; //this.txtDepartmentMirror.Visible = false; //this.txtOrganizationMirror.Left = 381; //this.txtOrganizationMirror.Size = new System.Drawing.Size(453, 23); //this.lblOrgMirr.Left = 300; //ClosingTimecomboBox.SelectedIndex = 0; //StartTimecomboBox.SelectedIndex = 0; // Epi.Windows.Dialogs.InputDialog inputDialog = new Windows.Dialogs.InputDialog("Enter organization key", "Organization Key", "", null, EpiInfo.Plugin.DataType.Text); //DialogResult result = inputDialog.ShowDialog(); // if (result == System.Windows.Forms.DialogResult.OK) //{ // this.OrganizationKey = inputDialog.OrganizationKey; this.txtOrganizationKey.Text = this.OrganizationKey; // Epi.Web.Enter.Common.Message.SurveyInfoRequest Request = new Epi.Web.Enter.Common.Message.SurveyInfoRequest(); EWEManagerService.SurveyInfoRequest Request = new EWEManagerService.SurveyInfoRequest(); EWEManagerService.SurveyInfoCriteria Criteria = new EWEManagerService.SurveyInfoCriteria(); List<string> IdList = new List<string>(); IdList.Add(WebSurveyId); Criteria.SurveyIdList = IdList.ToArray(); Criteria.OrganizationKey = new Guid(this.OrganizationKey); Criteria.SurveyType = -1; Request.Criteria = Criteria; // Epi.Web.Enter.Common.Message.SurveyInfoResponse response = client.GetSurveyInfo(Request); var response = client.GetSurveyInfo(Request); if (response.SurveyInfoList.Count() > 0) { currentSurveyInfoDTO = response.SurveyInfoList[0]; if (currentSurveyInfoDTO.IsDraftMode) { this.lblPublishModeStatus.Text = "Staging"; } else { this.lblPublishModeStatus.Text = "Production"; } //dtpSurveyClosingDate.Value = currentSurveyInfoDTO.ClosingDate; //StartDateDatePicker.Value = currentSurveyInfoDTO.StartDate; DateTime CloseTime = Convert.ToDateTime(currentSurveyInfoDTO.ClosingDate); DateTime StartTime = Convert.ToDateTime(currentSurveyInfoDTO.StartDate); //ClosingTimecomboBox.SelectedItem = this.GetComboBoxTimeFormat(CloseTime.Hour + ":" + CloseTime.Minute); //StartTimecomboBox.SelectedItem = this.GetComboBoxTimeFormat(StartTime.Hour + ":" + StartTime.Minute); //txtSurveyName.Text = currentSurveyInfoDTO.SurveyName; ////txtSurveyName.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; ////txtSurveyNameMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtSurveyID.Text = currentSurveyInfoDTO.SurveyNumber; ////txtSurveyID.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; ////txtSurveyIDMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtSurveyIDMirror.Text = currentSurveyInfoDTO.SurveyNumber; //txtOrganization.Text = currentSurveyInfoDTO.OrganizationName; ////txtOrganization.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; ////txtOrganizationMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtOrganizationMirror.Text = currentSurveyInfoDTO.OrganizationName; //txtDepartment.Text = currentSurveyInfoDTO.DepartmentName; ////txtDepartment.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; ////txtDepartmentMirror.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtDepartmentMirror.Text = currentSurveyInfoDTO.DepartmentName; //txtIntroductionText.Text = currentSurveyInfoDTO.IntroductionText; ////txtIntroductionText.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; //txtExitText.Text = currentSurveyInfoDTO.ExitText; ////txtExitText.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; btnPublishForm.Enabled = true; } //} } } catch (Exception ex) { throw ex; } }
private void UpdateFormMode(bool IsDraftMode) { try { Template template = new Template(this.mediator); var client = Epi.Core.ServiceClient.EWEServiceClient.GetClient(); DataTable table; View RootView = this.mediator.Project.Metadata.GetParentView(this.mediator.ProjectExplorer.CurrentView.Id); if (RootView == null) { table = this.mediator.Project.Metadata.GetPublishedViewKeys(this.mediator.ProjectExplorer.CurrentView.Id); } else { table = this.mediator.Project.Metadata.GetPublishedViewKeys(RootView.Id); } DataRow ViewRow = table.Rows[0]; string WebSurveyId = ViewRow.ItemArray[3].ToString(); string OrganizationKey = ViewRow.ItemArray[2].ToString(); Configuration config = Configuration.GetNewInstance(); Epi.EWEManagerService.SurveyInfoRequest Request = new Epi.EWEManagerService.SurveyInfoRequest(); Epi.EWEManagerService.SurveyInfoResponse Result = new Epi.EWEManagerService.SurveyInfoResponse(); Epi.EWEManagerService.SurveyInfoCriteria Criteria = new EWEManagerService.SurveyInfoCriteria(); // Request.Criteria.ClosingDate = this.CloseDate; Criteria.OrganizationKey = new Guid(OrganizationKey); //Criteria.UserPublishKey = new Guid(this.UserPublishKey); List<string> List = new List<string>(); List.Add(WebSurveyId); Criteria.SurveyIdList = List.ToArray(); Request.Criteria = Criteria; Epi.EWEManagerService.SurveyInfoDTO SurveyInfoDTO = new Epi.EWEManagerService.SurveyInfoDTO(); SurveyInfoDTO.StartDate = DateTime.Now; SurveyInfoDTO.SurveyId = new Guid(WebSurveyId).ToString(); SurveyInfoDTO.SurveyType = 2; SurveyInfoDTO.SurveyName = mediator.Project.Name; SurveyInfoDTO.OrganizationKey = new Guid(OrganizationKey); if (this.mediator.Project.CollectedData.GetDbDriver().ConnectionDescription.ToString().Contains("Microsoft SQL Server:")) { SurveyInfoDTO.IsSqlProject= true; }// Update IsSqlProject to true on change survey mode for Sql project. //SurveyInfoDTO.UserPublishKey = new Guid(this.UserPublishKey); SurveyInfoDTO.XML = template.CreateWebEnterTemplate(); Request.Criteria.SurveyType = 2; if (IsDraftMode) { Request.Action = "Update"; Request.Criteria.IsDraftMode = true; SurveyInfoDTO.IsDraftMode = true; } else { Request.Action = "UpdateMode"; Request.Criteria.IsDraftMode = false; SurveyInfoDTO.IsDraftMode = false; } List<Epi.EWEManagerService.SurveyInfoDTO> DTOList = new List<Epi.EWEManagerService.SurveyInfoDTO>(); DTOList.Add(SurveyInfoDTO); Request.SurveyInfoList = DTOList.ToArray(); Result = client.SetSurveyInfo(Request); if (Result != null && Result.SurveyInfoList.Count() > 0) { //this.UpdateStatus("Survey mode was successfully updated!"); if (IsDraftMode) { MessageBox.Show("Form mode was successfully changed to Staging.", "", MessageBoxButtons.OK); } else { MessageBox.Show("Form mode was successfully changed to Production.", "", MessageBoxButtons.OK); } } } catch (Exception ex) { //this.BeginInvoke(new FinishWithExceptionDelegate(FinishWithException), ex); } }
public static IsValidOrganizationKeyEnum IsValidOrgKey(string pOrganizationKey, string pSurveyId = null) { try { EWEManagerService.EWEManagerServiceV2Client client = EWEServiceClient.GetClient(); Configuration config = Configuration.GetNewInstance(); var Request = new EWEManagerService.SurveyInfoRequest(); EWEManagerService.SurveyInfoCriteria Criteria = new EWEManagerService.SurveyInfoCriteria(); if (!string.IsNullOrEmpty(pOrganizationKey)) { Criteria.OrganizationKey = new Guid(pOrganizationKey); Request.Criteria = Criteria; } if (!string.IsNullOrWhiteSpace(pSurveyId)) { Criteria.SurveyIdList = new string[1]; Criteria.SurveyIdList[0] = pSurveyId.ToString(); Request.Criteria = Criteria; } if (client.IsValidOrgKey(Request)) { return IsValidOrganizationKeyEnum.Yes; } else { return IsValidOrganizationKeyEnum.No; } } catch (System.ServiceModel.EndpointNotFoundException) { return IsValidOrganizationKeyEnum.EndPointNotFound; } catch { return IsValidOrganizationKeyEnum.GeneralException; } }
private void DoQuickPublish(Template template) { var client = Epi.Core.ServiceClient.EWEServiceClient.GetClient(); DataTable table; View RootView = this.mediator.Project.Metadata.GetParentView(this.mediator.ProjectExplorer.CurrentView.Id); if (RootView == null) { table = this.mediator.Project.Metadata.GetPublishedViewKeys(this.mediator.ProjectExplorer.CurrentView.Id); } else { table = this.mediator.Project.Metadata.GetPublishedViewKeys(RootView.Id); } DataRow ViewRow = table.Rows[0]; string WebSurveyId = ViewRow.ItemArray[3].ToString(); string OrganizationKey = ViewRow.ItemArray[2].ToString(); Configuration config = Configuration.GetNewInstance(); Epi.EWEManagerService.SurveyInfoRequest Request = new Epi.EWEManagerService.SurveyInfoRequest(); Epi.EWEManagerService.SurveyInfoResponse Result = new Epi.EWEManagerService.SurveyInfoResponse(); Epi.EWEManagerService.SurveyInfoCriteria Criteria = new EWEManagerService.SurveyInfoCriteria(); // Request.Criteria.ClosingDate = this.CloseDate; Criteria.OrganizationKey = new Guid(OrganizationKey); //Criteria.UserPublishKey = new Guid(this.UserPublishKey); List<string> List = new List<string>(); List.Add(WebSurveyId); Criteria.SurveyIdList = List.ToArray(); Request.Criteria = Criteria; Request.Action = "Update"; Epi.EWEManagerService.SurveyInfoDTO SurveyInfoDTO = new Epi.EWEManagerService.SurveyInfoDTO(); SurveyInfoDTO.StartDate = DateTime.Now; SurveyInfoDTO.SurveyId = new Guid(WebSurveyId).ToString(); SurveyInfoDTO.SurveyType = 2; SurveyInfoDTO.SurveyName = mediator.Project.Name; SurveyInfoDTO.OrganizationKey = new Guid(OrganizationKey); if (this.mediator.Project.CollectedData.GetDbDriver().ConnectionDescription.ToString().Contains("Microsoft SQL Server:")) { SurveyInfoDTO.IsSqlProject = true; }//changed IsSqlProject to true on quick publishing a SQL project //SurveyInfoDTO.UserPublishKey = new Guid(this.UserPublishKey); SurveyInfoDTO.XML = template.CreateWebEnterTemplate(); Request.Criteria.SurveyType = 2; Request.Criteria.IsDraftMode = true; //SurveyInfoDTO.IsDraftMode = this.IsDraftMode; List<Epi.EWEManagerService.SurveyInfoDTO> DTOList = new List<Epi.EWEManagerService.SurveyInfoDTO>(); DTOList.Add(SurveyInfoDTO); Request.SurveyInfoList = DTOList.ToArray(); Result = client.SetSurveyInfo(Request); if (Result != null && Result.SurveyInfoList.Count() > 0) { //this.UpdateStatus("Survey was successfully updated!"); MessageBox.Show("Form was successfully updated.", "", MessageBoxButtons.OK); } }