Beispiel #1
0
        private void CreateRelation(
            string bridgeName,
            string bridgeFriendlyName,
            string currentClassName,
            string currentSectionName,
            string currentDisplayText,
            string currentDisplayOrder,
            string relatedClassName,
            string relatedSectionName,
            string relatedDisplayText,
            string relatedDisplayOrder)
        {
            string currentFieldFiendlyName = currentDisplayText;
            string relatedFieldFiendlyName = relatedDisplayText;

            if (currentSectionName == notSetValue || ListManager.MetaClassIsList(currentClassName))
            {
                currentSectionName  = string.Empty;
                currentDisplayText  = string.Empty;
                currentDisplayOrder = string.Empty;
            }

            if (relatedSectionName == notSetValue || ListManager.MetaClassIsList(relatedClassName))
            {
                relatedSectionName  = string.Empty;
                relatedDisplayText  = string.Empty;
                relatedDisplayOrder = string.Empty;
            }

            MetaDataWrapper.CreateBridgeClass(
                bridgeName,
                bridgeFriendlyName,
                currentClassName,
                MetaDataWrapper.BridgeField1Name,
                currentFieldFiendlyName,
                currentSectionName,
                currentDisplayText,
                currentDisplayOrder,
                relatedClassName,
                MetaDataWrapper.BridgeField2Name,
                relatedFieldFiendlyName,
                relatedSectionName,
                relatedDisplayText,
                relatedDisplayOrder);
        }
Beispiel #2
0
        void imbtnSave_ServerClick(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            if (mc == null)
            {
                try
                {
                    mc = MetaDataWrapper.CreateBridgeClass(
                        txtClassName.Text.Trim(), txtClassFriendlyName.Text.Trim(), txtClassPluralName.Text.Trim(),
                        ddlClass1.SelectedValue, txtField1Name.Text.Trim(), txtField1FriendlyName.Text.Trim(),
                        ddlClass2.SelectedValue, txtField2Name.Text.Trim(), txtField2FriendlyName.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", "BridgeExistsErrorMessage").ToString(), "'" + txtClassName.Text.Trim() + "'");
                    lbError.Visible = true;
                }
                catch (MetaFieldAlreadyExistsException)
                {
                    lbError.Text    = string.Format(GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "FieldExistsErrorMessage").ToString(), "'" + txtField1Name.Text.Trim() + "' or '" + txtField2Name.Text.Trim() + "'");
                    lbError.Visible = true;
                }
            }
            else
            {
                MetaDataWrapper.UpdateBridge(mc, txtClassFriendlyName.Text.Trim(), txtClassPluralName.Text.Trim(),
                                             txtField1FriendlyName.Text.Trim(), txtField2FriendlyName.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);
                }
            }
        }