private void BindData() { EmployeeBLL EmployeeBL = new EmployeeBLL(connectionString); List <EmployeeViewModel> employees = EmployeeBL.GetEmployeeInventory(); string[] date_notime = new string[3]; List <string> employees_in_modal = new List <string>(); foreach (EmployeeViewModel element in employees) { date_notime = element.BirthDate.Split(' '); element.BirthDate = date_notime[0]; date_notime = element.StartDate.Split(' '); element.StartDate = date_notime[0]; if (!String.IsNullOrEmpty(element.EndDate)) { date_notime = element.EndDate.Split(' '); element.EndDate = date_notime[0]; } else { employees_in_modal.Add(element.Name); } } TerminateEmployeeList.DataSource = employees_in_modal; TerminateEmployeeList.DataBind(); EmployeeList.DataSource = employees; EmployeeList.DataBind(); }
private void BindData() { EmployeeBLL EmployeeBL = new EmployeeBLL(connectionString); List <EmployeeViewModel> employees = EmployeeBL.GetCurrentEmployeeInventory(); string[] date_notime = new string[3]; List <string> employees_in_modal = new List <string>(); /* * for (int i = 0; i < employees.Count; i++) * { * if (!String.IsNullOrEmpty(employees[i].EndDate)) * employees.RemoveAt(i); * } */ foreach (EmployeeViewModel element in employees) { date_notime = element.BirthDate.Split(' '); element.BirthDate = date_notime[0]; date_notime = element.StartDate.Split(' '); element.StartDate = date_notime[0]; if (!String.IsNullOrEmpty(element.EndDate)) { date_notime = element.EndDate.Split(' '); element.EndDate = date_notime[0]; } employees_in_modal.Add(element.Name); } TerminateEmployeeList.DataSource = employees_in_modal; TerminateEmployeeList.DataBind(); EmployeeList.DataSource = employees; EmployeeList.DataBind(); }