public void UpdateMode(bool IsDraftMode) { this.IsDraftMode = IsDraftMode; Template template = new Template(this.mediator); try { Epi.Windows.MakeView.Utils.ServiceClient.IsValidOrganizationKeyEnum IsValidOKey = Epi.Windows.MakeView.Utils.ServiceClient.IsValidOrganizationKeyEnum.No; if (string.IsNullOrWhiteSpace(this.projectExplorer.CurrentView.WebSurveyId)) { IsValidOKey = Epi.Windows.MakeView.Utils.ServiceClient.IsValidOrgKey(this.OrganizationKey); } else { IsValidOKey = Epi.Windows.MakeView.Utils.ServiceClient.IsValidOrgKey(this.OrganizationKey, this.projectExplorer.CurrentView.WebSurveyId); } WebPublishDialog dialog = 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(); UpdateSurveyMode(IsDraftMode); } } 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(); UpdateSurveyMode(IsDraftMode); } } } 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(); UpdateSurveyMode(IsDraftMode); } } } break; case Epi.Windows.MakeView.Utils.ServiceClient.IsValidOrganizationKeyEnum.Yes: SetSurveyInfo(); UpdateSurveyMode(IsDraftMode); break; } } catch (Exception ex)// not republishable { } }
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 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 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); } }
private void RunWizardForNewProjectFromTemplate(string selectedTemplate = null) { selectedTemplate = selectedTemplate == null ? string.Empty : selectedTemplate; ProjectFromTemplateDialog dialog = new ProjectFromTemplateDialog(selectedTemplate); string projectName = string.Empty; string projectDescription = string.Empty; string projectLocation = string.Empty; string dataDBInfo = string.Empty; Data.DbDriverInfo dbDriverInfo = new Data.DbDriverInfo(); string projectTemplatePath = string.Empty; try { dialog.ShowDialog(); if (dialog.DialogResult == DialogResult.OK) { CloseCurrentProject(); projectName = dialog.ProjectName; projectLocation = dialog.ProjectLocation; dataDBInfo = dialog.DataDBInfo; dbDriverInfo = dialog.DriverInfo; projectTemplatePath = dialog.ProjectTemplatePath; } else { return; } } finally { dialog.Dispose(); GC.Collect(); Refresh(); } canvas.HideUpdateStart(SharedStrings.CREATING_PROJECT); Project newProject = new Project(); newProject = newProject.CreateProject( projectName, projectDescription, projectLocation, dataDBInfo, dbDriverInfo); if (newProject != null) { mediator.Project = newProject; if (this.Interpreter == null) { Assembly assembly = Assembly.Load(newProject.EnterMakeviewIntepreter); Type myType = assembly.GetType(newProject.EnterMakeviewIntepreter + ".EpiInterpreterParser"); this.Interpreter = (IEnterInterpreter)Activator.CreateInstance(myType, new object[] { this.mediator }); this.Interpreter.Host = this.mediator; } canvas.UpdateHidePanel(SharedStrings.LOADING_PROJECT); projectExplorer.LoadProject(newProject); Template template = new Template(this.mediator); template.CreateFromTemplate(projectTemplatePath); //EnableFeatures(); OnProjectAccessed(newProject); // The code below is needed to catch a condition where the ParentView property of each View object is // not set during the creation of the template. Instead of re-writing this code in the template creation // process, we simply force the metadata to be refreshed (which assigns the ParentView property correctly). newProject.views = null; newProject.LoadViews(); } canvas.HideUpdateEnd(); EnableFeatures(); }
private bool ValidateUser() { iscancel = false; bool IsValidUser = false; string UserName = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString(); Configuration config = Configuration.GetNewInstance(); int ISWindowAuthMode = config.Settings.EWEServiceAuthMode; try { UserPrincipal User = GetUser(UserName); EWEManagerService.UserAuthenticationRequest Request = new EWEManagerService.UserAuthenticationRequest(); var rUser = new EWEManagerService.UserDTO(); rUser.EmailAddress = User.EmailAddress; Request.User = rUser; Request.User.Operation = EWEManagerService.ConstantOperationMode.NoChange; var client = Epi.Core.ServiceClient.EWEServiceClient.GetClient(); var Result = client.GetUser(Request); if (Result != null && ISWindowAuthMode == 1) { IsValidUser = true; LoginInfo.UserID = Result.User.UserId; } return IsValidUser; } catch (Exception ex) { /* Template template = new Template(this.mediator); WebEnterOptions dialog2 = new WebEnterOptions(); DialogResult result3 = dialog2.ShowDialog(); if (result3 == DialogResult.Cancel) { iscancel = true; dialog2.Close(); } */ if (ISWindowAuthMode == 0) { if (LoginInfo.UserID == -1) { Template template = new Template(this.mediator); UserAuthentication dialog = new UserAuthentication(); DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { dialog.Close(); IsValidUser = true; } } IsValidUser = true; } // } return IsValidUser; } }
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 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); } }
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 QuickFormInfoUpdate() { try { Template template = new Template(this.mediator); if (ValidateUser()) // Validate User { DoQuickPublish(template); } /* else // Validate User { Configuration config = Configuration.GetNewInstance(); 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(); DoQuickPublish(template); } } else { DoQuickPublish(template); } } else { MessageBox.Show("You are not authorized to quick publish this form to Epi Web Enter system. Please contact system admin for more info."); } }*/ } 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 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); } }
public void UpdateWebEnterMode(bool IsDraftMode) { this.IsEWEDraftMode = IsDraftMode; Template template = new Template(this.mediator); View RootView = mediator.Project.Metadata.GetParentView(this.projectExplorer.CurrentView.Id); // DataTable table = mediator.Project.Metadata.GetPublishedViewKeys(this.projectExplorer.CurrentView.Id); DataTable table; 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 OrganizationKey = ViewRow.ItemArray[2].ToString(); ; string WebSurveyId = ViewRow.ItemArray[3].ToString(); if(ValidateUser()) { DoUpDateMode(IsDraftMode, OrganizationKey, WebSurveyId); } /* else { Configuration config = Configuration.GetNewInstance(); 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) { DoUpDateMode(IsDraftMode, OrganizationKey, WebSurveyId); } } else { DoUpDateMode(IsDraftMode, OrganizationKey, WebSurveyId); } } else { MessageBox.Show("You are not authorized to Change mode for this form. Please contact system admin for more info."); } }*/ }