Ejemplo n.º 1
0
        /// <summary>
        /// Handles the ServerClick event of the imbtnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        void imbtnSave_ServerClick(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            if (mc == null)             // Create
            {
                try
                {
                    mc = MetaDataWrapper.CreateCard(ddlClass.SelectedValue,
                                                    txtClassName.Text.Trim(), txtClassFriendlyName.Text.Trim(), txtClassPluralName.Text.Trim());

                    FormDocument fDocBase = FormController.CreateFormDocument(mc.Name, FormController.BaseFormName);
                    fDocBase.Save();

                    FormDocument fDocCreate = FormController.CreateFormDocument(mc.Name, FormController.CreateFormName);
                    fDocCreate.Save();

                    Response.Redirect(String.Format("~/Apps/MetaDataBase/Pages/Admin/MetaClassView.aspx?class={0}", mc.Name), true);
                }
                catch (MetaClassAlreadyExistsException)
                {
                    lbError.Text    = string.Format(GetGlobalResourceObject("GlobalMetaInfo", "CardExistsErrorMessage").ToString(), "'" + txtClassName.Text.Trim() + "'");
                    lbError.Visible = true;
                }
            }
            else              // Update
            {
                MetaDataWrapper.UpdateCard(mc, txtClassFriendlyName.Text.Trim(), txtClassPluralName.Text.Trim());

                if (Back == "list")
                {
                    Response.Redirect("~/Apps/MetaDataBase/Pages/Admin/MetaClassList.aspx", true);
                }
                else
                {
                    Response.Redirect(String.Format("~/Apps/MetaDataBase/Pages/Admin/MetaClassView.aspx?class={0}", mc.Name), true);
                }
            }
        }
Ejemplo n.º 2
0
        void imbtnSave_ServerClick(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            if (mc == null)             // Create
            {
                try
                {
                    mc = MetaDataWrapper.CreateCard(ddlClass.SelectedValue,
                                                    txtClassName.Text.Trim(), txtClassFriendlyName.Text.Trim(), txtClassPluralName.Text.Trim());

                    Response.Redirect(String.Format(CultureInfo.InvariantCulture, "{0}?class={1}", CHelper.MetaClassAdminPage, mc.Name), true);
                }
                catch (MetaClassAlreadyExistsException)
                {
                    lbError.Text    = string.Format(GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "CardExistsErrorMessage").ToString(), "'" + txtClassName.Text.Trim() + "'");
                    lbError.Visible = true;
                }
            }
            else              // Update
            {
                MetaDataWrapper.UpdateCard(mc, txtClassFriendlyName.Text.Trim(), txtClassPluralName.Text.Trim());

                if (Back == "list")
                {
                    Response.Redirect("~/Apps/MetaDataBase/Pages/Admin/MetaClassList.aspx", true);
                }
                else
                {
                    Response.Redirect(String.Format(CultureInfo.InvariantCulture, "{0}?class={1}", CHelper.MetaClassAdminPage, mc.Name), true);
                }
            }
        }