Ejemplo n.º 1
0
 public ActionResult Edit(ItemfeedbackInfo itemfeedbackInfo)
 {
     if (itemfeedbackInfo.ID == 0)
     {
         return Insert(itemfeedbackInfo);
     }
     else
     {
         return Update(itemfeedbackInfo);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 设置SQL参数表
 /// </summary>
 /// <param name="Itemfeedback">Itemfeedback对象</param>
 /// <returns>Itemfeedback参数数组</returns>
 private SqlParameter[] Set_Itemfeedback_Parameters(ItemfeedbackInfo itemfeedbackInfo)
 {
     SqlParameter[] paramArray = new SqlParameter[] {new SqlParameter("@ID",itemfeedbackInfo.ID),
                                                         new SqlParameter("@SupplierID",itemfeedbackInfo.SupplierID),
                                                         new SqlParameter("@ItemID",itemfeedbackInfo.ItemID),
                                                         new SqlParameter("@Title",itemfeedbackInfo.Title),
                                                         new SqlParameter("@Content",string.IsNullOrEmpty(itemfeedbackInfo.Content)?"":itemfeedbackInfo.Content),
                                                         new SqlParameter("@Reply",string.IsNullOrEmpty(itemfeedbackInfo.Reply)?"":itemfeedbackInfo.Reply),
                                                         new SqlParameter("@CreatedBy",string.IsNullOrEmpty(itemfeedbackInfo.CreatedBy)?"":itemfeedbackInfo.CreatedBy),
                                                         new SqlParameter("@ReplyBy",string.IsNullOrEmpty(itemfeedbackInfo.ReplyBy)?"":itemfeedbackInfo.ReplyBy),
                                                         new SqlParameter("@ReplyDate",itemfeedbackInfo.ReplyDate)
                                                     };
     return paramArray;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 初始化ItemfeedbackInfo
 /// </summary>
 private ItemfeedbackInfo InitItemfeedbackInfoByDataReader(ItemfeedbackInfo itemfeedbackInfo, IDataReader reader)
 {
     itemfeedbackInfo = new ItemfeedbackInfo(reader["ID"].ToString() != "" ? Int32.Parse(reader["ID"].ToString()) : 0,
     reader["SupplierID"].ToString(),
     reader["ItemID"].ToString(),
     reader["Title"].ToString(),
     reader["Content"].ToString(),
     reader["Reply"].ToString(),
     reader["CreatedBy"].ToString(),
     reader["CreatedDate"].ToString() != "" ? DateTime.Parse(reader["CreatedDate"].ToString()) : new DateTime(),
     reader["ReplyBy"].ToString(),
     reader["ReplyDate"].ToString() != "" ? DateTime.Parse(reader["ReplyDate"].ToString()) : new DateTime());
     return itemfeedbackInfo;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 更新一条Itemfeedback记录
 /// </summary>
 /// <param name="db">DataBase对象</param>
 /// <param name="tran">一个有效的DbTransaction</param>
 /// <param name="itemfeedback">Itemfeedback对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateItemfeedback(Database db, DbTransaction tran, ItemfeedbackInfo itemfeedbackInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Itemfeedback_Parameters(itemfeedbackInfo);
     if (paras != null)
     {
         result += DBHelper.ExecuteNonQuery(db, tran, CommandType.Text, SQL_UPDATE_ITEMFEEDBACK, paras);
     }
     return result;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 新增一条Itemfeedback记录
 /// </summary>
 /// <param name="itemfeedback">Itemfeedback对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertItemfeedback(ItemfeedbackInfo itemfeedbackInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Itemfeedback_Parameters(itemfeedbackInfo);
     if (paras != null)
     {
         result = DBHelper.ExecuteNonQuery(CommandType.Text, SQL_INSERT_ITEMFEEDBACK, paras);
     }
     return result;
 }
Ejemplo n.º 6
0
 public ActionResult Insert(ItemfeedbackInfo itemfeedbackInfo)
 {
     try
     {
         itemfeedbackInfo.CreatedDate = DateTime.Now;
         itemfeedbackInfo.ReplyBy = CurrentUserInfo.UserCode;
         itemfeedbackInfo.CreatedBy = CurrentUserInfo.UserCode;
         itemfeedbackInfo.ReplyDate = DateTime.Now;
         IItemfeedbackService itemfeedbackService = UnityHelper.UnityResolve<IItemfeedbackService>();
         var data = itemfeedbackService.InsertItemfeedback(itemfeedbackInfo);
         LogHelper.LogOperation(CurrentUserInfo.UserCode, string.Format("Insert ItemfeedbackInfo {0},{1}", LogHelper.ChangeEntityToLog(itemfeedbackInfo), 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);
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 更新一条Itemfeedback记录
 /// </summary>
 /// <param name="itemfeedback">Itemfeedback对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateItemfeedback(ItemfeedbackInfo itemfeedbackInfo)
 {
     return itemfeedbackDA.UpdateItemfeedback(itemfeedbackInfo);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 新增一条Itemfeedback记录
 /// </summary>
 /// <param name="itemfeedback">Itemfeedback对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertItemfeedback(ItemfeedbackInfo itemfeedbackInfo)
 {
     return itemfeedbackDA.InsertItemfeedback(itemfeedbackInfo);
 }