コード例 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         DateTime dateActivite;
         dateActivite = Convert.ToDateTime(dateTxt.Text);
         OrganiserActivite org = new OrganiserActivite();
         if (activCombo.Text == "" || dateTxt.Text == "" || heureTxt.Text == "" || dateActivite.Date < DateTime.Today)
         {
             MessageBox.Show("Completer tous les champs obligatoires svp ou vérifier la date.\n N.B: La date ne doit pas etre inférieur à la date d'aujourd'hui", "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else if (UserSession.GetInstance().Fonction == "Secrétaire" || UserSession.GetInstance().Fonction == "SA")
         {
             if (dgDepart.Rows.Count > 0)
             {
                 for (int i = 0; i < (dgDepart.Rows.Count); i++)
                 {
                     org.Id           = id;
                     org.RefDepart    = Convert.ToInt32(dgDepart[0, i].Value.ToString());
                     org.RefActivite  = Convert.ToInt32(dn.retourId(activCombo.Text.Trim(), "@design", "GET_ID_ACTIVITE"));
                     org.Description  = descTxt.Text;
                     org.DateActivite = Convert.ToDateTime(dateTxt.Text);
                     org.Heure        = heureTxt.Text;
                     org.SaveDatas(org);
                 }
                 dgDepart.Rows.Clear();
             }
             else if (dgDepart.Rows.Count == 0)
             {
                 org.Id           = id;
                 org.RefActivite  = Convert.ToInt32(dn.retourId(activCombo.Text.Trim(), "@design", "GET_ID_ACTIVITE"));
                 org.Description  = descTxt.Text;
                 org.DateActivite = Convert.ToDateTime(dateTxt.Text);
                 org.Heure        = heureTxt.Text;
                 org.SaveDatas(org);
             }
             dn.Alert("Activité ajoutée", FrmAlert.enmType.Success);
             dgDepart.Rows.Clear();
             Initialiser();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #2
0
 void Search(OrganiserActivite org)
 {
     dgActivite.DataSource = org.Research(serchTxt.Text);
 }
コード例 #3
0
 void SelectDatas(OrganiserActivite org, string depart)
 {
     dgActivite.DataSource = org.ListOfActivites(depart);
     lblAnnonce.Text       = dgActivite.Rows.Count.ToString() + " Activités";
 }