Beispiel #1
0
        protected bool Equals(DepartmentStockIn entity)
        {
            if (entity == null) return false;
            if (!base.Equals(entity)) return false;

            return true;
        }
        private object PopulateStockOutList(DepartmentStockIn selectedStockIn)
        {
            var details = new ArrayList(DepartmentStockOutDetails);
            foreach (DepartmentStockInDetail inDetail in selectedStockIn.DepartmentStockInDetails)
            {
                Product product = inDetail.Product;
                if (!ProductInStockOutList(details, product))
                {
                    // create new stockout detail for that product
                    DepartmentStockOutDetail newDetail = DataErrorInfoFactory.Create<DepartmentStockOutDetail>();
                    newDetail.Product = inDetail.Product;
                    newDetail.ProductMaster = inDetail.ProductMaster;
                    newDetail.CreateDate = DateTime.Now;
                    newDetail.UpdateDate = DateTime.Now;
                    newDetail.CreateId = "admin";
                    newDetail.UpdateId = "admin";
                    newDetail.Quantity = inDetail.Quantity;
                    newDetail.DepartmentStockQuantity = inDetail.DepartmentStock.Quantity;

                    details.Add(newDetail);
                }
                else
                {
                    DepartmentStockOutDetail result = (from sod in details.OfType<DepartmentStockOutDetail>()
                                             where sod.Product.ProductId.Equals(product.ProductId)
                                             select sod).FirstOrDefault();
                    result.Quantity += inDetail.Quantity;

                }
            }

            DepartmentStockOutDetails = details;
            return null;
        }
        public void FetchDeptStock(DepartmentStockIn stockIn)
        {
            DepartmentStockInDao.Execute(delegate(ISession session)
            {
                foreach (DepartmentStockInDetail inDetail in stockIn.DepartmentStockInDetails)
                {
                    DepartmentStock stock = (from stk in session.Query<DepartmentStock>()
                                       where
                                           stk.DepartmentStockPK.ProductId.Equals(inDetail.Product.ProductId)
                                       select stk).FirstOrDefault();
                    inDetail.DepartmentStock = stock;
                }

                return null;
            });
        }
 public DepartmentStockIn Fetch(DepartmentStockIn selectedStockIn)
 {
     return DepartmentStockInDao.Fetch(selectedStockIn);
 }
 public void Delete(DepartmentStockIn data)
 {
     DepartmentStockInDao.Delete(data);
 }
 public DepartmentStockIn Add(DepartmentStockIn data)
 {
     DepartmentStockInDao.Add(data);
     return data;
 }
 public void Update(DepartmentStockIn data)
 {
     DepartmentStockInDao.Update(data);
 }