Esempio n. 1
0
        private void expenseGridControl_DoubleClick(object sender, EventArgs e)
        {
            var selected = expenseBindingSource.Current as Expense;
            var dialog   = new ExpenseEdit();

            dialog.ShowObject(selected);
            dialog.ShowDialog(this);
        }
Esempio n. 2
0
        private void gridControl2_DoubleClick(object sender, EventArgs e)
        {
            var record = expenseBindingSource.Current as Expense;
            var dialog = new ExpenseEdit();

            dialog.ShowObject(record);
            dialog.ShowDialog();
        }
Esempio n. 3
0
        private void addExpenseBarButtonItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var dialog  = new ExpenseEdit();
            var expense = new Expense();

            expense.VehicleId = maintenance.VehicleId;

            dialog.ShowObject(expense);
            var result = dialog.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                this.maintenance.Expenses.Add(expense);
            }
        }
Esempio n. 4
0
        private void AddExpenseRecord()
        {
            var record = new Expense()
            {
                VehicleId = this.vehicle.VehicleId
            };
            var dialog = new ExpenseEdit();

            dialog.ShowObject(record);
            var result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                this.vehicle.Expenses.Add(dialog.Current);
            }
        }
Esempio n. 5
0
        private void AddExpenseRecord()
        {
            var selected = (VehicleInfo)vehicleListBindingSource.Current;
            var record   = new Expense()
            {
                VehicleId = selected.VehicleId
            };
            var dialog = new ExpenseEdit();

            dialog.ShowObject(record);
            var result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                using (var ctx = new FleetEntities())
                {
                    ctx.Expenses1.AddObject(record);
                    ctx.SaveChanges();
                }
            }
        }