private void btn_Retour_Click(object sender, RoutedEventArgs e) { this.Close(); var window = new BelleTablePlanning.Window1(); window.Show(); }
private void Button_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(objetIncident.Text) || string.IsNullOrWhiteSpace(messageIncident.Text)) // Si un des deux sont vides { MessageBox.Show("Veuillez remplir tous les champs.", "Champs vides !"); } else if (string.IsNullOrWhiteSpace(objetIncident.Text) && string.IsNullOrWhiteSpace(messageIncident.Text)) // Si les deux sont vides { MessageBox.Show("Veuillez remplir tous les champs.", "Champs vides !"); } else { int IDUser = int.Parse(Application.Current.Properties["IDUser"].ToString()); // Base de test local //BddCo Connexion = new BddCo("localhost", "root", ""); // Serveur CFA // BddCo Connexion = new BddCo("localhost", "root", ""); // Autre serveur BddCo Connexion = new BddCo("srv-wakanda.cloudapp.net", "root", "KCX96mtkhm!"); int Etat; // DÉTERMINONS LA CRITICITÉ DE TON INCIDENT if (critiqueButton.IsChecked == true) { Etat = 3; } else if (urgentButton.IsChecked == true) { Etat = 2; } else if (normalButton.IsChecked == true) { Etat = 1; } else { Etat = 0; // Cet else n'est strictement jamais censé se produire. } Connexion.CreationIncident(objetIncident.Text, messageIncident.Text, Etat, DateTime.Now, IDUser, 0); MessageBox.Show("Incident signalé ! Merci."); this.Close(); var window = new BelleTablePlanning.Window1(); window.Show(); } }
private void btn_Connexion_Click(object sender, RoutedEventArgs e) { if (tb_Identi.Text == "" || tb_Mp.Password.ToString() == "") { MessageBox.Show("Veuillez renseigner tous les champs"); } else { if (Connexion.CheckCompte(tb_Identi.Text, tb_Mp.Password.ToString())) { this.Hide(); var window = new BelleTablePlanning.Window1(); window.Show(); } else { MessageBox.Show("Connexion échouée", "Impossible de se connecter", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void submitBtn_Click(object sender, RoutedEventArgs e) { // Créer des contrôles ------------ string Libelle = libelleText.Text; string Description = new TextRange(descriptionText.Document.ContentStart, descriptionText.Document.ContentEnd).Text; string Date = dateText.Text; string PlanAcces = new TextRange(planAccesText.Document.ContentStart, planAccesText.Document.ContentEnd).Text; // Vérification des champs vides if (string.IsNullOrWhiteSpace(Libelle) || string.IsNullOrWhiteSpace(Description) || string.IsNullOrWhiteSpace(Date) || string.IsNullOrWhiteSpace(PlanAcces) || typeCombo.SelectedIndex < 1 || interlocuteurCombo.SelectedIndex < 1) { MessageBox.Show("Veuillez remplir tous les champs.", "Erreur !"); } else { string TypeRdv = typeCombo.Text; string Interlocuteur = interlocuteurCombo.Text; // Détermination du type de rendez-vous selon le libellé int IDTypeRdv; if (TypeRdv == "Première rencontre") { IDTypeRdv = 1; } else if (TypeRdv == "Rendez-vous téléphonique") { IDTypeRdv = 2; } else if (TypeRdv == "Visite de courtoisie") { IDTypeRdv = 3; } else if (TypeRdv == "Visite technique") { IDTypeRdv = 4; } else if (TypeRdv == "Conclusion") { IDTypeRdv = 5; } else { IDTypeRdv = 0; // Else de backup. Il ne devrait jamais arriver. } #region if (Bdd.CreationRdvEtape1(Libelle, Description, IDTypeRdv, PlanAcces, "")) { Bdd.RecupereNewRdv(Libelle); int IDNewRdv = int.Parse(Application.Current.Properties["IDNewRdv"].ToString()); // ID récupéré int IDUser = int.Parse(Application.Current.Properties["IDUser"].ToString()); // ID récupéré Bdd.RecupereInterlocuteur(Interlocuteur); int IDNewInterlocuteur = int.Parse(Application.Current.Properties["IDNewInterlocuteur"].ToString()); // ID récupéré if (Bdd.CreationRdvEtape2(IDNewRdv, IDUser, IDNewInterlocuteur)) { int annees = dateText.SelectedDate.Value.Date.Year; int mois = dateText.SelectedDate.Value.Date.Month; int jours = dateText.SelectedDate.Value.Date.Day; int heures = Convert.ToInt32(cbHeures.SelectedItem); int minutes = Convert.ToInt32(cbMinutes.SelectedItem); DateTime fullDate = new DateTime(annees, mois, jours, heures, minutes, 0); Bdd.RecupereAgenda(IDUser); int IDAgenda = int.Parse(Application.Current.Properties["AgendaUser"].ToString()); // ID récupéré if (Bdd.CreationRdvEtape3(fullDate, IDAgenda, IDNewRdv)) { MessageBox.Show("Le rendez-vous a été créé avec succès ! RDV le " + Date + " avec " + Interlocuteur + ".", "Succès !"); Application.Current.Properties.Remove("IDNewRdv"); Application.Current.Properties.Remove("IDNewInterlocuteur"); Application.Current.Properties.Remove("AgendaUser"); this.Close(); var window = new BelleTablePlanning.Window1(); window.Show(); } else { MessageBox.Show("Une erreur s'est produite lors de l'étape 3.", "Erreur."); } } else { MessageBox.Show("Une erreur s'est produite lors de l'étape 2.", "Erreur."); } } else { MessageBox.Show("Une erreur s'est produite lors de l'étape 1.", "Erreur."); } #endregion } }