Ejemplo n.º 1
0
        private void btnGetTool_Click(object sender, EventArgs e)
        {
            var frm = new frmGetItem();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                Guid Id = frm.Id;

                using (var context = new Context())
                {
                    var worker = context.Workers.First(x => x.Id == _worker.Id);
                    try
                    {
                        var item = context.Items.First(x => x.Id == Id);

                        item.Condition = Condition.Given;
                        item.Worker    = worker;
                        item.GiveDate  = DateTime.Now;

                        var history = new History(History.Action.Give);
                        history.Item   = context.Items.First(x => x.Id == item.Id);
                        history.Worker = item.Worker.FullName;

                        context.Histories.Add(history);

                        context.SaveChanges();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message + "\n" + ex.InnerException + "\n" + ex.StackTrace);
                    }
                }
                RefreshList();
            }
        }
Ejemplo n.º 2
0
        private void btnItemInfo_Click(object sender, EventArgs e)
        {
            var frm = new frmGetItem(true);

            frm.ShowDialog();
        }