private void LoadGridView() { try { dataGridView1.DataSource = employee.GetAll(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void EmployeeModelGetAllShouldReturnList() { EmployeeModel model = new EmployeeModel(); List <Employee> allEmployees = model.GetAll(); Assert.IsTrue(allEmployees.Count > 0); }
//Retrieve all the employees public List <EmployeeViewModel> GetAll() { List <EmployeeViewModel> allVms = new List <EmployeeViewModel>(); try { List <Employee> allEmployees = _model.GetAll(); foreach (Employee emp in allEmployees) { EmployeeViewModel empVm = new EmployeeViewModel(); empVm.Title = emp.Title; empVm.Firstname = emp.FirstName; empVm.Lastname = emp.LastName; empVm.Phoneno = emp.PhoneNo; empVm.Email = emp.Email; empVm.Id = emp.Id; empVm.DepartmentId = emp.DepartmentId; empVm.DepartmentName = emp.Department.DepartmentName; if (emp.StaffPicture != null) { empVm.StaffPicture64 = Convert.ToBase64String(emp.StaffPicture); } empVm.Timer = Convert.ToBase64String(emp.Timer); allVms.Add(empVm); } } catch (Exception ex) { Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message); throw ex; } return(allVms); }
public void Employee_GetAll() { EmployeeModel model = new EmployeeModel(); List <Employees> allEmployees = model.GetAll(); Assert.True(allEmployees.Count > 0); }
private void ListEmployee() { try { dgvEmployeeList.DataSource = employee.GetAll(); dgvEmployeeList.Columns["EmployeeID"].Visible = false; dgvEmployeeList.Columns["PositionId"].Visible = false; dgvEmployeeList.Columns["TypeDocumentId"].Visible = false; dgvEmployeeList.Columns["Password"].Visible = false; dgvEmployeeList.Columns["FirstName"].HeaderText = "NOMBRE"; dgvEmployeeList.Columns["LastName"].HeaderText = "APELLIDO"; dgvEmployeeList.Columns["BirthDate"].HeaderText = "FECHA"; dgvEmployeeList.Columns["Document"].HeaderText = "TIPO DOC"; dgvEmployeeList.Columns["DocumentNumber"].HeaderText = "Nº DOC"; dgvEmployeeList.Columns["Address"].HeaderText = "DIRECCION"; dgvEmployeeList.Columns["PhoneNumber"].HeaderText = "TELEFONO"; dgvEmployeeList.Columns["Email"].HeaderText = "EMAIL"; dgvEmployeeList.Columns["UserName"].HeaderText = "USUARIO"; dgvEmployeeList.Columns["StateS"].HeaderText = "ESTADO"; } catch (Exception) { lblErrorGrid.Visible = true; lblErrorGrid.Text = "No se ha podido realizar la correcta carga de empleados,\nIntentelo mas tarde."; } }//end list
// Get list of EmployeeViewModel public List <EmployeeViewModel> GetAll() { // Declare List of EmployeeViewModel to store the elements List <EmployeeViewModel> allVms = new List <EmployeeViewModel>(); try { // Get the list List <Employees> allEmployees = _model.GetAll(); // Store every values from allEmployees to allVms foreach (Employees emp in allEmployees) { EmployeeViewModel empVm = new EmployeeViewModel(); empVm.Title = emp.Title; empVm.Firstname = emp.FirstName; empVm.Lastname = emp.LastName; empVm.Phoneno = emp.PhoneNo; empVm.Email = emp.Email; empVm.Id = emp.Id; empVm.DepartmentId = emp.DepartmentId; empVm.Timer = Timer = Convert.ToBase64String(emp.Timer); allVms.Add(empVm); } } catch (Exception ex) { Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message); throw ex; }// try/catch // Return List return(allVms); }
public void Employee_GetAll() { EmployeeModel model = new EmployeeModel(); List <Employees> allEmployees = new List <Employees>(); allEmployees = model.GetAll(); Assert.NotNull(allEmployees); }
private void ListEmployees() { try { dataGridView1.DataSource = employee.GetAll(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
// Retrieve all the EmployeeViewModel objects and add them to a List public List <EmployeeViewModel> GetAll() { // Create a list to hold the EmployeeViewModel objects List <EmployeeViewModel> allVms = new List <EmployeeViewModel>(); try { // Create the List to hold the Employee objects. Uses the GetAll() // from the EmployeeModel class to populate this List List <Employee> allEmployees = _model.GetAll(); // For each Employee in the allEmployees List create a view model for them and // then add them to the List of Employee objects foreach (Employee emp in allEmployees) { EmployeeViewModel empVm = new EmployeeViewModel(); empVm.Title = emp.Title; empVm.Firstname = emp.FirstName; empVm.Lastname = emp.LastName; empVm.Phoneno = emp.PhoneNo; empVm.Email = emp.Email; empVm.Id = emp.Id; empVm.DepartmentId = emp.DepartmentId; empVm.DepartmentName = emp.Department.DepartmentName; empVm.IsTech = emp.IsTech; if (emp.StaffPicture != null) { empVm.StaffPicture64 = Convert.ToBase64String(emp.StaffPicture); } empVm.Timer = Convert.ToBase64String(emp.Timer); allVms.Add(empVm); } } catch (Exception ex) { Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message); throw ex; } // Return the List of EmployeeViewModel objects return(allVms); }
private void LoadProduc() { //hacer llamado a productos mas vendidos con categoria+marca+clasificacion dgvProductList.DataSource = employee.GetAll(); }