Esempio n. 1
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;
        }