private void btnReportEmployee_Click(object sender, EventArgs e) { Vacations vacForm = new Vacations(); TIS.Model.Internal.Employee emp = ((TIS.Model.Internal.Employee)glouReportEmployee.GetSelectedDataRow()); vacForm.gdcVacation.DataSource = _vacationBL.GetByEmployee(emp); vacForm.Show(); }
public List<Vacation> GetByDispatcher(Employee disp) { try { List<Vacation> vacations = new XPQuery<Vacation>(uow).Where(v => v.Dispatcher.empID == disp.empID).OrderBy(e => e.Dispatcher.DisplayName).ToList(); return vacations; } 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); } }
public XPCollection<Vacation> GetByDispatcher(Employee dispatcher) { try { XPCollection<Vacation> vacations = new XPCollection<Vacation>(Session, Dispatcher.empID == dispatcher.empID); SortingCollection sc = new SortingCollection(); sc.Add(new SortProperty("Id", DevExpress.Xpo.DB.SortingDirection.Ascending)); vacations.Sorting = sc; return vacations; } catch (Exception ex) { throw new Exception(MethodBase.GetCurrentMethod().Name, ex); } }