public static Stage VerwerkRij(IDataRecord rij) { Stage type = new Stage(); type.ID = Convert.ToInt32(rij["ID"].ToString()); type.Name = rij["Name"].ToString(); return type; }
public static void DeleteType(Stage SelectedStage) { try { DbParameter paramName = Database.AddParameter("@Name", SelectedStage.Name); Database.ModifyData("DELETE FROM Stages WHERE Name = @Name", paramName); } catch (Exception e) { throw e; } }
public static void AddType(Stage SelectedStage) { try { DbParameter paramName = Database.AddParameter("@Name", SelectedStage.Name); Database.ModifyData("INSERT INTO Stages (Name) values (@Name)", paramName); } catch (Exception e) { Console.WriteLine(e.Message); } }
//Stage methods public void AddStage() { Stage newStage = new Stage(); Podiums.Add(newStage); SelectedStage = newStage; }
private static Stage CreateStageWithDate(DbDataReader reader, DateTime date) { Stage stage = new Stage(); stage.ID = Int32.Parse(reader["ID"].ToString()); stage.Name = Convert.ToString(reader["Name"]); stage.Bands = LineUp.GetBandsByLineUpIDAndDate(Convert.ToInt32(reader["ID"]), date); return stage; }
private static Stage CreateStage(DbDataReader rij) { Stage stage = new Stage(); stage.ID = Int32.Parse(rij["ID"].ToString()); stage.Name = Convert.ToString(rij["Name"]); stage.Bands = LineUp.GetBandsByLineUpID(Convert.ToInt32(rij["ID"])); return stage; }
public static void EditStage(Stage stag) { try { string sql = "UPDATE Ticket SET Name=@name WHERE ID=@ID;"; DbParameter par1 = Database.AddParameter("@name", stag.Name); DbParameter parID = Database.AddParameter("@ID", Convert.ToInt32(stag.ID)); Database.ModifyData(sql, par1, parID); } catch (Exception ex) { Console.WriteLine(ex.Message); throw ex; } }
public static Stage GetStageByID(int id) { Stage gevondenStage = new Stage(); DbParameter par1 = Database.AddParameter("@id", id); DbDataReader reader = Database.GetData("SELECT * FROM stages WHERE ID = @id",par1); while (reader.Read()) { gevondenStage.Name = reader["Name"].ToString(); } return gevondenStage; }