private void PreparerInfo(Employe emp, string operation) { try { this.tbAnnee.Text = sess_cong.TrouverAnneeFiscaleActuelle().ToString(); this.cboType.SelectedValue = "Annuel"; switch (operation) { case "Demande": if (emp.getConges().Count > 0 && !emp.dernierRetourEffectifValide()) { MessageBox.Show("Le dernier Retour de Congé n'a pas été validé!"); this.cboType.IsEnabled = false; this.dpDebut.IsEnabled = false; this.dpRetourPrevu.IsEnabled = false; this.dpRetourEffectif.IsEnabled = false; } else { this.dpRetourEffectif.IsEnabled = false; this.btnValiderDemande.Visibility = Visibility.Visible; } break; case "Retour": if (emp.getCongeOuvert() == null) { MessageBox.Show("L'Employé n'est pas actuellement en Congé!"); this.cboType.IsEnabled = false; this.dpDebut.IsEnabled = false; this.dpRetourPrevu.IsEnabled = false; this.dpRetourEffectif.IsEnabled = false; } else { this.cboType.IsEnabled = false; this.dpDebut.IsEnabled = false; this.dpRetourPrevu.IsEnabled = false; this.dpRetourEffectif.Visibility = Visibility.Visible; this.btnValiderRetour.Visibility = Visibility.Visible; } break; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void PreparerInfo(Employe emp, string operation) { try { this.tbAnnee.Text = sess_cong.TrouverAnneeFiscaleActuelle().ToString(); this.ddlType.SelectedValue = "Annuel"; this.ddlType.Enabled = false; this.tbAnnee.Enabled = false; switch (operation) { case "demande": this.operation_title.InnerText = "Demande de Congé"; if (emp.getConges().Count > 0 && !emp.dernierRetourEffectifValide()) { lblFailure.Text = "Le dernier Retour de Congé n'a pas été validé!"; this.ddlType.Enabled = false; this.tbAnnee.Enabled = false; this.tbDebut.Enabled = false; this.tbRetourPrevu.Enabled = false; this.tbRetourEffectif.Enabled = false; } else { this.lblSuccess.Text = "L'Employé peut prendre un Congé!"; this.tbRetourEffectif.Enabled = false; this.btnValiderDemande.Style.Add("display", "block"); } break; case "retour": this.operation_title.InnerText = "Retour Effectif d'un Congé"; if (emp.getCongeOuvert() == null) { this.lblFailure.Text = "L'Employé n'est pas actuellement en Congé!"; this.ddlType.Enabled = false; this.tbAnnee.Enabled = false; this.tbDebut.Enabled = false; this.tbRetourPrevu.Enabled = false; this.tbRetourEffectif.Enabled = false; } else { this.lblSuccess.Text = "L'Employé est bien en Congé!"; this.ddlType.Enabled = false; this.tbAnnee.Enabled = false; this.tbDebut.Enabled = false; this.tbRetourPrevu.Enabled = false; this.tbRetourEffectif.Enabled = true; this.btnValiderRetour.Style.Add("display", "block"); } break; } } catch (Exception ex) { this.lblFailure.Text = ex.Message; } }