Beispiel #1
0
        private void lstDetails_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (((Worker)lstWorkers.SelectedItem).Name == "")
            {
                MessageBox.Show("Операторо не выбран!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            var inp = new frmInputNum();

            if (inp.ShowDialog() != DialogResult.OK)
            {
                return;
            }


            int quant = inp.Value;

            var detail = lstDetails.SelectedItem as Detail;

            var producedDeatil = new ProducedDetail
            {
                Count        = quant,
                Detail       = detail,
                ProducedDate = dtpProducedData.Value,
                Worker       = lstWorkers.SelectedItem as Worker,
            };

            _context.ProducedDetails.Add(producedDeatil);
            _producedDetails.Add(producedDeatil);
            _context.SaveChanges();
            RefreshProdusedList();
        }
Beispiel #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (grid.SelectedRows.Count == 0)
            {
                MessageBox.Show("Запись для редактирования не выбрана!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            var frm    = new frmInputNum();
            var id     = Guid.Parse(grid.SelectedRows[0].Cells["colId"].Value.ToString());
            var detail = _producedDetails.First(x => x.Id == id);

            frm.Value = detail.Count;

            if (frm.ShowDialog() == DialogResult.OK)
            {
                detail.Count = frm.Value;
                _context.SaveChanges();
                RefreshProdusedList();
            }
        }