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); } }
protected bool Equals(MainPrice entity) { if (entity == null) return false; if (!base.Equals(entity)) return false; return true; }
private object SaveProductMaster() { CoralPOS.Models.ProductMaster master = Flow.Session.Get(FlowConstants.SAVE_PRODUCT_MASTER) as CoralPOS.Models.ProductMaster; IList productColors = Flow.Session.Get(FlowConstants.SAVE_PRODUCT_COLORS_LIST) as IList; IList productSizes = Flow.Session.Get(FlowConstants.SAVE_PRODUCT_SIZES_LIST) as IList; IsOK = ProductMasterLogic.Save(master, productColors, productSizes); if(IsOK) { message = master.ProductName + " đã được lưu thành công !"; // save MainPrice with default value is 0. DO WE NEED ? MainPrice price = new MainPrice { MainPricePK = new MainPricePK { DepartmentId = 0, ProductMasterId = master.ProductMasterId }, CreateDate = DateTime.Now, CreateId = "admin", DelFlg = 0, ExclusiveKey = 1, ProductMaster = master, UpdateDate = DateTime.Now, UpdateId = "admin", WholeSalePrice = 0, Price = 0 }; //MainPriceLogic.Add(price); } return null; }
public void Delete(MainPrice data) { MainPriceDao.Delete(data); }
public MainPrice Add(MainPrice data) { MainPriceDao.Add(data); return data; }
public void Update(MainPrice data) { MainPriceDao.Update(data); }