Beispiel #1
0
        public override void edit(int id)
        {
            Engineer Engineer = (from p in db.Engineer
                                 where p.Id == id
                                 select p).FirstOrDefault(); //

            EngineerForm EngineerViewer = new EngineerForm();

            EngineerViewer.mainEntity = Engineer;
            EngineerViewer.controller = this;

            if (EngineerViewer.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                db.SaveChanges();
            }
        }
Beispiel #2
0
        public override void add()
        {
            try
            {
                Engineer Engineer = new Engineer();
                //setting the default company
                Engineer.CompanyID = getDefaultCompany().Id;

                EngineerForm EngineerViewer = new EngineerForm();
                EngineerViewer.mainEntity = Engineer;
                EngineerViewer.controller = this;

                if (EngineerViewer.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    db.Engineer.Add(Engineer);
                    db.SaveChanges();
                }
            }
            catch (System.InvalidOperationException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }