/// <summary> /// 添加一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Add(FeeAnswerLog model, SqlTransaction tran = null) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into FeeAnswerLog("); strSql.Append(" AnswerId,UserID,FeeTime,IsDelete )"); strSql.Append(" values ("); strSql.Append("@AnswerId,@UserID,@FeeTime,@IsDelete)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@AnswerId", model.AnswerId), new SqlParameter("@UserID", model.UserID), new SqlParameter("@FeeTime", model.FeeTime), new SqlParameter("@IsDelete", model.IsDelete), }; object obj; if (tran == null) { obj = SqlHelper.GetSingle(strSql.ToString(), CommandType.Text, parameters); } else { obj = SqlHelper.GetSingle(tran, CommandType.Text, strSql.ToString(), parameters); } return(obj == null ? 0 : Convert.ToInt32(obj)); }
/// <summary> /// 修改 (可能有其他业务逻辑检查) /// </summary> /// <param name="model"></param> /// <returns></returns> public ResultInfo Update(FeeAnswerLog model) { ResultInfo ri = new ResultInfo(); if (Edit(model)) { ri.Ok = true; ri.Msg = "修改成功"; } return(ri); }
/// <summary> /// 保存 (可能有其他业务逻辑检查) /// </summary> /// <param name="model">实体</param> /// <returns></returns> public ResultInfo Create(FeeAnswerLog 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 Update(FeeAnswerLog model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update FeeAnswerLog set "); strSql.Append("AnswerId=@AnswerId,UserID=@UserID,FeeTime=@FeeTime,IsDelete=@IsDelete"); strSql.Append(" where FeeAnswerLogId=@FeeAnswerLogId"); SqlParameter[] parameters = { new SqlParameter("@AnswerId", model.AnswerId), new SqlParameter("@UserID", model.UserID), new SqlParameter("@FeeTime", model.FeeTime), new SqlParameter("@IsDelete", model.IsDelete), new SqlParameter("@FeeAnswerLogId", model.FeeAnswerLogId) }; return(SqlHelper.ExecuteSql(strSql.ToString(), CommandType.Text, parameters) > 0); }
/// <summary> /// 修改一条记录 /// </summary> /// <param name="model">实体对象</param> /// <returns></returns> public bool Edit(FeeAnswerLog model) { return(dal.Update(model)); }
/// <summary> /// 添加一条记录,没有任何逻辑 /// </summary> /// <param name="model">实体对象</param> /// <returns></returns> public int Add(FeeAnswerLog model, SqlTransaction tran) { return(dal.Add(model, tran)); }