Esempio n. 1
0
 public ActionResult Edit(SupplierInfo supplierInfo)
 {
     if (supplierInfo.SupplierID == 0)
     {
         return Insert(supplierInfo);
     }
     else
     {
         return Update(supplierInfo);
     }
 }
Esempio n. 2
0
 public ActionResult Insert(SupplierInfo supplierInfo)
 {
     try
     {
         supplierInfo.CreatedDate = DateTime.Now;
         supplierInfo.UpdatedDate = DateTime.Now;
         supplierInfo.CreatedBy = CurrentUserInfo.UserCode;
         supplierInfo.UpdatedBy = CurrentUserInfo.UserCode;
         ISupplierService supplierService = UnityHelper.UnityResolve<ISupplierService>();
         var data = supplierService.InsertSupplier(supplierInfo);
         LogHelper.LogOperation(CurrentUserInfo.UserCode, string.Format("Insert SupplierInfo {0},{1}", LogHelper.ChangeEntityToLog(supplierInfo), 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);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 更新一条Supplier记录
 /// </summary>
 /// <param name="supplier">Supplier对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateSupplier(SupplierInfo supplierInfo)
 {
     return supplierDA.UpdateSupplier(supplierInfo);
 }
Esempio n. 4
0
 /// <summary>
 /// 新增一条Supplier记录
 /// </summary>
 /// <param name="supplier">Supplier对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertSupplier(SupplierInfo supplierInfo)
 {
     return supplierDA.InsertSupplier(supplierInfo);
 }
Esempio n. 5
0
 /// <summary>
 /// 设置SQL参数表
 /// </summary>
 /// <param name="Supplier">Supplier对象</param>
 /// <returns>Supplier参数数组</returns>
 private SqlParameter[] Set_Supplier_Parameters(SupplierInfo supplierInfo)
 {
     SqlParameter[] paramArray = new SqlParameter[] {new SqlParameter("@SupplierID",supplierInfo.SupplierID),
                                                         new SqlParameter("@SupplierCode",supplierInfo.SupplierCode),
                                                         new SqlParameter("@SupplierName",supplierInfo.SupplierName),
                                                         new SqlParameter("@LoginPwd",string.IsNullOrEmpty(supplierInfo.LoginPwd)?"":supplierInfo.LoginPwd),
                                                         new SqlParameter("@Email",string.IsNullOrEmpty(supplierInfo.Email)?"":supplierInfo.Email),
                                                         new SqlParameter("@ContactAddress",string.IsNullOrEmpty(supplierInfo.ContactAddress)?"":supplierInfo.ContactAddress),
                                                         new SqlParameter("@Contact",string.IsNullOrEmpty(supplierInfo.Contact)?"":supplierInfo.Contact),
                                                         new SqlParameter("@Region",string.IsNullOrEmpty(supplierInfo.Region)?"":supplierInfo.Region),
                                                         new SqlParameter("@Stage",string.IsNullOrEmpty(supplierInfo.Stage)?"":supplierInfo.Stage),
                                                         new SqlParameter("@PostCode",string.IsNullOrEmpty(supplierInfo.PostCode)?"":supplierInfo.PostCode),
                                                         new SqlParameter("@ContactPhone",string.IsNullOrEmpty(supplierInfo.ContactPhone)?"":supplierInfo.ContactPhone),
                                                         new SqlParameter("@MobilePhone",string.IsNullOrEmpty(supplierInfo.MobilePhone)?"":supplierInfo.MobilePhone),
                                                         new SqlParameter("@QQ",string.IsNullOrEmpty(supplierInfo.QQ)?"":supplierInfo.QQ),
                                                         new SqlParameter("@Msn",string.IsNullOrEmpty(supplierInfo.Msn)?"":supplierInfo.Msn),
                                                         new SqlParameter("@Fax",string.IsNullOrEmpty(supplierInfo.Fax)?"":supplierInfo.Fax),
                                                         new SqlParameter("@WebUrl",string.IsNullOrEmpty(supplierInfo.WebUrl)?"":supplierInfo.WebUrl),
                                                         new SqlParameter("@Logo",string.IsNullOrEmpty(supplierInfo.Logo)?"":supplierInfo.Logo),
                                                         new SqlParameter("@CompanyIntro",string.IsNullOrEmpty(supplierInfo.CompanyIntro)?"":supplierInfo.CompanyIntro),
                                                         new SqlParameter("@CompanyCulture",string.IsNullOrEmpty(supplierInfo.CompanyCulture)?"":supplierInfo.CompanyCulture),
                                                         new SqlParameter("@ArtificialPerson",string.IsNullOrEmpty(supplierInfo.ArtificialPerson)?"":supplierInfo.ArtificialPerson),
                                                         new SqlParameter("@Remark",string.IsNullOrEmpty(supplierInfo.Remark)?"":supplierInfo.Remark),
                                                         new SqlParameter("@IsActive",string.IsNullOrEmpty(supplierInfo.IsActive)?"":supplierInfo.IsActive),
                                                         new SqlParameter("@CreatedBy",string.IsNullOrEmpty(supplierInfo.CreatedBy)?"":supplierInfo.CreatedBy),
                                                         new SqlParameter("@UpdatedBy",string.IsNullOrEmpty(supplierInfo.UpdatedBy)?"":supplierInfo.UpdatedBy)
                                                     };
     return paramArray;
 }
Esempio n. 6
0
 /// <summary>
 /// 初始化SupplierInfo
 /// </summary>
 private SupplierInfo InitSupplierInfoByDataReader(SupplierInfo supplierInfo, IDataReader reader)
 {
     supplierInfo = new SupplierInfo(reader["SupplierID"].ToString() != "" ? Int32.Parse(reader["SupplierID"].ToString()) : 0,
     reader["SupplierCode"].ToString(),
     reader["SupplierName"].ToString(),
     reader["LoginPwd"].ToString(),
     reader["Email"].ToString(),
     reader["ContactAddress"].ToString(),
     reader["Contact"].ToString(),
     reader["Region"].ToString(),
     reader["Stage"].ToString(),
     reader["PostCode"].ToString(),
     reader["ContactPhone"].ToString(),
     reader["MobilePhone"].ToString(),
     reader["QQ"].ToString(),
     reader["Msn"].ToString(),
     reader["Fax"].ToString(),
     reader["WebUrl"].ToString(),
     reader["Logo"].ToString(),
     reader["CompanyIntro"].ToString(),
     reader["CompanyCulture"].ToString(),
     reader["ArtificialPerson"].ToString(),
     reader["Remark"].ToString(),
     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 supplierInfo;
 }
Esempio n. 7
0
 /// <summary>
 /// 更新一条Supplier记录
 /// </summary>
 /// <param name="db">DataBase对象</param>
 /// <param name="tran">一个有效的DbTransaction</param>
 /// <param name="supplier">Supplier对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateSupplier(Database db, DbTransaction tran, SupplierInfo supplierInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Supplier_Parameters(supplierInfo);
     if (paras != null)
     {
         result += DBHelper.ExecuteNonQuery(db, tran, CommandType.Text, SQL_UPDATE_SUPPLIER, paras);
     }
     return result;
 }
Esempio n. 8
0
 /// <summary>
 /// 新增一条Supplier记录
 /// </summary>
 /// <param name="supplier">Supplier对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertSupplier(SupplierInfo supplierInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Supplier_Parameters(supplierInfo);
     if (paras != null)
     {
         result = DBHelper.ExecuteNonQuery(CommandType.Text, SQL_INSERT_SUPPLIER, paras);
     }
     return result;
 }