Ejemplo n.º 1
0
 public static Stage GetStage(string p)
 {
     Stage stage = new Stage();
     DbDataReader reader = Database.GetData("SELECT * FROM tbl_stage WHERE ID=@id",Database.AddParameter("@id",Convert.ToInt32(p)));
     foreach (IDataRecord db in reader)
     {
         stage=(Create(db));
     }
     return stage;
 }
Ejemplo n.º 2
0
 public static string DeleteStage(Stage SelectedStage)
 {
     DbDataReader reader = Database.GetData("SELECT * FROM tbl_lineup WHERE Stage=@id", Database.AddParameter("@id", Convert.ToInt32(SelectedStage.ID)));
     if (reader.HasRows)
     {
         return "Gelieve eerste alle bands uit de line up van deze stage te verwijderen";
     }
     else
     {
         Database.ModifyData("DELETE FROM tbl_stage WHERE ID=@id", Database.AddParameter("@id", Convert.ToInt32(SelectedStage.ID)));
     }
     return null;
 }
Ejemplo n.º 3
0
 public static string AddLineUp(Band SelectedBandAdd, string StartTime, string EndTime, Stage SelectedStage, DateTime SelectedDatum)
 {
     string error = "";
     error = CheckTime(StartTime, EndTime, SelectedStage,SelectedDatum);
     if (error == null)
     {
         error = CheckBand(StartTime, EndTime, SelectedStage, SelectedBandAdd,SelectedDatum);
         if (error == null)
         {
             Database.ModifyData("INSERT INTO tbl_lineup (DatePreformance,FromTime,UntilTime,Stage,Band) VALUES (@date,@from,@until,@stage,@band)",
                 Database.AddParameter("@date", SelectedDatum),
                 Database.AddParameter("@from", StartTime),
                 Database.AddParameter("@until", EndTime),
                 Database.AddParameter("@stage", Convert.ToInt32(SelectedStage.ID)),
                 Database.AddParameter("@band", Convert.ToInt32(SelectedBandAdd.ID))
                 );
         }
         else
         {
             return error;
         }
     }
     return error;
 }
Ejemplo n.º 4
0
 public static void EditStage(string TxtStage,Stage SelectedStage)
 {
     Database.ModifyData("UPDATE tbl_stage SET StageName=@name WHERE ID=@id", Database.AddParameter("@name", TxtStage), Database.AddParameter("@id",Convert.ToInt32(SelectedStage.ID)));
 }
Ejemplo n.º 5
0
 private static LineUp Create(IDataRecord db, Stage SelectedStage)
 {
     return new LineUp()
     {
         ID = db["ID"].ToString(),
         Date = Convert.ToDateTime(db["DatePreformance"]),
         From = db["FromTime"].ToString(),
         Until = db["UntilTime"].ToString(),
         Stage = SelectedStage,
         Band = Band.GetBands(db["Band"].ToString()),
     };
 }
Ejemplo n.º 6
0
 private static string CheckTime(string StartTime, string EndTime, Stage SelectedStage,DateTime SelectedDatum)
 {
     string[] strEndtime = EndTime.Split(':');
     string EndTimecom = strEndtime[0] + strEndtime[1];
     string[] strStarttime = StartTime.Split(':');
     string StartTimecom = strStarttime[0] + strStarttime[1];
     if (Convert.ToInt32(StartTimecom) >= Convert.ToInt32(EndTimecom))
     {
         return "De eindtijd moet groter zijn dan de starttijd";
     }
     else
     {
         DbDataReader reader = Database.GetData("SELECT * FROM tbl_lineup WHERE Stage=@stage AND DatePreformance=@date",
         Database.AddParameter("@stage", Convert.ToInt32(SelectedStage.ID)),
         Database.AddParameter("@date", SelectedDatum)
         );
         foreach (IDataRecord db in reader)
         {
             string[] strStartToCheck = db["FromTime"].ToString().Split(':');
             string[] strEndToCheck = db["UntilTime"].ToString().Split(':');
             if (Between(Convert.ToInt32(strStartToCheck[0] + strStartToCheck[1]), Convert.ToInt32(StartTimecom), Convert.ToInt32(EndTimecom)) || Between(Convert.ToInt32(strEndToCheck[0] + strEndToCheck[1]), Convert.ToInt32(StartTimecom), Convert.ToInt32(EndTimecom)))
             {
                 return "Deze tijden zijn al in gebruikt";
             }
         }
     }
     return null;
 }
Ejemplo n.º 7
0
 public static ObservableCollection<LineUp> GetLineUp(DateTime SelectedDatum, Stage SelectedStage)
 {
     ObservableCollection<LineUp> lineups = new ObservableCollection<LineUp>();
     if (SelectedStage != null && SelectedDatum != null)
     {
         DbDataReader reader = Database.GetData("SELECT tbl_lineup.ID as ID,DatePreformance,FromTime,UntilTime,Band FROM tbl_lineup WHERE Stage=@stageid AND DatePreformance=@date ORDER BY FromTime",
             Database.AddParameter("@stageid", Convert.ToInt32(SelectedStage.ID)),
             Database.AddParameter("@date", Convert.ToDateTime(SelectedDatum))
             );
         foreach (IDataRecord db in reader)
         {
             lineups.Add(Create(db, SelectedStage));
         }
     }
     return lineups;
 }
Ejemplo n.º 8
0
 public static string EditLineUp(Band SelectedBandAdd, string StartTime, string EndTime,Stage SelectedStage, DateTime SelectedDatum,string ID)
 {
     string error = "";
     error = CheckTime(StartTime, EndTime, SelectedStage,SelectedDatum);
     if (error == null)
     {
         error = CheckBand(StartTime, EndTime, SelectedStage, SelectedBandAdd,SelectedDatum);
         if (error == null)
         {
             Database.ModifyData("UPDATE tbl_lineup SET DatePreformance=@date,FromTime=@from,UntilTime=@until,Stage=@stage,Band=@band WHERE ID=@id",
                 Database.AddParameter("@date", SelectedDatum),
                 Database.AddParameter("@from", StartTime),
                 Database.AddParameter("@until", EndTime),
                 Database.AddParameter("@stage", Convert.ToInt32(SelectedStage.ID)),
                 Database.AddParameter("@id", Convert.ToInt32(ID)),
                 Database.AddParameter("@band", Convert.ToInt32(SelectedBandAdd.ID))
                 );
         }
         else
         {
             return error;
         }
     }
     return error;
 }