partial void DeleteRuch(Ruch instance);
partial void InsertRuch(Ruch instance);
partial void UpdateRuch(Ruch instance);
private void timer1_Tick(object sender, EventArgs e) { if (bus.Left >= (panel1.Left + panel1.Width)) { bus.Left = 0; inBus.Left = bus.Width / 2; } else { bus.Left += 1; inBus.Left += 1; } if ((bus.Left + bus.Width / 2) == (pictureBox2.Left + pictureBox2.Width / 2)) { int busOut = gen.Next(0, int.Parse(inBus.Text)); //ile wysiadlo int busIn = int.Parse(label1.Text); //ile wsiadlo startStop_Click(sender, e); inBus.Text = (int.Parse(inBus.Text) - busOut).ToString(); inBus.Text = (int.Parse(inBus.Text) + busIn).ToString(); Thread.Sleep(1500); Ruch tmp = new Ruch { nr_przystanku = 1, wsiadlo = busIn, wysiadlo = busOut, stan_po = int.Parse(inBus.Text), czas = DateTime.Now }; db.Ruches.InsertOnSubmit(tmp); db.SubmitChanges(); label1.Text = (gen.Next(0, 10)).ToString(); startStop_Click(sender, e); } if ((bus.Left + bus.Width / 2) == (pictureBox3.Left + pictureBox3.Width / 2)) { int busOut = gen.Next(0, int.Parse(inBus.Text)); int busIn = int.Parse(label2.Text); startStop_Click(sender, e); inBus.Text = (int.Parse(inBus.Text) - busOut).ToString(); inBus.Text = (int.Parse(inBus.Text) + busIn).ToString(); Thread.Sleep(1500); Ruch tmp = new Ruch { nr_przystanku = 2, wsiadlo = busIn, wysiadlo = busOut, stan_po = int.Parse(inBus.Text), czas = DateTime.Now.AddMinutes(gen.Next(5, 7)) }; db.Ruches.InsertOnSubmit(tmp); db.SubmitChanges(); label2.Text = (gen.Next(0, 10)).ToString(); startStop_Click(sender, e); } if ((bus.Left + bus.Width / 2) == (pictureBox4.Left + pictureBox4.Width / 2)) { int busOut = gen.Next(0, int.Parse(inBus.Text)); int busIn = int.Parse(label3.Text); startStop_Click(sender, e); inBus.Text = (int.Parse(inBus.Text) - busOut).ToString(); inBus.Text = (int.Parse(inBus.Text) + busIn).ToString(); Thread.Sleep(1500); Ruch tmp = new Ruch { nr_przystanku = 3, wsiadlo = busIn, wysiadlo = busOut, stan_po = int.Parse(inBus.Text), czas = DateTime.Now.AddMinutes(gen.Next(8, 11)) }; db.Ruches.InsertOnSubmit(tmp); db.SubmitChanges(); label3.Text = (gen.Next(0, 10)).ToString(); startStop_Click(sender, e); } if ((bus.Left + bus.Width / 2) == (pictureBox5.Left + pictureBox5.Width / 2)) { int busOut = gen.Next(0, int.Parse(inBus.Text)); int busIn = int.Parse(label4.Text); startStop_Click(sender, e); inBus.Text = (int.Parse(inBus.Text) - busOut).ToString(); inBus.Text = (int.Parse(inBus.Text) + busIn).ToString(); Thread.Sleep(1500); Ruch tmp = new Ruch { nr_przystanku = 4, wsiadlo = busIn, wysiadlo = busOut, stan_po = int.Parse(inBus.Text), czas = DateTime.Now.AddMinutes(gen.Next(12, 18)) }; db.Ruches.InsertOnSubmit(tmp); db.SubmitChanges(); label4.Text = (gen.Next(0, 10)).ToString(); startStop_Click(sender, e); } }