Esempio n. 1
0
        public void Delete(ObjectListView olv)
        {
            var obj = olv.SelectedObject as Machine;

            using (MachinesRepository repo = new MachinesRepository())
            {
                repo.Delete(obj);
                olv.RemoveObject(obj);
            }
        }
Esempio n. 2
0
        public ScheduleForm()
        {
            InitializeComponent();
            this.okΒutton.Click += okΒutton_Click;

            using (MachinesRepository repo = new MachinesRepository())
            {
                this.machineBindingSource.DataSource = repo.Get();
            }
            using (EmployeesRepository repo = new EmployeesRepository())
            {
                this.employeeBindingSource.DataSource = repo.Get();
            }
        }
Esempio n. 3
0
        public void New(ObjectListView olv)
        {
            TitleForm frm = new TitleForm();

            frm.Text = "Νέα Μηχανή";
            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                using (MachinesRepository repo = new MachinesRepository())
                {
                    Machine obj = repo.New();
                    obj.Title = frm.UserInput;
                    repo.Insert(obj);
                    olv.AddObject(obj);
                }
            }
        }
Esempio n. 4
0
 public void Get(ObjectListView olv)
 {
     using (MachinesRepository repo = new MachinesRepository())
     {
         var list = repo.Get();
         olv.ModelFilter = null;
         olv.Columns.Clear();
         olv.Columns.Add(new BrightIdeasSoftware.OLVColumn()
         {
             Text         = "Μηχάνημα",
             AspectGetter = delegate(object row) { return(((Machine)row).Title); },
             TextAlign    = System.Windows.Forms.HorizontalAlignment.Left,
             Width        = 200
         });
         olv.SetObjects(list);
     }
 }
Esempio n. 5
0
        public void Edit(ObjectListView olv)
        {
            var obj = olv.SelectedObject as Machine;

            if (obj == null)
            {
                return;
            }
            TitleForm frm = new TitleForm();

            frm.Text      = obj.Title;
            frm.UserInput = obj.Title;
            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                using (MachinesRepository repo = new MachinesRepository())
                {
                    obj.Title = frm.UserInput;
                    repo.Update(obj);
                    olv.RefreshObject(obj);
                }
            }
        }
Esempio n. 6
0
 public MachinesController(MachinesRepository repository)
 {
     this._repository = repository; /*?? throw new ArgumentNullException(nameof(repository));*/
 }