예제 #1
0
        protected bool Equals(MainPricePK entity)
        {
            if (entity == null) return false;
            if (!base.Equals(entity)) return false;

            return true;
        }
예제 #2
0
        private void CreateProductIdForInput(IList colorList, IList sizeList)
        {

            var productMaster = ProductMaster;
            string price = string.IsNullOrEmpty(Price) ? "0" : Price;
            string wholesaleprice = string.IsNullOrEmpty(WholeSalePrice) ? "0" : WholeSalePrice;
            MainPricePK findPk = new MainPricePK { DepartmentId = 0, ProductMasterId = productMaster.ProductMasterId };
            MainPrice newPrice = null;
            newPrice = MainPriceLogic.FindById(findPk);
            if (newPrice == null)
            {
                newPrice = new MainPrice();
                newPrice.Price = Int64.Parse(price);
                newPrice.WholeSalePrice = Int64.Parse(wholesaleprice);

                MainPricePK newPricePK = new MainPricePK
                {
                    DepartmentId = 0,
                    ProductMasterId = productMaster.ProductMasterId
                };
                newPrice.MainPricePK = newPricePK;
            }
            else // price has been existed
            {
                Price = newPrice.Price.ToString();
                WholeSalePrice = newPrice.WholeSalePrice.ToString();
            }

            IList<Product> products = StockInHelper.CreateProduct(productMaster, colorList, sizeList);
            foreach (Product newProduct in products)
            {
                bool isFound = CheckProductInStockInDetailList(newProduct);
                if (isFound) continue;

                string inputPrice = string.IsNullOrEmpty(InputPrice) ? "0" : InputPrice;
                //StockInDetail newDetail = DataErrorInfoFactory.Create<StockInDetail>();
                //StockInDetail newDetail = DataErrorInfoFactory.Create<StockInDetail>();
                StockInDetail newDetail = new StockInDetail();
                newDetail.Product = newProduct;
                newDetail.ProductMaster = productMaster;
                newDetail.CreateDate = DateTime.Now;
                newDetail.UpdateDate = DateTime.Now;
                newDetail.CreateId = "admin";
                newDetail.UpdateId = "admin";
                newDetail.Quantity = 0;
                newDetail.Price = Int64.Parse(inputPrice);
                StockInDetailPK detailPK = new StockInDetailPK
                                               {
                                                   ProductId = newProduct.ProductId
                                               };

                newDetail.StockInDetailPK = detailPK;
                //newDetail = DataErrorInfoFactory.CreateProxyFor(newDetail);


                //MainPrice newPrice = DataErrorInfoFactory.Create<MainPrice>();


                //newPrice = DataErrorInfoFactory.CreateProxyFor(newPrice);
                newDetail.MainPrice = newPrice;

                IList list = new ArrayList(_stockInDetailList);
                list.Add(newDetail);
                StockInDetailList = list;

            }
            if (StockIn.StockInDetails == null)
            {
                StockIn.StockInDetails = ObjectConverter.ConvertTo<StockInDetail>(StockInDetailList);
                NotifyOfPropertyChange(() => StockIn);
            }
        }
 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);
     }
 }