Exemple #1
0
        public static bool Delete(int fieldID)
        {
            ContFieldInfo dataById  = ContField.GetDataById(fieldID);
            ContModelInfo dataById2 = ContModel.GetDataById(dataById.ModelID);

            if (BizBase.dbo.DeleteModel <ContFieldInfo>(dataById))
            {
                TableManager.DropTableColumn(dataById2.TableName, dataById.FieldName);
            }
            CacheUtils.Del("JsonLeeCMS_CacheForGetContModel");
            return(true);
        }
Exemple #2
0
        public static bool Update(ContFieldInfo field)
        {
            ContModelInfo cacheModelByID = ContModel.GetCacheModelByID(field.ModelID);
            ContFieldInfo dataById       = ContField.GetDataById(field.AutoID);
            bool          result;

            if (BizBase.dbo.UpdateModel <ContFieldInfo>(field))
            {
                if (!dataById.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(cacheModelByID.TableName, dataById.FieldName, field.FieldName, text, true, field.DefaultValue);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                CacheUtils.Del("JsonLeeCMS_CacheForGetContModel");
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }