コード例 #1
0
        private void InitCommands()
        {
            RemoveGoodCommand = new RelayCommand(x =>
            {
                goodService.Remove(SelectedGood);
                Goods.Remove(SelectedGood);
            });

            RemoveCategoryCommand = new RelayCommand(x =>
            {
                categoryService.Remove(SelectedCategory);
                Categories.Remove(SelectedCategory);
            });

            RemoveManufacturerCommand = new RelayCommand(x =>
            {
                manufacturerService.Remove(SelectedManufactirer);
                Manufacturers.Remove(SelectedManufactirer);
            });

            AddUpdateGoodCommand = new RelayCommand(x =>
            {
                AddUpdateGood dlg = new AddUpdateGood();
                dlg.ShowDialog();
                var good = new GoodDTO
                {
                    GoodName       = GoodViewModelProxy.Proxy.GoodName,
                    GoodCount      = GoodViewModelProxy.Proxy.GoodCount,
                    Price          = GoodViewModelProxy.Proxy.GoodPrice,
                    CategoryId     = categoryService.GetAll().FirstOrDefault(y => y.CategoryName == GoodViewModelProxy.Proxy.GoodCategory).CategoryId,
                    ManufacturerId = manufacturerService.GetAll().FirstOrDefault(y => y.ManufacturerName == GoodViewModelProxy.Proxy.GoodManufacturer).ManufacturerId
                };
                var result = goodService.CreateOrUpdate(good);
                Goods.Add(result);
            });

            AddUpdateCategoryCommand = new RelayCommand(x =>
            {
                AddUpdateCategoryView dlg = new AddUpdateCategoryView();
                dlg.ShowDialog();
                var category = new CategoryDTO
                {
                    CategoryName = CategoryViewModelProxy.Proxy.CategoryName
                };
                var result = categoryService.CreateOrUpdate(category);
                Categories.Add(result);
            });

            AddUpdateManufacturerCommand = new RelayCommand(x =>
            {
                AddUpdateManufactorerView dlg = new AddUpdateManufactorerView();
                dlg.ShowDialog();
                var manufactorer = new ManufacturerDTO
                {
                    ManufacturerName = ManufacturerModelProxy.Proxy.ManufacturerName
                };
                var result = manufacturerService.CreateOrUpdate(manufactorer);
                Manufacturers.Add(result);
            });
        }
コード例 #2
0
        //сохранение товара
        private async void SaveGoods(object goodsObject)
        {
            tdGoods goods = goodsObject as tdGoods;

            if (goods != null)
            {
                IsBusy = true;
                // редактирование
                if (goods.tdGoodsID > 0)
                {
                    tdGoods updGoods = await mobileService.Update(goods);

                    // заменяем объект в списке на новый
                    if (updGoods != null)
                    {
                        int pos = Goods.IndexOf(updGoods);
                        Goods.RemoveAt(pos);
                        Goods.Insert(pos, updGoods);
                    }
                }
                // добавление
                else
                {
                    tdGoods addedGoods = await mobileService.Add(goods);

                    if (addedGoods != null)
                    {
                        Goods.Add(addedGoods);
                    }
                }
                IsBusy = false;
            }
            Back();
        }
コード例 #3
0
        public void AddOneDetail(string name, double price, int num)
        {
            OrderDetails orderDetailsTemp;

            orderDetailsTemp = new OrderDetails(name, price, num);
            Goods.Add(orderDetailsTemp);
        }
コード例 #4
0
        //вывод товаров с сервиса
        public async Task GetGoods()
        {
            if (initialized == true)
            {
                return;
            }
            //активируется загрузчик
            IsBusy = true;

            //добавляем данные в коллекцию
            IEnumerable <tdGoods> goods = await mobileService.Get();

            // очищаем список
            while (Goods.Any())
            {
                Goods.RemoveAt(Goods.Count - 1);
            }

            // добавляем загруженные данные коллекцию, где остатки > 0
            foreach (tdGoods a in goods)
            {
                if (a.Boxes > 0 && a.Pallet > 0)
                {
                    Goods.Add(a);
                }
            }
            //отключаем загрузчик после получения всех данных
            IsBusy      = false;
            initialized = true;
        }
コード例 #5
0
 public void AddItem(Goods item)
 {
     if (item != null)
     {
         Goods.Add(item);
         this.SaveChanges();
     }
 }
コード例 #6
0
ファイル: GoodApiVM.cs プロジェクト: HYMPYT/C-Sharp
 public CategoryApiVM(Category cat)
 {
     CategoryId   = cat.CategoryId;
     CategoryName = cat.CategoryName;
     if (cat.Good != null && cat.Good.Count > 0)
     {
         Parallel.ForEach(cat.Good, (g) => Goods.Add(g.GoodId));
     }
 }
