예제 #1
0
        public List <Ressource> LoadProfil()
        {
            DataTable rs;
            DataTable rs2;
            DataTable rs3;
            DataTable rs4;


            int i = 0;

            rs = proc.getAllProfil();

            while (i < rs.Rows.Count)
            {
                if (rs.Rows[i]["prenom"].ToString() != "")
                {
                    Profil newprof = new Profil(Convert.ToInt32(rs.Rows[i]["idProfil"].ToString()), rs.Rows[i]["prenom"].ToString(), rs.Rows[i]["nom"].ToString(), rs.Rows[i]["email"].ToString(), rs.Rows[i]["phoneNumber"].ToString(), Convert.ToInt32(rs.Rows[i]["seniority"].ToString()), Convert.ToInt32(rs.Rows[i]["quotaHeureMax"].ToString()));


                    if (posteCharge.Count != 0)
                    {
                        rs2 = proc.getProfilPoste(newprof.getId());

                        for (int j = 0; j < rs2.Rows.Count; j++)
                        {
                            int k = 0;
                            // MessageBox.Show(Convert.ToInt32(rs2.Rows[j]["idPoste"].ToString()) + "" + posteCharge[k].getId());
                            while (k < posteCharge.Count && Convert.ToInt32(rs2.Rows[j]["idPoste"].ToString()) != posteCharge[k++].getId())
                            { //MessageBox.Show(Convert.ToInt32(rs2.Rows[j]["idPoste"].ToString()) +""+ posteCharge[k].getId());
                            }

                            newprof.setPoste((Poste)posteCharge[--k]);
                        }
                    }

                    rs3 = proc.getProfilDispo(newprof.getId());
                    rs4 = proc.getProfilPreference(newprof.getId());
                    Console.WriteLine(rs4.Rows.Count + "");
                    for (int j = 0; j < rs3.Rows.Count; j++)
                    {
                        Bloc newBloc = new Bloc(DateTime.ParseExact(rs3.Rows[j]["debut"].ToString(), "yyyy-MM-dd HH:mm:ss", null), DateTime.ParseExact(rs3.Rows[j]["fin"].ToString(), "yyyy-MM-dd HH:mm:ss", null), 0, Convert.ToInt32(rs3.Rows[j]["idPlage"].ToString()));



                        newprof.addDispo(newBloc);
                    }

                    for (int j = 0; j < rs4.Rows.Count; j++)
                    {
                        Bloc newBloc = new Bloc(DateTime.ParseExact(rs4.Rows[j]["debut"].ToString(), "yyyy-MM-dd HH:mm:ss", null), DateTime.ParseExact(rs4.Rows[j]["fin"].ToString(), "yyyy-MM-dd HH:mm:ss", null), 0, Convert.ToInt32(rs4.Rows[j]["idPlage"].ToString()), Convert.ToInt32(rs4.Rows[j]["idPlage"].ToString()));
                        newprof.addPref(newBloc);
                    }

                    profilCharge.Add(newprof);
                }
                i++;
            }

            return(profilCharge);
        }
