⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 field.aspx.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
            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;
        }

        private void InitTxtVirtualLink(FieldInfo fieldInfo)
        {
            Collection<string> settings = fieldInfo.Settings;
            this.TxtVirtualLinkWidth.Text = settings[0];
            this.TxtVirtualLinkRow.Text = settings[1];
        }

        private void LookupDataBind()
        {
            IList<ModelInfo> modelList = ModelManager.GetModelList(ModelType.None, ModelShowType.Enable);
            this.DropLookupTable.DataSource = modelList;
            this.DropLookupTable.DataTextField = "ModelName";
            this.DropLookupTable.DataValueField = "ModelId";
            this.DropLookupTable.DataBind();
            int modelId = modelList[0].ModelId;
            FieldType[] fieldType = new FieldType[] { FieldType.TextType, FieldType.TitleType };
            this.DropLookupField.DataSource = PowerEasy.CommonModel.Field.GetFieldNames(modelId, fieldType);
            this.DropLookupField.DataTextField = "FieldAlias";
            this.DropLookupField.DataValueField = "FieldName";
            this.DropLookupField.DataBind();
        }

        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 = PowerEasy.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.HtmlEncode(this.m_ModelName) + "'>" + this.m_ModelName + "</a>";
                this.ShowEshopFields();
            }
            if (!PEContext.Current.Admin.IsSuperAdmin)
            {
                this.PnlRoleList.Visible = false;
            }
        }

        protected void RadlFieldType_SelectedIndexChanged(object sender, EventArgs e)
        {
            string iD = ((RadioButton) sender).ID;
            iD = iD.Substring(3, iD.Length - 3);
            FieldType showType = (FieldType) Enum.Parse(typeof(FieldType), iD);
            this.HdnFieldType.Value = showType.ToString();
            this.ShowPanel(showType);
        }

        private void ShowEshopFields()
        {
            if (BasePage.RequestInt32("ModelType") == 2)
            {
                this.RadAuthorType.Visible = false;
                this.RadSkinType.Visible = false;
                this.RadStatusType.Visible = false;
                this.RadSourceType.Visible = false;
                this.RadTemplateType.Visible = false;
                this.RadNodeType.Visible = false;
                this.RadSpecialType.Visible = false;
                this.RadInfoType.Visible = false;
                this.PnlRoleList.Visible = false;
                this.RadTitleType.Visible = false;
                this.RadDownServerType.Visible = false;
            }
            else
            {
                this.RadProperty.Visible = false;
            }
        }

        private void ShowPanel(FieldType showType)
        {
            int length = Enum.GetValues(typeof(FieldType)).Length;
            bool[] flagArray = new bool[length];
            for (int i = 0; i < length; i++)
            {
                if (i == (showType - 1))
                {
                    flagArray[i] = true;
                }
                else
                {
                    flagArray[i] = false;
                }
            }
            if (showType == FieldType.ListBoxType)
            {
                this.EBtnSubmit.Attributes.Add("onclick", "if(!ChangeHiddenFieldValue()){return false;}");
            }
            this.PnlText.Visible = flagArray[this.GetEnumIntValue(FieldType.TextType)];
            this.PnlMultiText.Visible = flagArray[this.GetEnumIntValue(FieldType.MultipleTextType)];
            this.PnlEditor.Visible = flagArray[this.GetEnumIntValue(FieldType.MultipleHtmlTextType)];
            this.PnlChoice.Visible = flagArray[this.GetEnumIntValue(FieldType.ListBoxType)];
            this.PnlNumber.Visible = flagArray[this.GetEnumIntValue(FieldType.NumberType)];
            this.PnlCurrency.Visible = flagArray[this.GetEnumIntValue(FieldType.MoneyType)];
            this.PnlDateTime.Visible = flagArray[this.GetEnumIntValue(FieldType.DateTimeType)];
            this.PnlLookup.Visible = flagArray[this.GetEnumIntValue(FieldType.LookType)];
            this.PnlURL.Visible = flagArray[this.GetEnumIntValue(FieldType.LinkType)];
            this.PnlBoolean.Visible = flagArray[this.GetEnumIntValue(FieldType.BoolType)];
            this.PnlImage.Visible = flagArray[this.GetEnumIntValue(FieldType.PictureType)];
            this.PnlFile.Visible = flagArray[this.GetEnumIntValue(FieldType.FileType)];
            this.PnlColor.Visible = flagArray[this.GetEnumIntValue(FieldType.ColorType)];
            this.PnlAuthor.Visible = flagArray[this.GetEnumIntValue(FieldType.AuthorType)];
            this.PnlSource.Visible = flagArray[this.GetEnumIntValue(FieldType.SourceType)];
            this.PnlKeyword.Visible = flagArray[this.GetEnumIntValue(FieldType.KeywordType)];
            this.PnlOperatingSystem.Visible = flagArray[this.GetEnumIntValue(FieldType.OperatingType)];
            this.PnlVirtualLink.Visible = flagArray[this.GetEnumIntValue(FieldType.InfoType)];
            this.PnlDownServer.Visible = flagArray[this.GetEnumIntValue(FieldType.DownServerType)];
            this.PnlSpecial.Visible = flagArray[this.GetEnumIntValue(FieldType.SpecialType)];
            this.PnlProducer.Visible = flagArray[this.GetEnumIntValue(FieldType.Producer)];
            this.PnlTrademark.Visible = flagArray[this.GetEnumIntValue(FieldType.Trademark)];
            this.PnlContent.Visible = flagArray[this.GetEnumIntValue(FieldType.ContentType)];
            this.PnlTitle.Visible = flagArray[this.GetEnumIntValue(FieldType.TitleType)];
            this.PnlMultiplePhoto.Visible = flagArray[this.GetEnumIntValue(FieldType.MultiplePhotoType)];
            this.PnlProperty.Visible = flagArray[this.GetEnumIntValue(FieldType.Property)];
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -