예제 #1
0
        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
             {

             }
        }
예제 #2
0
 private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     // OrgKey OK = new OrgKey();
     //OK.Show();
     OrgKey NewDialog = new OrgKey(this.view.WebSurveyId, false, "The organization key has been successfully submitted!", "The organization key is required for security purposes before you can change the survey mode.");
     DialogResult result = NewDialog.ShowDialog();
 }
예제 #3
0
        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);
        }