예제 #1
0
 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
                                    );
         }
     }
 }
예제 #2
0
        /// <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)
            {
            }
        }
예제 #3
0
        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 загружена");
        }