Esempio n. 1
0
        public GMaps()
        {
            if (DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return;
            }
            InitializeComponent();


            ini_map();
            lienlac          = new GiamSatXe_LienLac();
            TXe              = new T_XeOnline();
            timerVDH.Enabled = true;

            hienTrangXe1.Visible = false;
            hienTrangXe1.OnUserControlButtonClicked += new HienTrangXe.ButtonClickedEventHandler(hienTrangXe1_OnUserControlButtonClicked);

            Init_texbox();

            txtDiaChi.LostFocus += new EventHandler(txtDiaChi_LostFocus);
            txtTimXe.LostFocus  += new EventHandler(txtTimXe_LostFocus);

            cboMapType.Items.Insert(0, "Chọn bản đồ");
            cboMapType.Items.Insert(1, "Bình Anh");
            cboMapType.Items.Insert(2, "Google");
            cboMapType.Items.Insert(3, "Vệ Tinh");
            cboMapType.SelectedIndex = 2;

            txtTinhThanh.Text = ThongTinCauHinh.GPS_TenTinh;
            InitTimerbw();
        }
Esempio n. 2
0
        private void TimXe(string soHieuXe)
        {
            try
            {
                T_XeOnline XeOnline = new T_XeOnline();
                XeOnline = WCFService_Common.GetXeOnlineBySHX(soHieuXe);
                if (XeOnline == null)
                {
                    new MessageBox.MessageBoxBA().Show(string.Format("Không tồn tại xe {0} trên hệ thống", soHieuXe), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
                }
                else
                {
                    if (XeOnline.ThoiDiemChenDuLieu <= DateTime.Now.AddMinutes(-150))
                    {
                        new MessageBox.MessageBoxBA().Show(string.Format("Xe {0} đã mất tín hiệu GPS.", soHieuXe), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
                    }
                    else
                    {
                        //new MessageBox.MessageBox().Show(XeOnline.ViDo.ToString() + "-" + XeOnline.KinhDo.ToString());
                        //PointLatLng point = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo);
                        string strDiaChi = string.Format("[{0}]:{1}", soHieuXe, Service_Common.GetAddressByGeoBA((float)XeOnline.ViDo, (float)XeOnline.KinhDo));
                        int    trangThai = 0;//xe tắt máy
                        if ((XeOnline.TrangThai & 3) > 0)
                        {
                            trangThai = 2;//xe co khach
                        }
                        else if ((XeOnline.TrangThai & 8) == 0)
                        {
                            trangThai = 1;//xe bật máy.
                        }
                        //if (MainMap.OverlayXeDeCu != null && MainMap.OverlayXeDeCu.Markers != null)
                        //    MainMap.OverlayXeDeCu.Markers.Clear();
                        //if (MainMap.MarkerXeDeCu != null)
                        //    MainMap.MarkerXeDeCu.Overlay.Clear();

                        MainMap.addMarkerXeDeCu3(trangThai, XeOnline.KinhDo, XeOnline.ViDo, strDiaChi);
                        MainMap.Position = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo);
                    }
                }
            }
            catch (Exception ex)
            {
                new MessageBox.MessageBoxBA().Show("Lỗi, không tìm thấy xe", "Thông báo lỗi", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
            }
        }
 private void TimXe(string soHieuXe)
 {
     try
     {
         T_XeOnline XeOnline = new T_XeOnline();
         XeOnline = new SyncServiceOnlineClient().GetXeOnlineBySHX(soHieuXe);
         if (XeOnline != null)
         {
             if (XeOnline.TrangThaiKhac >= 0)
             {
                 //PointLatLng point = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo);
                 string strDiaChi = string.Format("[{0}]:{1}", soHieuXe, Taxi.Services.Service_Common.GetAddressByGeoBA((float)XeOnline.ViDo, (float)XeOnline.KinhDo));
                 int    trangThai = 0;//xe tắt máy
                 if ((XeOnline.TrangThai & 3) > 0)
                 {
                     trangThai = 2;//xe co khach
                 }
                 else if ((XeOnline.TrangThai & 8) == 0)
                 {
                     trangThai = 1;//xe bật máy.
                 }
                 MainMap.addMarkerXeDeCu3(trangThai, XeOnline.KinhDo, XeOnline.ViDo, strDiaChi);
                 MainMap.Position = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo);
             }
             else
             {
                 lblMsg.Text = string.Format("{0}-Xe {1} MTH", lblMsg.Text, soHieuXe);
             }
         }
         else
         {
             lblMsg.Text = string.Format("{0}-Xe {1} không có GPS", lblMsg.Text, soHieuXe);
         }
     }
     catch (Exception ex)
     {
         lblMsg.Text = string.Format("{0}-Lỗi không tìm thấy xe", lblMsg.Text);
         //new MessageBox.MessageBox().Show("Lỗi, không tìm thấy xe", "Thông báo lỗi", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Error);
     }
 }
 private void TimXe(string soHieuXe)
 {
     try
     {
         T_XeOnline XeOnline = new T_XeOnline();
         XeOnline = new SyncServiceOnlineClient().GetXeOnlineBySHX(soHieuXe);
         if (XeOnline == null)
         {
             new MessageBox.MessageBoxBA().Show(string.Format("Không tồn tại xe {0} trên hệ thống", soHieuXe), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
         }
         else
         {
             if (XeOnline.TrangThaiKhac < 0)
             {
                 new MessageBox.MessageBoxBA().Show(string.Format("Xe {0} đã mất tín hiệu " + XeOnline.TrangThaiKhacText, soHieuXe), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
             }
             else
             {
                 new MessageBox.MessageBoxBA().Show(XeOnline.ViDo.ToString() + "-" + XeOnline.KinhDo.ToString());
                 //PointLatLng point = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo);
                 string strDiaChi = string.Format("[{0}]:{1}", soHieuXe, Service_Common.GetAddressByGeoBA((float)XeOnline.ViDo, (float)XeOnline.KinhDo));
                 int    trangThai = 0;//xe tắt máy
                 if ((XeOnline.TrangThai & 3) > 0)
                 {
                     trangThai = 2;//xe co khach
                 }
                 else if ((XeOnline.TrangThai & 8) == 0)
                 {
                     trangThai = 1;//xe bật máy.
                 }
                 MainMap.addMarkerXeDeCu3(trangThai, XeOnline.KinhDo, XeOnline.ViDo, strDiaChi);
                 MainMap.Position = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo);
             }
         }
     }
     catch (Exception ex)
     {
         new MessageBox.MessageBoxBA().Show("Lỗi, không tìm thấy xe", "Thông báo lỗi", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
     }
 }
Esempio n. 5
0
 private void TimXe(string soHieuXe)
 {
     try
     {
         if (SearchType.EditValue.To <int>() == 1)
         {
             T_XeOnline XeOnline = new T_XeOnline();
             XeOnline = new SyncServiceOnlineClient().GetXeOnlineBySHX(soHieuXe);
             if (XeOnline == null)
             {
                 new MessageBox.MessageBoxBA().Show(string.Format("Không tồn tại xe {0} trên hệ thống", soHieuXe),
                                                    "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
             }
             else
             {
                 if (XeOnline.TrangThaiKhac < 0)
                 {
                     new MessageBox.MessageBoxBA().Show(
                         string.Format("Xe {0} đã mất tín hiệu " + XeOnline.TrangThaiKhacText, soHieuXe),
                         "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
                 }
                 else
                 {
                     //PointLatLng point = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo);
                     string strDiaChi = string.Format("[{0}]:{1}", soHieuXe,
                                                      Taxi.Services.Service_Common.GetAddressByGeoBA((float)XeOnline.ViDo,
                                                                                                     (float)XeOnline.KinhDo));
                     int trangThai = 0; //xe tắt máy
                     if ((XeOnline.TrangThai & 3) > 0)
                     {
                         trangThai = 2; //xe co khach
                     }
                     else if ((XeOnline.TrangThai & 8) == 0)
                     {
                         trangThai = 1; //xe bật máy.
                     }
                     MainMap.AddMarkerXeG5(trangThai, XeOnline.KinhDo, XeOnline.ViDo, strDiaChi);
                     MainMap.Position = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo);
                 }
             }
         }
         else
         {
             string bienso = CommonBL.ConvertSangBienSo(soHieuXe);
             if (string.IsNullOrEmpty(bienso))
             {
                 new MessageBox.MessageBoxBA().Show(string.Format("Không tồn tại xe {0} trên danh sách xe hệ thống", soHieuXe),
                                                    "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
                 return;
             }
             var rs = Service_Common.ServiceG5.TryGet(p => p.GetVehicleOnlne(bienso));
             //if (Global.IsDebug)
             //    new MessageBox.MessageBox().Show(string.Format(bienso));
             if (rs.Success && rs.Value != null)
             {
                 string strDiaChi = string.Format("[{0}]:{1}", soHieuXe,
                                                  Service_Common.GetAddressByGeoBA((float)rs.Value.Lat, (float)rs.Value.Lng));
                 int trangThai = 0;                //xe tắt máy
                 if ((rs.Value.Status & 4096) > 0) //4096  sẵn sàng
                 {
                     trangThai = 1;                //xe sẵn sàng
                 }
                 else if ((rs.Value.Status & 8) == 0)
                 {
                     //     trangThai = 1; //xe bật máy.
                 }
                 //MainMap.MarkerCustomer
                 MainMap.AddMarkerXeG5(trangThai, (float)rs.Value.Lng, (float)rs.Value.Lat, strDiaChi);
                 MainMap.Position = new PointLatLng((float)rs.Value.Lat, (float)rs.Value.Lng);
             }
             else
             {
                 new MessageBox.MessageBoxBA().Show(string.Format("Không tìm thấy vị trí xe {0} trên hệ thống", soHieuXe),
                                                    "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
             }
         }
     }
     catch
     (Exception ex)
     {
         new MessageBox.MessageBoxBA().Show("Lỗi, không tìm thấy xe", "Thông báo lỗi",
                                            Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
     }
 }
        private void TimXe(string soHieuXe)
        {
            try
            {
                if (SearchType.EditValue.To <int>() == 1)
                {
                    T_XeOnline XeOnline = new T_XeOnline();
                    XeOnline = WCFService_Common.GetXeOnlineBySHX(soHieuXe);
                    if (XeOnline == null)
                    {
                        new MessageBox.MessageBoxBA().Show(string.Format("Không tồn tại xe {0} trên hệ thống", soHieuXe),
                                                           "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
                    }
                    else
                    {
                        if (XeOnline.ThoiDiemChenDuLieu <= DateTime.Now.AddMinutes(-150))
                        {
                            new MessageBox.MessageBoxBA().Show(string.Format("Xe {0} đã mất tín hiệu GPS.{1}", soHieuXe, XeOnline.TGGPS.ToString("dd/MM/yyyy HH:mm:ss")),
                                                               "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
                        }
                        else
                        {
                            string strDiaChi = string.Format("[{0}]:{1}", soHieuXe, Service_Common.GetAddressByGeoBA(XeOnline.ViDo, XeOnline.KinhDo));
                            int    trangThai = 0; //xe tắt máy
                            if ((XeOnline.TrangThai & 3) > 0)
                            {
                                trangThai = 2; //xe co khach
                            }
                            else if ((XeOnline.TrangThai & 8) == 0)
                            {
                                trangThai = 1; //xe bật máy.
                            }

                            MainMap.addMarkerXeDeCu3(trangThai, XeOnline.KinhDo, XeOnline.ViDo, strDiaChi);
                            MainMap.Position = new PointLatLng(XeOnline.ViDo, XeOnline.KinhDo);
                        }
                    }
                }
                else
                {
                    string bienso = CommonBL.ConvertSangBienSo(soHieuXe);
                    if (string.IsNullOrEmpty(bienso))
                    {
                        new MessageBox.MessageBoxBA().Show(string.Format("Không tồn tại xe {0} trên danh sách xe hệ thống", soHieuXe),
                                                           "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
                        return;
                    }
                    var rs = WCFServicesApp.Client.TryGet(p => p.GetVehicleOnlne(bienso));
                    //if (Global.IsDebug)
                    //    new MessageBox.MessageBox().Show(string.Format(bienso));
                    if (rs.Success && rs.Value != null)
                    {
                        string strDiaChi = string.Format("[{0}]:{1}", soHieuXe,
                                                         Service_Common.GetAddressByGeoBA((float)rs.Value.Lat, (float)rs.Value.Lng));
                        int trangThai = 0;                //xe tắt máy
                        if ((rs.Value.Status & 4096) > 0) //4096  sẵn sàng
                        {
                            trangThai = 1;                //xe sẵn sàng
                        }
                        else if ((rs.Value.Status & 8) == 0)
                        {
                            //     trangThai = 1; //xe bật máy.
                        }

                        MainMap.AddMarkerXeG5(trangThai, (float)rs.Value.Lng, (float)rs.Value.Lat, strDiaChi);
                        MainMap.Position = new PointLatLng((float)rs.Value.Lat, (float)rs.Value.Lng);
                    }
                    else
                    {
                        new MessageBox.MessageBoxBA().Show(string.Format("Không tìm thấy vị trí xe {0} trên hệ thống", soHieuXe),
                                                           "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                new MessageBox.MessageBoxBA().Show("Lỗi, không tìm thấy xe", "Thông báo lỗi",
                                                   Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
                LogError.WriteLogError("TImXe", ex);
            }
        }