Ejemplo n.º 1
0
        public static DataActionState Add(FieldInfo fieldInfo, int modelId)
        {
            DataActionState successed = DataActionState.Successed;

            if (FieldExists(modelId, fieldInfo.FieldName))
            {
                return(DataActionState.Exist);
            }
            if (((fieldInfo.FieldType == FieldType.FileType) && DataConverter.CBoolean(fieldInfo.Settings[3])) && !string.IsNullOrEmpty(fieldInfo.Settings[4]))
            {
                FieldInfo info = new FieldInfo();
                info.Id         = fieldInfo.Settings[4];
                info.FieldName  = fieldInfo.Settings[4];
                info.FieldType  = FieldType.TextType;
                info.FieldLevel = 2;
                info.OrderId    = 0;
                DataActionState state2 = Add(info, modelId);
                if (state2 != DataActionState.Successed)
                {
                    return(state2);
                }
            }
            if (!ModelManager.AddFieldToTable(fieldInfo, modelId))
            {
                successed = DataActionState.Unknown;
            }
            return(successed);
        }
Ejemplo n.º 2
0
        public static DataActionState Update(FieldInfo fieldInfo, int modelId)
        {
            DataActionState unknown = DataActionState.Unknown;

            if (fieldInfo.FieldType == FieldType.FileType)
            {
                FieldInfo fieldInfoByFieldName = GetFieldInfoByFieldName(modelId, fieldInfo.FieldName);
                if ((DataConverter.CBoolean(fieldInfoByFieldName.Settings[3]) && !DataConverter.CBoolean(fieldInfo.Settings[3])) && !string.IsNullOrEmpty(fieldInfo.Settings[4]))
                {
                    Delete(fieldInfo.Settings[4], modelId);
                }
                if ((!DataConverter.CBoolean(fieldInfoByFieldName.Settings[3]) && DataConverter.CBoolean(fieldInfo.Settings[3])) && !string.IsNullOrEmpty(fieldInfo.Settings[4]))
                {
                    FieldInfo info2 = new FieldInfo();
                    info2.Id         = fieldInfo.Settings[4];
                    info2.FieldName  = fieldInfo.Settings[4];
                    info2.FieldType  = FieldType.TextType;
                    info2.FieldLevel = 2;
                    info2.OrderId    = 0;
                    DataActionState state2 = Add(info2, modelId);
                    if (state2 != DataActionState.Successed)
                    {
                        return(state2);
                    }
                }
            }
            if (ModelManager.UpdateFieldOfTable(fieldInfo, modelId))
            {
                unknown = DataActionState.Successed;
            }
            return(unknown);
        }
Ejemplo n.º 3
0
        public static DataActionState Update(AdvertisementInfo advertisementInfo)
        {
            DataActionState unknown = DataActionState.Unknown;

            if (dal.Update(advertisementInfo))
            {
                unknown = DataActionState.Successed;
            }
            return(unknown);
        }
Ejemplo n.º 4
0
        public static DataActionState Update(ModelTemplatesInfo modelTemplatesInfo)
        {
            DataActionState unknown = DataActionState.Unknown;

            if (dal.Update(modelTemplatesInfo))
            {
                unknown = DataActionState.Successed;
            }
            return(unknown);
        }
Ejemplo n.º 5
0
        public static DataActionState Update(UserGroupsInfo userGroupsInfo)
        {
            DataActionState unknown = DataActionState.Unknown;

            if (!RolePermissions.AccessCheck(OperateCode.UserGroupManage))
            {
                throw new CustomException(PEExceptionType.ExceedAuthority);
            }
            if (dal.Update(userGroupsInfo))
            {
                unknown = DataActionState.Successed;
            }
            return(unknown);
        }
Ejemplo n.º 6
0
        public static DataActionState Add(ADZoneInfo adZoneInfo)
        {
            DataActionState unknown = DataActionState.Unknown;

            if (!dal.Add(adZoneInfo))
            {
                return(unknown);
            }
            if (adZoneInfo.Active)
            {
                CreateJS(adZoneInfo.ZoneId.ToString(CultureInfo.CurrentCulture));
            }
            return(DataActionState.Successed);
        }
Ejemplo n.º 7
0
        private void ShowMessage(DataActionState flag)
        {
            switch (flag)
            {
            case DataActionState.Successed:
                BasePage.ResponseRedirect("UserGroupPermissions.aspx?GroupID=" + this.m_groupId.ToString());
                return;

            case DataActionState.Exist:
                AdminPage.WriteErrMsg("<li>该会员组已经存在,请使用另一会员组名!</li>", "");
                return;

            case DataActionState.Unknown:
                AdminPage.WriteErrMsg("<li>会员组信息保存失败!</li>", "");
                return;
            }
        }
