Пример #1
0
        private async void btnAccept_Click(object sender, EventArgs e)
        {
            string name     = txtBoxProduct.Text;
            double minPrise = double.Parse(txtBoxMinPrice.Text);
            double maxPrise = double.Parse(txtBoxMaxPrice.Text);

            DataItem newItem = new DataItem()
            {
                Name = name, MinPrice = minPrise, MaxPrice = maxPrise
            };

            if (await DbCommunicator.Communicator.AddItem(newItem))
            {
                ItemFromSheet newItemFromSheet = new ItemFromSheet(newItem);
                mainForm.ResizeForm(1);
            }
            this.Close();
        }
Пример #2
0
        public static async void RemoveItem()
        {
            if (removableButton != null)
            {
                DbCommunicator.Communicator.SubtractItem(Int32.Parse(removableButton.Name));

                mainForm.Controls.Clear();
                itemsList.Clear();

                mainForm.MaximumSize    = new Size(320, 70);
                mainForm.MinimumSize    = mainForm.MaximumSize;
                mainForm.Size           = mainForm.MaximumSize;
                buttonAndLabelLocationY = indent;

                var list = await DbCommunicator.Communicator.ReadAllItems();

                foreach (var item in list)
                {
                    ItemFromSheet itemFromSheet = new ItemFromSheet(item);
                }
                mainForm.ResizeForm(list.Count);
            }
        }