private void LoadPostIt() { formTitle = "Consultation d'un Post'it"; BtnCommentaires.Visible = true; PbxModifier.Visible = true; CbxOperateur.Visible = false; CbxCategorie.Visible = false; TxtTiers.Visible = false; TxtDescription.ReadOnly = true; TxtDescription.TabStop = false; TxtDescription.BackColor = Color.White; DtpEcheance.Visible = false; LblEcheanceView.Visible = true; LblOperateurView.Visible = true; LblTiersView.Visible = true; LblCategorieView.Visible = true; /* Récupération des données */ operateur = evenementProvider.GetEvenementById(_id).Operateur; statut = evenementProvider.GetEvenementById(_id).Statut; categorie = evenementProvider.GetEvenementById(_id).Categorie; tiers = evenementProvider.GetEvenementById(_id).Tiers; description = evenementProvider.GetEvenementById(_id).Description; echeance = evenementProvider.GetEvenementById(_id).Echeance; createdAt = evenementProvider.GetEvenementById(_id).CreatedAt; updatedAt = evenementProvider.GetEvenementById(_id).UpdatedAt; /* Affichage des donnees */ CbxOperateur.Text = operateur; LblOperateurView.Text = operateur; CbxCategorie.Text = categorie; LblCategorieView.Text = categorie; TxtTiers.Text = tiers; LblTiersView.Text = tiers; TxtDescription.Text = description; DtpEcheance.Value = echeance; LblEcheanceView.Text = echeance.ToString("dd/MM/yyyy"); /* Modification des boutons */ BtnEnregistrer.Visible = false; BtnAnnuler.Visible = false; BtnFermer.Visible = true; BtnReculeEcheance.Visible = true; BtnAvanceEcheance.Visible = true; /* Barre de statut */ TssDateCreation.Text = "Fiche créée le " + createdAt.ToString("dd/MM/yyyy HH:mm:ss"); TssStatut.Text = "Statut : " + statut; /* Si statut Annulé ou Terminé, plus de modifications */ if (statut == "Terminé" || statut == "Annulé") { PbxModifier.Visible = false; BtnAvanceEcheance.Visible = false; BtnReculeEcheance.Visible = false; noAnnotation = true; } }
private void AddDatabase() { Evenement evenement = evenementProvider.GetEvenementById(_id); /* Création de l'annotation */ Annotation annotation = new Annotation { Date = DateTime.Now, Commentaire = commentaire, Operateur = operateur, CreatedAt = DateTime.Now, EvenementId = _id }; annotationProvider.Create(evenement, annotation); }
/// <summary> /// Changement de statut du post'it /// </summary> /// <param name="statut">Annulé ou Terminé</param> private void ChangeStatut(string statut) { if (dgvEvenements.RowCount > 0) { if (dgvEvenements.CurrentRow.Cells[3].Value.ToString() == "Terminé" || dgvEvenements.CurrentRow.Cells[3].Value.ToString() == "Annulé") { /* Deja traite ou annule */ MessageBox.Show("Ce post'it ne peut plus changer de statut !", "Impossible", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { DialogResult result = MessageBox.Show("Etes-vous certain de vouloir modifier le statut de ce post'it ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { int ID = int.Parse(dgvEvenements.CurrentRow.Cells[0].Value.ToString()); Evenement evenement = evenementProvider.GetEvenementById(ID); evenement.Statut = statut; evenementProvider.Update(evenement); /* Ajout d'une annotation */ string commentaire = statut; AnnotationProvider annotationProvider = new AnnotationProvider(); Annotation annotation = new Annotation { Date = DateTime.Now, Commentaire = commentaire, Operateur = "-", CreatedAt = DateTime.Now, EvenementId = ID }; annotationProvider.Create(evenement, annotation); RefreshData(); } } } }