Ejemplo n.º 8
0
        public static DataActionState Add(UserGroupsInfo userGroupsInfo)
        {
            if (!RolePermissions.AccessCheck(OperateCode.UserGroupManage))
            {
                throw new CustomException(PEExceptionType.ExceedAuthority);
            }
            DataActionState unknown = DataActionState.Unknown;

            if (GroupNameIsExist(userGroupsInfo.GroupName))
            {
                return(DataActionState.Exist);
            }
            if (dal.Add(userGroupsInfo))
            {
                unknown = DataActionState.Successed;
            }
            return(unknown);
        }
Ejemplo n.º 9
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            UserGroupsInfo userGroupById;
            GroupType      type = (GroupType)Enum.Parse(typeof(GroupType), this.DropGropType.SelectedValue);

            if (this.HdnAction.Value == "Modify")
            {
                userGroupById = UserGroups.GetUserGroupById(DataConverter.CLng(this.HdnGroupId.Value));
            }
            else
            {
                userGroupById = new UserGroupsInfo();
            }
            userGroupById.GroupName   = this.TxtGroupName.Text;
            userGroupById.Description = this.TxtDescription.Text;
            userGroupById.GroupType   = type;
            DataActionState unknown = DataActionState.Unknown;

            if (this.Page.IsValid)
            {
                if (this.HdnAction.Value == "Modify")
                {
                    unknown = DataActionState.Exist;
                    if ((userGroupById.GroupName != this.HdnGroupName.Value) && UserGroups.GroupNameIsExist(userGroupById.GroupName))
                    {
                        this.ShowMessage(unknown);
                    }
                    unknown = UserGroups.Update(userGroupById);
                }
                else
                {
                    unknown        = UserGroups.Add(userGroupById);
                    this.m_groupId = userGroupById.GroupId;
                }
                this.ShowMessage(unknown);
            }
        }
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                DataActionState    unknown            = DataActionState.Unknown;
                ModelTemplatesInfo modelTemplatesInfo = new ModelTemplatesInfo();
                string             successMessage     = "";
                string             returnurl          = "ModelTemplateManage.aspx";
                modelTemplatesInfo.TemplateName        = this.TxtTemplateName.Text;
                modelTemplatesInfo.TemplateDescription = this.TxtTemplateDescription.Text;
                modelTemplatesInfo.IsEshop             = (ModelType)BasePage.RequestInt32("ModelType");
                string str3 = this.ViewState["action"].ToString();
                if (str3 != null)
                {
                    if (!(str3 == "Add"))
                    {
                        if (str3 == "Modify")
                        {
                            modelTemplatesInfo.TemplateId = DataConverter.CLng(this.HdnModelId.Value);
                            unknown        = EasyOne.CommonModel.ModelTemplate.Update(modelTemplatesInfo);
                            successMessage = "<li>修改模型模板操作成功!</li>";
                        }
                        else if (str3 == "AddModelToFieldTemplate")
                        {
                            ModelInfo modelInfoById = new ModelInfo();
                            modelInfoById            = ModelManager.GetModelInfoById(DataConverter.CLng(this.HdnModelId.Value));
                            modelTemplatesInfo.Field = modelInfoById.Field;
                            unknown        = EasyOne.CommonModel.ModelTemplate.Add(modelTemplatesInfo);
                            successMessage = "<li>保存到模型模板操作成功!</li>";
                            if (modelTemplatesInfo.IsEshop == ModelType.Content)
                            {
                                returnurl = "../Contents/ModelManage.aspx";
                            }
                            else
                            {
                                returnurl = "../Shop/ProductModelManage.aspx";
                            }
                        }
                    }
                    else
                    {
                        modelTemplatesInfo.Field = ModelManager.AddDefaultField();
                        unknown        = EasyOne.CommonModel.ModelTemplate.Add(modelTemplatesInfo);
                        successMessage = "<li>添加模型模板操作成功!</li>";
                    }
                }
                switch (unknown)
                {
                case DataActionState.Successed:
                    if (modelTemplatesInfo.IsEshop != ModelType.Shop)
                    {
                        returnurl = returnurl + "?ModelType=1";
                        break;
                    }
                    returnurl = returnurl + "?ModelType=2";
                    break;

                case DataActionState.Exist:
                    AdminPage.WriteErrMsg("<li>该模型下已经存在此字段,请指定其它的字段!</li>");
                    return;

                case DataActionState.Unknown:
                    AdminPage.WriteErrMsg("<li>模型模板操作失败!</li>");
                    return;

                default:
                    return;
                }
                AdminPage.WriteSuccessMsg(successMessage, returnurl);
            }
        }
