private void button20_Click(object sender, EventArgs e) { if (textBox12.Text != "") { if (MessageBox.Show("Вы действительно хотите удалить заказ " + textBox15.Text + "?", "", MessageBoxButtons.YesNoCancel) == DialogResult.Yes) { DBHandlerMySQL.DeleteOrder(textBox12.Text); RefreshTable(); MessageBox.Show("Заказ " + textBox15.Text + " успешно удален!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox8.Clear(); textBox9.Clear(); textBox10.Clear(); textBox12.Clear(); textBox15.Clear(); checkBox12.Checked = false; checkBox11.Checked = false; maskedTextBox1.Clear(); comboBox2.Text = "Нет"; } } }
private void RefreshTable() { DBHandlerMySQL.GetOrders(); dataGridView1.Rows.Clear(); for (int i = 0; i < Constants.ORDERS.Count; i++) { if (dateTimePicker2.Value.ToShortDateString().Equals(Constants.ORDERS[i].DateOrder.ToShortDateString())) { dataGridView1.Rows.Add(Constants.ORDERS[i].Id, Constants.ORDERS[i].DateCreate.ToShortDateString(), Constants.ORDERS[i].Name, Constants.ORDERS[i].Phone1, Constants.ORDERS[i].DateOrder.ToShortDateString(), Constants.ORDERS[i].Description, Constants.ORDERS[i].City, Constants.ORDERS[i].Street, Constants.ORDERS[i].House, Constants.ORDERS[i].Flat, Constants.ORDERS[i].Office, Constants.ORDERS[i].Porch, Constants.ORDERS[i].Floor, Constants.ORDERS[i].Intercom, Constants.ORDERS[i].Phone2, Constants.ORDERS[i].TimeBeg, Constants.ORDERS[i].Lat, Constants.ORDERS[i].Lon, Constants.ORDERS[i].Master ); } } }
public Form1() { InitializeComponent(); if (!Constants.ReadConfig()) { MessageBox.Show("Ошибка чтения конфигурационного файла!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); Process.GetCurrentProcess().Kill(); //Application.Exit(); } DBHandlerMySQL.GetMasters(); gMapControl1.MapProvider = GMap.NET.MapProviders.GoogleSatelliteMapProvider.Instance; GMaps.Instance.Mode = AccessMode.ServerOnly; Logger.Log.Info("Main form start"); masterButtons[0] = button7; masterButtons[1] = button8; masterButtons[2] = button9; masterButtons[3] = button10; masterButtons[4] = button11; masterButtons[5] = button12; masterButtons[6] = button13; masterButtons[7] = button14; masterButtons[8] = button15; masterButtons[9] = button16; routeList[0] = button4; routeList[1] = button5; routeList[2] = button22; routeList[3] = button23; routeList[4] = button24; routeList[5] = button25; routeList[6] = button26; routeList[7] = button27; routeList[8] = button28; routeList[9] = button29; }
/// <summary> /// Добавить заказ в систему /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button6_Click(object sender, EventArgs e) { try { string name = textBox11.Text; string lat = textBox19.Text; string lon = textBox20.Text; string timeBeg = maskedTextBox1.Text; DateTime dateOrder = dateTimePicker1.Value;//.ToShortDateString(); if (lat.Length == 0 || lon.Length == 0) { MessageBox.Show("Не заданы координаты заказа!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { Convert.ToDouble(lat.Replace('.', ',')); Convert.ToDouble(lon.Replace('.', ',')); } catch (Exception ex) { MessageBox.Show("Ошибка в координатах заказа!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (dateTimePicker1.Value.Date < DateTime.Now.Date) { MessageBox.Show("Проверьте дату выполнения заказа!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (name.Length == 0) { MessageBox.Show("Не указано название заказа!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!CheckTimeBeg()) { MessageBox.Show("Ошибка формата времени начала работы!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DBHandlerMySQL.AddOrder(name, "", lat, lon, "", "", "", "", "", "", false, "", dateOrder, timeBeg, "", "", "Нет"); DBHandlerMySQL.GetOrders(); FillCombo1(); textBox11.Clear(); maskedTextBox1.Clear(); textBox17.Clear(); textBox19.Clear(); textBox20.Clear(); //MessageBox.Show("Заказ " + name + " успешно создан!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { } }
private void button3_Click(object sender, EventArgs e) { if (DialogResult.Yes == MessageBox.Show("Вы действительно хотите удалить мастера " + textBox1.Text + "?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { DBHandlerMySQL.DeleteMaster(textBox1.Text); RefreshTable(); } }
private void RefreshTable() { DBHandlerMySQL.GetMasters(); dataGridView1.Rows.Clear(); for (int i = 0; i < Constants.MASTERS.Count; i++) { dataGridView1.Rows.Add(i + 1, Constants.MASTERS[i].Name, Constants.MASTERS[i].StartLat, Constants.MASTERS[i].StartLon, Constants.MASTERS[i].InWork); } }
private void Form1_Load(object sender, EventArgs e) { //gMapControl1.MapProvider = GMap.NET.MapProviders.GMapProviders.OpenStreetMap; //GMaps.Instance.Mode = AccessMode.ServerOnly; gMapControl1.Position = new PointLatLng(55.75006997032796, 37.62540103074475); gMapControl1.ShowTileGridLines = false; gMapControl1.ShowCenter = false; gMapControl1.DragButton = MouseButtons.Left; DBHandlerMySQL.GetOrders(); FillCombo1(); FillMasters(); GetMyOrders(); ShowMarkers(); ShowRoutes(); Logger.Log.Info("Form1 загружена"); }
private void AppointOrder(Master master) { Order order = null; for (int i = 0; i < Constants.ORDERS.Count; i++) { if (Constants.ORDERS[i].Name.Equals(comboBox1.Text)) { order = Constants.ORDERS[i]; } } if (order != null) { order.Master = master.Name; DBHandlerMySQL.SetMasterOrder(order); master.myOrders.Add(order); FillCombo1(); } }
private void button19_Click(object sender, EventArgs e) { try { string id = textBox12.Text; string name = textBox15.Text; bool completed = checkBox12.Checked; string dateOrder = dateTimePicker2.Value.ToShortDateString(); string timeBeg = maskedTextBox1.Text; string master = comboBox2.Text; string city = textBox1.Text; string street = textBox2.Text; string house = textBox3.Text; string office = textBox4.Text; string flat = textBox5.Text; string porch = textBox6.Text; string floor = textBox7.Text; bool intercom = checkBox11.Checked; string phone1 = textBox8.Text; string phone2 = textBox9.Text; string description = textBox10.Text; if (dateTimePicker2.Value.Date < DateTime.Now.Date) { MessageBox.Show("Проверьте дату выполнения заказа!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (name.Length == 0) { MessageBox.Show("Не указано название заказа!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DBHandlerMySQL.UpdateOrder(id, name, description, city, street, house, flat, office, porch, intercom, floor, dateOrder, timeBeg, phone1, phone2, master, completed); RefreshTable(); MessageBox.Show("Информация о заказе " + name + " успешно обновлена!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { } }
private void button2_Click(object sender, EventArgs e) { DBHandlerMySQL.UpdateMaster(textBox1.Text, textBox2.Text, textBox3.Text, checkBox1.Checked); RefreshTable(); }