示例#1
0
 public ActionResult Edit(MembercommentInfo membercommentInfo)
 {
     if (membercommentInfo.CommentID == 0)
     {
         return Insert(membercommentInfo);
     }
     else
     {
         return Update(membercommentInfo);
     }
 }
示例#2
0
 /// <summary>
 /// 设置SQL参数表
 /// </summary>
 /// <param name="Membercomment">Membercomment对象</param>
 /// <returns>Membercomment参数数组</returns>
 private SqlParameter[] Set_Membercomment_Parameters(MembercommentInfo membercommentInfo)
 {
     SqlParameter[] paramArray = new SqlParameter[] {new SqlParameter("@CommentID",membercommentInfo.CommentID),
                                                         new SqlParameter("@ItemID",membercommentInfo.ItemID),
                                                         new SqlParameter("@Title",string.IsNullOrEmpty(membercommentInfo.Title)?"":membercommentInfo.Title),
                                                         new SqlParameter("@Content",string.IsNullOrEmpty(membercommentInfo.Content)?"":membercommentInfo.Content),
                                                         new SqlParameter("@CommentPoints",membercommentInfo.CommentPoints),
                                                         new SqlParameter("@IsActive",string.IsNullOrEmpty(membercommentInfo.IsActive)?"":membercommentInfo.IsActive),
                                                         new SqlParameter("@CreatedBy",string.IsNullOrEmpty(membercommentInfo.CreatedBy)?"":membercommentInfo.CreatedBy),
                                                         new SqlParameter("@UpdatedBy",string.IsNullOrEmpty(membercommentInfo.UpdatedBy)?"":membercommentInfo.UpdatedBy)
                                                     };
     return paramArray;
 }
示例#3
0
 /// <summary>
 /// 初始化MembercommentInfo
 /// </summary>
 private MembercommentInfo InitMembercommentInfoByDataReader(MembercommentInfo membercommentInfo, IDataReader reader)
 {
     membercommentInfo = new MembercommentInfo(reader["CommentID"].ToString() != "" ? Int32.Parse(reader["CommentID"].ToString()) : 0,
     reader["ItemID"].ToString() != "" ? Int32.Parse(reader["ItemID"].ToString()) : 0,
     reader["Title"].ToString(),
     reader["Content"].ToString(),
     reader["CommentPoints"].ToString() != "" ? Int32.Parse(reader["CommentPoints"].ToString()) : 0,
     reader["IsActive"].ToString(),
     reader["CreatedBy"].ToString(),
     reader["CreatedDate"].ToString() != "" ? DateTime.Parse(reader["CreatedDate"].ToString()) : new DateTime(),
     reader["UpdatedBy"].ToString(),
     reader["UpdatedDate"].ToString() != "" ? DateTime.Parse(reader["UpdatedDate"].ToString()) : new DateTime());
     return membercommentInfo;
 }
示例#4
0
 /// <summary>
 /// 更新一条Membercomment记录
 /// </summary>
 /// <param name="db">DataBase对象</param>
 /// <param name="tran">一个有效的DbTransaction</param>
 /// <param name="membercomment">Membercomment对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateMembercomment(Database db, DbTransaction tran, MembercommentInfo membercommentInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Membercomment_Parameters(membercommentInfo);
     if (paras != null)
     {
         result += DBHelper.ExecuteNonQuery(db, tran, CommandType.Text, SQL_UPDATE_MEMBERCOMMENT, paras);
     }
     return result;
 }
示例#5
0
 /// <summary>
 /// 新增一条Membercomment记录
 /// </summary>
 /// <param name="membercomment">Membercomment对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertMembercomment(MembercommentInfo membercommentInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Membercomment_Parameters(membercommentInfo);
     if (paras != null)
     {
         result = DBHelper.ExecuteNonQuery(CommandType.Text, SQL_INSERT_MEMBERCOMMENT, paras);
     }
     return result;
 }
示例#6
0
 /// <summary>
 /// 更新一条Membercomment记录
 /// </summary>
 /// <param name="membercomment">Membercomment对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateMembercomment(MembercommentInfo membercommentInfo)
 {
     return membercommentDA.UpdateMembercomment(membercommentInfo);
 }
示例#7
0
 /// <summary>
 /// 新增一条Membercomment记录
 /// </summary>
 /// <param name="membercomment">Membercomment对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertMembercomment(MembercommentInfo membercommentInfo)
 {
     return membercommentDA.InsertMembercomment(membercommentInfo);
 }
示例#8
0
 public ActionResult Insert(MembercommentInfo membercommentInfo)
 {
     try
     {
         membercommentInfo.CreatedDate = DateTime.Now;
         membercommentInfo.UpdatedDate = DateTime.Now;
         membercommentInfo.CreatedBy = CurrentUserInfo.UserCode;
         membercommentInfo.UpdatedBy = CurrentUserInfo.UserCode;
         IMembercommentService membercommentService = UnityHelper.UnityResolve<IMembercommentService>();
         var data = membercommentService.InsertMembercomment(membercommentInfo);
         LogHelper.LogOperation(CurrentUserInfo.UserCode, string.Format("Insert MembercommentInfo {0},{1}", LogHelper.ChangeEntityToLog(membercommentInfo), data));
         if (data > 0)
         {
             return Content("OK");
         }
         else
         {
             return Content("Failed");
         }
     }
     catch (BusinessException bex)
     {
         return Content(bex.Message);
     }
     catch (Exception ex)
     {
         LogHelper.LogError(ex, "");
         return Content(ex.Message);
     }
 }