예제 #1
0
        private void sklad_Click(object sender, RoutedEventArgs e)
        {
            clothSklad sklad = new clothSklad(IdUser);

            sklad.Show();
            this.Close();
        }
예제 #2
0
파일: sklad.xaml.cs 프로젝트: Zorrys9/wsr
        private void clth_Click(object sender, RoutedEventArgs e)
        {
            clothSklad cs = new clothSklad(IdUser);

            cs.Show();
            this.Close();
        }
예제 #3
0
        private void Exit_Click(object sender, RoutedEventArgs e)
        {
            clothSklad clothSkl = new clothSklad(IdUser);

            if (nameItem == "Ткань")
            {
                clothSkl.Show();
                this.Close();
            }
            else if (nameItem == "Фурнитура")
            {
                furnitureSklad furnitureSklad = new furnitureSklad(IdUser);
                furnitureSklad.Show();
                this.Close();
            }
        }
예제 #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string[] listInventory = new string[4];
            int      cntDoc        = 0;

            for (int i = 0; i < inventoryClothList.Items.Count - 1; i++)
            {
                listInventory = db.ArrayItem(i, dt);
                cntDoc       += int.Parse(listInventory[3]);
            }
            var select = db.kladCloth;
            int cntSkl = 0;

            foreach (kladCloth cloth in select)
            {
                cntSkl += cloth.count;
            }
            int           diff          = cntDoc - cntSkl;
            DateTime      dat           = DateTime.Parse(DateTime.Now.ToString("dd MMMM yyyy"));
            inventoryItog inventoryItog = new inventoryItog {
                date = dat, item = nameItem, difference = diff
            };

            db.inventory.Add(inventoryItog);
            db.SaveChanges();
            var select2 = db.inventory.Where(inv => inv.date == dat && inv.difference == diff && inv.item == nameItem);

            for (int i = 0; i < inventoryClothList.Items.Count - 1; i++)
            {
                listInventory = db.ArrayItem(i, dt);
                inventoryItem inventoryItm = new inventoryItem();
                inventoryItm.articul      = listInventory[0];
                inventoryItm.length       = double.Parse(listInventory[2]);
                inventoryItm.width        = double.Parse(listInventory[3]);
                inventoryItm.Idinv        = select2.FirstOrDefault().Id;
                inventoryItm.countToDoc   = cntDoc;
                inventoryItm.countToSklad = cntSkl;
                db.inventoryItem.Add(inventoryItm);
            }
            db.SaveChanges();
            clothSklad clothSkl = new clothSklad(IdUser);

            MessageBox.Show("Инвентаризация успешно сохранена");
            clothSkl.Show();
            this.Close();
        }
예제 #5
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string[] listcloth = new string[4];

            for (int i = 0; i < postCloth.Items.Count - 1; i++)
            {
                listcloth = db.ArrayItem(i, dt);
                string art   = listcloth[0];
                double wdth  = double.Parse(listcloth[1]);
                double lngth = double.Parse(listcloth[2]);
                int    cnt   = int.Parse(listcloth[3]);

                var select = db.kladCloth.Where(kc => kc.cloth == art && kc.width == wdth && kc.length == lngth);
                if (select.Count() != 0)
                {
                    cnt += select.FirstOrDefault().count;
                    int id = select.FirstOrDefault().Id;

                    kladCloth update = db.kladCloth.Find(id);
                    update.count = cnt;
                    db.kladCloth.Create();
                    db.SaveChanges();
                }
                else
                {
                    kladCloth item = new kladCloth();
                    item.cloth  = art;
                    item.count  = cnt;
                    item.length = lngth;
                    item.width  = wdth;
                    var insert = db.kladCloth.Add(item);
                    db.SaveChanges();
                }
            }
            MessageBox.Show("Товары успешно добавлены на склад");
            clothSklad cs = new clothSklad(IdUser);

            cs.Show();
            this.Close();
        }
예제 #6
0
        private void inpsave_Click(object sender, RoutedEventArgs e)
        {
            string[] list = new string[4];
            for (int i = 0; i < listcloth.Items.Count - 1; i++)
            {
                list = db.ArrayItem(i, dt);

                string art   = list[0];
                double wdth  = double.Parse(list[1]);
                double lngth = double.Parse(list[2]);
                int    cnt   = int.Parse(list[3]);

                var select = db.kladCloth.Where(kcl => kcl.cloth == art && kcl.width == wdth && kcl.length == lngth);
                if (select.Count() != 0)
                {
                    if (select.FirstOrDefault().count >= cnt)
                    {
                        cnt = select.FirstOrDefault().count - cnt;

                        kladCloth item = db.kladCloth.Find(select.FirstOrDefault().Id);
                        item.count = cnt;
                        db.kladCloth.Create();
                        db.SaveChanges();
                        MessageBox.Show("Данные успешно обновлены");
                        clothSklad cs = new clothSklad(IdUser);
                        cs.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Запрошенного количества товара нет на складе");
                    }
                }
                else
                {
                    MessageBox.Show("Одного из товаров не существует");
                }
            }
        }
예제 #7
0
        private void Window_Closed(object sender, EventArgs e)
        {
            clothSklad cs = new clothSklad(IdUser);

            cs.Show();
        }