public List <ResignationReason> getAllResignationReasons() { List <ResignationReason> resignationReasons = new List <ResignationReason>(); OleDbCommand cmd = DBConnection.getInstance.getDbCommand(); cmd.CommandText = "SELECT * FROM RESIGNATION_REASON"; OleDbDataReader result = cmd.ExecuteReader(); if (result.HasRows) { while (result.Read()) { ResignationReason resignationReason = new ResignationReason(); resignationReason.idResignationReason = result.GetInt32(0); resignationReason.description = result.GetString(1); resignationReasons.Add(resignationReason); } } result.Close(); return(resignationReasons); }
private void upsertResignationReason() { ResignationReason resignationReason = getResignationReasonFromControls(); Boolean success; if (idResignationReasonEditing != 0) { resignationReason.idResignationReason = idResignationReasonEditing; success = resignationReasonControl.updateResignationReason(resignationReason); saveModeControls(); } else { success = resignationReasonControl.saveResignationReason(resignationReason); } cleanControls(); if (success) { DialogHost.Show(new SampleMessageDialog("Motivo de Demissão salvo com sucesso."), "DHMain"); resignationReasonViewControl.fillGridResignationReason(); } else { DialogHost.Show(new SampleMessageDialog("Erro ao salvar Motivo de Demissão."), "DHMain"); } }
public Boolean updateResignationReason(ResignationReason resignationReason) { Boolean success; OleDbCommand cmd = DBConnection.getInstance.getDbCommand(); cmd.CommandText = "UPDATE RESIGNATION_REASON SET DESCRIPTION=? WHERE ID_RESIGNATION_REASON=?"; cmd.Parameters.Add("DESCRIPTION", OleDbType.VarChar).Value = resignationReason.description; cmd.Parameters.Add("ID_RESIGNATION_REASON", OleDbType.Integer).Value = resignationReason.idResignationReason; try { cmd.ExecuteNonQuery(); success = true; } catch (Exception e) { Console.WriteLine("Erro ao alterar!" + e); success = false; } DBConnection.getInstance.closeConnection(); return(success); }
private void loadResignationReason(ResignationReason resignationReason) { TBDescription.Text = resignationReason.description; idResignationReasonEditing = resignationReason.idResignationReason; editModeControls(); }
private ResignationReason getResignationReasonFromControls() { ResignationReason resignationReason = new ResignationReason(); resignationReason.description = TBDescription.Text; return(resignationReason); }
private async void deleteResignationReason(object sender, RoutedEventArgs e) { OptionMessageDialog optionMessageDialog = new OptionMessageDialog("Deseja realmente excluir este Motivo de Demissão?"); Boolean result = (Boolean)await DialogHost.Show(optionMessageDialog, "DHMain"); if (result == true) { ResignationReason resignationReason = ((FrameworkElement)sender).DataContext as ResignationReason; deleteResignationReason(resignationReason); } }
public bool Filter(object obj) { ResignationReason data = (ResignationReason)obj; if (obj is ResignationReason) { if (!string.IsNullOrEmpty(_TBFilter)) { return(Util.contains(data.description, _TBFilter)); } return(true); } return(false); }
private void deleteResignationReason(ResignationReason resignationReason) { Boolean success = resignationReasonControl.deleteResignationReason(resignationReason); if (success) { DialogHost.Show(new SampleMessageDialog("Motivo de Demissão excluído com sucesso."), "DHMain"); resignationReasonViewControl.fillGridResignationReason(); } else { DialogHost.Show(new SampleMessageDialog("Erro ao excluir Movivo de Demissão."), "DHMain"); } }
public ResignationReason getResignationReason(int idResignationReason) { ResignationReason resignationReason = new ResignationReason(); OleDbCommand cmd = DBConnection.getInstance.getDbCommand(); cmd.CommandText = "SELECT * FROM RESIGNATION_REASON WHERE ID_RESIGNATION_REASON=?"; cmd.Parameters.Add("ID_RESIGNATION_REASON", OleDbType.Integer).Value = idResignationReason; OleDbDataReader result = cmd.ExecuteReader(); if (result.HasRows) { while (result.Read()) { resignationReason.idResignationReason = result.GetInt32(0); resignationReason.description = result.GetString(1); } } result.Close(); return(resignationReason); }
public Boolean deleteResignationReason(ResignationReason resignationReason) { Boolean success; OleDbCommand cmd = DBConnection.getInstance.getDbCommand(); cmd.CommandText = "DELETE FROM RESIGNATION_REASON WHERE ID_RESIGNATION_REASON=?"; cmd.Parameters.Add("ID_RESIGNATION_REASON", OleDbType.Integer).Value = resignationReason.idResignationReason; try { cmd.ExecuteNonQuery(); success = true; } catch (Exception e) { Console.WriteLine("Erro ao excluir!" + e); success = false; } DBConnection.getInstance.closeConnection(); return(success); }
public Boolean saveResignationReason(ResignationReason resignationReason) { Boolean success; OleDbCommand cmd = DBConnection.getInstance.getDbCommand(); cmd.CommandText = "INSERT INTO RESIGNATION_REASON (DESCRIPTION) VALUES (?)"; cmd.Parameters.Add("DESCRIPTION", OleDbType.VarChar).Value = resignationReason.description; try { cmd.ExecuteNonQuery(); success = true; } catch (Exception e) { Console.WriteLine("Erro ao salvar!" + e); success = false; } DBConnection.getInstance.closeConnection(); return(success); }
public Boolean saveResignationReason(ResignationReason resignationReason) { return(resignationReasonDAO.saveResignationReason(resignationReason)); }
private void loadResignationReason(object sender, RoutedEventArgs e) { ResignationReason resignationReason = ((FrameworkElement)sender).DataContext as ResignationReason; loadResignationReason(resignationReason); }
public Boolean updateResignationReason(ResignationReason resignationReason) { return(resignationReasonDAO.updateResignationReason(resignationReason)); }
private void insertResignationReason() { ResignationReason resignationReason = getResignationReasonFromControls(); resignationReasonControl.saveResignationReason(resignationReason); }
private void loadEmployee(Employee employee) { int indexCompany = -1; int indexSchedule = -1; int indexDepartment = -1; int indexOffice = -1; int indexRReason = -1; for (int i = 0; i < allCompanies.Count; i++) { Company cp = (Company)allCompanies[i]; if (employee.company.idCompany == cp.idCompany) { indexCompany = i; break; } } for (int i = 0; i < allSchedules.Count; i++) { Schedule sc = (Schedule)allSchedules[i]; if (employee.schedule.idSchedule == sc.idSchedule) { indexSchedule = i; break; } } for (int i = 0; i < allDepartments.Count; i++) { Department dp = (Department)allDepartments[i]; if (employee.department.idDepartment == dp.idDepartment) { indexDepartment = i; break; } } for (int i = 0; i < allOffices.Count; i++) { Office o = (Office)allOffices[i]; if (employee.office.idOffice == o.idOffice) { indexOffice = i; break; } } for (int i = 0; i < allRReasons.Count; i++) { ResignationReason rr = (ResignationReason)allRReasons[i]; if (employee.resignationReason.idResignationReason == rr.idResignationReason) { indexRReason = i; break; } } imgEmployeePhoto.Source = employee.employeeImage; TBName.Text = employee.employeeName; TBPispasep.Text = employee.pisPasep; CBCompany.SelectedIndex = indexCompany; CBSchedule.SelectedIndex = indexSchedule; TBLeefNumber.Text = employee.leefNumber; TBCtps.Text = employee.ctps; CBDepartment.SelectedIndex = indexDepartment; CBOffice.SelectedIndex = indexOffice; DPAdmission.SelectedDate = employee.admission; DPResignation.SelectedDate = employee.resignation; CBResignationReason.SelectedIndex = indexRReason; TBPhone.Text = employee.phone; TBEmail.Text = employee.email; TBGenegalRegister.Text = employee.generalRegistry; TBRegisterEntity.Text = employee.registryEntity; TBFather.Text = employee.father; TBMother.Text = employee.mother; DPBirth.SelectedDate = employee.birth; TBGender.Text = employee.gender; TBCivilStatus.Text = employee.civilStatus; TBNacionality.Text = employee.nationality; TBNaturalness.Text = employee.naturalness; TBAddress.Text = employee.address; TBNeighborhood.Text = employee.neighborhood; TBCity.Text = employee.city; TBState.Text = employee.state; TBZipCode.Text = employee.zipCode; idEmployeeEditing = employee.idEmployee; editModeControls(); }
public Boolean deleteResignationReason(ResignationReason resignationReason) { return(resignationReasonDAO.deleteResignationReason(resignationReason)); }