private void txtStart_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { string strAddress = txtStart.Text.Trim(); var ad = Service_Common.GetGeobyAddressV2_Full(strAddress); if (ad == null || ad.Equals("*") || ad == "") { lblMsg.Text = "Không tìm thấy điểm xuất phát"; txtStart.Focus(); return; } var cut = ad.Split(' '); if (_markerStart != null) { _markerStart.Position = new PointLatLng(double.Parse(cut[0]), double.Parse(cut[1])); _markerStart.ToolTipText = "Điểm xuất phát:" + strAddress; MainMap.Position = _markerStart.Position; } else { MainMap.IsPosition = true; MainMap.AddMarkerAOne(double.Parse(cut[0]), double.Parse(cut[1]), "Điểm xuất phát:" + strAddress); _markerStart = MainMap.MarkerCustomer; MainMap.IsPosition = false; } _flgmarkerA = false; Route(); } }
//tim dia chi private void txtDiaChi_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { hienTrangXe1.Visible = false; ovlDiaChi.Markers.Clear(); //string tinhthanh = "hai phong"; var address = Service_Common.GetGeobyAddress(StringTools.TrimSpace(txtDiaChi.Text), StringTools.TrimSpace(txtTinhThanh.Text.Trim())); if (address == "*") { new MessageBox.MessageBoxBA().Show("Không tìm thấy địa chỉ hoặc địa chỉ không tồn tại!", "Thông báo"); } else { var cut = address.Split(' '); marker1 = new GMarkerGoogle(new PointLatLng(double.Parse(cut[0]), double.Parse(cut[1])), GMarkerGoogleType.green); ovlDiaChi.Markers.Add(marker1); gmap.Position = new PointLatLng(double.Parse(cut[0]), double.Parse(cut[1])); gmap.Zoom = 16; } } } catch (Exception ex) { LogError.WriteLogError("txtDiaChi_KeyDown: ", ex); } }
private bool XacDinhViTri(string diaChi, float kinhDo, float viDo) { try { if (viDo == 0 && kinhDo == 0) { string toaDo = Service_Common.GetGeobyAddress(diaChi, ThongTinCauHinh.GPS_TenTinh).Replace(',', '.'); if ((toaDo != "*" && toaDo != string.Empty)) { string[] arrString = toaDo.Split(' '); viDo = float.Parse(arrString[0], CultureInfo.InvariantCulture); kinhDo = float.Parse(arrString[1], CultureInfo.InvariantCulture); MainMap.addMarkerMG(new PointLatLng(viDo, kinhDo), diaChi); return(true); } else { lblMsg.Text = "Không tìm thấy địa chỉ này trên bản đồ"; return(false); } } else { MainMap.addMarkerMG(new PointLatLng(viDo, kinhDo), diaChi); return(true); } } catch (Exception ex) { LogError.WriteLogError("XacDinhViTri: ", ex); return(false); } }
public static KeyValuePair <float, float>?Search(string address) { var str = Service_Common.GetGeobyAddress(address, ThongTinCauHinh.GPS_TenTinh); if (str.Split(' ').Length == 2) { return(new KeyValuePair <float, float>(str.Split(' ')[0].ConvertToFloat(), str.Split(' ')[1].ConvertToFloat())); } return(null); }
private void MainMap_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && _isMouseDown) { _isMouseDown = false; var address = Service_Common.GetAddressByGeoBA((float)_currentMarker.Position.Lat, (float)_currentMarker.Position.Lng); if (!address.Equals("*") && _currentMarker is GMapMarkerCustomType) { switch (_currentMarker.As <GMapMarkerCustomType>().Type) { case MarkerCustomType.A: _currentMarker.ToolTipText = _currentMarker.ToolTipText.Split(':')[0] + ":" + address; this._markerA = _currentMarker; if (txtDiemXuatPhat.Text.Trim() == "" || _flgmarkerA) { txtDiemXuatPhat.Text = address; } break; case MarkerCustomType.B: _currentMarker.ToolTipText = _currentMarker.ToolTipText.Split(':')[0] + ":" + address; this._markerB = _currentMarker; if (txtDiemDungCuoi.Text.Trim() == "" || _flgmarkerB) { txtDiemDungCuoi.Text = address; } break; case MarkerCustomType.None: var index = _currentMarker.ToolTipText.Remove(0, 4).Trim().Split(':')[0].To <int>(); _currentMarker.ToolTipText = string.Format("Điểm {0}:{1}", index, address); switch (index) { case 1: if (txtDiemDen1.Text.Trim() == "" || _flgmarker1) { txtDiemDen1.Text = address; } break; case 2: if (txtDiemDen2.Text.Trim() == "" || _flgmarker2) { txtDiemDen2.Text = address; } break; } break; } Route(); } _currentMarker = null; } }
private void inputVehicle_EditValueChanged(object sender, EventArgs e) { var item = inputVehicle.GetSelectedDataRow() as GiamSatXe_HoatDong; if (item == null) { inputVehicle.EditValue = null; if (!string.IsNullOrEmpty(inputVehicle.Text)) { lblThongBao.Text = "Số xe không thuộc hệ thống hoặc đang chở khách"; } item = new GiamSatXe_HoatDong(); } else { lblThongBao.Text = string.Empty; } lblDiemDo.Text = item.TenDiemDo; lblDriverName.Text = item.TenNhanVien; MaLaiXe = item.MaLaiXe; if (item.SoHieuXe != null) { var xeOnline = WCFService_Common.WCFServiceClient.TryGet(p => p.GetXeOnlineBySHX(item.SoHieuXe)).Value; KinhDo = xeOnline.KinhDo; ViDo = xeOnline.ViDo; DiemDo = item.DiemDo ?? 0; try { if (KinhDo > 0 && ViDo > 0) { txtDiaChiDon.Text = Service_Common.GetAddressByGeoBA(ViDo, KinhDo); } else { txtDiaChiDon.Text = string.Empty; } } catch (Exception) { } } else { txtDiaChiDon.Text = string.Empty; } }
/// <summary> /// Xử lý tìm đường theo từ điểm và nếu không có thì tìm theo service google /// </summary> public string GetGeobyAddress(string diaChi) { diaChi = StringTools.TrimSpace(diaChi); var address = Service_Common.GetGeobyAddressV2(diaChi); //double lat = 0; //double lng = 0; //if (!address.Equals("*")) //{ // //double.TryParse(address.Split(' ')[0], out lat); // //double.TryParse(address.Split(' ')[1], out lng); // return address; //} return(address); }
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 txt_SearchAddress_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { var address = Service_Common.GetGeobyAddressV2_Gooogle_Full(txt_SearchAddress.Text.Trim()); if (address == null || address == "*" || address == "" || address.Split(' ').Length != 2) { lblMsg.Text = "Không tìm thấy địa chỉ hoặc địa chỉ không tồn tại!"; } else { var cut = address.Split(' '); MainMap.Position = new PointLatLng(cut[0].To <float>(), cut[1].To <float>()); MainMap.Zoom = 14; } txt_SearchAddress.Focus(); } }
void gmap_MouseMove(object sender, MouseEventArgs e) { if (IsMouseUp && currentMarker != null) { var pos = currentMarker.Position = gmap.FromLocalToLatLng(e.X, e.Y); this.Lat = (float)pos.Lat; // float.Parse(cut[0], CultureInfo.InvariantCulture); this.Lng = (float)pos.Lng; // float.Parse(cut[1], CultureInfo.InvariantCulture); try { string address = Service_Common.GetAddressByGeoBA(this.Lat, this.Lng); this.DiaChi = address; currentMarker.ToolTipText = address; } catch (Exception ex) { } // gmap.Position = gmap.FromLocalToLatLng(e.X, e.Y); } }
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, 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); } }
private void MainMap_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { isMouseDown = true; if (MainMap.OverlayCustom != null && MainMap.OverlayCustom.Markers.Count > 0) { MainMap.OverlayCustom.Markers.Clear(); } PointLatLng point = MainMap.FromLocalToLatLng(e.X, e.Y); try { string strDiaChi = Service_Common.GetAddressByGeoBA((float)point.Lat, (float)point.Lng); MainMap.addMarkerCustomer(point, strDiaChi); txtTenDiem.Text = strDiaChi; txtDiaChi_GPS.Text = strDiaChi; } catch (Exception ex) { LogError.WriteLogError("MainMap_MouseDown:", ex); } } }
private void setMarkerDSXeDonKhachDeCu(string DSXeDonKhach, string DSXeDonKhach_TD) { try { if (DSXeDonKhach == "") { return; } string[] arrDSXeDonKhach = DSXeDonKhach.Split(','); string[] arrDSXeDonKhach_TD = DSXeDonKhach_TD.Split(','); string[] Values; double KinhDo = 0; double ViDo = 0; for (int i = 0; i < arrDSXeDonKhach.Length; i++) { Values = arrDSXeDonKhach_TD[i].Split('_'); if (Values.Length > 0) { if (!String.IsNullOrEmpty(Values[3])) { ViDo = Convert.ToDouble(Values[3], Global.CultureSystem); KinhDo = Convert.ToDouble(Values[2], Global.CultureSystem); MainMap.addMarkerXeNhan(2, KinhDo, ViDo, string.Format("{0}-{1}", arrDSXeDonKhach[i], Service_Common.GetAddressByGeoBA((float)ViDo, (float)KinhDo))); G_LstXeDonDeCu.Add(new XeDonDeCuEntity( Values[0], KinhDo, ViDo, DateTime.Parse(Values[5]) )); } } } } catch (Exception ex) { LogError.WriteLogError("SetMarkerDSXeDonKhachDeCu: ", ex); } }
private void ShowHienTrangXe(VehicleOnline xeonline, string SoHieuXe) { #region --Kiem tra tra trang thai xe va dua thong tin vao panel-- var address = !Taxi.Business.ThongTinCauHinh.GPS_TrangThai ? "" : Service_Common.GetAddressByGeoBA(xeonline.ViDo, xeonline.KinhDo); #region Thông tin xe pnMarker.Visible = true; pnMarker.Refresh(); if ((xeonline.Trangthai & 3) > 0) { TrangThaiXe = "Có khách"; } else if ((xeonline.Trangthai & 3) <= 0) { TrangThaiXe = "Không khách"; } if ((xeonline.Trangthai & 8) == 0) { may = "Bật"; DungXeNoMay = "\r\nDừng xe nổ máy: \t" + xeonline.TGDungXeNoMay; } else if ((xeonline.Trangthai & 8) > 0) { may = "Tắt"; } if ((xeonline.Trangthai & 32) > 0) { DieuHoa = "Tắt"; } else if ((xeonline.Trangthai & 32) == 0) { DieuHoa = "Bật"; } int.TryParse((xeonline.TGGPS - xeonline.ThoiDiemDiChuyenGanNhat).ToString("mm"), out timedung); if ((xeonline.TrangThaiKhac) == -2 && (xeonline.VGPS) >= 3 && timedung < 0) { DaDung = ""; } else { DaDung = "\r\nĐã dừng:\t\t" + timedung.ToString() + " phút"; } var dt = lienlac.Map_HienTrangXe(SoHieuXe); string BienSoXe = ""; if (dt != null && dt.Rows.Count > 0) { if (dt.Rows[0]["TenNhanVien"] != null && !dt.Rows[0]["TenNhanVien"].ToString().Equals("")) { //TenLaiXe = "Tên lái xe:\t" + dt.Rows[0]["TenNhanVien"].ToString(); //Phone = "Sđt:\t" + dt.Rows[0]["DiDong"].ToString(); loaixe = dt.Rows[0]["TenLoaiXe"].ToString() + " "; socho = dt.Rows[0]["SoCho"].ToString(); gara = "\r\nGara: \t\t" + dt.Rows[0]["Name"].ToString(); } else if (dt.Rows[0]["TenNhanVien"].ToString().Equals("")) { //TenLaiXe = "Tên lái xe:\t" + dt.Rows[0]["TenNhanVien"].ToString(); //Phone = "Sđt:\t" + dt.Rows[0]["DiDong"].ToString(); loaixe = dt.Rows[0]["TenLoaiXe"].ToString() + " "; socho = dt.Rows[0]["SoCho"].ToString(); gara = "\r\nGara: \t\t" + dt.Rows[0]["Name"].ToString(); } BienSoXe = dt.Rows[0]["BienKiemSoat"].ToString(); loaixe = dt.Rows[0]["TenLoaiXe"].ToString() + " "; socho = dt.Rows[0]["SoCho"].ToString(); gara = "\r\nGara: \t\t" + dt.Rows[0]["Name"].ToString(); #region Thời điểm kd DateTime det = DateTime.MinValue; var tdkd = string.Empty; //txtThoiDiemKD.Visible = true; tdkd += string.Format("Tên lX:\t {0}", dt.Rows[0]["TenNhanVien"]); tdkd += string.Format("\r\nSDT:\t {0}", dt.Rows[0]["DiDong"]); if (DateTime.TryParse(dt.Rows[0]["ThoiDiemBao"].ToString(), out det) && det > DateTime.MinValue) { tdkd += string.Format("\r\nRa KD: {0:HH:mm dd/MM/yyyy}", dt.Rows[0]["ThoiDiemBao"]); } #endregion string strDiemDo = ""; var getInfoKD = lienlac.GetInfoKD(SoHieuXe); if (getInfoKD != null && getInfoKD.Rows.Count > 0) { DiemDoKhaiBao = dt.Rows[0]["DiemDo"] == DBNull.Value ? 0 : int.Parse(dt.Rows[0]["DiemDo"].ToString()); //txtDiemDo.Visible = true; //txtDiemDo.Text = "Điểm đỗ: " + getInfoKD.Rows[0]["ViTriDiemBao"].ToString() // + "\r\nThời điểm: " + ((DateTime)getInfoKD.Rows[0]["ThoiDiemBao"]).ToString("HH:mm dd/MM/yyyy"); strDiemDo = "Điểm đỗ: " + getInfoKD.Rows[0]["ViTriDiemBao"].ToString() + "\r\nThời điểm: " + ((DateTime)getInfoKD.Rows[0]["ThoiDiemBao"]).ToString("HH:mm dd/MM/yyyy"); } var getTrangThai = lienlac.GetTrangThaiBySoXe(SoHieuXe); if (getTrangThai != null && getTrangThai.Rows.Count > 0) { //txtDiemDo.Text = txtDiemDo.Text + "\r\nTrạng thái: " + getTrangThai.Rows[0]["TrangThai"]; strDiemDo += "\r\nTrạng thái: " + getTrangThai.Rows[0]["TrangThai"]; if (getTrangThai.Rows[0]["LyDoVe"] != DBNull.Value && string.IsNullOrEmpty(getTrangThai.Rows[0]["LyDoVe"].ToString())) { strDiemDo += "\r\nLý do về: " + getTrangThai.Rows[0]["LyDoVe"]; //txtDiemDo.Text = txtDiemDo.Text + "\r\nLý do về: " + getTrangThai.Rows[0]["LyDoVe"]; } } txtThoiDiemKD.Text = tdkd + "\r\n" + strDiemDo; } else { BienSoXe = xeonline.BienSoXe; var strXeKhongKD = string.Empty; //kiểm tra xem có xin nghỉ ko đi kinh doanh không - nếu có thì hiển hị lý do nghỉ var nghi = lienlac.GetVehicleNotWorkingBySoXe(SoHieuXe); if (nghi != null && nghi.Rows.Count > 0) { strXeKhongKD += string.Format("\r\nLý do nghỉ: {0}", nghi.Rows[0]["ReasonName"]); } txtThoiDiemKD.Text = strXeKhongKD; } DataTable dtVungDh = (new VungDieuHanh()).VDHById(xeonline.VungID); if (dtVungDh != null && dtVungDh.Rows.Count > 0) { vdh = dtVungDh.Rows[0]["NameVungDH"].ToString(); DiemDoGPS = int.Parse(dtVungDh.Rows[0]["Id"].ToString()); } else { vdh = "Không xác định"; DiemDoGPS = 0; } DateTime hientai = CommonBL.GetTimeServer(); DataTable dtCheckAnCa = lienlac.CheckAnCa(SoHieuXe); if (dtCheckAnCa.Rows.Count > 0) { switch (int.Parse(dtCheckAnCa.Rows[0]["TrangThaiLaiXeBao"].ToString())) { case 6: TrangThaiLaiXe = "ăn ca"; break; case 7: TrangThaiLaiXe = "rời xe"; break; case 11: TrangThaiLaiXe = "mất liên lạc"; break; } ThoiDiemCB = DateTime.Parse(dtCheckAnCa.Rows[0]["ThoiDiemBao"].ToString()); var tongtime = (hientai - ThoiDiemCB); var SoPhut = 0; var strSoPhutBao = ""; int.TryParse(dtCheckAnCa.Rows[0]["SoPhutNghi"].ToString(), out SoPhut); if (SoPhut > 0) { strSoPhutBao = " " + SoPhut + " phút"; } if (TrangThaiLaiXe != "") { TrangThaiLaiXe = ((dt.Rows.Count == 1 && dt.Rows[0]["IsHoatDong"].ToString().Contains("1")) ? "" : "Báo " + TrangThaiLaiXe + strSoPhutBao + "\r\nThời điểm: " + ThoiDiemCB.ToString("HH:mm dd/MM/yyyy")); //txtCanhBao.Visible = true; txtCanhBao.Text = TrangThaiLaiXe + (TrangThaiLaiXe == "" ? "" : "\r\nTổng thời gian: " + tongtime.Hours + " giờ " + tongtime.Minutes + " phút"); } } //txtAddress.BackColor = Color.FromArgb(250, 246, 237); txtInfoHeader.ForeColor = Color.Red; txtInfoHeader.TextAlign = HorizontalAlignment.Center; txtInfoHeader.Font = new Font(txtInfoHeader.Font, FontStyle.Bold); txtInfoHeader.Height = 26; txtInfoHeader.Width = 437; txtInfoHeader.Text = " Hiện trạng xe: " + SoHieuXe + "-" + BienSoXe; txtInfoHeader.ReadOnly = true; txtVitri.Text = "Vị trí: " + address; txtInfoXe.Text = "Loại xe: \t\t" + loaixe + socho + " chỗ" + "\r\nNgày/giờ: \t" + xeonline.TGGPS.ToString("HH:mm dd/MM/yyyy"); //if (!string.IsNullOrEmpty(TenLaiXe)) //{ // txtInfoXe.Text += "\r\n" + TenLaiXe; //} //if (!string.IsNullOrEmpty(Phone)) //{ // txtInfoXe.Text += "\r\n" + Phone; //} string strInfoXe = "Loại xe: \t\t" + loaixe + socho + " chỗ" + "\r\nNgày/giờ: \t" + xeonline.TGGPS.ToString("HH:mm dd/MM/yyyy"); if (TenLaiXe != null && TenLaiXe != "") { strInfoXe += "\r\n" + TenLaiXe; } if (Phone != null && Phone != "") { strInfoXe += "\r\n" + Phone; } strInfoXe += "\r\nVận tốc GPS/Cơ: \t" + xeonline.VGPS + "/" + xeonline.VCo + " Km/h"; if (gara != "") { strInfoXe += gara; } if (DieuHoa != "") { strInfoXe += "\r\nĐiều hòa: \t" + DieuHoa; } if (DungXeNoMay != "") { strInfoXe += DungXeNoMay; } if (may != "") { strInfoXe += "\r\nMáy: \t\t" + may; } if (TrangThaiXe != "") { strInfoXe += "\r\nTrạng thái xe: \t" + TrangThaiXe; } if (vdh != "") { strInfoXe += "\r\nĐiểm đỗ:\t\t" + vdh; } if (DaDung != "") { strInfoXe += DaDung; } txtInfoXe.Text = strInfoXe; #endregion #region Doanh thu xe string strDoanhThuXe = ""; var info = System.Globalization.CultureInfo.GetCultureInfo("vi-VN"); var objTongCuoc = new Taxi.Services.WCFServices.TongCuoc_Ca(); if (Global.HasGPS) { objTongCuoc = WCFService_Common.GetTongCuoc(BienSoXe, false); } if (objTongCuoc != null) { double kmCoKhach = objTongCuoc.kmCoKhachField; double kmRong = objTongCuoc.kmRongField; string strKmCoKhach_Rong = ""; if (xeonline.KmWithPassenger > 0) { kmCoKhach = kmCoKhach - xeonline.KmWithPassenger; xeonline.WaitingTime = xeonline.WaitingTime > 0 ? xeonline.WaitingTime : 0; } kmRong = kmRong + xeonline.EmptyKm; strKmCoKhach_Rong = String.Format("{0} km/{1} km", kmCoKhach, kmRong); strDoanhThuXe = String.Format("Tổng cuốc:\t{0}", objTongCuoc.tongCuocKhachField); if (kmCoKhach > 0) { strDoanhThuXe += String.Format("\r\nKm CK/Rỗng:\t{0}", strKmCoKhach_Rong); } strDoanhThuXe += String.Format(info, "\r\nTổng doanh thu:\t{0:c0}", objTongCuoc.tongTienField); } if ((xeonline.Trangthai & 3) > 0) { strDoanhThuXe += String.Format(info, "\r\nTiền cuốc ht:\t{0:c0}", xeonline.Money); strDoanhThuXe += String.Format("\r\nThời gian chờ:\t{0} phút", xeonline.FreeWatingTime); strDoanhThuXe += String.Format("\r\nKm cuốc đang chạy: {0} km", xeonline.KmWithPassenger); } txtDoanhThu.Text = strDoanhThuXe; #endregion #region Thông tin cuốc hàng var cuochang = ""; if (Global.TaxiOperation_Module == TaxiOperation_Module.DieuXeTai || Global.TaxiOperation_Module == TaxiOperation_Module.Luong) { var db = new TaxiOperation_Truck().GetTruckBySoXe(SoHieuXe.Trim()); if (db != null) { cuochang += string.Format("ĐC đón: {0}", db.DiaChiDon); cuochang += string.Format("\r\nĐiện thoại:{0}", db.SoDT); cuochang += string.Format("\r\nTG Điều: {0:HH:mm dd/MM}", db.TGDieuXe); if (db.TGGap != null) { cuochang += string.Format("\r\nTG Gặp KH: {0:HH:mm dd/MM}", db.TGGap); } if (!String.IsNullOrEmpty(db.DiaChiTra)) { cuochang += string.Format("\r\nĐC Trả: {0}", db.DiaChiTra); } } txtCuocHang.Text = cuochang; txtCuocHang.ForeColor = Color.Black; txtCuocHang.Font = new Font(txtCuocHang.Font.FontFamily, txtCuocHang.Font.Size, FontStyle.Bold); } #endregion pnMarker.Controls.Add(txtInfoHeader); pnMarker.BackColor = Color.White; #endregion -------------------End------------------------------- }
private KeyValuePair <double, string> AddRoute_ByService_Company(PointLatLng start, PointLatLng end, Color color) { try { float fromLat, fromLng, toLat, toLng = 0; float.TryParse(start.Lat.ToString(), out fromLat); float.TryParse(start.Lng.ToString(), out fromLng); float.TryParse(end.Lat.ToString(), out toLat); float.TryParse(end.Lng.ToString(), out toLng); Taxi.Services.WCFServiceGEO.PriceResponse itemReturn = Service_Common.GetPrice(fromLat, fromLng, toLat, toLng, Config_Common.DTV_ROUTE_SERVICE, G_CarType); if (itemReturn != null && itemReturn.Price > 0) { if (color.Name == lbl_KM1.ForeColor.Name) { if (MainMap.Overlays[1].Markers != null && MainMap.Overlays[1].Markers.Count > 0) { MainMap.Overlays[1].Markers.Clear(); } } else if (color.Name == lbl_KM2.ForeColor.Name) { if (MainMap.Overlays[2].Markers != null && MainMap.Overlays[2].Markers.Count > 0) { MainMap.Overlays[2].Markers.Clear(); } } else if (color.Name == lbl_KM3.ForeColor.Name) { if (MainMap.Overlays[3].Markers != null && MainMap.Overlays[3].Markers.Count > 0) { MainMap.Overlays[3].Markers.Clear(); } } var lstCoordinate = MapHelper.PolylineAlgorithmDecode(itemReturn.Polyline); PointLatLng itemStart = new PointLatLng(); PointLatLng itemEnd = new PointLatLng(); Pen pen = new Pen(color, 3); for (int i = 1; i < lstCoordinate.Count(); i++) { Coordinate itemCoor1 = lstCoordinate.ElementAt(i - 1); Coordinate itemCoor2 = lstCoordinate.ElementAt(i); itemStart = new PointLatLng(itemCoor1.Latitude, itemCoor1.Longitude); itemEnd = new PointLatLng(itemCoor2.Latitude, itemCoor2.Longitude); GMapMarkerLine auxLine = new GMapMarkerLine(itemStart, itemEnd, pen); if (color.Name == lbl_KM1.ForeColor.Name) { MainMap.Overlays[1].Markers.Add(auxLine); } else if (color.Name == lbl_KM2.ForeColor.Name) { MainMap.Overlays[2].Markers.Add(auxLine); } else if (color.Name == lbl_KM3.ForeColor.Name) { MainMap.Overlays[3].Markers.Add(auxLine); } } } return(new KeyValuePair <double, string>(Math.Round((double)itemReturn.Distance / 1000, 1), color.Name)); } catch (Exception) { return(new KeyValuePair <double, string>(0, "")); } }
private void txtXe_Leave(object sender, EventArgs e) { if (txtXe.IsForceChangeText && txtXe.Text != "") { try { lblMsg.Text = string.Empty; lblBienSoXe.Text = ""; Xe objXe = new Xe().GetChiTietXe(txtXe.Text); if (objXe != null) { txtDienThoai.EditValue = objXe.DienThoai; txtTenLaiXe.EditValue = objXe.TenNhanVien; this.loaiXe = objXe.LoaiXeID; lblBienSoXe.Text = objXe.BienKiemSoat; } var xe = WCFService_Common.GetXeOnlineBySHX(txtXe.Text); if (xe != null) { // lblBienSoXe.Text = xe.BienSoXe; float lat = (float)xe.ViDo; float lng = (float)xe.KinhDo; auDiaChiDon.Text = string.Empty; if (lng > 0) { string address = Service_Common.GetAddressByGeoBA(lat, lng).RemoveRoutePr(); if (!string.IsNullOrEmpty(address) && address.Trim() != "*") { auDiaChiDon.Text = address; auDiaChiDon.ReSearch(); auDiaChiDon.TempLat = lat; auDiaChiDon.TempLng = lng; } } xe_lat = lat; xe_lng = lng; Model.BienSoXe = xe.BienSoXe; } auDiaChiDon_EventSelectAutoComplete(null); if (txtDienThoai.EditValue == null || txtDienThoai.Text == string.Empty) { txtDienThoai.Focus(); } else if (string.IsNullOrEmpty(auDiaChiDon.Text)) { auDiaChiDon.Focus(); } else { auDiaChiTra.Focus(); } if (XeDiDuongDai.Inst.CheckXeChuaKetThucDuongDai(txtXe.EditValue.To <string>().Trim())) { ShowError(string.Format("Xe {0} chưa kết thúc cuốc đường dài", txtXe.EditValue.To <string>().Trim())); } } catch (Exception ex) { LogError.WriteLogError("txtXe_Leave: ", ex); } } }
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); } }
public void RouteThread() { IsProcess = true; new Thread(p => { if (IsProcess) { var frm = new DevExpress.Utils.WaitDialogForm("Vui lòng chờ giây lát.", "Hệ thống đang Xử lý...."); while (IsProcess) { frm.Refresh(); Thread.Sleep(100); } frm.Close(); } }).Start(); try { string khoangcach; string thoigian; string addressA = string.Empty; string addressB = string.Empty; string address = string.Empty; MapRoute route = null; InsertDataControl(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, null); // if (_gMapMarkerA == null || _gMapMarkerB == null) { if (_gMapMarkerA != null) { addressA = Service_Common.GetAddressByGeoBA((float)_gMapMarkerA.Position.Lat, (float)_gMapMarkerA.Position.Lng).RemoveRoutePr(); } if (_gMapMarkerB != null) { addressB = Service_Common.GetAddressByGeoBA((float)_gMapMarkerB.Position.Lat, (float)_gMapMarkerB.Position.Lng).RemoveRoutePr(); } } // else { if (!(LoTrinh.Distance > 0 && !processFisrt)) { this.LoTrinh = Taxi.Controls.FastTaxis.TaxiChieuVe.TaxiReturn_Process.LayLoTrinh(_gMapMarkerA.Position, _gMapMarkerB.Position); } processFisrt = true; if (!string.IsNullOrEmpty(LoTrinh.LoTrinh_DiaChi)) { this.Distance = (int)LoTrinh.Distance; khoangcach = (this.Distance).ToString("#,##0.##") + " km"; TinhTienTheoKm objTinhTien = new TinhTienTheoKm(this.LoaiXeId, Distance); TienDuKien = objTinhTien.TongTien1Chieu; time = (float)((float)this.Distance / 40); if (time < 1) { thoigian = ((int)(time * 60)).ToString() + " phút"; } else { thoigian = ((int)time).ToString() + " giờ " + ((int)(((time - ((int)time))) * 60)).ToString() + " phút"; } address = this.LoTrinh.LoTrinh_DiaChi.Replace("=>", "<br/>=>"); route = new MapRoute(this.LoTrinh.ListPoint, "Lộ trình"); } else { khoangcach = "-1"; thoigian = "Không tồn tại đường"; } } InsertDataControl(khoangcach, thoigian, addressA, addressB, address, route); } catch (Exception ex) { new Log().WriteLog(ThongTinDangNhap.USER_ID, "frmUpdateTrip_Map\\RouteThread", DateTime.Now, string.Format("Số lần {0}:{1}", countRouteThread, ex.Message)); if (countRouteThread < 5) { countRouteThread++; RouteThread(); } else { countRouteThread = 0; } } countRouteThread = 0; IsProcess = false; }
private void btnEnd_Click(object sender, EventArgs e) { string strAddress = txtEnd.Text.Trim(); if (!string.IsNullOrEmpty(strAddress) && txtStop2.KinhDo <= 0 && txtStop2.ViDo <= 0) { var ad = Service_Common.GetGeobyAddressV2_Full(strAddress); if (ad.Trim().Equals("*") || ad.Trim().Equals("")) { lblMsg.Text = "Không tìm thấy điểm dừng cuối"; txtEnd.Focus(); return; } var cut = ad.Split(' '); if (_markerEnd != null) { _markerEnd.Position = new PointLatLng(double.Parse(cut[0]), double.Parse(cut[1])); MainMap.Position = _markerEnd.Position; _markerEnd.ToolTipText = "Điểm dừng cuối:" + strAddress; } else { MainMap.IsPosition = true; MainMap.AddMarkerDOne(double.Parse(cut[0]), double.Parse(cut[1]), "Điểm dừng cuối:" + strAddress); _markerEnd = MainMap.MarkerCustomer; MainMap.IsPosition = false; } } else { double kinhdo, vido = 0; var address = ""; var position = MainMap.Position;//.FromLocalToLatLng(MainMap.Width / 2, MainMap.Height / 2); if (txtEnd.KinhDo > 0 && txtEnd.ViDo > 0) { kinhdo = txtEnd.KinhDo; vido = txtEnd.ViDo; position = new PointLatLng(vido, kinhdo); address = strAddress; } else { kinhdo = position.Lng; vido = position.Lat; address = Service_Common.GetAddressByGeoBA((float)vido, (float)kinhdo); } _flgmarkerB = true; if (_markerEnd != null) { _markerEnd.Position = position; _markerEnd.ToolTipText = "Điểm dừng cuối:" + address; MainMap.Position = _markerEnd.Position; } else { MainMap.IsPosition = true; MainMap.AddMarkerDOne(vido, kinhdo, "Điểm dừng cuối:" + address); _markerEnd = MainMap.MarkerCustomer; MainMap.IsPosition = false; } txtEnd.Text = address; } Route(); }
public string GetAddressByGeo(double lat, double lng) { var address = Service_Common.GetAddressByGeoBA((float)lat, (float)lng); return(address); }
private void FormMainRibbon_Load(object sender, EventArgs e) { if (DieuHanhTaxi.CheckConnection()) { // Lưu ý:Làm hàm Load tối giản lại càng tốt RealTimeEnvironment.IniRealTime(); PingApp = new BackgroundWorker(); PingApp.DoWork += PingApp_DoWork; using (var PingWcf = new BackgroundWorker()) { PingWcf.DoWork += (sender1, e1) => Service_Common.PingWcf(); PingWcf.RunWorkerAsync(); } if (Config_Common.DienThoai_KhungDiaChi == KhungDiaChi.Duoi) { PanelThongTinDiaChi.Dock = DockStyle.Bottom; } else { PanelThongTinDiaChi.Dock = DockStyle.Top; } if (Config_Common.GridConfig != 1) { btnAnHien.PerformClick(); btnAnHien.Visible = false; } #region ==== GridControl ==== // RealTimeEnvironment.LineVung = "124;179"; // Lấy cấu hình. #region === Ini Data === grvChoGiaiQuyet.FuncGetTimerServer = () => RealTimeEnvironment.TimeServer; grvChoGiaiQuyet.FuncGetAll = CuocGoi.G5_DIENTHOAI_LayAllCuocGoi; grvChoGiaiQuyet.FuncGetNew = CuocGoi.G5_DIENTHOAI_LayDSCuocGoiMoi_FT; grvChoGiaiQuyet.FuncGetUpdate = CuocGoi.G5_DIENTHOAI_LayDSCuocGoiThayDoiByTongDai; grvChoGiaiQuyet.FuncGetDelete = (Line, LsKeys) => CuocGoi.G5_DIENTHOAI_LayCacIDCuocGoiKetThucByTongDai(LsKeys, Line); grvChoGiaiQuyet.ActionPopUp += grvChoGiaiQuyet_ActionPopUp; grvChoGiaiQuyet.EventActionStep += grvChoGiaiQuyet_EventActionStep; grvCuocKhachLineKhac.FuncGetTimerServer = () => RealTimeEnvironment.TimeServer; grvCuocKhachLineKhac.FuncGetAll = CuocGoi.DIENTHOAI_LayAllCuocGoi_Khac; grvCuocKhachLineKhac.FuncGetNew = CuocGoi.DIENTHOAI_LayDSCuocGoiMoi_V3_Khac; grvCuocKhachLineKhac.FuncGetUpdate = CuocGoi.DIENTHOAI_LayDSCuocGoiThayDoiByTongDai_V3_Khac; grvCuocKhachLineKhac.FuncGetDelete = (Line, LsKeys) => CuocGoi.DIENTHOAI_LayCacIDCuocGoiKetThuc_Khac(LsKeys, Line); #endregion grvCuocKhachLineKhac.LoadAll(); grvChoGiaiQuyet.LoadAll(); grvChoGiaiQuyet.StartRealTime(); #endregion #region === Form Input === formInput = new frmDienThoaiInputDataNew_V3(RealTimeEnvironment.ListDataAutoComplete, false, RealTimeEnvironment.DMVung_GPS); formInput.OKCloseFormEvent += SaveData_Click; formInput.HienThiCuocMoiEvent += g_frmInput_HienThiCuocMoiEvent; formInput.GetTimeServerEvent += g_frmInput_GetTimeServerEvent; formInput.EventCallOut += g_frmInput_EventCallOut; #endregion IsShowCommandHelp = GetHelpCommand(); panelTopHelp.Visible = IsShowCommandHelp; if (!CheckIn()) { Application.Exit(); } } else { MessageBox.Show(this, "Có lỗi kết nối máy chủ, cần liên lạc với quản trị.", "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
private void setMarkerDSXeDonKhachDeCu(string DSXeDonKhach, string DSXeDonKhach_TD) { try { if (DSXeDonKhach == "") { return; } //int trangThai = 0; string[] arrDSXeDonKhach = DSXeDonKhach.Split(','); string[] arrDSXeDonKhach_TD = DSXeDonKhach_TD.Split(','); string[] Values; double KinhDo = 0; double ViDo = 0; for (int i = 0; i < arrDSXeDonKhach.Length; i++) { //"SHXe_KhoangCach_KD_VD_TrangThai_TGDon" Values = arrDSXeDonKhach_TD[i].Split('_'); if (Values.Length > 0) { if (!String.IsNullOrEmpty(Values[3])) { // trangThai = (Convert.ToInt16(Values[4]) & 8) == 0 ? 1 : 0;//---0 : xe tắt máy; 1 : xe bật máy. //} ViDo = Convert.ToDouble(Values[3]); KinhDo = Convert.ToDouble(Values[2]); MainMap.addMarkerXeNhan(2, KinhDo, ViDo, string.Format("{0}-{1}", arrDSXeDonKhach[i], Service_Common.GetAddressByGeoBA((float)ViDo, (float)KinhDo))); G_LstXeDonDeCu.Add(new XeDonDeCuEntity( Values[0], KinhDo, ViDo, DateTime.Parse(Values[5]) )); } } } } catch (Exception ex) { } }
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 txtXeDon_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { try { T_XeOnline_TT xeOnline = WCFService_Common.GetXeDonKhach(txtXeDon.Text.Trim()); if (xeOnline != null) { if (xeOnline.TDDonKhach > DateTime.MinValue) { float KD = xeOnline.KinhDoDonKhach; float VD = xeOnline.ViDoDonKhach; string strDiaChi = string.Format("[{0}] đón khách : {1}", xeOnline.TDDonKhach.ToString("HH:mm:ss"), Service_Common.GetAddressByGeoBA(VD, KD)); if (xeOnline.TDTraKhach > DateTime.MinValue) { //Xe đã trả khách MainMap.addMarkerXeDeCu3(1, KD, VD, strDiaChi); } else { MainMap.addMarkerXeDeCu3(2, KD, VD, strDiaChi); } MainMap.Position = new PointLatLng(VD, KD); } else { new MessageBox.MessageBoxBA().Show(string.Format("Xe không khách"), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Information); } } else { new MessageBox.MessageBoxBA().Show(string.Format("Ko tìm thấy xe"), "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Information); } } catch (Exception) { new MessageBox.MessageBoxBA().Show("Lỗi tìm xe", "Thông Báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Information); } } }