예제 #1
0
        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);
        }
예제 #2
0
        public static TableCaravan ZnajdzKarawane(string id)
        {
            TableCaravan karawana = tableCaravan.Select(n => n).Where(x => x.GetId() == id).FirstOrDefault();

            return(karawana);
        }
예제 #3
0
        internal void UpdateCaravan(TableCaravan Caravan)
        {
            SqlConnection conn = new SqlConnection(connectionString);

            try
            {
                conn.Open();
            }
            catch (SqlException se)
            {
                return;
            }

            SqlCommand cmd = new SqlCommand("Insert into Caravan" + "(IdCaravan, IdLoc, Wagons, Guard, Duration, Minions) Values (@IdCaravan, @IdLoc, @Wagons, @Guard, @Duration, @Minions)", conn);

            SqlParameter param = new SqlParameter();

            param.ParameterName = "@IdCaravan";
            param.Value         = Caravan.GetId();
            param.SqlDbType     = SqlDbType.VarChar;
            cmd.Parameters.Add(param);

            param = new SqlParameter();
            param.ParameterName = "@IdLoc";
            param.Value         = Caravan.GetIdLoc();
            param.SqlDbType     = SqlDbType.VarChar;
            cmd.Parameters.Add(param);

            param = new SqlParameter();
            param.ParameterName = "@Wagons";
            param.Value         = Caravan.GetWagons();
            param.SqlDbType     = SqlDbType.Int;
            cmd.Parameters.Add(param);

            param = new SqlParameter();
            param.ParameterName = "@Guard";
            param.Value         = Caravan.GetGuard();
            param.SqlDbType     = SqlDbType.Int;
            cmd.Parameters.Add(param);

            param = new SqlParameter();
            param.ParameterName = "@Duration";
            param.Value         = Caravan.GetDuration();
            param.SqlDbType     = SqlDbType.Int;
            cmd.Parameters.Add(param);

            param = new SqlParameter();
            param.ParameterName = "@Minions";
            param.Value         = Caravan.GetMinions();
            param.SqlDbType     = SqlDbType.Int;
            cmd.Parameters.Add(param);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (SqlException se)
            {
                return;
            }
            conn.Close();
            conn.Dispose();
        }