Ejemplo n.º 1
0
        public static bool Delete(int fieldID)
        {
            UserFieldInfo dataById  = UserField.GetDataById(fieldID);
            UserGroupInfo dataById2 = UserGroup.GetDataById(dataById.UserGroupID);

            if (BizBase.dbo.DeleteModel <UserFieldInfo>(dataById))
            {
                TableManager.DropTableColumn(dataById2.TableName, dataById.FieldName);
            }
            CacheUtils.Del("JsonLeeCMS_CacheForGetUserGroup");
            return(true);
        }
Ejemplo n.º 2
0
        public static bool Update(UserFieldInfo field)
        {
            UserGroupInfo dataById  = UserGroup.GetDataById(field.UserGroupID);
            UserFieldInfo dataById2 = UserField.GetDataById(field.AutoID);
            bool          result;

            if (BizBase.dbo.UpdateModel <UserFieldInfo>(field))
            {
                if (!dataById2.IsSystem)
                {
                    try
                    {
                        string text = field.DataType;
                        if (string.Compare(text, "nvarchar", true) == 0)
                        {
                            object obj = text;
                            text = string.Concat(new object[]
                            {
                                obj,
                                "(",
                                field.DataLength,
                                ")"
                            });
                        }
                        TableManager.AlterTableColumn(dataById.TableName, dataById2.FieldName, field.FieldName, text, true, field.DefaultValue);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                CacheUtils.Del("JsonLeeCMS_CacheForGetUserGroup");
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }