private object LoadStockInAndGoToDetail(CoralPOS.Models.StockIn stockOut)
 {
     stockOut = StockInLogic.Fetch(stockOut);
     Flow.Session.Put(FlowConstants.SAVE_STOCK_IN, stockOut);
     return null;
 }
        private object PopulateStockOutList(CoralPOS.Models.StockIn selectedStockIn)
        {
            var details = new ArrayList(StockOutDetails);
            foreach (StockInDetail inDetail in selectedStockIn.StockInDetails)
            {
                Product product = inDetail.Product;
                if (!ProductInStockOutList(details, product))
                {
                    // create new stockout detail for that product
                    StockOutDetail newDetail = DataErrorInfoFactory.Create<StockOutDetail>();
                    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.StockQuantity = inDetail.Stock.Quantity;
                    newDetail.GoodQuantity = inDetail.Quantity;
                    details.Add(newDetail);
                }
                else
                {
                    StockOutDetail result = (from sod in details.OfType<StockOutDetail>()
                                             where sod.Product.ProductId.Equals(product.ProductId)
                                             select sod).FirstOrDefault();
                    result.Quantity += inDetail.Quantity;
                    result.GoodQuantity += inDetail.Quantity;
                }
            }

            StockOutDetails = details;
            return null;
        }
 private void PopulatePrice(CoralPOS.Models.StockIn stockIn)
 {
     foreach (var detail in stockIn.StockInDetails)
     {
         MainPricePK pk = new MainPricePK
         {
             DepartmentId = 0,
             ProductMasterId = detail.Product.ProductMaster.ProductMasterId
         };
         detail.MainPrice = MainPriceLogic.FindById(pk);
     }
 }