示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_shop"></param>
        /// <param name="param">1 означает что это возврат товара</param>
        public BarcodeEnter(ShopClient _shop, int param = 0)
        {
            InitializeComponent();
            masGoods = new List <Good>();
            textBox1.Select();
            this.shop  = _shop;
            this.param = param;
            r          = new Random();

            sale();

            if (param == 0)
            {
                this.Text  = "Продажа товара";
                goodsCount = shop.GetGoodsBalance();
            }
            else
            {
                this.Text = "Возврат товара";
            }
        }
示例#2
0
文件: Form1.cs 项目: B10S2/Shop
        //Обновление информации в TabPages
        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            TabControl control = (sender as TabControl);

            if (control.SelectedTab.Text == "Все категории")
            {
                string[] Cat = Shop.GetCategoryes();
                dataGridView3.Rows.Clear();
                foreach (string s in Cat)
                {
                    DataGridViewRow  row = new DataGridViewRow();
                    DataGridViewCell cel = new DataGridViewTextBoxCell();
                    cel.Value = s;
                    row.Cells.Add(cel);
                    dataGridView3.Rows.Add(row);
                }
            }
            else if (control.SelectedTab.Text == "Все товары")
            {
                Good[] goods = Shop.GetAllGoods();
                dgvAllGoods.Rows.Clear();
                foreach (Good g in goods)
                {
                    DataGridViewRow  row = new DataGridViewRow();
                    DataGridViewCell cel = new DataGridViewTextBoxCell();
                    cel.Value = g.Barcode;
                    row.Cells.Add(cel);

                    cel       = new DataGridViewTextBoxCell();
                    cel.Value = g.Name;
                    row.Cells.Add(cel);

                    dgvAllGoods.Rows.Add(row);
                }
            }
            else if (control.SelectedTab.Text == "Товаров на складе")
            {
                Good[] goods = Shop.GetGoodsBalance();
                dgvBalance.Rows.Clear();
                foreach (Good g in goods)
                {
                    DataGridViewRow  row = new DataGridViewRow();
                    DataGridViewCell cel = new DataGridViewTextBoxCell();
                    cel.Value = g.Barcode;
                    row.Cells.Add(cel);

                    cel       = new DataGridViewTextBoxCell();
                    cel.Value = g.Name;
                    row.Cells.Add(cel);


                    cel       = new DataGridViewTextBoxCell();
                    cel.Value = g.Category;
                    row.Cells.Add(cel);


                    cel       = new DataGridViewTextBoxCell();
                    cel.Value = g.Count;
                    row.Cells.Add(cel);


                    cel       = new DataGridViewTextBoxCell();
                    cel.Value = g.PriceOut;
                    row.Cells.Add(cel);

                    dgvBalance.Rows.Add(row);
                }
            }
            else if (control.SelectedTab.Text == "Добавленные сегодня")
            {
                Good[] goods = Shop.GetGoodsToDay();
                dgvChangeInserted.Rows.Clear();
                foreach (Good g in goods)
                {
                    DataGridViewRow  row = new DataGridViewRow();
                    DataGridViewCell cel = new DataGridViewTextBoxCell();
                    cel.Value = g.Barcode;
                    row.Cells.Add(cel);

                    cel       = new DataGridViewTextBoxCell();
                    cel.Value = g.Name;
                    row.Cells.Add(cel);


                    cel       = new DataGridViewTextBoxCell();
                    cel.Value = g.Category;
                    row.Cells.Add(cel);


                    cel       = new DataGridViewTextBoxCell();
                    cel.Value = g.Count;
                    row.Cells.Add(cel);


                    cel       = new DataGridViewTextBoxCell();
                    cel.Value = g.PriceIn;
                    row.Cells.Add(cel);
                    row.Tag = g.idWare;

                    dgvChangeInserted.Rows.Add(row);
                }
            }
        }
示例#3
0
文件: Form1.cs 项目: B10S2/Shop
        //Обновление инф в таб контроле
        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            TabControl control = (sender as TabControl);

            try
            {
                if (control.SelectedTab.Text == "Остатки на складе")
                {
                    #region
                    Good[] goods = shop.GetGoodsBalance();
                    dgv4.Rows.Clear();
                    foreach (Good g in goods)
                    {
                        DataGridViewRow  row = new DataGridViewRow();
                        DataGridViewCell cel = new DataGridViewTextBoxCell();
                        cel.Value = g.Barcode;
                        row.Cells.Add(cel);

                        cel       = new DataGridViewTextBoxCell();
                        cel.Value = g.Name;
                        row.Cells.Add(cel);

                        cel       = new DataGridViewTextBoxCell();
                        cel.Value = g.PriceOut;
                        row.Cells.Add(cel);

                        cel       = new DataGridViewTextBoxCell();
                        cel.Value = g.Count;
                        row.Cells.Add(cel);

                        cel       = new DataGridViewTextBoxCell();
                        cel.Value = g.Category;
                        row.Cells.Add(cel);

                        dgv4.Rows.Add(row);
                    }
                    #endregion
                }
                if (control.SelectedTab.Text == "Операции с деньгами за текущий день")
                {
                    #region
                    dgv3.Rows.Clear();
                    CashOperation[] saleToday = shop.GetToDayOperations();
                    foreach (CashOperation CO in saleToday)
                    {
                        DataGridViewRow        row  = new DataGridViewRow();
                        DataGridViewCell       cel  = new DataGridViewTextBoxCell();
                        DataGridViewButtonCell Bcel = new DataGridViewButtonCell();
                        Color color = new Color();
                        if (CO.TypeOperation.Equals("Инкасация", StringComparison.InvariantCultureIgnoreCase))
                        {
                            color = Color.Red;
                        }
                        if (CO.TypeOperation.Equals("Пополнение", StringComparison.InvariantCultureIgnoreCase))
                        {
                            color = Color.Green;
                        }
                        if (CO.TypeOperation.Equals("Продажа", StringComparison.InvariantCultureIgnoreCase))
                        {
                            color = Color.White;
                        }


                        cel.Value           = CO.PriceOperation;
                        cel.Style.BackColor = color;
                        row.Cells.Add(cel);

                        cel                 = new DataGridViewTextBoxCell();
                        cel.Value           = CO.TimeOpertion;
                        cel.Style.BackColor = color;
                        row.Cells.Add(cel);

                        cel                 = new DataGridViewTextBoxCell();
                        cel.Value           = CO.TypeOperation;
                        cel.Style.BackColor = color;
                        row.Cells.Add(cel);

                        cel                 = new DataGridViewTextBoxCell();
                        cel.Value           = CO.CashBalance;
                        cel.Style.BackColor = color;
                        row.Cells.Add(cel);

                        Bcel.Style.BackColor = color;
                        Bcel.Value           = "Подробности";
                        row.Cells.Add(Bcel);

                        row.Tag = CO.ID;
                        dgv3.Rows.Add(row);
                    }
                    tbBalanceDayStart.Text = shop.GetStartBalance().ToString();

                    if (saleToday.Count() != 0)
                    {
                        //Находим максимальное значение id в коллекции saleToday
                        int id = saleToday.Max(x => x.ID);
                        //Инициализируем структуру CashOperation с найденным максимальным id
                        CashOperation c = saleToday.First(x => x.ID == id);
                        //Заносим текущий баланс в текстовое поле
                        tbBalanceReal.Text = c.CashBalance.ToString();
                    }
                    else
                    {
                        tbBalanceReal.Text = shop.GetStartBalance().ToString();
                    }
                    #endregion
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); MessageBox.Show(ex.StackTrace); }
        }