private void uiTxtSearch_TextChanged(object sender, EventArgs e) { try { uiFlowPanel.Controls.Clear(); Employee employee = new Employee { CPF = uiTxtSearch.Text }.ObterInicialCPF(); UtilCreatePanel.CreateUserPanel(employee, uiFlowPanel, Employee_Click); //CreateUserPanel(employee, uiFlowPanel); } catch (NullReferenceException) { if (uiTxtSearch.TextLength == 11) { new Alert("CPF inválido ou não cadastrado.", Type.Warning); } else if (uiTxtSearch.TextLength == 0) { List <Employee> employeeList = new Employee { }.ObterTodos(); UtilCreatePanel.CreateUserPanel(employeeList, uiFlowPanel, Employee_Click); } } catch (Exception ex) { new Alert(ex.Message, Type.Warning); } }
private void ObterFuncionarios() { List <Employee> employee = new Employee { }.ObterDescadastrados(); for (int i = 0; i < uiFlowPanel.Controls.Count; i++) { uiFlowPanel.Controls.RemoveAt(i); } for (int i = 0; i < employee.Count; i++) { UtilCreatePanel.CreateUserPanel(employee[i], uiFlowPanel, Employee_Click); } }
private void uctFuncionario_Load(object sender, EventArgs e) { uiTxtCPF.ReadOnly = false; List <Employee> employee = new Employee { }.ObterTodos(); for (int i = 1; i < uiFlowPanel.Controls.Count; i++) { uiFlowPanel.Controls.RemoveAt(i); } for (int i = 0; i < employee.Count; i++) { UtilCreatePanel.CreateUserPanel(employee[i], uiFlowPanel, Employee_Click); } }