Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (MercuryApplication == null)
            {
                return;
            }

            Client.Core.Forms.Form entityForm = null;

            renderEngine = new FormRenderEngine(this, MercuryApplication, Session, SessionCachePrefix);

            if (!IsPostBack)
            {
                Int64 entityFormId = 0;

                if (Request.QueryString["EntityFormId"] != null)
                {
                    if (Int64.TryParse((String)Request.QueryString["EntityFormId"], out entityFormId))
                    {
                        entityForm = MercuryApplication.FormGetByEntityFormId(entityFormId);

                        if (entityForm == null)
                        {
                            entityFormId = 0;
                        }
                    }
                }

                else if (Request.QueryString["EntityFormSessionKey"] != null)
                {
                    entityForm = (Client.Core.Forms.Form)Session[((String)Request.QueryString["EntityFormSessionKey"])];

                    if (Request.QueryString["ForPrint"] != null)
                    {
                        Boolean forPrint = Convert.ToBoolean((String)Request.QueryString["ForPrint"]);

                        if (forPrint)
                        {
                            TelerikAjaxManager.ResponseScripts.Add("window.print (); window.close ();");
                        }
                    }
                }

                if (entityForm == null)
                {
                    Server.Transfer("/PermissionDenied.aspx"); return;
                }

                Page.Title = entityForm.Name;

                RenderForm(entityForm);
            }

            return;
        }
Example #2
0
        public void SaveAsDraftButton_OnClick(Object sender, EventArgs e)
        {
            if (MercuryApplication == null)
            {
                return;
            }

            if (FormEditorControl == null)
            {
                return;
            }

            if (FormEditorControl.EditorForm == null)
            {
                return;
            }


            Client.Core.Forms.Form editorForm = FormEditorControl.EditorForm;

            FormEditorControl.EditorForm = editorForm;


            Server.Application.WorkflowUserInteractionResponseRequireForm formResponse = new Mercury.Server.Application.WorkflowUserInteractionResponseRequireForm();

            formResponse.InteractionType = Mercury.Server.Application.UserInteractionType.RequireForm;

            formResponse.Form = (Server.Application.Form)FormEditorControl.EditorForm.ToServerObject();

            formResponse.SaveAsDraft = true;

            formResponse.Cancel = false;


            WorkflowPage.UserInteractionResponse = formResponse;


            if (!String.IsNullOrEmpty(ResponseScript))
            {
                Telerik.Web.UI.RadAjaxManager ajaxManager = (Telerik.Web.UI.RadAjaxManager)Page.FindControl("TelerikAjaxManager");

                ajaxManager.ResponseScripts.Add(ResponseScript);
            }
        }
Example #3
0
        protected void RenderForm(Client.Core.Forms.Form viewerForm)
        {
            if (viewerForm == null)
            {
                return;
            }

            if (MercuryApplication == null)
            {
                return;
            }

            if (renderEngine.IsFormRendered)
            {
                return;
            }


            FormContent.Controls.Clear();

            FormContent.Controls.Add(renderEngine.RenderForm(viewerForm));

            return;
        }
Example #4
0
        public void SetForm(Client.Core.Forms.Form forForm)
        {
            FormEditorControl.SetForm(forForm);

            return;
        }
Example #5
0
        public void SubmitButton_OnClick(Object sender, EventArgs e)
        {
            if (MercuryApplication == null)
            {
                return;
            }

            if (FormEditorControl == null)
            {
                return;
            }

            if (FormEditorControl.EditorForm == null)
            {
                return;
            }


            Client.Core.Forms.Form editorForm = FormEditorControl.EditorForm;

            List <Server.Application.FormCompileMessage> validationResponse = editorForm.Submit();

            FormEditorControl.EditorForm = editorForm;

            if (validationResponse.Count != 0)
            {
                System.Data.DataTable compileOutputTable = new System.Data.DataTable();

                compileOutputTable.Columns.Add("MessageType");
                compileOutputTable.Columns.Add("Description");
                compileOutputTable.Columns.Add("ControlId");
                compileOutputTable.Columns.Add("ControlType");
                compileOutputTable.Columns.Add("ControlName");

                foreach (Server.Application.FormCompileMessage currentMessage in validationResponse)
                {
                    compileOutputTable.Rows.Add(currentMessage.MessageType.ToString(), currentMessage.Description, currentMessage.ControlId, currentMessage.ControlType.ToString(), currentMessage.ControlName);
                }

                FormSubmitGrid.DataSource = compileOutputTable;

                FormSubmitGrid.Rebind();

                FormSubmitGridDiv.Visible = true;


                if (TelerikAjaxManager != null)
                {
                    TelerikAjaxManager.ResponseScripts.Add("setTimeout (\"document.getElementById ('" + FormSubmitGrid.ClientID + "').focus ();\", 250);");

                    //TelerikAjaxManager.ResponseScripts.Add ("setTimeout (\"alert (document.getElementById('" + FormSubmitGridDiv.ClientID + "'));\", 1000");

                    //TelerikAjaxManager.ResponseScripts.Add ("setTimeout (\"document.getElementById('" + FormSubmitGridDiv.ClientID + "').focus();\", 1000");
                }
            }

            else
            {
                Server.Application.WorkflowUserInteractionResponseRequireForm formResponse = new Mercury.Server.Application.WorkflowUserInteractionResponseRequireForm();

                formResponse.InteractionType = Mercury.Server.Application.UserInteractionType.RequireForm;

                formResponse.Form = (Server.Application.Form)FormEditorControl.EditorForm.ToServerObject();


                WorkflowPage.UserInteractionResponse = formResponse;


                if (!String.IsNullOrEmpty(ResponseScript))
                {
                    Telerik.Web.UI.RadAjaxManager ajaxManager = (Telerik.Web.UI.RadAjaxManager)Page.FindControl("TelerikAjaxManager");

                    ajaxManager.ResponseScripts.Add(ResponseScript);
                }
            }

            return;
        }