/// <summary> /// Gets Staff Members already existing in the Staff tab with the <c>lineRef</c> related. The <c>employeesView</c> can be of type AppointmentEmployees_View or ServiceOrderEmployees_View. /// </summary> /// <param name="staffView">Object of type AppointmentEmployees_View or ServiceOrderEmployees_View.</param> /// <param name="lineRef">Line ref of related Service Line.</param> /// <returns>List of EmployeeID's existing in Employee Tab.</returns> private static List <int?> GetStaffByLineRefTab(object staffView, string lineRef) { List <int?> employeeIDList = new List <int?>(); if (staffView is AppointmentCore.AppointmentServiceEmployees_View) { AppointmentCore.AppointmentServiceEmployees_View appEmployeeView = (AppointmentCore.AppointmentServiceEmployees_View)staffView; foreach (FSAppointmentEmployee fsAppointmentEmployeeRow in appEmployeeView.Select().AsEnumerable().Where(y => ((FSAppointmentEmployee)y).ServiceLineRef == lineRef)) { employeeIDList.Add(fsAppointmentEmployeeRow.EmployeeID); } } if (staffView is ServiceOrderCore.ServiceOrderEmployees_View) { ServiceOrderCore.ServiceOrderEmployees_View soEmployeeView = (ServiceOrderCore.ServiceOrderEmployees_View)staffView; foreach (FSSOEmployee fsSOEmployeeRow in soEmployeeView.Select().AsEnumerable().Where(y => ((FSSOEmployee)y).ServiceLineRef == lineRef)) { employeeIDList.Add(fsSOEmployeeRow.EmployeeID); } } return(employeeIDList); }
/// <summary> /// Initialize the EmployeeGrid filter with the existing employees in the Employee tab. /// </summary> /// <param name="employeesView">Employee view from Appointment or ServiceOrder screen.</param> private static IEnumerable <EmployeeGridFilter> PopulateEmployeeFilter(object employeesView) { HashSet <EmployeeGridFilter> employees = new HashSet <EmployeeGridFilter>(); if (employeesView is AppointmentCore.AppointmentServiceEmployees_View) { AppointmentCore.AppointmentServiceEmployees_View appEmployeeView = (AppointmentCore.AppointmentServiceEmployees_View)employeesView; foreach (FSAppointmentEmployee fsAppointmentEmployeeRow in appEmployeeView.Select()) { EmployeeGridFilter employee = new EmployeeGridFilter(); employee.EmployeeID = fsAppointmentEmployeeRow.EmployeeID; employees.Add(employee); } } if (employeesView is ServiceOrderCore.ServiceOrderEmployees_View) { ServiceOrderCore.ServiceOrderEmployees_View soEmployeeView = (ServiceOrderCore.ServiceOrderEmployees_View)employeesView; foreach (FSSOEmployee fsSOEmployeeRow in soEmployeeView.Select()) { EmployeeGridFilter employee = new EmployeeGridFilter(); employee.EmployeeID = fsSOEmployeeRow.EmployeeID; employees.Add(employee); } } return(employees); }