示例#1
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();
        }
示例#2
0
        public void addPreset(Bloc bloc, int x)
        {
            TimeSpan dateDebut = new TimeSpan(bloc.getDebut().Hour, bloc.getDebut().Minute, bloc.getDebut().Second);
            TimeSpan dateFin   = new TimeSpan(bloc.getFin().Hour, bloc.getFin().Minute, bloc.getFin().Second);



            DateTime tempDebut = new DateTime(this.dateDuJour.Year, this.dateDuJour.Month, this.dateDuJour.Day) + dateDebut;
            DateTime tempFin   = new DateTime(this.dateFin.Year, this.dateFin.Month, this.dateFin.Day) + dateFin;


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

            tempBloc.setRessourceAffectes(bloc.getRessourceAffectes());
            tempBloc.setRessourceVoulus(bloc.getListRessourceVoulus());
            tempBloc.setId(bloc.getId());



            if (placementValide(tempBloc))
            {
                //Ajout du block valide
                tempBloc.draw(width, grfx);
                loader.bloc.Add(tempBloc);
                tempBloc.save(true);
            }
            else
            {
                MessageBox.Show("Placement invalide");
            }
        }
示例#3
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();
        }
示例#4
0
        public void addPreset(Bloc bloc, int x)
        {
            TimeSpan dateDebut = new TimeSpan(bloc.getDebut().Hour, bloc.getDebut().Minute, bloc.getDebut().Second);
                TimeSpan dateFin = new TimeSpan(bloc.getFin().Hour, bloc.getFin().Minute, bloc.getFin().Second);

                DateTime tempDebut = new DateTime(this.dateDuJour.Year, this.dateDuJour.Month, this.dateDuJour.Day)+dateDebut;
                DateTime tempFin = new DateTime(this.dateFin.Year, this.dateFin.Month, this.dateFin.Day) +dateFin;

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

                tempBloc.setRessourceAffectes(bloc.getRessourceAffectes());
                tempBloc.setRessourceVoulus(bloc.getListRessourceVoulus());
                tempBloc.setId(bloc.getId());

                if (placementValide(tempBloc))
                {
                    //Ajout du block valide
                    tempBloc.draw(width, grfx);
                    loader.bloc.Add(tempBloc);
                    tempBloc.save(true);
                }
                else
                    MessageBox.Show("Placement invalide");
        }