public static void dodajKarawane(string a, string b) { TableCaravan nowa = new TableCaravan(a, b, 1, 0, 0, 1); tableCaravan.Add(nowa); TableArtInCaravan nowy = new TableArtInCaravan(a, "TO01", 0); tableArtInCaravan.Add(nowy); nowy = new TableArtInCaravan(a, "TO01", 0); tableArtInCaravan.Add(nowy); nowy = new TableArtInCaravan(a, "TO02", 0); tableArtInCaravan.Add(nowy); nowy = new TableArtInCaravan(a, "TO03", 0); tableArtInCaravan.Add(nowy); nowy = new TableArtInCaravan(a, "TO04", 0); tableArtInCaravan.Add(nowy); nowy = new TableArtInCaravan(a, "TO05", 0); tableArtInCaravan.Add(nowy); nowy = new TableArtInCaravan(a, "TO06", 0); tableArtInCaravan.Add(nowy); nowy = new TableArtInCaravan(a, "TO07", 0); tableArtInCaravan.Add(nowy); nowy = new TableArtInCaravan(a, "TO08", 0); tableArtInCaravan.Add(nowy); nowy = new TableArtInCaravan(a, "TO09", 0); tableArtInCaravan.Add(nowy); nowy = new TableArtInCaravan(a, "TO10", 0); tableArtInCaravan.Add(nowy); nowy = new TableArtInCaravan(a, "TO11", 0); tableArtInCaravan.Add(nowy); }
internal void UpdateArtInCaravan(TableArtInCaravan ArtInCaravan) { SqlConnection conn = new SqlConnection(connectionString); try { conn.Open(); } catch (SqlException se) { return; } SqlCommand cmd = new SqlCommand("Insert into Art_in_Caravan" + "(IdCaravan, IdArticle, Number) Values (@Id, @IdArt, @Num)", conn); SqlParameter param = new SqlParameter(); param.ParameterName = "@Id"; param.Value = ArtInCaravan.GetId(); param.SqlDbType = SqlDbType.VarChar; cmd.Parameters.Add(param); param = new SqlParameter(); param.ParameterName = "@IdArt"; param.Value = ArtInCaravan.GetIdArticle(); param.SqlDbType = SqlDbType.VarChar; cmd.Parameters.Add(param); param = new SqlParameter(); param.ParameterName = "@Num"; param.Value = ArtInCaravan.GetNumber(); param.SqlDbType = SqlDbType.Int; cmd.Parameters.Add(param); try { cmd.ExecuteNonQuery(); } catch (SqlException se) { return; } conn.Close(); conn.Dispose(); }
public static TableArtInCaravan ZnajdzTowarWKarawanie(string idt, string idk) { TableArtInCaravan towar = tableArtInCaravan.Select(n => n).Where(x => x.GetId() == idk && x.GetIdArticle() == idt).FirstOrDefault(); return(towar); }