Пример #1
0
        private void FillPrices()
        {
            if (wareSelectorUC1.WareID != null)
            {
                int wareId = Convert.ToInt32(/*WaresGV.SelectedRows[0].Cells["WareID"].Value*/ wareSelectorUC1.WareID);
                //int priceGroupId = Convert.ToInt32(PriceGroupsCBE.EditValue);
                decimal discount              = Convert.ToDecimal(DiscountForUnitNUD.Value);
                decimal unitQuantity          = Convert.ToDecimal(UnitQuantityNUD.Value);
                decimal secondaryUnitQuantity = Convert.ToDecimal(SecondaryUnitQuantityNUD.Value);

                WarePricesLogic prices = new WarePricesLogic(manager);
                WarePrice       price  = prices.GetAll(wareId).OrderByDescending(a => a.Active).FirstOrDefault();

                if (price != null)
                {
                    UnitPriceNUD.Value = price.SalePriceForUnit;
                }
                else
                {
                    UnitPriceNUD.Value = 0;
                }
            }
        }
Пример #2
0
        private void Fill()
        {
            WarePricesLogic prices     = new WarePricesLogic(manager);
            var             pricesList = prices.GetAll(wareId).Select(a => new
            {
                a.ID,
                a.WareID,
                a.WarePriceGroupID,
                a.DocumentID,
                a.AllowDiscount,
                a.PurchasePriceForUnit,
                a.SalePriceForUnit,
                a.Active,
                a.Ware.Name,
                UnitID             = a.Ware.UnitID,
                UnitName           = a.Ware.WareUnit == null ? "" : a.Ware.WareUnit.Name,
                CategoryID         = a.Ware.CategoryID,
                CategoryName       = a.Ware.WareCategory == null ? "" : a.Ware.WareCategory.Name,
                WarePriceGroupName = a.WarePriceGroup == null ? "" : a.WarePriceGroup.Name,
                ManufacturerName   = a.Ware.WareManufacturer == null ? "" : a.Ware.WareManufacturer.Name,
                ManufacturerID     = a.Ware.ManufacturerID
            });

            view = new SortableBindingList <PricesView>();


            //var waresList = wares.GetAll(name, categoryId, manufacturerId, unitId).Select(a => new
            //{
            //    a.ID,
            //    Name = a.Name,
            //    UnitName = a.WareUnit != null ? a.WareUnit.Name : "",
            //    ManufacturerName = a.WareManufacturer != null ? a.WareManufacturer.Name : "",
            //    CategoryName = a.WareCategory != null ? a.WareCategory.Name : ""
            //});//.OrderBy(a => a.CategoryName).ThenBy(a=> a.Name).ToList();

            foreach (var a in pricesList)
            {
                PricesView pv = new PricesView();
                pv.ID               = a.ID;
                pv.WareName         = a.Name;
                pv.CategoryID       = a.CategoryID;
                pv.CategoryName     = a.CategoryName;
                pv.ManufacturerName = a.ManufacturerName;
                pv.UnitName         = a.UnitName;
                pv.DocumentID       = a.DocumentID;
                pv.ManufacturerID   = a.ManufacturerID;

                pv.PurshasePriceForUnit = a.PurchasePriceForUnit;
                pv.SalePriceForUnit     = a.SalePriceForUnit;
                pv.UnitID             = a.UnitID;
                pv.UnitName           = a.UnitName;
                pv.WareID             = a.WareID;
                pv.WarePriceGroupID   = a.WarePriceGroupID;
                pv.WarePriceGroupName = a.WarePriceGroupName;

                pv.AllowDiscount = a.AllowDiscount;
                pv.Active        = a.Active;
                view.Add(pv);
            }

            //BindingListView<WareView> view = new BindingListView<WareView>(viewList);
            //bs.DataSource = view;
            //bs.Sort = columnName;

            //SortableBindingList<PricesView> viewList = new SortableBindingList<PricesView>(view);
            DataGV.DataSource = view;
            DataGV.Update();
        }
Пример #3
0
        private void Fill()
        {
            WarePricesLogic prices = new WarePricesLogic(manager);
            var pricesList = prices.GetAll(wareId).Select(a => new
            {
                a.ID,
                a.WareID,
                a.WarePriceGroupID,
                a.DocumentID,
                a.AllowDiscount,
                a.PurchasePriceForUnit,
                a.SalePriceForUnit,
                a.Active,
                a.Ware.Name,
                UnitID = a.Ware.UnitID,
                UnitName = a.Ware.WareUnit == null ? "" : a.Ware.WareUnit.Name,
                CategoryID = a.Ware.CategoryID,
                CategoryName = a.Ware.WareCategory == null ? "" : a.Ware.WareCategory.Name,
                WarePriceGroupName = a.WarePriceGroup == null ? "" : a.WarePriceGroup.Name,
                ManufacturerName = a.Ware.WareManufacturer == null ? "" : a.Ware.WareManufacturer.Name,
                ManufacturerID = a.Ware.ManufacturerID
            });

            view = new SortableBindingList<PricesView>();

            //var waresList = wares.GetAll(name, categoryId, manufacturerId, unitId).Select(a => new
            //{
            //    a.ID,
            //    Name = a.Name,
            //    UnitName = a.WareUnit != null ? a.WareUnit.Name : "",
            //    ManufacturerName = a.WareManufacturer != null ? a.WareManufacturer.Name : "",
            //    CategoryName = a.WareCategory != null ? a.WareCategory.Name : ""
            //});//.OrderBy(a => a.CategoryName).ThenBy(a=> a.Name).ToList();

            foreach (var a in pricesList)
            {
                PricesView pv = new PricesView();
                pv.ID = a.ID;
                pv.WareName = a.Name;
                pv.CategoryID = a.CategoryID;
                pv.CategoryName = a.CategoryName;
                pv.ManufacturerName = a.ManufacturerName;
                pv.UnitName = a.UnitName;
                pv.DocumentID = a.DocumentID;
                pv.ManufacturerID = a.ManufacturerID;

                pv.PurshasePriceForUnit = a.PurchasePriceForUnit;
                pv.SalePriceForUnit = a.SalePriceForUnit;
                pv.UnitID = a.UnitID;
                pv.UnitName = a.UnitName;
                pv.WareID = a.WareID;
                pv.WarePriceGroupID = a.WarePriceGroupID;
                pv.WarePriceGroupName = a.WarePriceGroupName;

                pv.AllowDiscount = a.AllowDiscount;
                pv.Active = a.Active;
                view.Add(pv);
            }

            //BindingListView<WareView> view = new BindingListView<WareView>(viewList);
            //bs.DataSource = view;
            //bs.Sort = columnName;

            //SortableBindingList<PricesView> viewList = new SortableBindingList<PricesView>(view);
            DataGV.DataSource = view;
            DataGV.Update();
        }