/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Base.CacheStore.Model.CacheSetting model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update CacheSetting set "); strSql.Append("SetKey=@SetKey, SetText=@SetText, CreateDate=@CreateDate, Remark=@Remark "); strSql.Append(" where Id=@Id "); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); if (model.Id == null) { h.AddParameter("@Id", DBNull.Value); } else { h.AddParameter("@Id", model.Id); } if (model.SetKey == null) { h.AddParameter("@SetKey", DBNull.Value); } else { h.AddParameter("@SetKey", model.SetKey); } if (model.SetText == null) { h.AddParameter("@SetText", DBNull.Value); } else { h.AddParameter("@SetText", model.SetText); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } return(h.ExecuteNonQuery()); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Assist.Logger.Model.SqlserverLog model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update SqlserverLog set "); strSql.Append("Date=@Date, Level=@Level, Logger=@Logger, Message=@Message "); strSql.Append(" where id=@id "); IDbHelper h = DbHelper.GetDbHelper(SqlType.SqlServer, GlobalHelp.Connection); h.CreateCommand(strSql.ToString()); if (model.id == null) { h.AddParameter("@id", DBNull.Value); } else { h.AddParameter("@id", model.id); } if (model.Date == null) { h.AddParameter("@Date", DBNull.Value); } else { h.AddParameter("@Date", model.Date); } if (model.Level == null) { h.AddParameter("@Level", DBNull.Value); } else { h.AddParameter("@Level", model.Level); } if (model.Logger == null) { h.AddParameter("@Logger", DBNull.Value); } else { h.AddParameter("@Logger", model.Logger); } if (model.Message == null) { h.AddParameter("@Message", DBNull.Value); } else { h.AddParameter("@Message", model.Message); } return(h.ExecuteNonQuery()); }
/// <summary>执行查询 /// /// </summary> /// <returns>返回实体对象</returns> public List <T> ToList2() { if (dbHelper != null) { dbHelper.CreateCommand(this.Sql); foreach (var item in this.DbParams) { dbHelper.AddParameter(item.Key, item.Value); } return(MappingUntilTool.DataReaderToList <T>(typeof(T), dbHelper.ExecuteReader(), "*")); } return(null); }
/// <summary>增加一条数据 /// /// </summary> public int Add(Exception objectEx, string Logger) { Nikita.Assist.Logger.Model.SqlserverLog model = new Nikita.Assist.Logger.Model.SqlserverLog(); model.Date = DateTime.Now; model.Logger = Logger; model.Message = objectEx.ToString(); model.Level = 1; StringBuilder strSql = new StringBuilder(); strSql.Append("insert into SqlserverLog("); strSql.Append("Date, Level, Logger, Message )"); strSql.Append(" values ("); strSql.Append("@Date, @Level, @Logger, @Message )"); strSql.Append(";select @@IDENTITY"); IDbHelper h = DbHelper.GetDbHelper(SqlType.SqlServer, GlobalHelp.Connection); h.CreateCommand(strSql.ToString()); if (model.Date == null) { h.AddParameter("@Date", DBNull.Value); } else { h.AddParameter("@Date", model.Date); } if (model.Level == null) { h.AddParameter("@Level", DBNull.Value); } else { h.AddParameter("@Level", model.Level); } if (model.Logger == null) { h.AddParameter("@Logger", DBNull.Value); } else { h.AddParameter("@Logger", model.Logger); } if (model.Message == null) { h.AddParameter("@Message", DBNull.Value); } else { h.AddParameter("@Message", model.Message); } int result; string obj = h.ExecuteScalar(); if (!int.TryParse(obj, out result)) { return(0); } return(result); }
/// <summary>删除一条数据 /// /// </summary> public bool Delete(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from CacheConfig "); strSql.Append(" where Id=@Id "); IDbHelper h = GlobalHelp.GetDataAccessHelper(); #region 缓存配置行 h.CreateCommand("select * from CacheConfig where id =" + Id + ""); DataTable dt = h.ExecuteQuery(); dt.TableName = "CacheConfig"; #endregion h.CreateCommand(strSql.ToString()); h.AddParameter("@Id", Id); bool blnReturn = h.ExecuteNonQuery(); if (blnReturn) { #region 修改缓存配置:如果是则需要推送更新缓存的消息。即是发消息告诉服务端我修改了缓存配置,让服务端统一向所有在线客户端发送更新缓存消息 string strCacheTableName = dt.Rows[0]["CacheTableName"].ToString(); CacheMessageEntity messageEntity = new CacheMessageEntity { CacheKey = strCacheTableName, Operation = "Delete", DataTableCache = dt }; CacheListener.AddMessage(messageEntity); #endregion } return(blnReturn); }
public Trip GetDriverCurrentTrip(int LoginID) { dbHelper.CreateCommand("getcurrenttripbydriver", System.Data.CommandType.StoredProcedure); dbHelper.AddParameter("currID", LoginID); DataSet ds = dbHelper.ExecuteDataSet(); return(DataMapper.ConvertTripFromDataSet(ds)); }
/// <summary>增加一条数据 /// /// </summary> public int Add(Nikita.Base.CacheStore.Model.CacheSetting model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into CacheSetting("); strSql.Append("SetKey, SetText, CreateDate, Remark )"); strSql.Append(" values ("); strSql.Append("@SetKey, @SetText, @CreateDate, @Remark )"); strSql.Append(";select @@IDENTITY"); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); if (model.SetKey == null) { h.AddParameter("@SetKey", DBNull.Value); } else { h.AddParameter("@SetKey", model.SetKey); } if (model.SetText == null) { h.AddParameter("@SetText", DBNull.Value); } else { h.AddParameter("@SetText", model.SetText); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } int intResult; string obj = h.ExecuteScalar(); if (!int.TryParse(obj, out intResult)) { return(0); } return(intResult); }
/// <summary>删除一条数据 /// /// </summary> public bool Delete(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from SqlserverLog "); strSql.Append(" where id=@id "); IDbHelper h = DbHelper.GetDbHelper(SqlType.SqlServer, GlobalHelp.Connection); h.CreateCommand(strSql.ToString()); h.AddParameter("@id", id); return(h.ExecuteNonQuery()); }
/// <summary>删除一条数据 /// /// </summary> public bool Delete(int ModuleID) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from BseModule "); strSql.Append(" where ModuleID=@ModuleID "); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); h.AddParameter("@ModuleID", ModuleID); return(h.ExecuteNonQuery()); }
/// <summary>删除一条数据 /// /// </summary> public bool Delete(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from CacheSetting "); strSql.Append(" where Id=@Id "); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); h.AddParameter("@Id", Id); return(h.ExecuteNonQuery()); }
public static DataTable GetColumnByTbName(string tbName, string strConn) { IDbHelper helper = DbHelper.GetDbHelper(SqlType.SqlServer, strConn); //MSSQLHelper helper = new MSSQLHelper(strConn); const string strSql = " SELECT 字段名 = a.name, 主键 = CASE WHEN EXISTS ( SELECT 1 FROM sysobjects WHERE xtype='PK' AND parent_obj=a.id AND name IN ( SELECT name FROM sysindexes WHERE indid IN ( SELECT indid FROM sysindexkeys WHERE id=a.id AND colid=a.colid)) ) THEN '√' ELSE '' END,类型 = b.name,允许空 = CASE WHEN a.isnullable=1 THEN '√' ELSE '' END,默认值 = ISNULL(e.text,''), 字段说明 = ISNULL(g.value,''), 标识 = CASE WHEN COLUMNPROPERTY(a.id,a.name,'IsIdentity')=1 THEN '√' ELSE '' END,字段序号 = a.colorder,长度 = COLUMNPROPERTY(a.id,a.name,'PRECISION'), 小数位数 = ISNULL(COLUMNPROPERTY(a.id,a.name,'Scale'),0)FROM syscolumns a LEFT JOIN systypes b ON a.xusertype=b.xusertype INNER JOIN sysobjects d ON a.id=d.id AND d.xtype='U' AND d.name<>'dtproperties' AND d.name<>'sysdiagrams'LEFT JOIN syscomments e ON a.cdefault=e.id LEFT JOIN sys.extended_properties g ON a.id=G.major_id AND a.colid=g.minor_id LEFT JOIN sys.extended_properties f ON d.id=f.major_id AND f.minor_id=0 WHERE d.name=@name ORDER BY a.id,a.colorder"; helper.CreateCommand(strSql); helper.AddParameter("@name", tbName); DataTable dt = helper.ExecuteQuery(); return(dt); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Base.CacheStore.Model.CacheTables model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update CacheTables set "); strSql.Append("TableName=@TableName, Remark=@Remark, Status=@Status "); strSql.Append(" where Id=@Id "); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); if (model.Id == null) { h.AddParameter("@Id", DBNull.Value); } else { h.AddParameter("@Id", model.Id); } if (model.TableName == null) { h.AddParameter("@TableName", DBNull.Value); } else { h.AddParameter("@TableName", model.TableName); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } if (model.Status == null) { h.AddParameter("@Status", DBNull.Value); } else { h.AddParameter("@Status", model.Status); } return(h.ExecuteNonQuery()); }
/// <summary>生成主键 /// /// </summary> /// <param name="dbType">数据库类型</param> /// <param name="strTableName">表名</param> /// <param name="strConn">IDBuilder数据库连接字符串</param> /// <returns>组件</returns> public long GetNewID(SqlType dbType, string strTableName, string strConn) { long lngNewId = 0; IDbHelper dbHelper = DbHelper.GetDbHelper(dbType, strConn); if (dbType == SqlType.MySql || dbType == SqlType.SqlServer) { dbHelper.CreateStoredCommand("Get_TableKey"); dbHelper.AddParameter("@TableName", strTableName); lngNewId = long.Parse(dbHelper.ExecuteScalar()); } else if (dbType == SqlType.SQLite) { } return(lngNewId); }
/// <summary>分页获取数据列表 /// /// </summary> public DataSet GetList(string fileds, string order, string ordertype, int PageSize, int PageIndex, string strWhere) { IDbHelper h = DbHelper.GetDbHelper(SqlType.SqlServer, GlobalHelp.Connection); h.CreateStoredCommand("[proc_SplitPage]"); h.AddParameter("@tblName", "SqlserverLog"); h.AddParameter("@strFields", fileds); h.AddParameter("@strOrder", order); h.AddParameter("@strOrderType", ordertype); h.AddParameter("@PageSize", PageSize); h.AddParameter("@PageIndex", PageIndex); h.AddParameter("@strWhere", strWhere); DataTable dt = h.ExecuteQuery(); DataSet ds = new DataSet(); ds.Tables.Add(dt); return(ds); }
/// <summary>分页获取数据列表 /// /// </summary> public DataSet GetList(string strFileds, string strOrder, string strOrderType, int intPageSize, int intPageIndex, string strWhere) { IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateStoredCommand("[proc_SplitPage]"); h.AddParameter("@tblName", "CacheSetting"); h.AddParameter("@strFields", strFileds); h.AddParameter("@strOrder", strOrder); h.AddParameter("@strOrderType", strOrderType); h.AddParameter("@PageSize", intPageSize); h.AddParameter("@PageIndex", intPageIndex); h.AddParameter("@strWhere", strWhere); DataTable dt = h.ExecuteQuery(); DataSet ds = new DataSet(); ds.Tables.Add(dt); return(ds); }
/// <summary>得到一个对象实体 /// /// </summary> public Nikita.Base.CacheStore.Model.CacheSetting GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from CacheSetting "); strSql.Append(" where Id=@Id "); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); h.AddParameter("@Id", Id); Nikita.Base.CacheStore.Model.CacheSetting model = null; using (IDataReader dataReader = h.ExecuteReader()) { if (dataReader.Read()) { model = ReaderBind(dataReader); } h.CloseConn(); } return(model); }
/// <summary>得到一个对象实体 /// /// </summary> public Nikita.Platform.BugClose.Model.BseProjectVersion GetModel(int VersionID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from BseProjectVersion "); strSql.Append(" where VersionID=@VersionID "); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); h.AddParameter("@VersionID", VersionID); Nikita.Platform.BugClose.Model.BseProjectVersion model = null; using (IDataReader dataReader = h.ExecuteReader()) { if (dataReader.Read()) { model = ReaderBind(dataReader); } h.CloseConn(); } return(model); }
/// <summary>得到一个对象实体 /// /// </summary> public Nikita.Platform.BugClose.Model.BseDictionary GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from BseDictionary "); strSql.Append(" where Id=@Id "); IDbHelper h = GlobalHelp.GetDataAccessHelper();; h.CreateCommand(strSql.ToString()); h.AddParameter("@Id", Id); Nikita.Platform.BugClose.Model.BseDictionary model = null; using (IDataReader dataReader = h.ExecuteReader()) { if (dataReader.Read()) { model = ReaderBind(dataReader); } h.CloseConn(); } return(model); }
/// <summary>得到一个对象实体 /// /// </summary> public Nikita.Assist.Logger.Model.SqlserverLog GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from SqlserverLog "); strSql.Append(" where id=@id "); IDbHelper h = DbHelper.GetDbHelper(SqlType.SqlServer, GlobalHelp.Connection); h.CreateCommand(strSql.ToString()); h.AddParameter("@id", id); Nikita.Assist.Logger.Model.SqlserverLog model = null; using (IDataReader dataReader = h.ExecuteReader()) { if (dataReader.Read()) { model = ReaderBind(dataReader); } h.CloseConn(); } return(model); }
/// <summary>增加一条数据 /// /// </summary> public int Add(Nikita.Base.CacheStore.Model.CacheTables model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into CacheTables("); strSql.Append("TableName, Remark, Status )"); strSql.Append(" values ("); strSql.Append("@TableName, @Remark, @Status )"); strSql.Append(";select @@IDENTITY"); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); if (model.TableName == null) { h.AddParameter("@TableName", DBNull.Value); } else { h.AddParameter("@TableName", model.TableName); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } if (model.Status == null) { h.AddParameter("@Status", DBNull.Value); } else { h.AddParameter("@Status", model.Status); } int intResult; string obj = h.ExecuteScalar(); if (!int.TryParse(obj, out intResult)) { return(0); } return(intResult); }
/// <summary>分页获取数据列表 /// /// </summary> public List <Nikita.Base.CacheStore.Model.CacheSetting> GetListArray(string strFileds, string strOrder, string strOrderType, int intPageSize, int intPageIndex, string strWhere) { IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateStoredCommand("[proc_SplitPage]"); h.AddParameter("@tblName", "CacheSetting"); h.AddParameter("@strFields", strFileds); h.AddParameter("@strOrder", strOrder); h.AddParameter("@strOrderType", strOrderType); h.AddParameter("@PageSize", intPageSize); h.AddParameter("@PageIndex", intPageIndex); h.AddParameter("@strWhere", strWhere); List <Nikita.Base.CacheStore.Model.CacheSetting> list = new List <Nikita.Base.CacheStore.Model.CacheSetting>(); using (IDataReader dataReader = h.ExecuteReader()) { while (dataReader.Read()) { list.Add(ReaderBind(dataReader)); } h.CloseConn(); } return(list); }
/// <summary>分页获取数据列表 /// /// </summary> public List <Nikita.Assist.Logger.Model.SqlserverLog> GetListArray(string fileds, string order, string ordertype, int PageSize, int PageIndex, string strWhere) { IDbHelper h = DbHelper.GetDbHelper(SqlType.SqlServer, GlobalHelp.Connection); h.CreateStoredCommand("[proc_SplitPage]"); h.AddParameter("@tblName", "SqlserverLog"); h.AddParameter("@strFields", fileds); h.AddParameter("@strOrder", order); h.AddParameter("@strOrderType", ordertype); h.AddParameter("@PageSize", PageSize); h.AddParameter("@PageIndex", PageIndex); h.AddParameter("@strWhere", strWhere); List <Nikita.Assist.Logger.Model.SqlserverLog> list = new List <Nikita.Assist.Logger.Model.SqlserverLog>(); using (IDataReader dataReader = h.ExecuteReader()) { while (dataReader.Read()) { list.Add(ReaderBind(dataReader)); } h.CloseConn(); } return(list); }
/// <summary>获取业务单据 /// /// </summary> /// <param name="dbType">数据库类型</param> /// <param name="strType">单据前缀:如:'ORD'等</param> /// <param name="strTableName">表名</param> /// <param name="strTableField">字段名</param> /// <param name="strPreficLength">单据流水长度,如果一天可以产生1000张,则长度为4</param> /// <param name="blnDt">是否需要日期,格式20151227</param> /// <param name="intFyId">公司ID</param> /// <param name="strConn">IDBuilder数据库连接字符串</param> /// <returns>单据流水号</returns> public string GetSeriesNumber(SqlType dbType, string strType, string strTableName, string strTableField, string strPreficLength, bool blnDt, int intFyId, string strConn) { IDbHelper dbHelper = DbHelper.GetDbHelper(dbType, strConn); string strSeriesNumber = string.Empty; if (dbType == SqlType.MySql || dbType == SqlType.SqlServer) { dbHelper.CreateStoredCommand("Get_Sys_Series_Number"); dbHelper.AddParameter("@strType", strType); dbHelper.AddParameter("@TableName", strTableName); dbHelper.AddParameter("@TableField ", strTableField); dbHelper.AddParameter("@preficLength", strPreficLength); dbHelper.AddParameter("@BlnDt", blnDt); dbHelper.AddParameter("@Fy_Id", intFyId); strSeriesNumber = dbHelper.ExecuteScalar(); } else if (dbType == SqlType.SQLite) { } return(strSeriesNumber); }
/// <summary>增加一条数据 /// /// </summary> public int Add(Nikita.Platform.BugClose.Model.BseDictionary model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into BseDictionary("); strSql.Append("ParentID, OwerCompanyId, Name, Value, Status, OnLevel, Remark, Sort, DeptId, CompanyID, CreateDate, CreateUser, EditDate, EditUser )"); strSql.Append(" values ("); strSql.Append("@ParentID, @OwerCompanyId, @Name, @Value, @Status, @OnLevel, @Remark, @Sort, @DeptId, @CompanyID, @CreateDate, @CreateUser, @EditDate, @EditUser )"); strSql.Append(";select @@IDENTITY"); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); if (model.ParentID == null) { h.AddParameter("@ParentID", DBNull.Value); } else { h.AddParameter("@ParentID", model.ParentID); } if (model.OwerCompanyId == null) { h.AddParameter("@OwerCompanyId", DBNull.Value); } else { h.AddParameter("@OwerCompanyId", model.OwerCompanyId); } if (model.Name == null) { h.AddParameter("@Name", DBNull.Value); } else { h.AddParameter("@Name", model.Name); } if (model.Value == null) { h.AddParameter("@Value", DBNull.Value); } else { h.AddParameter("@Value", model.Value); } if (model.Status == null) { h.AddParameter("@Status", DBNull.Value); } else { h.AddParameter("@Status", model.Status); } if (model.OnLevel == null) { h.AddParameter("@OnLevel", DBNull.Value); } else { h.AddParameter("@OnLevel", model.OnLevel); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } if (model.Sort == null) { h.AddParameter("@Sort", DBNull.Value); } else { h.AddParameter("@Sort", model.Sort); } if (model.DeptId == null) { h.AddParameter("@DeptId", DBNull.Value); } else { h.AddParameter("@DeptId", model.DeptId); } if (model.CompanyID == null) { h.AddParameter("@CompanyID", DBNull.Value); } else { h.AddParameter("@CompanyID", model.CompanyID); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } if (model.CreateUser == null) { h.AddParameter("@CreateUser", DBNull.Value); } else { h.AddParameter("@CreateUser", model.CreateUser); } if (model.EditDate == null) { h.AddParameter("@EditDate", DBNull.Value); } else { h.AddParameter("@EditDate", model.EditDate); } if (model.EditUser == null) { h.AddParameter("@EditUser", DBNull.Value); } else { h.AddParameter("@EditUser", model.EditUser); } int intResult; string obj = h.ExecuteScalar(); if (!int.TryParse(obj, out intResult)) { return(0); } return(intResult); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Platform.BugClose.Model.BseDictionary model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update BseDictionary set "); strSql.Append("ParentID=@ParentID, OwerCompanyId=@OwerCompanyId, Name=@Name, Value=@Value, Status=@Status, OnLevel=@OnLevel, Remark=@Remark, Sort=@Sort, DeptId=@DeptId, CompanyID=@CompanyID, CreateDate=@CreateDate, CreateUser=@CreateUser, EditDate=@EditDate, EditUser=@EditUser "); strSql.Append(" where Id=@Id "); IDbHelper h = GlobalHelp.GetDataAccessHelper();; h.CreateCommand(strSql.ToString()); if (model.Id == null) { h.AddParameter("@Id", DBNull.Value); } else { h.AddParameter("@Id", model.Id); } if (model.ParentID == null) { h.AddParameter("@ParentID", DBNull.Value); } else { h.AddParameter("@ParentID", model.ParentID); } if (model.OwerCompanyId == null) { h.AddParameter("@OwerCompanyId", DBNull.Value); } else { h.AddParameter("@OwerCompanyId", model.OwerCompanyId); } if (model.Name == null) { h.AddParameter("@Name", DBNull.Value); } else { h.AddParameter("@Name", model.Name); } if (model.Value == null) { h.AddParameter("@Value", DBNull.Value); } else { h.AddParameter("@Value", model.Value); } if (model.Status == null) { h.AddParameter("@Status", DBNull.Value); } else { h.AddParameter("@Status", model.Status); } if (model.OnLevel == null) { h.AddParameter("@OnLevel", DBNull.Value); } else { h.AddParameter("@OnLevel", model.OnLevel); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } if (model.Sort == null) { h.AddParameter("@Sort", DBNull.Value); } else { h.AddParameter("@Sort", model.Sort); } if (model.DeptId == null) { h.AddParameter("@DeptId", DBNull.Value); } else { h.AddParameter("@DeptId", model.DeptId); } if (model.CompanyID == null) { h.AddParameter("@CompanyID", DBNull.Value); } else { h.AddParameter("@CompanyID", model.CompanyID); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } if (model.CreateUser == null) { h.AddParameter("@CreateUser", DBNull.Value); } else { h.AddParameter("@CreateUser", model.CreateUser); } if (model.EditDate == null) { h.AddParameter("@EditDate", DBNull.Value); } else { h.AddParameter("@EditDate", model.EditDate); } if (model.EditUser == null) { h.AddParameter("@EditUser", DBNull.Value); } else { h.AddParameter("@EditUser", model.EditUser); } return(h.ExecuteNonQuery()); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Base.CacheStore.Model.CacheConfig model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update CacheConfig set "); strSql.Append("ConnectionString=@ConnectionString, TableName=@TableName, Filter=@Filter, CacheTableName=@CacheTableName, CacheChekGuid=@CacheChekGuid, CacheVersion=@CacheVersion, CreateUser=@CreateUser, CreateDate=@CreateDate, Remark=@Remark, Status=@Status "); strSql.Append(" where Id=@Id "); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); if (model.Id == null) { h.AddParameter("@Id", DBNull.Value); } else { h.AddParameter("@Id", model.Id); } if (model.ConnectionString == null) { h.AddParameter("@ConnectionString", DBNull.Value); } else { h.AddParameter("@ConnectionString", model.ConnectionString); } if (model.TableName == null) { h.AddParameter("@TableName", DBNull.Value); } else { h.AddParameter("@TableName", model.TableName); } if (model.Filter == null) { h.AddParameter("@Filter", DBNull.Value); } else { h.AddParameter("@Filter", model.Filter); } if (model.CacheTableName == null) { h.AddParameter("@CacheTableName", DBNull.Value); } else { h.AddParameter("@CacheTableName", model.CacheTableName); } if (model.CacheChekGuid == null) { h.AddParameter("@CacheChekGuid", DBNull.Value); } else { h.AddParameter("@CacheChekGuid", model.CacheChekGuid); } if (model.CacheVersion == null) { h.AddParameter("@CacheVersion", DBNull.Value); } else { h.AddParameter("@CacheVersion", model.CacheVersion); } if (model.CreateUser == null) { h.AddParameter("@CreateUser", DBNull.Value); } else { h.AddParameter("@CreateUser", model.CreateUser); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } if (model.Status == null) { h.AddParameter("@Status", DBNull.Value); } else { h.AddParameter("@Status", model.Status); } bool blnReturn = h.ExecuteNonQuery(); return(blnReturn); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Platform.BugClose.Model.BseModule model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update BseModule set "); strSql.Append("ProjectID=@ProjectID, Name=@Name, Status=@Status, Remark=@Remark, Sort=@Sort, DeptId=@DeptId, CompanyID=@CompanyID, CreateDate=@CreateDate, CreateUser=@CreateUser, EditDate=@EditDate, EditUser=@EditUser "); strSql.Append(" where ModuleID=@ModuleID "); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); if (model.ModuleID == null) { h.AddParameter("@ModuleID", DBNull.Value); } else { h.AddParameter("@ModuleID", model.ModuleID); } if (model.ProjectID == null) { h.AddParameter("@ProjectID", DBNull.Value); } else { h.AddParameter("@ProjectID", model.ProjectID); } if (model.Name == null) { h.AddParameter("@Name", DBNull.Value); } else { h.AddParameter("@Name", model.Name); } if (model.Status == null) { h.AddParameter("@Status", DBNull.Value); } else { h.AddParameter("@Status", model.Status); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } if (model.Sort == null) { h.AddParameter("@Sort", DBNull.Value); } else { h.AddParameter("@Sort", model.Sort); } if (model.DeptId == null) { h.AddParameter("@DeptId", DBNull.Value); } else { h.AddParameter("@DeptId", model.DeptId); } if (model.CompanyID == null) { h.AddParameter("@CompanyID", DBNull.Value); } else { h.AddParameter("@CompanyID", model.CompanyID); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } if (model.CreateUser == null) { h.AddParameter("@CreateUser", DBNull.Value); } else { h.AddParameter("@CreateUser", model.CreateUser); } if (model.EditDate == null) { h.AddParameter("@EditDate", DBNull.Value); } else { h.AddParameter("@EditDate", model.EditDate); } if (model.EditUser == null) { h.AddParameter("@EditUser", DBNull.Value); } else { h.AddParameter("@EditUser", model.EditUser); } return(h.ExecuteNonQuery()); }
/// <summary>增加一条数据 /// /// </summary> public int Add(Nikita.Base.CacheStore.Model.CacheConfig model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into CacheConfig("); strSql.Append("ConnectionString, TableName, Filter, CacheTableName, CacheChekGuid, CacheVersion, CreateUser, CreateDate, Remark, Status )"); strSql.Append(" values ("); strSql.Append("@ConnectionString, @TableName, @Filter, @CacheTableName, @CacheChekGuid, @CacheVersion, @CreateUser, @CreateDate, @Remark, @Status )"); strSql.Append(";select @@IDENTITY"); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); if (model.ConnectionString == null) { h.AddParameter("@ConnectionString", DBNull.Value); } else { h.AddParameter("@ConnectionString", model.ConnectionString); } if (model.TableName == null) { h.AddParameter("@TableName", DBNull.Value); } else { h.AddParameter("@TableName", model.TableName); } if (model.Filter == null) { h.AddParameter("@Filter", DBNull.Value); } else { h.AddParameter("@Filter", model.Filter); } if (model.CacheTableName == null) { h.AddParameter("@CacheTableName", DBNull.Value); } else { h.AddParameter("@CacheTableName", model.CacheTableName); } if (model.CacheChekGuid == null) { h.AddParameter("@CacheChekGuid", DBNull.Value); } else { h.AddParameter("@CacheChekGuid", model.CacheChekGuid); } if (model.CacheVersion == null) { h.AddParameter("@CacheVersion", DBNull.Value); } else { h.AddParameter("@CacheVersion", model.CacheVersion); } if (model.CreateUser == null) { h.AddParameter("@CreateUser", DBNull.Value); } else { h.AddParameter("@CreateUser", model.CreateUser); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } if (model.Status == null) { h.AddParameter("@Status", DBNull.Value); } else { h.AddParameter("@Status", model.Status); } model.CacheChekGuid = Guid.NewGuid().ToString(); int intResult; string obj = h.ExecuteScalar(); if (!int.TryParse(obj, out intResult)) { return(0); } #region 新增缓存配置:如果是则需要推送更新缓存的消息。。即是发消息告诉服务端我修改了缓存配置,让服务端统一向所有在线客户端发送更新缓存消息 h.CreateCommand("select * from CacheConfig where id =" + intResult + ""); DataTable dt = h.ExecuteQuery(); dt.TableName = "CacheConfig"; CacheMessageEntity messageEntity = new CacheMessageEntity { CacheKey = model.CacheTableName, Operation = "Add", DataTableCache = dt }; CacheListener.AddMessage(messageEntity); #endregion return(intResult); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Assist.Note.Model.BseUrl2 model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update BseUrl2 set "); strSql.Append("Type=@Type, UrlTitle=@UrlTitle, Url=@Url, UrlContent=@UrlContent, Remark=@Remark, Status=@Status, CreateDate=@CreateDate "); strSql.Append(" where Id=@Id "); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); if (model.Id == null) { h.AddParameter("@Id", DBNull.Value); } else { h.AddParameter("@Id", model.Id); } if (model.Type == null) { h.AddParameter("@Type", DBNull.Value); } else { h.AddParameter("@Type", model.Type); } if (model.UrlTitle == null) { h.AddParameter("@UrlTitle", DBNull.Value); } else { h.AddParameter("@UrlTitle", model.UrlTitle); } if (model.Url == null) { h.AddParameter("@Url", DBNull.Value); } else { h.AddParameter("@Url", model.Url); } if (model.UrlContent == null) { h.AddParameter("@UrlContent", DBNull.Value); } else { h.AddParameter("@UrlContent", model.UrlContent); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } if (model.Status == null) { h.AddParameter("@Status", DBNull.Value); } else { h.AddParameter("@Status", model.Status); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } return(h.ExecuteNonQuery()); }
/// <summary>增加一条数据 /// /// </summary> public int Add(Nikita.Assist.Note.Model.BseUrl2 model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into BseUrl2("); strSql.Append("Type, UrlTitle, Url, UrlContent, Remark, Status, CreateDate )"); strSql.Append(" values ("); strSql.Append("@Type, @UrlTitle, @Url, @UrlContent, @Remark, @Status, @CreateDate )"); strSql.Append(";select @@IDENTITY"); IDbHelper h = GlobalHelp.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); if (model.Type == null) { h.AddParameter("@Type", DBNull.Value); } else { h.AddParameter("@Type", model.Type); } if (model.UrlTitle == null) { h.AddParameter("@UrlTitle", DBNull.Value); } else { h.AddParameter("@UrlTitle", model.UrlTitle); } if (model.Url == null) { h.AddParameter("@Url", DBNull.Value); } else { h.AddParameter("@Url", model.Url); } if (model.UrlContent == null) { h.AddParameter("@UrlContent", DBNull.Value); } else { h.AddParameter("@UrlContent", model.UrlContent); } if (model.Remark == null) { h.AddParameter("@Remark", DBNull.Value); } else { h.AddParameter("@Remark", model.Remark); } if (model.Status == null) { h.AddParameter("@Status", DBNull.Value); } else { h.AddParameter("@Status", model.Status); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } int intResult; string obj = h.ExecuteScalar(); if (!int.TryParse(obj, out intResult)) { return(0); } return(intResult); }