示例#1
0
        //line up ophalen uit database
        public static ObservableCollection <LineUp> GetLineUp()
        {
            ObservableCollection <LineUp> lineUp = new ObservableCollection <LineUp>();

            String       sSQL   = "SELECT * FROM LineUP";
            DbDataReader reader = Database.GetData(sSQL);
            DateTime     today  = DateTime.Now;


            while (reader.Read())
            {
                LineUp l = new LineUp();

                int ID = (int)reader["ID"];
                l.ID    = Convert.ToString(ID);
                l.Date  = !Convert.IsDBNull((DateTime)reader["Date"]) ? (DateTime)reader["Date"] : today;
                l.From  = !Convert.IsDBNull((string)reader["Van"]) ? (string)reader["Van"] : "";
                l.Until = !Convert.IsDBNull((string)reader["Until"]) ? (string)reader["Until"] : "";
                l.Stage = GetStageFromLineUp(reader["Stage"].ToString());
                l.Band  = GetBandFromLineUp(reader["Band"].ToString());

                lineUp.Add(l);
            }
            return(lineUp);
        }
示例#2
0
        //LineUp verwijderen van database
        public static void DeleteLineUp(LineUp lu)
        {
            String sSQL = "DELETE FROM LineUp WHERE Date = @Date AND Van = @From AND Until = @Until";

            DbParameter par1 = Database.AddParameter("@Date", lu._Date);
            DbParameter par2 = Database.AddParameter("@From", lu._From);
            DbParameter par3 = Database.AddParameter("@Until", lu._Until);

            Database.ModifyData(sSQL, par1, par2, par3);
        }
示例#3
0
        //LineUp toevoegen aan database
        public static void AddLineUp(LineUp lu)
        {
            String sSQL = "INSERT INTO LineUp (Date, Van, Until, Stage, Band) VALUES (@Date, @From, @Until, @StageID, @BandID)";

            DbParameter par1 = Database.AddParameter("@Date", lu.Date);
            DbParameter par2 = Database.AddParameter("@From", lu.From);
            DbParameter par3 = Database.AddParameter("@Until", lu.Until);
            DbParameter par4 = Database.AddParameter("@StageID", lu.Stage.ID);
            DbParameter par5 = Database.AddParameter("@BandID", lu.Band.ID);

            Database.ModifyData(sSQL, par1, par2, par3, par4, par5);
        }
示例#4
0
        //LineUp aanpassen in database
        public static void ModifyLineUp(LineUp lu)
        {
            String sSQL = "UPDATE LineUP SET Date = @Date,van = @From, Until = @Until, Stage = @StageID, Band = @BandID  WHERE LineUpID = @ID";

            DbParameter par1 = Database.AddParameter("@ID", lu.ID);
            DbParameter par2 = Database.AddParameter("@Date", Convert.ToDateTime(lu._Date));
            DbParameter par3 = Database.AddParameter("@From", lu._From);
            DbParameter par4 = Database.AddParameter("@Until", lu._Until);
            DbParameter par5 = Database.AddParameter("@StageID", Convert.ToInt32(lu.Stage));
            DbParameter par6 = Database.AddParameter("@BandID", Convert.ToInt32(lu.Band));

            Database.ModifyData(sSQL, par1, par2, par3, par4, par5, par6);
        }