コード例 #7
0
ファイル: GoodApiVM.cs プロジェクト: HYMPYT/C-Sharp
 public ManufacturerApiVM(Manufacturer man)
 {
     ManufacturerId   = man.ManufacturerId;
     ManufacturerName = man.ManufacturerName;
     if (man.Good != null && man.Good.Count > 0)
     {
         Parallel.ForEach(man.Good, (g) => Goods.Add(g.GoodId));
     }
 }
コード例 #8
0
 public void AddGood(Good good)
 {
     if (CheckGoods(good))
     {
         Goods.Add(good);
     }
     else
     {
         throw new Exception("Check for good type failed!");
     }
 }
コード例 #9
0
ファイル: Good.cs プロジェクト: marati/LanitShop
        public void Add(object parameter)
        {
            GoodEntity good = parameter as GoodEntity;

            if (good != null)
            {
                if (!Goods.Contains(good))
                {
                    Goods.Add(good);
                }
            }
        }
コード例 #10
0
 public void AddGood(Good good)
 {
     if (CheckGoods(good))
     {
         Goods.Add(good);
     }
     else
     {
         Console.WriteLine($"{good.Name} is not for this shop!");
         Console.WriteLine();
     }
 }
コード例 #11
0
        //-------------------------------------------
        private void MenuOpen_Click(object sender, RoutedEventArgs e)
        {
            if (Goods.Count != 0)
            {
                if (CurrentDir != "")
                {
                    Save(false);
                }
                else
                {
                    Save(true);
                }

                Goods.Clear();
            }

            if (openFileDialog.ShowDialog() == true)
            {
                CurrentDir = openFileDialog.FileName;

                XDocument xdocRead = XDocument.Load(CurrentDir);

                foreach (XElement item in xdocRead.Root.Elements())
                {
                    Laptop laptop = new Laptop()
                    {
                        Name       = item.Element("Name").Value,           /* XElement("Name", item.Name*/
                        OS         = item.Element("OS").Value,             /*Element("OS", item.OS),*/
                        RAM        = item.Element("RAM").Value,            /*Element("RAM", item.RAM),*/
                        HDD        = item.Element("HDD").Value,            /*Element("HDD", item.HDD)),*/
                        ScreenSize = item.Element("ScreenSize").Value,     /*Element("ScreenSize", item.*/
                        VebCam     = item.Element("VebCam").Value,         /*Element("VebCam", item.VebC*/
                        OldPrice   = item.Element("OldPrice").Value,       /*Element("OldPrice", item.Ol*/
                        NewPrice   = item.Element("NewPrice").Value,       /*Element("NewPrice", item.Ne*/
                        ImageName  = item.Element("ImageName").Value       /*Element("ImageName", item.I*/
                    };

                    Goods.Add(laptop);
                }
            }
        }
コード例 #12
0
ファイル: GoodsBLL.cs プロジェクト: syunie/.NETandCloud
 public static int AddGoods(GoodsInfo model)
 {
     return(goodsDAL.Add(model));
 }
コード例 #13
0
 private void Initialize()
 {
     if (!Stores.Any())
     {
         Stores.Add(new Store {
             Descr = "Главный склад", IsAccount = true
         });
         Stores.Add(new Store {
             Descr = "Склад 1", IsAccount = true
         });
         Stores.Add(new Store {
             Descr = "Склад 2", IsAccount = false
         });
         SaveChanges();
     }
     if (!Cags.Any())
     {
         Cags.Add(new Cag {
             Descr = "АктивМед"
         });
         Cags.Add(new Cag {
             Descr = "Пакт-М"
         });
     }
     if (!Categories.Any())
     {
         Categories.Add(new GoodCategory {
             Descr = "Лекарства"
         });
         Categories.Add(new GoodCategory {
             Descr = "БАДы"
         });
     }
     if (!Units.Any())
     {
         Units.Add(new Unit {
             Descr = "Штука", Scale = 1.0, ShortDescr = "шт"
         });
         Units.Add(new Unit {
             Descr = "Упаковка", Scale = 1.0, ShortDescr = "уп"
         });
     }
     if (!Components.Any())
     {
         Components.Add(new Component {
             Descr = "Нафазолин"
         });
         Components.Add(new Component {
             Descr = "Амбазон"
         });
     }
     if (!Goods.Any())
     {
         Goods.Add(new Good {
             Descr = "Нафтизин"
         });
         Goods.Add(new Good {
             Descr = "Фарингосепт"
         });
     }
 }
コード例 #14
0
 public void AddGood(Good good)
 {
     Goods.Add(good);
 }
