Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str     = BasePage.RequestString("FieldName");
            int    modelId = BasePage.RequestInt32("ModelID");

            this.m_ModelName = base.Server.UrlDecode(BasePage.RequestString("ModelName"));
            string str2 = BasePage.RequestString("Action", "Add");

            this.ViewState["action"] = str2;
            this.TxtFieldName.Attributes.Add("onpropertychange", "SetLitFieldName(this.value)");
            if (!base.IsPostBack)
            {
                this.SmpNavigator.CurrentNode = "<a href='FieldManage.aspx?ModelType=" + BasePage.RequestInt32("ModelType").ToString() + "&ModelId=" + modelId.ToString() + "&ModelName=" + base.Server.HtmlEncode(this.m_ModelName) + "'>字段管理</a>";
                this.LookupDataBind();
                if (BasePage.RequestInt32("ModelType") == 1)
                {
                    this.InitRoleCheckBoxList();
                }
                this.EBtnSubmit.Text = "保存字段";
                switch (str2)
                {
                case "Modify":
                case "Copy":
                    if (!string.IsNullOrEmpty(str))
                    {
                        FieldInfo fieldInfoByFieldName = EasyOne.CommonModel.Field.GetFieldInfoByFieldName(modelId, str);
                        this.ShowPanel(fieldInfoByFieldName.FieldType);
                        if (str2 == "Modify")
                        {
                            this.SmpNavigator.AdditionalNode = "修改字段";
                            this.LblTitle.Text        = "修改字段:" + fieldInfoByFieldName.FieldAlias;
                            this.TxtFieldName.Enabled = false;
                            if (BasePage.RequestInt32("ModelType") == 1)
                            {
                                IList <RoleFieldPermissionsInfo> fieldPermissionById = UserPermissions.GetFieldPermissionById(modelId, str);
                                StringBuilder sb = new StringBuilder();
                                foreach (RoleFieldPermissionsInfo info2 in fieldPermissionById)
                                {
                                    StringHelper.AppendString(sb, info2.RoleId.ToString());
                                }
                                IList <RoleFieldPermissionsInfo> fieldPermissionByModelId = RolePermissions.GetFieldPermissionByModelId(modelId, str);
                                StringBuilder builder2 = new StringBuilder();
                                foreach (RoleFieldPermissionsInfo info3 in fieldPermissionByModelId)
                                {
                                    StringHelper.AppendString(builder2, info3.RoleId.ToString());
                                }
                                this.EChkGroupList.SetSelectValue(sb.ToString());
                                this.EChkRoleList.SetSelectValue(builder2.ToString());
                            }
                        }
                        else
                        {
                            fieldInfoByFieldName.FieldName   = "";
                            fieldInfoByFieldName.FieldAlias  = "";
                            fieldInfoByFieldName.Description = "";
                            fieldInfoByFieldName.Tips        = "";
                            this.EBtnSubmit.Text             = " 复制 ";
                            this.LblTitle.Text = "复制字段:" + str;
                            this.SmpNavigator.AdditionalNode = "复制字段";
                        }
                        this.TxtFieldName.Text                        = fieldInfoByFieldName.FieldName;
                        this.LblFieldName.Text                        = fieldInfoByFieldName.FieldName;
                        this.TxtFieldAliax.Text                       = fieldInfoByFieldName.FieldAlias;
                        this.TxtDescription.Text                      = fieldInfoByFieldName.Description;
                        this.TxtTips.Text                             = fieldInfoByFieldName.Tips;
                        this.RadlEnableNull.SelectedValue             = fieldInfoByFieldName.EnableNull.ToString();
                        this.RadlEnableShowOnSearchForm.SelectedValue = fieldInfoByFieldName.EnableShowOnSearchForm.ToString();
                        string id = "Rad" + Enum.GetName(typeof(FieldType), fieldInfoByFieldName.FieldType);
                        ((RadioButton)this.TdFieldType.FindControl(id)).Checked = true;
                        if ((fieldInfoByFieldName.FieldType != FieldType.TextType) && (fieldInfoByFieldName.FieldType != FieldType.MultipleTextType))
                        {
                            this.RadTextType.Enabled             = false;
                            this.RadMultipleTextType.Enabled     = false;
                            this.RadMultipleHtmlTextType.Enabled = false;
                            this.RadListBoxType.Enabled          = false;
                            this.RadNumberType.Enabled           = false;
                            this.RadMoneyType.Enabled            = false;
                            this.RadDateTimeType.Enabled         = false;
                            this.RadLookType.Enabled             = false;
                            this.RadLinkType.Enabled             = false;
                            this.RadBoolType.Enabled             = false;
                            this.RadPictureType.Enabled          = false;
                            this.RadFileType.Enabled             = false;
                            this.RadColorType.Enabled            = false;
                            this.RadAuthorType.Enabled           = false;
                            this.RadSourceType.Enabled           = false;
                            this.RadKeywordType.Enabled          = false;
                            this.RadOperatingType.Enabled        = false;
                            this.RadNodeType.Enabled             = false;
                            this.RadInfoType.Enabled             = false;
                            this.RadSkinType.Enabled             = false;
                            this.RadTemplateType.Enabled         = false;
                            this.RadDownServerType.Enabled       = false;
                            this.RadSpecialType.Enabled          = false;
                            this.RadStatusType.Enabled           = false;
                            this.RadProducer.Enabled             = false;
                            this.RadTrademark.Enabled            = false;
                            this.RadContentType.Enabled          = false;
                            this.RadTitleType.Enabled            = false;
                            this.RadMultiplePhotoType.Enabled    = false;
                            this.RadProperty.Enabled             = false;
                        }
                        this.InitFieldSettingControls(fieldInfoByFieldName);
                        this.HdnFieldLevel.Value = fieldInfoByFieldName.FieldLevel.ToString();
                        this.HdnFieldType.Value  = ((int)fieldInfoByFieldName.FieldType).ToString();
                        this.HdnOrderId.Value    = fieldInfoByFieldName.OrderId.ToString();
                        this.HdnDisabled.Value   = fieldInfoByFieldName.Disabled.ToString();
                    }
                    break;

                default:
                    str = "添加字段";
                    this.SmpNavigator.AdditionalNode = "添加字段";
                    this.ShowPanel(FieldType.TextType);
                    this.HdnFieldType.Value      = 1.ToString();
                    this.RadNodeType.Visible     = false;
                    this.RadInfoType.Visible     = false;
                    this.RadSkinType.Visible     = false;
                    this.RadTemplateType.Visible = false;
                    this.RadSpecialType.Visible  = false;
                    this.RadStatusType.Visible   = false;
                    this.RadTitleType.Visible    = false;
                    break;
                }
                this.LblModelName.Text = "当前模型:<a href='FieldManage.aspx?ModelType=" + BasePage.RequestInt32("ModelType").ToString() + "&ModelId=" + modelId.ToString() + "&ModelName=" + base.Server.UrlEncode(this.m_ModelName) + "'>" + this.m_ModelName + "</a>";
                this.ShowEshopFields();
            }
            if (!PEContext.Current.Admin.IsSuperAdmin)
            {
                this.PnlRoleList.Visible = false;
            }
        }