示例#1
0
        private void EditToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            Supply supply     = _shop.Supplies[SuppliesGridView.CurrentRow.Index];
            var    supplyForm = new SupplyForm(supply, _shop.Items);

            if (supplyForm.ShowDialog() == DialogResult.OK)
            {
                _supplyList[SuppliesGridView.CurrentRow.Index] = new { DateTimeEnd = DateTime.Now + TimeSpan.FromDays(2), Count = supplyForm.Supply.Portions.Count };
                supplyBindingSource.ResetBindings(false);
                _isChanged = true;
                ColorSupply();
            }
        }
示例#2
0
        private void NewToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            var supplyForm = new SupplyForm(_shop.Items);

            if (supplyForm.ShowDialog() == DialogResult.OK)
            {
                _shop.AddSupplyFirst(supplyForm.Supply);
                _supplyList.Insert(0, new { supplyForm.Supply.DateTimeEnd, supplyForm.Supply.Portions.Count });
                supplyBindingSource.ResetBindings(true);
                _isChanged = true;

                SuppliesGridView.Rows[0].Selected = true;
                SuppliesGridView.FirstDisplayedScrollingRowIndex = 0;
                ColorSupply();
            }
        }
示例#3
0
        private void SuppliesGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (SuppliesGridView.CurrentRow.Index < _shop.Supplies.Count)
            {
                if ((DateTime)SuppliesGridView.CurrentRow.Cells[0].Value - TimeSpan.FromDays(2) <=
                    DateTime.Now &&
                    (DateTime)SuppliesGridView.CurrentRow.Cells[0].Value - TimeSpan.FromDays(2) +
                    TimeSpan.FromHours(2) >= DateTime.Now)

                {
                    EditToolStripMenuItem1_Click(sender, EventArgs.Empty);
                    return;
                }
                var supplyForm = new SupplyForm(_shop.Supplies[SuppliesGridView.CurrentRow.Index]);
                supplyForm.ShowDialog();
            }
            else
            {
                var supplyForm = new SupplyForm(_shop.HistorySupplies[SuppliesGridView.CurrentRow.Index - _shop.Supplies.Count]);
                supplyForm.ShowDialog();
            }
        }