Ejemplo n.º 11
0
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            if (!this.Page.IsValid)
            {
                return;
            }
            int modelId = BasePage.RequestInt32("ModelID");
            IList <FieldInfo> fieldList = EasyOne.CommonModel.Field.GetFieldList(modelId);
            int orderId = 0;

            foreach (FieldInfo info in fieldList)
            {
                if (info.OrderId > orderId)
                {
                    orderId = info.OrderId;
                }
            }
            orderId++;
            FieldInfo fieldInfo = new FieldInfo();

            fieldInfo.Id          = DataSecurity.FilterBadChar(this.TxtFieldName.Text.Trim());
            fieldInfo.FieldName   = DataSecurity.FilterBadChar(this.TxtFieldName.Text.Trim());
            fieldInfo.FieldAlias  = this.TxtFieldAliax.Text.Trim();
            fieldInfo.Description = this.TxtDescription.Text.Trim();
            fieldInfo.Tips        = this.TxtTips.Text;
            fieldInfo.EnableNull  = DataConverter.CBoolean(this.RadlEnableNull.SelectedValue);
            fieldInfo.FieldType   = (FieldType)Enum.Parse(typeof(FieldType), this.HdnFieldType.Value);
            fieldInfo.CopyToSettings(this.GetSettingsByFieldType((FieldType)Enum.Parse(typeof(FieldType), this.HdnFieldType.Value)));
            fieldInfo.OrderId  = orderId;
            fieldInfo.Disabled = false;
            fieldInfo.EnableShowOnSearchForm = DataConverter.CBoolean(this.RadlEnableShowOnSearchForm.SelectedValue);
            fieldInfo.DefaultValue           = this.GetDefaultValue((FieldType)Enum.Parse(typeof(FieldType), this.HdnFieldType.Value));
            DataActionState unknown = DataActionState.Unknown;
            string          str     = null;

            if ((fieldInfo.FieldType == FieldType.FileType) && DataConverter.CBoolean(fieldInfo.Settings[3]))
            {
                if (string.IsNullOrEmpty(fieldInfo.Settings[4]))
                {
                    AdminPage.WriteErrMsg("<li>记录文件大小字段名不能为空!</li>");
                }
                if (string.Compare(fieldInfo.Settings[4], fieldInfo.FieldName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    AdminPage.WriteErrMsg("<li>保存文件大小的字段名不能与主字段名重复!</li>");
                }
            }
            string str2 = this.ViewState["action"].ToString();

            if (str2 != null)
            {
                if (!(str2 == "Add"))
                {
                    if (str2 == "Copy")
                    {
                        fieldInfo.FieldLevel = 1;
                        unknown = EasyOne.CommonModel.Field.Add(fieldInfo, modelId);
                        str     = "复制";
                        goto Label_035A;
                    }
                }
                else
                {
                    str = "添加";
                    fieldInfo.FieldLevel = 1;
                    unknown = EasyOne.CommonModel.Field.Add(fieldInfo, modelId);
                    if (unknown == DataActionState.Successed)
                    {
                        UserPermissions.AddFieldPermission(this.EChkGroupList.SelectList(), modelId, fieldInfo.FieldName, OperateCode.ContentFieldInput, 1);
                        RolePermissions.AddFieldPermissionToRoles(this.EChkRoleList.SelectList(), modelId, fieldInfo.FieldName, OperateCode.ContentFieldInput);
                    }
                    goto Label_035A;
                }
            }
            str = "修改";
            fieldInfo.FieldLevel = DataConverter.CLng(this.HdnFieldLevel.Value);
            fieldInfo.OrderId    = DataConverter.CLng(this.HdnOrderId.Value);
            fieldInfo.Disabled   = DataConverter.CBoolean(this.HdnDisabled.Value);
            unknown = EasyOne.CommonModel.Field.Update(fieldInfo, modelId);
            if (unknown == DataActionState.Successed)
            {
                UserPermissions.AddFieldPermission(this.EChkGroupList.SelectList(), modelId, fieldInfo.FieldName, OperateCode.ContentFieldInput, 1);
                RolePermissions.AddFieldPermissionToRoles(this.EChkRoleList.SelectList(), modelId, fieldInfo.FieldName, OperateCode.ContentFieldInput);
            }
Label_035A:
            switch (unknown)
            {
            case DataActionState.Successed:
                AdminPage.WriteSuccessMsg("<li>字段" + str + "成功!</li>", string.Concat(new object[] { "FieldManage.aspx?ModelType=", BasePage.RequestInt32("ModelType").ToString(), "&ModelID=", modelId, "&ModelName=", HttpUtility.UrlEncode(this.m_ModelName) }));
                return;

            case DataActionState.Exist:
                AdminPage.WriteErrMsg("<li>该模型下已经存在此字段,请指定其它的字段!</li>");
                return;

            case DataActionState.Unknown:
                AdminPage.WriteErrMsg("<li>对不起,字段" + str + "失败!</li>");
                return;

            default:
                return;
            }
        }