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"); } }
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"); }