Пример #1
0
        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));
        }
Пример #2
0
        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;
            
        }
Пример #3
0
 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);
 }
Пример #4
0
        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);
            }

        }
Пример #5
0
 public void ResetQtyInUse(ProductInventory productInventory) { BasicMngr.ResetQtyInUse(productInventory); }
Пример #6
0
 public void PersistProductInUse(ProductInventory productInventory) { BasicMngr.PersistProductInUse(productInventory); }
Пример #7
0
 public IList<ProductInventory> GetProductInventoryByProduct(ProductInventory productInventory, List<int> productList)
 { return Factory.DaoProductInventory().GetProductInventory(productInventory, productList); }
Пример #8
0
 public void UpdateProductInventory(ProductInventory data) { Factory.DaoProductInventory().Update(data); }
Пример #9
0
 public void DeleteProductInventory(ProductInventory data) { Factory.DaoProductInventory().Delete(data); }
Пример #10
0
 public ProductInventory SaveProductInventory(ProductInventory data) { return Factory.DaoProductInventory().Save(data); }
Пример #11
0
 public IList<ProductInventory> GetProductInventory(ProductInventory data) { return Factory.DaoProductInventory().Select(data); }
Пример #12
0
 public ProductInventory SelectById(ProductInventory data)
 {
     return (ProductInventory)base.SelectById(data);
 }
Пример #13
0
 public Boolean Delete(ProductInventory data)
 {
     return base.Delete(data);
 }
Пример #14
0
 public Boolean Update(ProductInventory data)
 {
     return base.Update(data);
 }
Пример #15
0
 public ProductInventory Save(ProductInventory data)
 {
     return (ProductInventory)base.Save(data);
 }
Пример #16
0
        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>();
        }