Ejemplo n.º 1
0
 private void spInsertBilletType(BilletType billetType, Afvikling afvikling)
 {
     using (SqlConnection connection = new SqlConnection(ConnectionString))
     {
         SqlCommand command = new SqlCommand();
         command.CommandText = "EXECUTE spInsertBilletType @Udbud, @Pris, @Afvikling";
         command.Parameters.AddWithValue("@Udbud", billetType.Udbud);
         command.Parameters.AddWithValue("@Pris", billetType.Pris);
         command.Parameters.AddWithValue("@Afvikling", afvikling.ID);
         command.Connection = connection;
         command.Connection.Open();
         command.ExecuteNonQuery();
         connection.Close();
     }
     using (SqlConnection connection = new SqlConnection(ConnectionString))
     {
         SqlCommand command = new SqlCommand();
         command.CommandText = "EXECUTE spGetBilletTypeId @Pris, @Afvikling";
         command.Parameters.AddWithValue("@Pris", billetType.Pris);
         command.Parameters.AddWithValue("@Afvikling", afvikling.ID);
         command.Connection = connection;
         command.Connection.Open();
         SqlDataReader sqlDataReader = command.ExecuteReader();
         sqlDataReader.Read();
         billetType.ID = (int)sqlDataReader["BilletTypeId"];
         sqlDataReader.Close();
         connection.Close();
     }
 }
Ejemplo n.º 2
0
        //private void spInsertAfvikling(ODEONEvent OE, Afvikling afvikling)
        //{
        //    using (SqlConnection connection = new SqlConnection(ConnectionString))
        //    {
        //        SqlCommand command = new SqlCommand();
        //        command.CommandText = "EXECUTE spInsertAfvikling @Dato, @Event, @Sal";
        //        command.Parameters.AddWithValue("@Dato", afvikling.Dato);
        //        command.Parameters.AddWithValue("@Event", OE.ID);
        //        command.Parameters.AddWithValue("@Sal", afvikling.Sal.ID);
        //        command.Connection = connection;
        //        command.Connection.Open();
        //        command.ExecuteNonQuery();
        //        connection.Close();
        //    }
        //    using (SqlConnection connection = new SqlConnection(ConnectionString))
        //    {
        //        SqlCommand command = new SqlCommand();
        //        command.CommandText = "EXECUTE spGetAfviklingId @Event, @Dato";
        //        command.Parameters.AddWithValue("@Event", OE.ID);
        //        command.Parameters.AddWithValue("@Dato", afvikling.Dato);
        //        command.Connection = connection;
        //        command.Connection.Open();
        //        SqlDataReader sqlDataReader = command.ExecuteReader();
        //        sqlDataReader.Read();
        //        afvikling.ID = (int)sqlDataReader["DatoId"];
        //        sqlDataReader.Close();
        //        connection.Close();
        //    }
        //}

        private void spInsertAfvikling(ODEONEvent OE, Afvikling afvikling)
        {
            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                SqlCommand command = new SqlCommand();
                command.CommandText = "EXECUTE spTest @Dato, @Event, @Sal";
                command.Parameters.AddWithValue("@Dato", afvikling.Dato);
                command.Parameters.AddWithValue("@Event", OE.ID);
                command.Parameters.AddWithValue("@Sal", afvikling.Sal.ID);
                command.Connection = connection;
                command.Connection.Open();
                SqlDataReader sqlDataReader = command.ExecuteReader();
                sqlDataReader.Read();
                afvikling.ID = (int)sqlDataReader["DatoId"];
                sqlDataReader.Close();
                connection.Close();
            }
        }
Ejemplo n.º 3
0
 private void spGetAfviklinger(ODEONEvent OE)
 {
     using (SqlConnection connection = new SqlConnection(ConnectionString))
     {
         SqlCommand command = new SqlCommand();
         command.CommandText = "EXECUTE [spGetAfviklinger] @EventID";
         command.Parameters.AddWithValue("@EventID", OE.ID);
         command.Connection = connection;
         connection.Open();
         SqlDataReader Reader = command.ExecuteReader();
         while (Reader.Read())
         {
             Afvikling afvikling = new Afvikling((DateTime)Reader["Dato"]);
             afvikling.ID  = (int)Reader["DatoId"];
             afvikling.Sal = SalRepo.GetItem((int)Reader["Sal"]);
             OE.Afviklinger.Add(afvikling);
         }
     }
 }
Ejemplo n.º 4
0
 private void spGetBilletTyper(Afvikling afvikling)
 {
     using (SqlConnection connection = new SqlConnection(ConnectionString))
     {
         SqlCommand command = new SqlCommand();
         command.CommandText = "EXECUTE [spGetBilletTyper] @AfviklingID";
         command.Parameters.AddWithValue("@AfviklingID", afvikling.ID);
         command.Connection = connection;
         connection.Open();
         SqlDataReader Reader = command.ExecuteReader();
         while (Reader.Read())
         {
             int        udbud  = (int)Reader["Udbud"];
             decimal    pris   = (decimal)Reader["Pris"];
             BilletType billet = new BilletType(udbud, pris);
             billet.ID = (int)Reader["BilletTypeId"];
             afvikling.BilletTyper.Add(billet);
         }
     }
 }
Ejemplo n.º 5
0
 public override string ToString()
 {
     return(Pris.ToString() + " " + Afvikling.ToString());
 }