예제 #2
0
        public void createBlock(int x, int heureDebut, DateTime debut, DateTime fin)
        {
            string hDebut = heureDebut + "";
            string hFin   = (heureDebut + 1) + "";

            CreationBloc creationbloc = new CreationBloc(hDebut, hFin);

            creationbloc.ShowDialog();

            if (creationbloc.isValide())
            {
                //Compute Nouvelle Date ** Ajouter validation **
                int  dateDebut = int.Parse(creationbloc.getHd());
                int  dateFin   = int.Parse(creationbloc.getHf());
                bool isPreset  = creationbloc.getPreset();



                DateTime tempDebut = new DateTime(debut.Year, debut.Month, debut.Day, dateDebut, debut.Minute, debut.Second);
                DateTime tempFin   = new DateTime(fin.Year, fin.Month, fin.Day, dateFin, fin.Minute, fin.Second) - new TimeSpan(0, 0, 0, 1);


                //Affecte le bloc



                Bloc tempBloc = new Bloc(tempDebut, tempFin, 0, 0, isPreset);



                if (placementValide(tempBloc))
                {
                    if (profil != null)
                    {
                        if (loader == null && laGrille.isPref)
                        {
                            profil.addPref(tempBloc);
                        }
                        else
                        if (loader == null && !laGrille.isPref)
                        {
                            profil.addDispo(tempBloc);
                        }
                        tempBloc.draw(width, grfx);
                    }
                    else
                    {
                        //Ajout du block valide
                        tempBloc.draw(width, grfx);
                        loader.bloc.Add(tempBloc);
                    }
                }
                else
                {
                    MessageBox.Show("Placement invalide");
                }
            }

            creationbloc.Dispose();
        }
예제 #3
0
        public List<Ressource> LoadProfil()
        {
            DataTable rs;
            DataTable rs2;
            DataTable rs3;
            DataTable rs4;

            int i = 0;
            rs = proc.getAllProfil();

            while (i < rs.Rows.Count)
            {

                if (rs.Rows[i]["prenom"].ToString() != "")
                {
                    Profil newprof = new Profil(Convert.ToInt32(rs.Rows[i]["idProfil"].ToString()), rs.Rows[i]["prenom"].ToString(), rs.Rows[i]["nom"].ToString(), rs.Rows[i]["email"].ToString(), rs.Rows[i]["phoneNumber"].ToString(), Convert.ToInt32(rs.Rows[i]["seniority"].ToString()), Convert.ToInt32(rs.Rows[i]["quotaHeureMax"].ToString()));

                    if (posteCharge.Count != 0)
                    {

                        rs2 = proc.getProfilPoste(newprof.getId());

                        for (int j = 0; j < rs2.Rows.Count; j++)
                        {
                            int k = 0;
                           // MessageBox.Show(Convert.ToInt32(rs2.Rows[j]["idPoste"].ToString()) + "" + posteCharge[k].getId());
                            while (k<posteCharge.Count && Convert.ToInt32(rs2.Rows[j]["idPoste"].ToString()) != posteCharge[k++].getId())
                            { //MessageBox.Show(Convert.ToInt32(rs2.Rows[j]["idPoste"].ToString()) +""+ posteCharge[k].getId());
                            }

                            newprof.setPoste((Poste)posteCharge[--k]);
                        }

                    }

                    rs3 = proc.getProfilDispo(newprof.getId());
                    rs4 = proc.getProfilPreference(newprof.getId());
                    Console.WriteLine(rs4.Rows.Count+"");
                    for (int j = 0; j < rs3.Rows.Count; j++)
                    {

                        Bloc newBloc = new Bloc(DateTime.ParseExact(rs3.Rows[j]["debut"].ToString(), "yyyy-MM-dd HH:mm:ss", null), DateTime.ParseExact(rs3.Rows[j]["fin"].ToString(), "yyyy-MM-dd HH:mm:ss", null), 0, Convert.ToInt32(rs3.Rows[j]["idPlage"].ToString() ));

                        newprof.addDispo(newBloc);

                    }

                    for (int j = 0; j < rs4.Rows.Count; j++)
                    {
                        Bloc newBloc = new Bloc(DateTime.ParseExact(rs4.Rows[j]["debut"].ToString(), "yyyy-MM-dd HH:mm:ss", null), DateTime.ParseExact(rs4.Rows[j]["fin"].ToString(), "yyyy-MM-dd HH:mm:ss", null), 0, Convert.ToInt32(rs4.Rows[j]["idPlage"].ToString()), Convert.ToInt32(rs4.Rows[j]["idPlage"].ToString()));
                        newprof.addPref(newBloc);
                    }

                    profilCharge.Add(newprof);

                }
                i++;

            }

            return (profilCharge);
        }