コード例 #15
0
        public async Task Refresh()
        {
            // NEED TO REWORK FOR THE NEW VIEW - OUTDATED

            IsLoading = true;

            #region Receipts
            Receipts.Clear();
            List <AlbumItem> receipts = await _azure.GetAllImages(CurrentTransaction.ID, true);

            foreach (AlbumItem t in receipts)
            {
                Receipts.Add(t);
            }

            receipts.Add(new AlbumItem {
                IsAddButton = true, IsReceipt = true
            });
            int            i       = 0;
            ImageListItems tempILI = new ImageListItems();

            //ClearItems before applying new items
            ReceiptItems.Clear();
            foreach (AlbumItem t in receipts)
            {
                //RESET temp class for next ListEntry
                if (tempILI == null)
                {
                    tempILI = new ImageListItems();
                }

                //Add Image
                tempILI.ItemImages.Add(t);

                //Add ListEntry content and reset for next Entry
                if (i >= 3)
                {
                    ReceiptItems.Add(tempILI);
                    tempILI = null;
                    i       = 0;
                }
                i++;
            }

            //Fill aditional spaces with filler image
            if (tempILI != null)
            {
                for (int j = tempILI.ItemImages.Count; j < 3; j++)
                {
                    tempILI.ItemImages.Add(new AlbumItem());
                }
                ReceiptItems.Add(tempILI);
            }
            #endregion

            //Reset Values to refresh Goods
            tempILI = null;
            i       = 0;

            #region Goods
            Goods.Clear();
            List <AlbumItem> goods = await _azure.GetAllImages(CurrentTransaction.ID, false);

            foreach (AlbumItem t in goods)
            {
                Goods.Add(t);
            }

            goods.Add(new AlbumItem {
                IsAddButton = true, IsReceipt = false
            });
            //ClearItems before applying new items
            GoodsItems.Clear();
            foreach (AlbumItem t in goods)
            {
                if (tempILI == null)
                {
                    tempILI = new ImageListItems();
                }

                tempILI.ItemImages.Add(t);
                if (i >= 3)
                {
                    GoodsItems.Add(tempILI);
                    tempILI = null;
                    i       = 0;
                }
                i++;
            }

            //Fill aditional spaces with filler image
            if (tempILI != null)
            {
                for (int j = tempILI.ItemImages.Count; j < 3; j++)
                {
                    tempILI.ItemImages.Add(new AlbumItem());
                }
                GoodsItems.Add(tempILI);
            }
            #endregion

            List <AlbumItem> images = await _azure.GetAllImages(CurrentTransaction.ID);

            foreach (AlbumItem image in images)
            {
                Images.Add(image);
            }

            if (!IsUnitTesting)
            {
                HockeyApp.MetricsManager.TrackEvent("Images Page Loaded");
            }

            IsLoading = false;
        }
コード例 #16
0
 public void AddOneDetail(OrderDetails orderDetails)
 {
     Goods.Add(orderDetails);
 }
コード例 #17
0
        public async Task Refresh()
        {
            _receiptItems.Clear();
            _goodsItems.Clear();

            List <AlbumItem> receipts = await _azure.GetAllImages(CurrentTransaction.ID, true);

            foreach (AlbumItem t in receipts)
            {
                Receipts.Add(t);
            }

            receipts.Add(new AlbumItem {
                IsAddButton = true, IsReceipt = true
            });
            int            i       = 0;
            ImageListItems tempILI = new ImageListItems();

            foreach (AlbumItem t in receipts)
            {
                //RESET temp class for next ListEntry
                if (tempILI == null)
                {
                    tempILI = new ImageListItems();
                }

                //Add Image
                tempILI.ItemImages.Add(t);

                //Add ListEntry content and reset for next Entry
                if (i >= 3)
                {
                    ReceiptItems.Add(tempILI);
                    tempILI = null;
                    i       = 0;
                }
                i++;
            }

            //Fill aditional spaces with filler image
            if (tempILI != null)
            {
                for (int j = tempILI.ItemImages.Count; j < 3; j++)
                {
                    tempILI.ItemImages.Add(new AlbumItem());
                }
                ReceiptItems.Add(tempILI);
            }

            //Reset Values to refresh Goods
            tempILI = null;
            i       = 0;


            List <AlbumItem> goods = await _azure.GetAllImages(CurrentTransaction.ID, false);

            foreach (AlbumItem t in goods)
            {
                Goods.Add(t);
            }

            goods.Add(new AlbumItem {
                IsAddButton = true, IsReceipt = false
            });
            foreach (AlbumItem t in goods)
            {
                if (tempILI == null)
                {
                    tempILI = new ImageListItems();
                }

                tempILI.ItemImages.Add(t);
                if (i >= 3)
                {
                    GoodsItems.Add(tempILI);
                    tempILI = null;
                    i       = 0;
                }
                i++;
            }

            //Fill aditional spaces with filler image
            if (tempILI != null)
            {
                for (int j = tempILI.ItemImages.Count; j < 3; j++)
                {
                    tempILI.ItemImages.Add(new AlbumItem());
                }
                GoodsItems.Add(tempILI);
            }
            HockeyApp.MetricsManager.TrackEvent("Images Page Loaded");
        }
コード例 #18
0
 public void AddItem(Item item)
 {
     Goods.Add(item);
 }