///<summary> ///Get conditions by object with Multi-TokenType. ///</summary> public static ParameterCollection GetConditionsByObject(DO_Title.UO_Title parameterObj, bool isAnd, TokenTypes tokenTypes, Dictionary<DO_Title.Columns, TokenTypes> extTokens) { ParameterCollection objectConditions = new ParameterCollection(); TokenTypes tt = tokenTypes; ParameterType pt = isAnd ? ParameterType.And : ParameterType.Or; if (!string.IsNullOrEmpty(parameterObj.BigDateCode)) { objectConditions.AddCondition(pt, GetColumnTokenType(tt, DO_Title.Columns.BigDateCode, extTokens), DO_Title.Columns.BigDateCode, parameterObj.BigDateCode); } if (!string.IsNullOrEmpty(parameterObj.TitleCode)) { objectConditions.AddCondition(pt, GetColumnTokenType(tt, DO_Title.Columns.TitleCode, extTokens), DO_Title.Columns.TitleCode, parameterObj.TitleCode); } if (!string.IsNullOrEmpty(parameterObj.TitleName)) { objectConditions.AddCondition(pt, GetColumnTokenType(tt, DO_Title.Columns.TitleName, extTokens), DO_Title.Columns.TitleName, parameterObj.TitleName); } if (parameterObj.CreateOn != DateTime.MinValue) { objectConditions.AddCondition(pt, GetColumnTokenType(tt, DO_Title.Columns.CreateOn, extTokens), DO_Title.Columns.CreateOn, parameterObj.CreateOn); } if (!string.IsNullOrEmpty(parameterObj.CreateBy)) { objectConditions.AddCondition(pt, GetColumnTokenType(tt, DO_Title.Columns.CreateBy, extTokens), DO_Title.Columns.CreateBy, parameterObj.CreateBy); } if (parameterObj.UpdateOn != DateTime.MinValue) { objectConditions.AddCondition(pt, GetColumnTokenType(tt, DO_Title.Columns.UpdateOn, extTokens), DO_Title.Columns.UpdateOn, parameterObj.UpdateOn); } if (!string.IsNullOrEmpty(parameterObj.UpdateBy)) { objectConditions.AddCondition(pt, GetColumnTokenType(tt, DO_Title.Columns.UpdateBy, extTokens), DO_Title.Columns.UpdateBy, parameterObj.UpdateBy); } return objectConditions; }
///<summary> ///Get all records count. ///</summary> public static int GetAllRecordsCount() { DO_Title da = new DO_Title(); return da.GetRecordsCount(); }
///<summary> ///Delete object by primary key(with transation). ///</summary> public static int Delete(string BigDateCode, string TitleCode, IDbConnection connection, IDbTransaction transaction) { DO_Title da = new DO_Title(); return da.Delete(connection, transaction, GetConditionsByPrimaryKey(BigDateCode, TitleCode)); }
///<summary> ///Get all records. ///</summary> public static DO_Title.UOList_Title GetAllList() { DO_Title da = new DO_Title(); return da.GetAllList(); }
///<summary> ///Get the tokenType of the column of condition query. ///</summary> private static TokenTypes GetColumnTokenType(TokenTypes defaultTokenType, DO_Title.Columns column, Dictionary<DO_Title.Columns, TokenTypes> extTokens) { if (extTokens != null && extTokens.ContainsKey(column)) return extTokens[column]; else return defaultTokenType; }
///<summary> ///Delete object by primary key. ///</summary> public static int Delete(string BigDateCode, string TitleCode) { DO_Title da = new DO_Title(); return da.Delete(GetConditionsByPrimaryKey(BigDateCode, TitleCode)); }
///<summary> ///Update object by primary key. ///</summary> public static bool UpdateObject(DO_Title.UO_Title obj, string BigDateCode, string TitleCode) { return obj.Update(GetConditionsByPrimaryKey(BigDateCode, TitleCode)) > 0; }
///<summary> ///Update object by primary key(with transation). ///</summary> public static bool UpdateObject(DO_Title.UO_Title obj, string BigDateCode, string TitleCode, IDbConnection connection, IDbTransaction transaction) { return obj.Update(connection, transaction, GetConditionsByPrimaryKey(BigDateCode, TitleCode)) > 0; }
///<summary> ///Get records count. ///</summary> public static int GetRecordsCount(DO_Title.UO_Title parameterObj) { return GetRecordsCount(parameterObj, true, TokenTypes.Equal, null); }
///<summary> ///Get records count. ///</summary> public static int GetRecordsCount(DO_Title.UO_Title parameterObj, bool isAnd, TokenTypes tokenTypes, Dictionary<DO_Title.Columns, TokenTypes> extTokens) { DO_Title da = new DO_Title(); return da.GetRecordsCount(GetConditionsByObject(parameterObj, isAnd, tokenTypes, extTokens)); }
///<summary> ///Get paging list. ///</summary> public static PagingResult<DO_Title.UO_Title, DO_Title.UOList_Title> GetPagingList(DO_Title.UO_Title parameterObj, int pageNumber, int pageSize, string sortBy, bool isAsc) { return parameterObj.GetPagingList(GetConditionsByObject(parameterObj, true, TokenTypes.Like, null), pageNumber, pageSize, sortBy, isAsc); }
///<summary> ///Get paging list. ///</summary> public static PagingResult<DO_Title.UO_Title, DO_Title.UOList_Title> GetPagingList(DO_Title.UO_Title parameterObj, int pageNumber, int pageSize, string sortBy, bool isAsc, bool isAnd, TokenTypes tokenTypes, Dictionary<DO_Title.Columns, TokenTypes> extTokens) { return parameterObj.GetPagingList(GetConditionsByObject(parameterObj, isAnd, tokenTypes, extTokens), pageNumber, pageSize, sortBy, isAsc); }
///<summary> ///Get object by primary key. ///</summary> public static DO_Title.UO_Title GetObject(string BigDateCode, string TitleCode) { DO_Title da = new DO_Title(); DO_Title.UOList_Title l = da.GetList(GetConditionsByPrimaryKey(BigDateCode, TitleCode)); return l.Count > 0 ? l[0] : null; }
///<summary> ///Get list by object. ///</summary> public static DO_Title.UOList_Title GetList(DO_Title.UO_Title parameterObj) { return GetList(parameterObj, true, TokenTypes.Equal, null); }
///<summary> ///Get list by object. ///</summary> public static DO_Title.UOList_Title GetList(DO_Title.UO_Title parameterObj, bool isAnd, TokenTypes tokenTypes, Dictionary<DO_Title.Columns, TokenTypes> extTokens) { return parameterObj.GetList(GetConditionsByObject(parameterObj, isAnd, tokenTypes, extTokens)); }