/// <summary>删除一条数据 /// /// </summary> /// <param name="User_Id">主键ID</param> /// <returns>返回受影响的行数</returns> public bool Delete(int User_Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from Bse_User "); strSql.Append(" where User_Id=@User_Id "); DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); h.AddParameter("@User_Id", User_Id); return(h.ExecuteNonQuery()); }
/// <summary>删除一条数据 /// /// </summary> /// <param name="KeyId">主键ID</param> /// <returns>返回受影响的行数</returns> public bool Delete(int KeyId) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from Sys_Roles "); strSql.Append(" where KeyId=@KeyId "); DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo(); h.CreateCommand(strSql.ToString()); h.AddParameter("@KeyId", KeyId); return(h.ExecuteNonQuery()); }
/// <summary>更新一一个字段 /// /// </summary> public bool Update(string strFieldWithValue, string strCond) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Sys_Roles set "); strSql.Append(strFieldWithValue); if (!string.IsNullOrEmpty(strCond)) { strSql.Append(" where " + strCond); } DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo(); h.CreateCommand(strSql.ToString()); return(h.ExecuteNonQuery()); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Assist.CodeMaker.Model.OrderMaster model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update OrderMaster set "); strSql.Append("OrderNumber=@OrderNumber, Status=@Status, CreateDate=@CreateDate "); strSql.Append(" where OrderId=@OrderId "); DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo(); h.CreateCommand(strSql.ToString()); if (model.OrderId == null) { h.AddParameter("@OrderId", DBNull.Value); } else { h.AddParameter("@OrderId", model.OrderId); } if (model.OrderNumber == null) { h.AddParameter("@OrderNumber", DBNull.Value); } else { h.AddParameter("@OrderNumber", model.OrderNumber); } 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 bool Update(Nikita.Assist.CodeMaker.Model.TreeListDemo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TreeListDemo set "); strSql.Append("ParentId=@ParentId, Name=@Name, Value=@Value, OnLevel=@OnLevel, OwerCompanyId=@OwerCompanyId, Status=@Status, Remark=@Remark, Dept_Id=@Dept_Id, Company_Id=@Company_Id, CreateUser=@CreateUser, CreateDate=@CreateDate, EditUser=@EditUser, EditDate=@EditDate "); strSql.Append(" where Id=@Id "); DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo(); 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.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.OnLevel == null) { h.AddParameter("@OnLevel", DBNull.Value); } else { h.AddParameter("@OnLevel", model.OnLevel); } if (model.OwerCompanyId == null) { h.AddParameter("@OwerCompanyId", DBNull.Value); } else { h.AddParameter("@OwerCompanyId", model.OwerCompanyId); } 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.Dept_Id == null) { h.AddParameter("@Dept_Id", DBNull.Value); } else { h.AddParameter("@Dept_Id", model.Dept_Id); } if (model.Company_Id == null) { h.AddParameter("@Company_Id", DBNull.Value); } else { h.AddParameter("@Company_Id", model.Company_Id); } 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.EditUser == null) { h.AddParameter("@EditUser", DBNull.Value); } else { h.AddParameter("@EditUser", model.EditUser); } if (model.EditDate == null) { h.AddParameter("@EditDate", DBNull.Value); } else { h.AddParameter("@EditDate", model.EditDate); } return(h.ExecuteNonQuery()); }
/// <summary>更新一条数据 /// /// </summary> /// <param name="model">实体对象</param> /// <returns>返回受影响的行数</returns> public bool Update(Nikita.Assist.CodeMaker.Model.Bse_User model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Bse_User set "); strSql.Append("UserName=@UserName, Password=@Password, TrueName=@TrueName, Company=@Company, CreateDate=@CreateDate, State=@State "); strSql.Append(" where User_Id=@User_Id "); DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelper(); h.CreateCommand(strSql.ToString()); if (model.User_Id == null) { h.AddParameter("@User_Id", DBNull.Value); } else { h.AddParameter("@User_Id", model.User_Id); } if (model.UserName == null) { h.AddParameter("@UserName", DBNull.Value); } else { h.AddParameter("@UserName", model.UserName); } if (model.Password == null) { h.AddParameter("@Password", DBNull.Value); } else { h.AddParameter("@Password", model.Password); } if (model.TrueName == null) { h.AddParameter("@TrueName", DBNull.Value); } else { h.AddParameter("@TrueName", model.TrueName); } if (model.Company == null) { h.AddParameter("@Company", DBNull.Value); } else { h.AddParameter("@Company", model.Company); } if (model.CreateDate == null) { h.AddParameter("@CreateDate", DBNull.Value); } else { h.AddParameter("@CreateDate", model.CreateDate); } if (model.State == null) { h.AddParameter("@State", DBNull.Value); } else { h.AddParameter("@State", model.State); } return(h.ExecuteNonQuery()); }
/// <summary>更新一条数据 /// /// </summary> public bool Update(Nikita.Assist.CodeMaker.Model.OrderDetail model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update OrderDetail set "); strSql.Append("OrderId=@OrderId, Customer=@Customer, ProductName=@ProductName, Amount=@Amount, SumMoney=@SumMoney, Status=@Status "); strSql.Append(" where DetailId=@DetailId "); DataAccess4DBHelper.IDbHelper h = GlobalHelpDemoForm.GetDataAccessHelperDemo(); h.CreateCommand(strSql.ToString()); if (model.DetailId == null) { h.AddParameter("@DetailId", DBNull.Value); } else { h.AddParameter("@DetailId", model.DetailId); } if (model.OrderId == null) { h.AddParameter("@OrderId", DBNull.Value); } else { h.AddParameter("@OrderId", model.OrderId); } if (model.Customer == null) { h.AddParameter("@Customer", DBNull.Value); } else { h.AddParameter("@Customer", model.Customer); } if (model.ProductName == null) { h.AddParameter("@ProductName", DBNull.Value); } else { h.AddParameter("@ProductName", model.ProductName); } if (model.Amount == null) { h.AddParameter("@Amount", DBNull.Value); } else { h.AddParameter("@Amount", model.Amount); } if (model.SumMoney == null) { h.AddParameter("@SumMoney", DBNull.Value); } else { h.AddParameter("@SumMoney", model.SumMoney); } if (model.Status == null) { h.AddParameter("@Status", DBNull.Value); } else { h.AddParameter("@Status", model.Status); } return(h.ExecuteNonQuery()); }