public void Add(Vacation vac) { try { //Vacation vacation = new Vacation(Session); //vacation.Employee = vac.Employee; //vacation.Dispatcher = vac.Dispatcher; //vacation.Date = vac.Date; Session.Save(vac); } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
private void btnAddVacation_Click(object sender, EventArgs e) { try { TIS.Model.Internal.Employee disp = ((TIS.Model.Internal.Employee)glouDispatcher.GetSelectedDataRow()); TIS.Model.Internal.VacationType type = ((TIS.Model.Internal.VacationType)glouVacationType.GetSelectedDataRow()); if (!CheckDateAndTime()) { XtraMessageBox.Show("Gelieve de datum en tijd te controleren.", "Opgepast", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (dteDateFrom.DateTime != null && dteDateFrom.DateTime != DateTime.MinValue && type != null) { TIS.Model.Internal.Vacation vac = new TIS.Model.Internal.Vacation(Uow) { Employee = EmployeeModel, Dispatcher = disp, DateFrom = dteDateFrom.DateTime.Date, DateTo = dteDateTo.DateTime.Date, TimeFrom = teTimeFrom.Time, TimeTo = teTimeTo.Time, VacationType = type, Description = txtDescription.Text }; Uow.CommitChanges(); _vacations.Add(vac); gdvVacation.RefreshData(); dteDateFrom.EditValue = null; dteDateTo.EditValue = null; } else { XtraMessageBox.Show("Gelieve alle velden in te vullen.", "Opgepast", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (System.Exception exception1) { System.Exception thisException = exception1; Management.ShowException(thisException); } }
private void btnRemoveVacation_Click(object sender, EventArgs e) { try { if (DevExpress.XtraEditors.XtraMessageBox.Show(this.LookAndFeel, "Bent u zeker dat u het verlof wilt verwijderen", "Verwijderen?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3) == DialogResult.Yes) { TIS.Model.Internal.Vacation vacation = (TIS.Model.Internal.Vacation)gdvVacation.GetRow(this.gdvVacation.FocusedRowHandle); vacation.Delete(); Uow.CommitChanges(); _vacations.Remove(vacation); gdvVacation.RefreshData(); //_vacationBL.Remove(vacation); //_tasks.Remove(task); //gdcTask.Refresh(); } } catch (System.Exception exception1) { System.Exception thisException = exception1; Management.ShowException(thisException); } }
private void btnAddVacation_Click(object sender, EventArgs e) { try { TIS.Model.Internal.Employee disp = ((TIS.Model.Internal.Employee)glouDispatcher.GetSelectedDataRow()); TIS.Model.Internal.VacationType type = ((TIS.Model.Internal.VacationType)glouVacationType.GetSelectedDataRow()); if (!CheckDateAndTime()) { XtraMessageBox.Show("Gelieve de datum en tijd te controleren.", "Opgepast", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (dteDateFrom.DateTime != null && dteDateFrom.DateTime != DateTime.MinValue && type != null) { TIS.Model.Internal.Vacation vac = new TIS.Model.Internal.Vacation(Uow) { Employee = EmployeeModel, Dispatcher = disp, DateFrom = dteDateFrom.DateTime.Date, DateTo = dteDateTo.DateTime.Date, TimeFrom = teTimeFrom.Time, TimeTo = teTimeTo.Time, VacationType = type, Description = txtDescription.Text }; Uow.CommitChanges(); _vacations.Add(vac); gdvVacation.RefreshData(); dteDateFrom.EditValue = null; dteDateTo.EditValue = null; } else XtraMessageBox.Show("Gelieve alle velden in te vullen.", "Opgepast", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (System.Exception exception1) { System.Exception thisException = exception1; Management.ShowException(thisException); } }
public void Add(Vacation vac) { try { //Vacation vacation = new Vacation(Session); //vacation.Employee = vac.Employee; //vacation.Dispatcher = vac.Dispatcher; //vacation.Date = vac.Date; Session.Save(vac); } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }