public override Boolean Equals(object obj) { if ((obj == null) || (obj.GetType() != this.GetType())) { return(false); } ProductInventory castObj = (ProductInventory)obj; return((castObj != null) && (this.RowID == castObj.RowID)); }
public IList<ProductInventory> Select(ProductInventory data) { IList<ProductInventory> datos = new List<ProductInventory>(); try { datos = GetHsql(data).List<ProductInventory>(); if (!Factory.IsTransactional) Factory.Commit(); } catch (Exception e) { NHibernateHelper.WriteEventLog(WriteLog.GetTechMessage(e)); } return datos; }
public void ResetQtyInUse(ProductInventory productInventory) { //Borrando todas las lineas que no fueron allocated. IList<ProductInventory> list = Factory.DaoProductInventory().Select(productInventory); foreach (ProductInventory reg in list.Where(f => f.QtyAllocated <= 0)) Factory.DaoProductInventory().Delete(reg); }
public void PersistProductInUse(ProductInventory productInventory) { try //NEW { productInventory.CreationDate = DateTime.Now; productInventory.ModDate = DateTime.Now; productInventory.ModifiedBy = productInventory.CreatedBy; Factory.DaoProductInventory().Save(productInventory); } catch { //UPDATE double qtyInUse = productInventory.QtyInUse; double qtyAllocated = productInventory.QtyAllocated; string createdBy = productInventory.CreatedBy; productInventory = Factory.DaoProductInventory().Select(productInventory).First(); productInventory.QtyInUse += qtyInUse; if (productInventory.QtyInUse < 0) productInventory.QtyInUse = 0; if (productInventory.QtyAllocated < 0) productInventory.QtyAllocated += qtyAllocated; if (productInventory.QtyAllocated + productInventory.QtyInUse == 0) { Factory.DaoProductInventory().Delete(productInventory); return; } productInventory.ModDate = DateTime.Now; productInventory.ModifiedBy = createdBy; Factory.DaoProductInventory().Update(productInventory); } }
public void ResetQtyInUse(ProductInventory productInventory) { BasicMngr.ResetQtyInUse(productInventory); }
public void PersistProductInUse(ProductInventory productInventory) { BasicMngr.PersistProductInUse(productInventory); }
public IList<ProductInventory> GetProductInventoryByProduct(ProductInventory productInventory, List<int> productList) { return Factory.DaoProductInventory().GetProductInventory(productInventory, productList); }
public void UpdateProductInventory(ProductInventory data) { Factory.DaoProductInventory().Update(data); }
public void DeleteProductInventory(ProductInventory data) { Factory.DaoProductInventory().Delete(data); }
public ProductInventory SaveProductInventory(ProductInventory data) { return Factory.DaoProductInventory().Save(data); }
public IList<ProductInventory> GetProductInventory(ProductInventory data) { return Factory.DaoProductInventory().Select(data); }
public ProductInventory SelectById(ProductInventory data) { return (ProductInventory)base.SelectById(data); }
public Boolean Delete(ProductInventory data) { return base.Delete(data); }
public Boolean Update(ProductInventory data) { return base.Update(data); }
public ProductInventory Save(ProductInventory data) { return (ProductInventory)base.Save(data); }
public IList<ProductInventory> GetProductInventory(ProductInventory productInventory, List<int> productList) { StringBuilder sql = new StringBuilder("select a from ProductInventory a Where "); if (productInventory != null) { Parms = new List<Object[]>(); if (productInventory.RowID != 0) { sql.Append(" a.RowID = :id and "); Parms.Add(new Object[] { "id", productInventory.RowID }); } if (productInventory.Location != null && productInventory.Location.LocationID != 0) { sql.Append(" a.Location.LocationID = :id1 and "); Parms.Add(new Object[] { "id1", productInventory.Location.LocationID }); } if (productInventory.Product != null && productInventory.Product.ProductID != 0) { sql.Append(" a.Product.ProductID = :cot and "); Parms.Add(new Object[] { "cot", productInventory.Product.ProductID }); } if (productInventory.Document != null && productInventory.Document.DocID != 0) { sql.Append(" a.Document.DocID = :doc and "); Parms.Add(new Object[] { "doc", productInventory.Document.DocID }); } if (productList != null && productList.Count > 0) { sql.Append(" a.Product.ProductID IN ( 0 "); int i = 0; foreach (int p in productList) { sql.Append(", :px" + i.ToString()); Parms.Add(new Object[] { "px" + i.ToString(), p }); i++; } sql.Append(") and "); } } sql = new StringBuilder(sql.ToString()); sql.Append(" 1=1 "); IQuery query = Factory.Session.CreateQuery(sql.ToString()); SetParameters(query); return query.List<ProductInventory>(); }