/// <summary> /// 添加一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Add(ClickMsg model, SqlTransaction tran = null) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into ClickMsg("); strSql.Append(" ClickMsgId,Msg,Msg_en,Color,CreateTime,CreateUser,UpdateTime,UpdateUser,IsDelete )"); strSql.Append(" values ("); strSql.Append("@ClickMsgId,@Msg,@Msg_en,@Color,@CreateTime,@CreateUser,@UpdateTime,@UpdateUser,@IsDelete);"); SqlParameter[] parameters = { new SqlParameter("@Msg", model.Msg), new SqlParameter("@Msg_en", model.Msg_en), new SqlParameter("@Color", model.Color), new SqlParameter("@CreateTime", model.CreateTime), new SqlParameter("@CreateUser", model.CreateUser), new SqlParameter("@UpdateTime", model.UpdateTime), new SqlParameter("@UpdateUser", model.UpdateUser), new SqlParameter("@IsDelete", model.IsDelete), new SqlParameter("@ClickMsgId", model.ClickMsgId) }; int obj; if (tran == null) { obj = SqlHelper.ExecuteSql(strSql.ToString(), CommandType.Text, parameters); } else { obj = SqlHelper.ExecuteSql(tran, CommandType.Text, strSql.ToString(), parameters); } return(obj); }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Update(ClickMsg model, SqlTransaction tran = null) { StringBuilder strSql = new StringBuilder(); strSql.Append("update ClickMsg set "); strSql.Append("ClickMsgId=@ClickMsgId,Msg=@Msg,Msg_en=@Msg_en,Color=@Color,CreateTime=@CreateTime,CreateUser=@CreateUser,UpdateTime=@UpdateTime,UpdateUser=@UpdateUser,IsDelete=@IsDelete"); strSql.Append(" where ClickMsgId=@ClickMsgId"); SqlParameter[] parameters = { new SqlParameter("@Msg", model.Msg), new SqlParameter("@Msg_en", model.Msg_en), new SqlParameter("@Color", model.Color), new SqlParameter("@CreateTime", model.CreateTime), new SqlParameter("@CreateUser", model.CreateUser), new SqlParameter("@UpdateTime", model.UpdateTime), new SqlParameter("@UpdateUser", model.UpdateUser), new SqlParameter("@IsDelete", model.IsDelete), new SqlParameter("@ClickMsgId", model.ClickMsgId) }; if (tran == null) { return(SqlHelper.ExecuteSql(strSql.ToString(), CommandType.Text, parameters) > 0); } else { return(SqlHelper.ExecuteSql(tran, CommandType.Text, strSql.ToString(), parameters) > 0); } }
public void Add_ClickMsg(ClickMsg model) { var list = ClickMsgBLL.Instance.FindALL(); list.Add(model); CSharpCacheHelper.Set(APPConst.ClickMsgs, list, APPConst.ExpriseTime.Week1); }
public void Update_ClickMsg(ClickMsg model) { var list = ClickMsgBLL.Instance.FindALL(); var newlist = list.Where(a => { return(a.ClickMsgId != model.ClickMsgId); }).ToList(); newlist.Add(model); CSharpCacheHelper.Set(APPConst.ClickMsgs, newlist, APPConst.ExpriseTime.Week1); }
/// <summary> /// 修改 (可能有其他业务逻辑检查) /// </summary> /// <param name="model"></param> /// <returns></returns> public ResultInfo Update(ClickMsg model, SqlTransaction tran = null) { ResultInfo ri = new ResultInfo(); if (Edit(model, tran)) { ri.Ok = true; ri.Msg = "修改成功"; } return(ri); }
/// <summary> /// 保存 (可能有其他业务逻辑检查) /// </summary> /// <param name="model">实体</param> /// <returns></returns> public ResultInfo Create(ClickMsg model, SqlTransaction tran = null) { ResultInfo ri = new ResultInfo(); if (model == null) { return(ri); } int result = Add(model, tran); if (result > 0) { ri.Ok = true; ri.Msg = "添加成功"; } return(ri); }
/// <summary> /// 修改一条记录 /// </summary> /// <param name="model">实体对象</param> /// <returns></returns> public bool Edit(ClickMsg model, SqlTransaction tran = null) { return(dal.Update(model, tran)); }
/// <summary> /// 添加一条记录,没有任何逻辑 /// </summary> /// <param name="model">实体对象</param> /// <returns></returns> public int Add(ClickMsg model, SqlTransaction tran = null) { return(dal.Add(model, tran)); }
public void Delete_ClickMsg(ClickMsg model) { var list = ClickMsgBLL.Instance.FindALL(); CSharpCacheHelper.Set(APPConst.ClickMsgs, list.Where(a => { return(a.ClickMsgId == model.ClickMsgId); }).ToList(), APPConst.ExpriseTime.Week1); }