public static DataSet GetPagerData(int intPageSize, int intCurrentPageIndex) { int num = 0; int num2 = 0; return(ContField.GetPagerData(intPageSize, intCurrentPageIndex, ref num, ref num2)); }
public static IList <ContFieldInfo> GetCustomFieldListByModelID(int modelID) { IList <ContFieldInfo> list = BizBase.dbo.GetList <ContFieldInfo>(" SELECT * FROM cms_ContField WHERE ModelID=" + modelID + " AND IsSystem=0 "); list.Add(ContField.GetExistsFieldInfo()); return(list); }
public static ModelDeleteStatus Delete(int modelID) { ContModelInfo cacheModelByID = ContModel.GetCacheModelByID(modelID); ModelDeleteStatus result; if (cacheModelByID == null) { result = ModelDeleteStatus.ModelNotExists; } else { int num = ContModel.IsModelRefing(modelID); if (num > 0) { result = (ModelDeleteStatus)num; } else if (BizBase.dbo.DeleteModel <ContModelInfo>(cacheModelByID)) { ContField.DeleteByModelID(modelID); BizBase.dbo.ExecSQL(" DROP TABLE " + cacheModelByID.TableName); CacheUtils.Del("JsonLeeCMS_CacheForGetContModel"); result = ModelDeleteStatus.Success; } else { CacheUtils.Del("JsonLeeCMS_CacheForGetContModel"); result = ModelDeleteStatus.Error; } } return(result); }
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); }
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); }
public static IList <ContFieldInfo> GetFieldListWithValue(int intContID, int intModelID, string strTableName) { IList <ContFieldInfo> fieldListByModelID = ContField.GetFieldListByModelID(intModelID, true); IList <ContFieldInfo> usingFieldList = ContField.GetUsingFieldList(intModelID); DataTable contentById = Content.GetContentById(intContID, strTableName, (List <ContFieldInfo>)usingFieldList); if (contentById.Rows.Count == 1) { foreach (ContFieldInfo current in fieldListByModelID) { if (contentById.Columns.Contains(current.FieldName)) { current.Value = contentById.Rows[0][current.FieldName].ToString(); } else { current.Value = current.DefaultValue; } } } return(fieldListByModelID); }
public static bool DeleteByModelID(int modelID) { bool result; if (modelID <= 0) { result = false; } else { IList <ContFieldInfo> fieldListByModelID = ContField.GetFieldListByModelID(modelID); bool flag = BizBase.dbo.ExecSQL(" DELETE FROM cms_ContField WHERE ModelID=" + modelID); if (flag) { CacheUtils.Del("JsonLeeCMS_CacheForGetContModel"); result = true; } else { result = false; } } return(result); }
public static DataSet GetPagerData(string strCondition, int intPageSize, int intCurrentPageIndex, ref int intTotalCount, ref int intTotalPage) { return(ContField.GetPagerData("*", strCondition, intPageSize, intCurrentPageIndex, ref intTotalCount, ref intTotalPage)); }
public static bool CopyContent(int intContID) { ContentInfo dataById = Content.GetDataById(intContID); bool result; if (dataById != null) { ContModelInfo cacheModelByID = ContModel.GetCacheModelByID(dataById.ModelID); string strSQL = string.Concat(new object[] { "INSERT INTO cms_Content ( NodeID, NodeName, ModelID, TableName, Title, SubTitle, Summary, Author, Editor, Source, SourceUrl, Content, Attachment, TagKey, ContentImage, SeoKey, SeoDescription, Lang, Inputer, Sort, Status, AutoTimeStamp ) SELECT NodeID, NodeName, ModelID, TableName, '复制:'+Title, SubTitle, Summary, Author, Editor, Source, SourceUrl, Content, Attachment, TagKey, ContentImage, SeoKey, SeoDescription, Lang, '", Account.GetLoginAccount().AccountName, "', (SELECT MAX(Sort)+1 FROM cms_Content) AS CurrSort, 0, getdate() FROM cms_Content WHERE AutoID=", intContID, ";if @@rowcount>0 select @@IDENTITY" }); object @object = BizBase.dbo.GetObject(strSQL); int num = (@object == null) ? 0 : Convert.ToInt32(@object); if (num > 0) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(" INSERT INTO " + dataById.TableName + " ( "); IList <ContFieldInfo> customFieldListByModelID = ContField.GetCustomFieldListByModelID(cacheModelByID.AutoID); for (int i = 0; i < customFieldListByModelID.Count; i++) { if (customFieldListByModelID[i].FieldName != "AutoID") { if (i == customFieldListByModelID.Count - 1) { stringBuilder.Append(customFieldListByModelID[i].FieldName); } else { stringBuilder.Append(customFieldListByModelID[i].FieldName + ","); } } } stringBuilder.Append(" ) "); stringBuilder.Append(" SELECT "); for (int i = 0; i < customFieldListByModelID.Count; i++) { if (customFieldListByModelID[i].FieldName != "AutoID") { if (i == customFieldListByModelID.Count - 1) { if (customFieldListByModelID[i].FieldName.Equals("ContID")) { stringBuilder.Append(num.ToString()); } else { stringBuilder.Append(customFieldListByModelID[i].FieldName); } } else if (customFieldListByModelID[i].FieldName.Equals("ContID")) { stringBuilder.Append(num.ToString() + ","); } else { stringBuilder.Append(customFieldListByModelID[i].FieldName + ","); } } } stringBuilder.Append(string.Concat(new object[] { " FROM ", dataById.TableName, " WHERE ContID=", dataById.AutoID })); result = BizBase.dbo.ExecSQL(stringBuilder.ToString()); return(result); } } result = false; return(result); }
public static bool UpdateContent(ContentInfo content, Dictionary <string, ContFieldInfo> dicField) { bool result; if (content == null) { result = false; } else { ContModelInfo cacheModelByID = ContModel.GetCacheModelByID(content.ModelID); if (cacheModelByID == null) { result = false; } else { content.Title = Content.GetStringFromDic("Title", dicField); if (string.IsNullOrEmpty(content.Title)) { content.Title = "默认的标题"; } content.SubTitle = Content.GetStringFromDic("SubTitle", dicField); content.Summary = Content.GetStringFromDic("Summary", dicField); content.Author = Content.GetStringFromDic("Author", dicField); content.Editor = Content.GetStringFromDic("Editor", dicField); content.Source = Content.GetStringFromDic("Source", dicField); content.SourceUrl = Content.GetStringFromDic("SourceUrl", dicField); content.Content = Content.GetStringFromDic("Content", dicField); content.TagKey = Content.GetStringFromDic("TagKey", dicField); content.ContentImage = Content.GetStringFromDic("ContentImage", dicField); content.Attachment = Content.GetStringFromDic("Attachment", dicField); content.RelateContent = Content.GetStringFromDic("RelateContent", dicField); content.SeoKey = Content.GetStringFromDic("SeoKey", dicField); content.SeoDescription = Content.GetStringFromDic("SeoDescription", dicField); content.IsTop = Content.GetBoolFromDic("IsTop", dicField, false); content.IsRecommend = Content.GetBoolFromDic("IsRecommend", dicField, false); content.IsNew = Content.GetBoolFromDic("IsNew", dicField, false); content.TemplateFile = Content.GetStringFromDic("TemplateFile", dicField); content.Hit = Content.GetIntFromDic("Hit", dicField, 0); content.Sort = Content.GetIntFromDic("Sort", dicField, 999); content.AutoTimeStamp = Content.GetDateTimeFromDic("AutoTimeStamp", dicField, new DateTime(1900, 1, 1)); Content.Update(content); IList <ContFieldInfo> customFieldListByModelID = ContField.GetCustomFieldListByModelID(content.ModelID); foreach (ContFieldInfo current in customFieldListByModelID) { if (current.FieldName == "ContID") { current.Value = content.AutoID.ToString(); } else { current.Value = Content.GetStringFromDic(current.FieldName, dicField); } } if (Content.ExistsCustomTableData(cacheModelByID.TableName, content.AutoID)) { Content.UpdateCustomContent(content.AutoID, content.TableName, customFieldListByModelID); } else { Content.AddCustomContent(cacheModelByID, customFieldListByModelID); } result = true; } } return(result); }
public static int Add(ContentInfo content, Dictionary <string, ContFieldInfo> dicField) { NodeInfo cacheNodeById = Node.GetCacheNodeById(content.NodeID); int result; if (cacheNodeById == null) { result = 0; } else { ContModelInfo cacheModelByID = ContModel.GetCacheModelByID(cacheNodeById.ModelID); if (cacheModelByID == null) { result = 0; } else { content.NodeName = cacheNodeById.NodeName; content.ModelID = cacheModelByID.AutoID; content.TableName = cacheModelByID.TableName; content.Title = Content.GetStringFromDic("Title", dicField); if (string.IsNullOrEmpty(content.Title)) { content.Title = "默认的标题"; } content.SubTitle = Content.GetStringFromDic("SubTitle", dicField); content.Summary = Content.GetStringFromDic("Summary", dicField); content.Author = Content.GetStringFromDic("Author", dicField); content.Editor = Content.GetStringFromDic("Editor", dicField); content.Source = Content.GetStringFromDic("Source", dicField); content.SourceUrl = Content.GetStringFromDic("SourceUrl", dicField); content.Content = Content.GetStringFromDic("Content", dicField); content.TagKey = Content.GetStringFromDic("TagKey", dicField); content.ContentImage = Content.GetStringFromDic("ContentImage", dicField); content.Attachment = Content.GetStringFromDic("Attachment", dicField); content.RelateContent = Content.GetStringFromDic("RelateContent", dicField); content.SeoKey = Content.GetStringFromDic("SeoKey", dicField); content.SeoDescription = Content.GetStringFromDic("SeoDescription", dicField); content.IsTop = Content.GetBoolFromDic("IsTop", dicField, false); content.IsRecommend = Content.GetBoolFromDic("IsRecommend", dicField, false); content.IsNew = Content.GetBoolFromDic("IsNew", dicField, false); content.TemplateFile = Content.GetStringFromDic("TemplateFile", dicField); content.Hit = Content.GetIntFromDic("Hit", dicField, 0); content.Sort = Content.GetIntFromDic("Sort", dicField, 999); content.Inputer = Account.GetLoginAccount().AccountName; content.Lang = JObject.cultureLang; if (dicField.ContainsKey("AutoTimeStamp")) { content.AutoTimeStamp = Content.GetDateTimeFromDic("AutoTimeStamp", dicField, DateTime.Now); } else { content.AutoTimeStamp = DateTime.Now; } int num = Content.Add(content); IList <ContFieldInfo> customFieldListByModelID = ContField.GetCustomFieldListByModelID(cacheModelByID.AutoID); foreach (ContFieldInfo current in customFieldListByModelID) { if (current.FieldName == "ContID") { current.Value = num.ToString(); } else { current.Value = Content.GetStringFromDic(current.FieldName, dicField); } } Content.AddCustomContent(cacheModelByID, customFieldListByModelID); result = num; } } return(result); }
public static IList <ContFieldInfo> GetPagerList(int intCurrentPageIndex, int intPageSize, ref int intTotalCount, ref int intTotalPage) { return(ContField.GetPagerList("", "Sort ASC,AutoID DESC", intCurrentPageIndex, intPageSize, ref intTotalCount, ref intTotalPage)); }
public static DataSet GetPagerData(string strFilter, string strCondition, int intPageSize, int intCurrentPageIndex, ref int intTotalCount, ref int intTotalPage) { return(ContField.GetPagerData(strFilter, strCondition, " Sort asc,AutoID desc ", intPageSize, intCurrentPageIndex, ref intTotalCount, ref intTotalPage)); }
public static IList <ContFieldInfo> GetUsingFieldList(int modelID) { return(ContField.GetFieldListByModelID(modelID, true)); }
public static IList <ContFieldInfo> GetList(int intTopCount, string strCondition) { string strSort = " Sort asc,AutoID desc "; return(ContField.GetList(intTopCount, strCondition, strSort)); }
public static IList <ContFieldInfo> GetTopNList(int intTopCount, string strSort) { return(ContField.GetList(intTopCount, string.Empty, strSort)); }
public static IList <ContFieldInfo> GetAllList() { return(ContField.GetList(0, string.Empty)); }
public static ContFieldInfo GetTopData() { return(ContField.GetTopData(" Sort ASC,AutoID desc ")); }