private void updateSurveyToolStripMenuItem_Click(object sender, EventArgs e) { Template template = new Template(this.mediator); string InvalidForPublishing = ListFieldsNotSupportedForWeb(); if (InvalidForPublishing.Length > 0) { SupportedFieldTypeDialog dialog = new SupportedFieldTypeDialog(InvalidForPublishing); dialog.ShowDialog(); } else { RepublishSurveyFields dialog = new RepublishSurveyFields(this.OrganizationKey, this.projectExplorer.CurrentView, template.CreateWebSurveyTemplate()); dialog.ShowDialog(); } }
private void publishNewSurveyToolStripMenuItem_Click(object sender, EventArgs e) { 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 (config.Settings.Republish_IsRepbulishable == true) { if (string.IsNullOrWhiteSpace(this.OrganizationKey) && !string.IsNullOrWhiteSpace(view.WebSurveyId)) { Epi.Windows.MakeView.Utils.ServiceClient.IsValidOrganizationKeyEnum IsValidOKey = Epi.Windows.MakeView.Utils.ServiceClient.IsValidOrganizationKeyEnum.No; if (string.IsNullOrWhiteSpace(view.WebSurveyId)) { IsValidOKey = Epi.Windows.MakeView.Utils.ServiceClient.IsValidOrgKey(this.OrganizationKey); } else { IsValidOKey = Epi.Windows.MakeView.Utils.ServiceClient.IsValidOrgKey(this.OrganizationKey, view.WebSurveyId); } WebPublishDialog dialog = null; WebSurveyOptions wso = null; switch (IsValidOKey) { case Epi.Windows.MakeView.Utils.ServiceClient.IsValidOrganizationKeyEnum.No: OrgKey NewDialog = new OrgKey(this.CurrentView.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.OrganizationKey = NewDialog.OrganizationKey; if (!string.IsNullOrWhiteSpace(OrganizationKey)) { SetSurveyInfo(); dialog = new WebPublishDialog(this.OrganizationKey, view, template.CreateWebSurveyTemplate()); dialog.ShowDialog(); } } break; case Epi.Windows.MakeView.Utils.ServiceClient.IsValidOrganizationKeyEnum.EndPointNotFound: WebSurveyOptions dialog1 = new WebSurveyOptions(); DialogResult result1 = dialog1.ShowDialog(); if (result1 == System.Windows.Forms.DialogResult.OK) { OrgKey OrgKeyDialog = new OrgKey(this.CurrentView.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.OrganizationKey = OrgKeyDialog.OrganizationKey; if (!string.IsNullOrWhiteSpace(OrganizationKey)) { SetSurveyInfo(); dialog = new WebPublishDialog(this.OrganizationKey, view, template.CreateWebSurveyTemplate()); dialog.ShowDialog(); } } } break; case Epi.Windows.MakeView.Utils.ServiceClient.IsValidOrganizationKeyEnum.GeneralException: WebSurveyOptions dialog2 = new WebSurveyOptions(); DialogResult result3 = dialog2.ShowDialog(); if (result3 == System.Windows.Forms.DialogResult.OK) { OrgKey OrgKeyDialog = new OrgKey(this.CurrentView.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.OrganizationKey = OrgKeyDialog.OrganizationKey; if (!string.IsNullOrWhiteSpace(OrganizationKey)) { SetSurveyInfo(); dialog = new WebPublishDialog(this.OrganizationKey, view, template.CreateWebSurveyTemplate()); dialog.ShowDialog(); } } } break; case Epi.Windows.MakeView.Utils.ServiceClient.IsValidOrganizationKeyEnum.Yes: SetSurveyInfo(); dialog = new WebPublishDialog(this.OrganizationKey, view, template.CreateWebSurveyTemplate()); dialog.ShowDialog(); break; } } else { if (!string.IsNullOrEmpty(this.OrganizationKey)) { WebPublishDialog dialog = new WebPublishDialog(this.OrganizationKey, view, template.CreateWebSurveyTemplate()); dialog.ShowDialog(); }else { try { SurveyManagerService.ManagerServiceClient client = Epi.Windows.MakeView.Utils.ServiceClient.GetClient(); Epi.Web.Common.Message.OrganizationRequest Request = new Epi.Web.Common.Message.OrganizationRequest(); var TestService = client.GetOrganization(Request); WebPublishDialog dialog = new WebPublishDialog(null, view, template.CreateWebSurveyTemplate()); DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.Cancel) { this.OrganizationKey = dialog.GetOrgKey; } } catch (Exception ex) { WebSurveyOptions dialog2 = new WebSurveyOptions(); DialogResult result3 = dialog2.ShowDialog(); if (result3 == System.Windows.Forms.DialogResult.OK) { WebPublishDialog dialog = new WebPublishDialog(this.OrganizationKey, view, template.CreateWebSurveyTemplate()); DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.Cancel) { this.OrganizationKey = dialog.GetOrgKey; } } } } } } else { try { SurveyManagerService.ManagerServiceClient client = Epi.Windows.MakeView.Utils.ServiceClient.GetClient(); Epi.Web.Common.Message.OrganizationRequest Request = new Epi.Web.Common.Message.OrganizationRequest(); var TestService = client.GetOrganization(Request); WebPublishDialog dialog = new WebPublishDialog(null, view, template.CreateWebSurveyTemplate()); DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.Cancel) { this.OrganizationKey = 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) { WebPublishDialog dialog = new WebPublishDialog(this.OrganizationKey, view, template.CreateWebSurveyTemplate()); DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.Cancel) { this.OrganizationKey = dialog.GetOrgKey; } } } else { WebPublishDialog dialog = new WebPublishDialog(null, view, template.CreateWebSurveyTemplate()); dialog.ShowDialog(); } } } } catch(Exception ex)// not republishable { WebPublishDialog dialog = new WebPublishDialog(null, view, template.CreateWebSurveyTemplate()); dialog.ShowDialog(); } } this.SetPublishMenuItems(view); }
private void updateSurveyInformationToolStripMenuItem_Click(object sender, EventArgs e) { Template template = new Template(this.mediator); string InvalidForPublishing = ListFieldsNotSupportedForWeb(); if (InvalidForPublishing.Length > 0) { SupportedFieldTypeDialog dialog = new SupportedFieldTypeDialog(InvalidForPublishing); dialog.ShowDialog(); } else { WebPublishDialog dialog = new WebPublishDialog(this.OrganizationKey, this.projectExplorer.CurrentView, template.CreateWebSurveyTemplate(), true); dialog.ShowDialog(); } this.OrganizationKey = this.projectExplorer.CurrentView.CheckCodeBefore; this.projectExplorer.CurrentView.CheckCodeBefore = ""; }
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); }