示例#1
0
 public ActionResult Edit(PurchaseorderInfo purchaseorderInfo)
 {
     if (purchaseorderInfo.PoID == 0)
     {
         return Insert(purchaseorderInfo);
     }
     else
     {
         return Update(purchaseorderInfo);
     }
 }
示例#2
0
 /// <summary>
 /// 更新一条Purchaseorder记录
 /// </summary>
 /// <param name="purchaseorder">Purchaseorder对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdatePurchaseorder(PurchaseorderInfo purchaseorderInfo)
 {
     return purchaseorderDA.UpdatePurchaseorder(purchaseorderInfo);
 }
示例#3
0
 /// <summary>
 /// 新增一条Purchaseorder记录
 /// </summary>
 /// <param name="purchaseorder">Purchaseorder对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertPurchaseorder(PurchaseorderInfo purchaseorderInfo)
 {
     return purchaseorderDA.InsertPurchaseorder(purchaseorderInfo);
 }
示例#4
0
 public ActionResult Insert(PurchaseorderInfo purchaseorderInfo)
 {
     try
     {
         purchaseorderInfo.CreatedDate = DateTime.Now;
         purchaseorderInfo.UpdatedDate = DateTime.Now;
         purchaseorderInfo.CreatedBy = CurrentUserInfo.UserCode;
         purchaseorderInfo.UpdatedBy = CurrentUserInfo.UserCode;
         IPurchaseorderService purchaseorderService = UnityHelper.UnityResolve<IPurchaseorderService>();
         var data = purchaseorderService.InsertPurchaseorder(purchaseorderInfo);
         LogHelper.LogOperation(CurrentUserInfo.UserCode, string.Format("Insert PurchaseorderInfo {0},{1}", LogHelper.ChangeEntityToLog(purchaseorderInfo), 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);
     }
 }
示例#5
0
 /// <summary>
 /// 设置SQL参数表
 /// </summary>
 /// <param name="Purchaseorder">Purchaseorder对象</param>
 /// <returns>Purchaseorder参数数组</returns>
 private SqlParameter[] Set_Purchaseorder_Parameters(PurchaseorderInfo purchaseorderInfo)
 {
     SqlParameter[] paramArray = new SqlParameter[] {new SqlParameter("@PoID",purchaseorderInfo.PoID),
                                                         new SqlParameter("@SupplierID",purchaseorderInfo.SupplierID),
                                                         new SqlParameter("@PoDate",purchaseorderInfo.PoDate),
                                                         new SqlParameter("@Contact",string.IsNullOrEmpty(purchaseorderInfo.Contact)?"":purchaseorderInfo.Contact),
                                                         new SqlParameter("@ContactPhone",string.IsNullOrEmpty(purchaseorderInfo.ContactPhone)?"":purchaseorderInfo.ContactPhone),
                                                         new SqlParameter("@ContactAddress",string.IsNullOrEmpty(purchaseorderInfo.ContactAddress)?"":purchaseorderInfo.ContactAddress),
                                                         new SqlParameter("@Status",string.IsNullOrEmpty(purchaseorderInfo.Status)?"":purchaseorderInfo.Status),
                                                         new SqlParameter("@TotalAmount",purchaseorderInfo.TotalAmount),
                                                         new SqlParameter("@TotalItemCount",purchaseorderInfo.TotalItemCount),
                                                         new SqlParameter("@Remark",string.IsNullOrEmpty(purchaseorderInfo.Remark)?"":purchaseorderInfo.Remark),
                                                         new SqlParameter("@CreatedBy",string.IsNullOrEmpty(purchaseorderInfo.CreatedBy)?"":purchaseorderInfo.CreatedBy),
                                                         new SqlParameter("@UpdatedBy",string.IsNullOrEmpty(purchaseorderInfo.UpdatedBy)?"":purchaseorderInfo.UpdatedBy)
                                                     };
     return paramArray;
 }
示例#6
0
 /// <summary>
 /// 初始化PurchaseorderInfo
 /// </summary>
 private PurchaseorderInfo InitPurchaseorderInfoByDataReader(PurchaseorderInfo purchaseorderInfo, IDataReader reader)
 {
     purchaseorderInfo = new PurchaseorderInfo(reader["PoID"].ToString() != "" ? Int32.Parse(reader["PoID"].ToString()) : 0,
     reader["SupplierID"].ToString() != "" ? Int32.Parse(reader["SupplierID"].ToString()) : 0,
     reader["PoDate"].ToString() != "" ? DateTime.Parse(reader["PoDate"].ToString()) : new DateTime(),
     reader["Contact"].ToString(),
     reader["ContactPhone"].ToString(),
     reader["ContactAddress"].ToString(),
     reader["Status"].ToString(),
     reader["TotalAmount"].ToString() != "" ? Decimal.Parse(reader["TotalAmount"].ToString()) : 0,
     reader["TotalItemCount"].ToString() != "" ? Int32.Parse(reader["TotalItemCount"].ToString()) : 0,
     reader["Remark"].ToString(),
     reader["Ts"],
     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 purchaseorderInfo;
 }
示例#7
0
 /// <summary>
 /// 更新一条Purchaseorder记录
 /// </summary>
 /// <param name="db">DataBase对象</param>
 /// <param name="tran">一个有效的DbTransaction</param>
 /// <param name="purchaseorder">Purchaseorder对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdatePurchaseorder(Database db, DbTransaction tran, PurchaseorderInfo purchaseorderInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Purchaseorder_Parameters(purchaseorderInfo);
     if (paras != null)
     {
         result += DBHelper.ExecuteNonQuery(db, tran, CommandType.Text, SQL_UPDATE_PURCHASEORDER, paras);
     }
     return result;
 }
示例#8
0
 /// <summary>
 /// 新增一条Purchaseorder记录
 /// </summary>
 /// <param name="purchaseorder">Purchaseorder对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertPurchaseorder(PurchaseorderInfo purchaseorderInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Purchaseorder_Parameters(purchaseorderInfo);
     if (paras != null)
     {
         result = DBHelper.ExecuteNonQuery(CommandType.Text, SQL_INSERT_PURCHASEORDER, paras);
     }
     return result;
 }