private void toolStripPublishToWebEnter_Click(object sender, EventArgs e) { DataTable table = mediator.Project.Metadata.GetPublishedViewKeys(this.projectExplorer.CurrentView.Id); DataRow ViewRow = table.Rows[0]; // this.OrganizationKey = this.projectExplorer.CurrentView.EWEOrganizationKey; this.EWEOrganizationKey = ViewRow.ItemArray[2].ToString(); if (string.IsNullOrEmpty(EWEOrganizationKey)) if (RepublishOrgKey != null) EWEOrganizationKey = RepublishOrgKey; Template template = new Template(this.mediator); string InvalidForPublishing = ListFieldsNotSupportedForWeb(); View view; if (projectExplorer.CurrentView != null) { view = projectExplorer.CurrentView; } else { view = projectExplorer.SelectedPage.view; } if (InvalidForPublishing.Length > 0) { SupportedFieldTypeDialog dialog = new SupportedFieldTypeDialog(InvalidForPublishing); dialog.ShowDialog(); } else { Configuration config = Configuration.GetNewInstance(); try { if (view.Project.CollectedData.TableExists(view.TableName) == false)//checking if no table is created in Epi7 { CreateViewDataTable(view); } if (ValidateUser() && !iscancel) // Validate User { if (config.Settings.Republish_IsRepbulishable == true) //IsRepbulishable { if (string.IsNullOrWhiteSpace(this.EWEOrganizationKey) && !string.IsNullOrWhiteSpace(view.EWEFormId))//valitate OrgId and FormId { Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum IsValidOKey = Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.No; if (string.IsNullOrWhiteSpace(view.EWEFormId)) { IsValidOKey = Epi.Core.ServiceClient.EWEServiceClient.IsValidOrgKey(this.EWEOrganizationKey); } else { IsValidOKey = Epi.Core.ServiceClient.EWEServiceClient.IsValidOrgKey(this.EWEOrganizationKey, view.EWEFormId); } WebEnterPublishDialog dialog = null; WebEnterOptions wso = null; switch (IsValidOKey) { case Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.No: EWEOrgKey NewDialog = new EWEOrgKey(this.CurrentView.EWEFormId, false, "The organization key has been successfully submitted!", "The organization key is required for security purposes before you can republish this survey."); DialogResult result = NewDialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { this.EWEOrganizationKey = NewDialog.OrganizationKey; if (!string.IsNullOrWhiteSpace(EWEOrganizationKey)) { SetFormInfo(); dialog = new WebEnterPublishDialog(this.EWEOrganizationKey, this.mediator, template.CreateWebEnterTemplate()); dialog.ShowDialog(); } } break; case Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.EndPointNotFound: WebEnterOptions dialog1 = new WebEnterOptions(); DialogResult result1 = dialog1.ShowDialog(); if (result1 == System.Windows.Forms.DialogResult.OK) { EWEOrgKey OrgKeyDialog = new EWEOrgKey(this.CurrentView.EWEFormId, false, "The organization key has been successfully submitted!", "The organization key is required for security purposes before you can republish this survey."); DialogResult result2 = OrgKeyDialog.ShowDialog(); if (result2 == System.Windows.Forms.DialogResult.OK) { this.EWEOrganizationKey = OrgKeyDialog.OrganizationKey; if (!string.IsNullOrWhiteSpace(EWEOrganizationKey)) { SetFormInfo(); dialog = new WebEnterPublishDialog(this.EWEOrganizationKey, this.mediator, template.CreateWebEnterTemplate()); dialog.ShowDialog(); } } } break; case Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.GeneralException: WebEnterOptions dialog2 = new WebEnterOptions(); DialogResult result3 = dialog2.ShowDialog(); if (result3 == System.Windows.Forms.DialogResult.OK) { EWEOrgKey OrgKeyDialog = new EWEOrgKey(this.CurrentView.EWEFormId, false, "The organization key has been successfully submitted!", "The organization key is required for security purposes before you can republish this survey."); DialogResult result4 = OrgKeyDialog.ShowDialog(); if (result4 == System.Windows.Forms.DialogResult.OK) { this.EWEOrganizationKey = OrgKeyDialog.OrganizationKey; if (!string.IsNullOrWhiteSpace(EWEOrganizationKey)) { SetFormInfo(); dialog = new WebEnterPublishDialog(this.EWEOrganizationKey, this.mediator, template.CreateWebEnterTemplate()); dialog.ShowDialog(); } } } break; case Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.Yes: SetFormInfo(); dialog = new WebEnterPublishDialog(this.EWEOrganizationKey, this.mediator, template.CreateWebEnterTemplate()); dialog.ShowDialog(); break; } } else //valitate OrgId and FormId { if (!string.IsNullOrEmpty(this.EWEOrganizationKey)) { WebEnterPublishDialog dialog = new WebEnterPublishDialog(this.EWEOrganizationKey, this.mediator, template.CreateWebEnterTemplate()); dialog.ShowDialog(); } else { try { var client = Epi.Core.ServiceClient.EWEServiceClient.GetClient(); EWEManagerService.OrganizationRequest Request = new Epi.EWEManagerService.OrganizationRequest(); //Epi.Web.Common.Message.OrganizationRequest Request = new Epi.Web.Common.Message.OrganizationRequest(); Request.Organization = new EWEManagerService.OrganizationDTO(); var TestService = client.GetOrganization(Request); WebEnterPublishDialog dialog = new WebEnterPublishDialog(null, this.mediator, template.CreateWebEnterTemplate()); DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.Cancel) { this.EWEOrganizationKey = dialog.GetOrgKey; } } catch (Exception ex) { WebEnterOptions dialog2 = new WebEnterOptions(); DialogResult result3 = dialog2.ShowDialog(); if (result3 == System.Windows.Forms.DialogResult.OK) { WebEnterPublishDialog dialog = new WebEnterPublishDialog(this.EWEOrganizationKey, this.mediator, template.CreateWebEnterTemplate()); DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.Cancel) { this.EWEOrganizationKey = dialog.GetOrgKey; } } } } } } else // IsRepbulishable { try { SurveyManagerService.ManagerServiceV3Client client = Epi.Core.ServiceClient.ServiceClient.GetClient(); SurveyManagerService.OrganizationRequest Request = new SurveyManagerService.OrganizationRequest(); SurveyManagerService.OrganizationDTO orgDTO = new SurveyManagerService.OrganizationDTO(); Request.Organization = orgDTO; var TestService = client.GetOrganization(Request); WebEnterPublishDialog dialog = new WebEnterPublishDialog(null, this.mediator, template.CreateWebEnterTemplate()); DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.Cancel) { this.EWEOrganizationKey = dialog.GetOrgKey; } } catch (Exception ex) { if (config.Settings.Republish_IsRepbulishable == true) { WebSurveyOptions dialog2 = new WebSurveyOptions(); DialogResult result3 = dialog2.ShowDialog(); if (result3 == System.Windows.Forms.DialogResult.OK) { WebEnterPublishDialog dialog = new WebEnterPublishDialog(this.EWEOrganizationKey, this.mediator, template.CreateWebEnterTemplate()); DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.Cancel) { this.EWEOrganizationKey = dialog.GetOrgKey; } } } else { WebEnterPublishDialog dialog = new WebEnterPublishDialog(null, this.mediator, template.CreateWebEnterTemplate()); dialog.ShowDialog(); } } } } /* else if(!iscancel)// Validate User { int ISWindowAuthMode = config.Settings.EWEServiceAuthMode; if (ISWindowAuthMode == 0) { if (LoginInfo.UserID == -1) { UserAuthentication dialog = new UserAuthentication(); DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { dialog.Close(); if (string.IsNullOrEmpty(this.EWEOrganizationKey)) { WebEnterPublishDialog dialog1 = new WebEnterPublishDialog(null, this.mediator, template.CreateWebEnterTemplate()); dialog1.ShowDialog(); } else { WebEnterPublishDialog dialog1 = new WebEnterPublishDialog(this.EWEOrganizationKey, this.mediator, template.CreateWebEnterTemplate()); dialog1.ShowDialog(); } } } else { if (string.IsNullOrEmpty(this.EWEOrganizationKey)) { WebEnterPublishDialog dialog1 = new WebEnterPublishDialog(null, this.mediator, template.CreateWebEnterTemplate()); dialog1.ShowDialog(); } else { WebEnterPublishDialog dialog1 = new WebEnterPublishDialog(this.EWEOrganizationKey, this.mediator, template.CreateWebEnterTemplate()); dialog1.ShowDialog(); } } } else { MessageBox.Show("You are not authorized to publish this form to Epi Web Enter system. Please contact system admin for more info."); } }*/ } catch (Exception ex)// not republishable { WebEnterPublishDialog dialog = new WebEnterPublishDialog(null, this.mediator, template.CreateWebEnterTemplate()); dialog.ShowDialog(); } } this.SetPublishMenuItems(view); }
private void toWebEnterToolStripMenuItem_Click(object sender, EventArgs e) { 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[2].ToString(); this.EWEOrganizationKey = ViewRow.ItemArray[3].ToString(); if (!string.IsNullOrWhiteSpace(EWEOrganizationKey)) { SetFormInfo(); QuickFormInfoUpdate(); } else { EWEOrgKey NewDialog = new EWEOrgKey(WebSurveyId, false, "The organization key has been successfully submitted!", "The organization key is required for security purposes before you can republish this survey."); DialogResult result = NewDialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { this.EWEOrganizationKey = NewDialog.OrganizationKey; if (!string.IsNullOrWhiteSpace(EWEOrganizationKey)) { SetFormInfo(); QuickFormInfoUpdate(); } } } //Template template = new Template(this.mediator); //try // { // Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum IsValidOKey = Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.No; // if (string.IsNullOrWhiteSpace(WebSurveyId)) // { // IsValidOKey = Epi.Core.ServiceClient.EWEServiceClient.IsValidOrgKey(this.EWEOrganizationKey); // } // else // { // IsValidOKey = Epi.Core.ServiceClient.EWEServiceClient.IsValidOrgKey(WebSurveyId,this.projectExplorer.CurrentView.EWEFormId); // } // WebEnterPublishDialog dialog = null; // switch (IsValidOKey) // { // case Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.No: // EWEOrgKey NewDialog = new EWEOrgKey(WebSurveyId, false, "The organization key has been successfully submitted!", "The organization key is required for security purposes before you can republish this survey."); // DialogResult result = NewDialog.ShowDialog(); // if (result == System.Windows.Forms.DialogResult.OK) // { // this.EWEOrganizationKey = NewDialog.OrganizationKey; // if (!string.IsNullOrWhiteSpace(EWEOrganizationKey)) // { // SetFormInfo(); // QuickFormInfoUpdate(); // } // } // break; // case Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.EndPointNotFound: // WebEnterOptions dialog1 = new WebEnterOptions(); // DialogResult result1 = dialog1.ShowDialog(); // if (result1 == System.Windows.Forms.DialogResult.OK) // { // EWEOrgKey OrgKeyDialog = new EWEOrgKey(WebSurveyId, false, "The organization key has been successfully submitted!", "The organization key is required for security purposes before you can republish this survey."); // DialogResult result2 = OrgKeyDialog.ShowDialog(); // if (result2 == System.Windows.Forms.DialogResult.OK) // { // this.EWEOrganizationKey = OrgKeyDialog.OrganizationKey; // if (!string.IsNullOrWhiteSpace(EWEOrganizationKey)) // { // SetFormInfo(); // QuickFormInfoUpdate(); // } // } // } // break; // case Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.GeneralException: // WebEnterOptions dialog2 = new WebEnterOptions(); // DialogResult result3 = dialog2.ShowDialog(); // if (result3 == System.Windows.Forms.DialogResult.OK) // { // EWEOrgKey OrgKeyDialog = new EWEOrgKey(WebSurveyId, false, "The organization key has been successfully submitted!", "The organization key is required for security purposes before you can republish this survey."); // DialogResult result4 = OrgKeyDialog.ShowDialog(); // if (result4 == System.Windows.Forms.DialogResult.OK) // { // this.EWEOrganizationKey = OrgKeyDialog.OrganizationKey; // if (!string.IsNullOrWhiteSpace(EWEOrganizationKey)) // { // SetFormInfo(); // QuickFormInfoUpdate(); // } // } // } // break; // case Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.Yes: // SetFormInfo(); // QuickFormInfoUpdate(); // break; // } // } //catch (Exception ex)// not republishable // { // } }
private void DoUpDateMode(bool IsDraftMode, string OrganizationKey, string WebSurveyId) { try { Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum IsValidOKey = Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.No; if (string.IsNullOrWhiteSpace(WebSurveyId)) { IsValidOKey = Epi.Core.ServiceClient.EWEServiceClient.IsValidOrgKey(OrganizationKey); } else { IsValidOKey = Epi.Core.ServiceClient.EWEServiceClient.IsValidOrgKey(OrganizationKey, WebSurveyId); } WebEnterPublishDialog dialog = null; switch (IsValidOKey) { case Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.No: EWEOrgKey NewDialog = new EWEOrgKey(WebSurveyId, false, "The organization key has been successfully submitted!", "The organization key is required for security purposes before you can republish this survey."); DialogResult result = NewDialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { OrganizationKey = NewDialog.OrganizationKey; if (!string.IsNullOrWhiteSpace(OrganizationKey)) { SetFormInfo(); UpdateFormMode(IsDraftMode); } } break; case Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.EndPointNotFound: WebEnterOptions dialog1 = new WebEnterOptions(); DialogResult result1 = dialog1.ShowDialog(); if (result1 == System.Windows.Forms.DialogResult.OK) { EWEOrgKey OrgKeyDialog = new EWEOrgKey(WebSurveyId, false, "The organization key has been successfully submitted!", "The organization key is required for security purposes before you can republish this survey."); DialogResult result2 = OrgKeyDialog.ShowDialog(); if (result2 == System.Windows.Forms.DialogResult.OK) { OrganizationKey = OrgKeyDialog.OrganizationKey; if (!string.IsNullOrWhiteSpace(OrganizationKey)) { SetFormInfo(); UpdateFormMode(IsDraftMode); } } } break; case Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.GeneralException: WebEnterOptions dialog2 = new WebEnterOptions(); DialogResult result3 = dialog2.ShowDialog(); if (result3 == System.Windows.Forms.DialogResult.OK) { EWEOrgKey OrgKeyDialog = new EWEOrgKey(WebSurveyId, false, "The organization key has been successfully submitted!", "The organization key is required for security purposes before you can republish this survey."); DialogResult result4 = OrgKeyDialog.ShowDialog(); if (result4 == System.Windows.Forms.DialogResult.OK) { OrganizationKey = OrgKeyDialog.OrganizationKey; if (!string.IsNullOrWhiteSpace(OrganizationKey)) { SetFormInfo(); UpdateFormMode(IsDraftMode); } } } break; case Epi.Core.ServiceClient.EWEServiceClient.IsValidOrganizationKeyEnum.Yes: SetFormInfo(); UpdateFormMode(IsDraftMode); break; } } catch (Exception ex)// not republishable { } }