public void update(PartInventory cPartInventory, int userId) { partInventory = cPartInventory; if (valid()) { PartInventoryDAL.update(partInventory.partInventoryId, partInventory.partId, partInventory.regDate, partInventory.DOInvoiceNo, partInventory.customerId, partInventory.recd, partInventory.lSold, partInventory.gOnHand, partInventory.price, partInventory.oemRecd, partInventory.rSold, partInventory.imOnHand, partInventory.price2, partInventory.totalAvailabel, partInventory.totalDemand, partInventory.detail, userId); } else { throw new Exception("Invalid Part Inventory Data!"); } }
public int createPartInventory(PartInventory partInventory, int userId) { this.partInventory = partInventory; if (valid()) { return PartInventoryDAL.create(partInventory.partId, partInventory.regDate, partInventory.DOInvoiceNo, partInventory.customerId, partInventory.recd, partInventory.lSold, partInventory.gOnHand, partInventory.price, partInventory.oemRecd, partInventory.rSold, partInventory.imOnHand, partInventory.price2, partInventory.totalAvailabel, partInventory.totalDemand, partInventory.detail, userId); } else { return -1; } }
public static List<PartInventory> getPartInventories(int partId) { try { SQLHelper dbhelper = new SQLHelper(); List<MySqlParameter> lstParameter = new List<MySqlParameter>(); lstParameter.Add(new MySqlParameter("_PartID", partId)); var resultSet = dbhelper.executeSP<DataSet>(lstParameter, "SelectPartInventoryByPartId"); List<PartInventory> partInventories = new List<PartInventory>(); foreach (DataRow drow in resultSet.Tables[0].Rows) { PartInventory partInventory = new PartInventory(); partInventory.partInventoryId = Convert.ToInt32(drow["partInventoryId"].ToString()); partInventory.partId = Convert.ToInt32(drow["partId"].ToString()); partInventory.customerId = (!string.IsNullOrEmpty(drow["customerId"].ToString())) ? Convert.ToInt32(drow["customerId"].ToString()) : 0; partInventory.customerName = drow["customerName"].ToString(); partInventory.regDate = Convert.ToDateTime(drow["regDate"].ToString()); partInventory.DOInvoiceNo = drow["DOInvoiceNo"].ToString(); partInventory.recd = Convert.ToInt32(drow["recd"].ToString()); partInventory.lSold = Convert.ToInt32(drow["lSold"].ToString()); partInventory.gOnHand = Convert.ToInt32(drow["gOnHand"].ToString()); partInventory.oemRecd = Convert.ToInt32(drow["oemRecd"].ToString()); partInventory.price = Convert.ToDecimal(drow["price"].ToString()); partInventory.rSold = Convert.ToInt32(drow["rSold"].ToString()); partInventory.imOnHand = Convert.ToInt32(drow["imOnHand"].ToString()); partInventory.price2 = Convert.ToDecimal(drow["price2"].ToString()); partInventory.totalAvailabel = Convert.ToInt32(drow["totalAvailabel"].ToString()); partInventory.totalDemand = Convert.ToInt32(drow["totalDemand"].ToString()); partInventory.detail = drow["detail"].ToString(); partInventories.Add(partInventory); } return partInventories; } catch (Exception e) { throw e; } }