示例#1
0
 public ActionResult Edit(ItemInfo itemInfo)
 {
     if (itemInfo.ItemID == 0)
     {
         return Insert(itemInfo);
     }
     else
     {
         return Update(itemInfo);
     }
 }
示例#2
0
 public ActionResult Insert(ItemInfo itemInfo)
 {
     try
     {
         itemInfo.CreatedDate = DateTime.Now;
         itemInfo.UpdatedDate = DateTime.Now;
         itemInfo.CreatedBy = CurrentUserInfo.UserCode;
         itemInfo.UpdatedBy = CurrentUserInfo.UserCode;
         IItemService itemService = UnityHelper.UnityResolve<IItemService>();
         var data = itemService.InsertItem(itemInfo);
         LogHelper.LogOperation(CurrentUserInfo.UserCode, string.Format("Insert ItemInfo {0},{1}", LogHelper.ChangeEntityToLog(itemInfo), 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);
     }
 }
示例#3
0
 /// <summary>
 /// 更新一条Item记录
 /// </summary>
 /// <param name="item">Item对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateItem(ItemInfo itemInfo)
 {
     return itemDA.UpdateItem(itemInfo);
 }
示例#4
0
 /// <summary>
 /// 新增一条Item记录
 /// </summary>
 /// <param name="item">Item对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertItem(ItemInfo itemInfo)
 {
     return itemDA.InsertItem(itemInfo);
 }
示例#5
0
文件: ItemDA.cs 项目: jerryxi/GXP
 /// <summary>
 /// 设置SQL参数表
 /// </summary>
 /// <param name="Item">Item对象</param>
 /// <returns>Item参数数组</returns>
 private SqlParameter[] Set_Item_Parameters(ItemInfo itemInfo)
 {
     SqlParameter[] paramArray = new SqlParameter[] {new SqlParameter("@ItemID",itemInfo.ItemID),
                                                         new SqlParameter("@SupplierID",itemInfo.SupplierID),
                                                         new SqlParameter("@ItemCode",itemInfo.ItemCode),
                                                         new SqlParameter("@ItemName",itemInfo.ItemName),
                                                         new SqlParameter("@ItemDescription",string.IsNullOrEmpty(itemInfo.ItemDescription)?"":itemInfo.ItemDescription),
                                                         new SqlParameter("@ItemSynopsis",string.IsNullOrEmpty(itemInfo.ItemSynopsis)?"":itemInfo.ItemSynopsis),
                                                         new SqlParameter("@ItemCharacter",string.IsNullOrEmpty(itemInfo.ItemCharacter)?"":itemInfo.ItemCharacter),
                                                         new SqlParameter("@ItemClassID",string.IsNullOrEmpty(itemInfo.ItemClassID)?"":itemInfo.ItemClassID),
                                                         new SqlParameter("@ItemBrandID",string.IsNullOrEmpty(itemInfo.ItemBrandID)?"":itemInfo.ItemBrandID),
                                                         new SqlParameter("@GrossWgt",itemInfo.GrossWgt),
                                                         new SqlParameter("@NetWgt",itemInfo.NetWgt),
                                                         new SqlParameter("@Length",itemInfo.Length),
                                                         new SqlParameter("@Width",itemInfo.Width),
                                                         new SqlParameter("@Height",itemInfo.Height),
                                                         new SqlParameter("@Cube",itemInfo.Cube),
                                                         new SqlParameter("@UomID",string.IsNullOrEmpty(itemInfo.UomID)?"":itemInfo.UomID),
                                                         new SqlParameter("@AreaID",string.IsNullOrEmpty(itemInfo.AreaID)?"":itemInfo.AreaID),
                                                         new SqlParameter("@CostPrice",itemInfo.CostPrice),
                                                         new SqlParameter("@MarketPrice",itemInfo.MarketPrice),
                                                         new SqlParameter("@AdvicePrice",itemInfo.AdvicePrice),
                                                         new SqlParameter("@SalesPrice",itemInfo.SalesPrice),
                                                         new SqlParameter("@ItemStyle",string.IsNullOrEmpty(itemInfo.ItemStyle)?"":itemInfo.ItemStyle),
                                                         new SqlParameter("@ItemColor",string.IsNullOrEmpty(itemInfo.ItemColor)?"":itemInfo.ItemColor),
                                                         new SqlParameter("@ItemSize",string.IsNullOrEmpty(itemInfo.ItemSize)?"":itemInfo.ItemSize),
                                                         new SqlParameter("@PresentPoints",itemInfo.PresentPoints),
                                                         new SqlParameter("@PhotoUrl",string.IsNullOrEmpty(itemInfo.PhotoUrl)?"":itemInfo.PhotoUrl),
                                                         new SqlParameter("@Remark",string.IsNullOrEmpty(itemInfo.Remark)?"":itemInfo.Remark),
                                                         new SqlParameter("@IsActive",string.IsNullOrEmpty(itemInfo.IsActive)?"":itemInfo.IsActive),
                                                         new SqlParameter("@IsAudited",string.IsNullOrEmpty(itemInfo.IsAudited)?"":itemInfo.IsAudited),
                                                         new SqlParameter("@BillingType",string.IsNullOrEmpty(itemInfo.BillingType)?"":itemInfo.BillingType),
                                                         new SqlParameter("@CreatedBy",itemInfo.CreatedBy),
                                                         new SqlParameter("@UpdatedBy",itemInfo.UpdatedBy)
                                                     };
     return paramArray;
 }
示例#6
0
文件: ItemDA.cs 项目: jerryxi/GXP
 /// <summary>
 /// 初始化ItemInfo
 /// </summary>
 private ItemInfo InitItemInfoByDataReader(ItemInfo itemInfo, IDataReader reader)
 {
     itemInfo = new ItemInfo(reader["ItemID"].ToString() != "" ? Int32.Parse(reader["ItemID"].ToString()) : 0,
     reader["SupplierID"].ToString() != "" ? Int32.Parse(reader["SupplierID"].ToString()) : 0,
     reader["ItemCode"].ToString(),
     reader["ItemName"].ToString(),
     reader["ItemDescription"].ToString(),
     reader["ItemSynopsis"].ToString(),
     reader["ItemCharacter"].ToString(),
     reader["ItemClassID"].ToString(),
     reader["ItemBrandID"].ToString(),
     reader["GrossWgt"].ToString() != "" ? Decimal.Parse(reader["GrossWgt"].ToString()) : 0,
     reader["NetWgt"].ToString() != "" ? Decimal.Parse(reader["NetWgt"].ToString()) : 0,
     reader["Length"].ToString() != "" ? Decimal.Parse(reader["Length"].ToString()) : 0,
     reader["Width"].ToString() != "" ? Decimal.Parse(reader["Width"].ToString()) : 0,
     reader["Height"].ToString() != "" ? Decimal.Parse(reader["Height"].ToString()) : 0,
     reader["Cube"].ToString() != "" ? Decimal.Parse(reader["Cube"].ToString()) : 0,
     reader["UomID"].ToString(),
     reader["AreaID"].ToString(),
     reader["CostPrice"].ToString() != "" ? Decimal.Parse(reader["CostPrice"].ToString()) : 0,
     reader["MarketPrice"].ToString() != "" ? Decimal.Parse(reader["MarketPrice"].ToString()) : 0,
     reader["AdvicePrice"].ToString() != "" ? Decimal.Parse(reader["AdvicePrice"].ToString()) : 0,
     reader["SalesPrice"].ToString() != "" ? Decimal.Parse(reader["SalesPrice"].ToString()) : 0,
     reader["ItemStyle"].ToString(),
     reader["ItemColor"].ToString(),
     reader["ItemSize"].ToString(),
     reader["PresentPoints"].ToString() != "" ? Int32.Parse(reader["PresentPoints"].ToString()) : 0,
     reader["PhotoUrl"].ToString(),
     reader["Remark"].ToString(),
     reader["IsActive"].ToString(),
     reader["IsAudited"].ToString(),
     reader["BillingType"].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 itemInfo;
 }
示例#7
0
文件: ItemDA.cs 项目: jerryxi/GXP
 /// <summary>
 /// 更新一条Item记录
 /// </summary>
 /// <param name="db">DataBase对象</param>
 /// <param name="tran">一个有效的DbTransaction</param>
 /// <param name="item">Item对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateItem(Database db, DbTransaction tran, ItemInfo itemInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Item_Parameters(itemInfo);
     if (paras != null)
     {
         result += DBHelper.ExecuteNonQuery(db, tran, CommandType.Text, SQL_UPDATE_ITEM, paras);
     }
     return result;
 }
示例#8
0
文件: ItemDA.cs 项目: jerryxi/GXP
 /// <summary>
 /// 新增一条Item记录
 /// </summary>
 /// <param name="item">Item对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertItem(ItemInfo itemInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Item_Parameters(itemInfo);
     if (paras != null)
     {
         result = DBHelper.ExecuteNonQuery(CommandType.Text, SQL_INSERT_ITEM, paras);
     }
     return result;
 }