Exemplo n.º 1
0
    { public void OpretBestilling()
      {
          Indtast    Skriv        = new Indtast();
          SQL        DataCmd      = new SQL();
          int        KundeId      = Skriv.IndtastId();
          DateTime   Forestilling = Skriv.IndtastDato();
          string     Film         = Skriv.IndtastFilm();
          string     Betalling    = Skriv.IndtastBetalling();
          Bestilling Ordre        = new Bestilling(KundeId, Forestilling, Film, Betalling);

          DataCmd.OpretBestilling(Ordre);
      }
Exemplo n.º 2
0
 public void OpretBestilling(Bestilling Ordre)
 {
     using (SqlConnection Con = new SqlConnection(ConString))
     {
         Con.Open();
         SqlCommand Cmd = new SqlCommand("INSERT INTO Bestilling VALUES (" + Ordre.KundeId + ",'" + Ordre.Bestillingstid + "','" + Ordre.Film + "','" + Ordre.Betalling + "')", Con);
         try
         {
             Cmd.ExecuteNonQuery();
         }
         catch (Exception) { Console.WriteLine("Der kunne ikke bestilles."); }
     }
 }
Exemplo n.º 3
0
 public List <Bestilling> VisBestilling(int id)
 {
     using (SqlConnection Con = new SqlConnection(ConString))
     {
         Con.Open();
         SqlCommand        Sql       = new SqlCommand("SELECT Fornavn, Efternavn, KundeId, Bestillingstid, Film, Betaling FROM Kunder,Bestilling WHERE Bestilling.KundeId = Kunder.Id and Kunder.Id = " + id, Con);
         List <Bestilling> OrdreList = new List <Bestilling>();
         SqlDataReader     Reader    = Sql.ExecuteReader();
         while (Reader.Read())
         {
             string     Fornavn   = Reader.GetString(0);
             string     Efternavn = Reader.GetString(1);
             int        KundeId   = Reader.GetInt32(2);
             DateTime   Tid       = Reader.GetDateTime(3);
             string     Film      = Reader.GetString(4);
             string     Betalling = Reader.GetString(5);
             Bestilling Ordre     = new Bestilling(Fornavn, Efternavn, KundeId, Tid, Film, Betalling);
             OrdreList.Add(Ordre);
         }
         return(OrdreList);
     }
 }