示例#1
0
        public static StockIn Create(Department department,IDictionary<Product,long> productList, string createId,DateTime createDate,string description,int stockInType = 1,int confirmFlag = 1)
        {
            CoralPOS.Models.StockIn stockIn = new CoralPOS.Models.StockIn
            {
                CreateDate = createDate,
                ConfirmFlg = confirmFlag,
                CreateId = createId,
                UpdateId = createId,
                UpdateDate = createDate,
                Description = description,
                ExclusiveKey = 0,
                DelFlg = 0,
                StockInDate = createDate,
                StockInDetails = new List<StockInDetail>(),
                StockInType = 3,

            };

            foreach (var tempValid in productList)
            {
                CoralPOS.Models.StockInDetail detail = new StockInDetail
                {
                    StockIn = stockIn,
                    CreateDate = createDate,
                    UpdateDate = createDate,
                    CreateId = createId,
                    UpdateId = createId,
                    DelFlg = 0,
                    ExclusiveKey = 0,
                    Quantity = tempValid.Value,
                    Product = tempValid.Key,
                    ProductMaster = tempValid.Key.ProductMaster,
                    StockInType = stockInType,

                };
                stockIn.StockInDetails.Add(detail);
            }
            return stockIn;
        }
示例#2
0
 public void Delete(StockInDetail data)
 {
     StockInDetailDao.Delete(data);
 }
示例#3
0
 public StockInDetail Add(StockInDetail data)
 {
     StockInDetailDao.Add(data);
     return data;
 }
示例#4
0
 public void Update(StockInDetail data)
 {
     StockInDetailDao.Update(data);
 }
示例#5
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);
            }
        }
示例#6
0
        protected bool Equals(StockInDetail entity)
        {
            if (entity == null) return false;
            if (!base.Equals(entity)) return false;

            return true;
        }