public PointsInRoute(string Branch, string NameRt, List <Point> Route, DateTime Dt) { InitializeComponent(); Get_dbFileName(Branch); Name = NameRt; DateT = Dt; Text = Name + " " + DateT.ToShortDateString(); int ct = 0; string Code = "", Adress = ""; foreach (Point p in Route) { if (p.Adress == "Start") { if (ct == 0) { dataGridView1.Rows.Add("", "Точка выезда", "0", "0", "0", StrDoubleToTime(p.TimeDepart)); } else { dataGridView1.Rows.Add("", "Точка приезда", p.DistPrevTP.ToString(), p.DistanceFromFirst.ToString(), StrDoubleToTime(p.TimeArrive)); } } else { Code = p.CodeTradePoint; Adress = p.Adress; List <string> strData = DBHandler.getPoints(Code); if (p.IsVisited) { dataGridView1.Rows.Add(++ct, Code, p.DistPrevTP.ToString(), p.DistanceFromFirst.ToString(), StrDoubleToTime(p.TimeArrive), StrDoubleToTime(p.TimeDepart), p.FactTimeArrive.TimeOfDay.ToString(), p.FactTimeDepart.TimeOfDay.ToString(), Adress, strData[0], strData[1], strData[2] + " - " + strData[3]); dataGridView1.Rows[dataGridView1.Rows.Count - 1].DefaultCellStyle.BackColor = Color.LightGreen; } else { dataGridView1.Rows.Add(++ct, Code, p.DistPrevTP.ToString(), p.DistanceFromFirst.ToString(), StrDoubleToTime(p.TimeArrive), StrDoubleToTime(p.TimeDepart), "", "", Adress, strData[0], strData[1], strData[2] + " - " + strData[3]); dataGridView1.Rows[dataGridView1.Rows.Count - 1].DefaultCellStyle.BackColor = Color.LightYellow; } } } }
private void button1_Click(object sender, EventArgs e) { DBHandler db = new DBHandler(); try { if (db.getAuth(textBox1.Text, textBox2.Text) != null) { status = textBox1.Text; Close(); } else { MessageBox.Show("Неправильный логин или пароль. Повторите ввод.", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; } } catch { MessageBox.Show("Проблемы при работе с базой данных. Обратитесь к администратору.", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }