public void activate_open() { pictureBox_error.Hide(); this.BackColor = Color.White; label_name.ForeColor = Color.Green; label_balance.Show(); label_name.Show(); pictureBox_open.Show(); for (int i = 0; i < user.GetData().Rows.Count; i++) { if (user.GetData().Rows[i]["CarNumber"].ToString() == frm.number()) { User first = new User(); label_name.Text = "Здравствуйте, " + user.GetData().Rows[i]["FirstName"].ToString() + " " + user.GetData().Rows[i]["LastName"].ToString(); user.updateTimeEnter(DateTime.Now, frm.number()); label_balance.Text = "На вашем счете: " + user.GetData().Rows[i]["Balance"].ToString()+ " руб " + " \nМаксимальное время парковки: " + ((int)(((int)(Double.Parse(user.GetData().Rows[i]["Balance"].ToString()) / (double)first.getPrice())) / 60)).ToString() + " час(ов) " + ((int)(((int)(Double.Parse(user.GetData().Rows[i]["Balance"].ToString()) / (double)first.getPrice())) % 60)).ToString() + " минут(ы) "; user.updateParking(true, frm.number()); } } float time = 0; Timer timer = new Timer(); timer.Tick += new EventHandler((sender, e) => { if ((time +=1) >= 7200) { this.BackColor = Color.Black; label_balance.Hide(); label_name.Hide(); pictureBox_open.Hide(); timer.Stop(); } }); timer.Interval = 1; timer.Start(); }
private void Form_open_Load(object sender, EventArgs e) { this.Location = new Point(frm.Location.X - form_operator.Width-235, frm.Location.Y + form_operator.Height+10); this.BackColor = Color.Black; label_balance.Hide(); label_name.Hide(); pictureBox_open.Hide(); for (int i = 0; i < user.GetData().Rows.Count; i++) { if (user.GetData().Rows[i]["CarNumber"].ToString() == frm.number()) { User first = new User(); label_name.Text = "Здравствуйте, " + user.GetData().Rows[i]["FirstName"].ToString() + " " + user.GetData().Rows[i]["LastName"].ToString(); user.updateTimeEnter(DateTime.Now, frm.number()); label_balance.Text = "На вашем счете: " + user.GetData().Rows[i]["Balance"].ToString() + " руб." + " \nМаксимальное время парковки: " + ((int)(Double.Parse(user.GetData().Rows[i]["Balance"].ToString())/(double)first.getPrice())).ToString() + " мин"; user.updateParking(true, frm.number()); } } }