Exemple #1
0
        public VehicleOnline Search_Xe()
        {
            if (DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return(null);
            }

            VehicleOnline xe   = new VehicleOnline();
            string        soXe = txtTimXe.Text.Trim();

            if (CommonData.G_Dict_VehicleOnline.ContainsKey(soXe))
            {
                VehicleOnline item = CommonData.G_Dict_VehicleOnline[soXe];
                xe.SoHieuXe  = item.SoHieuXe;
                xe.MaXN      = item.MaXN;
                xe.BienSoXe  = item.BienSoXe;
                xe.KinhDo    = item.KinhDo;
                xe.ViDo      = item.ViDo;
                xe.Huong     = item.Huong;
                xe.SoChoNgoi = item.SoChoNgoi;
                xe.LoaiXeGPS = item.LoaiXeGPS;
                xe.LoaiXe    = item.LoaiXe;
                xe.TGCapNhat = item.TGCapNhat;
                xe.Gara      = item.Gara;
                xe.Trangthai = item.Trangthai;
                xe.VGPS      = item.VGPS;
                xe.VCo       = item.VCo;
                p            = new PointLatLng(item.ViDo, item.KinhDo);
                return(xe);
            }
            return(xe);
        }
Exemple #2
0
        private void Load_Data()
        {
            try
            {
                if (DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime)
                {
                    return;
                }
                isLoadSuccess = false;
                overlays.Markers.Clear();

                if (CommonData.G_Dict_VehicleOnline == null)
                {
                    CommonData.G_Dict_VehicleOnline = new Dictionary <string, VehicleOnline>();
                }

                foreach (var obj in CommonData.G_Dict_VehicleOnline)
                {
                    VehicleOnline item = obj.Value;
                    if (item.SoChoNgoi <= 4)
                    {
                        socho = 4;
                    }
                    else
                    {
                        socho = 7;
                    }

                    //add marker to map
                    var marker = new GMapMarkerVehice(new PointLatLng(item.ViDo, item.KinhDo), MDir[item.Huong], socho, item.Trangthai, item.TrangThaiKhac);
                    marker.ToolTipText         = item.SoHieuXe;
                    marker.ToolTip.Font        = new Font("Arial", 9, FontStyle.Bold);
                    marker.ToolTip.Stroke      = new Pen(Color.Empty, 0);
                    marker.ToolTip.TextPadding = new Size(5, 5);
                    marker.ToolTipMode         = MarkerTooltipMode.Always;
                    marker.ToolTip.Offset      = new Point(-15, -17);
                    try
                    {
                        overlays.Markers.Add(marker);
                    }
                    catch (Exception ex)
                    {
                        LogError.WriteLogError("BanDo_Online Load_Data", ex);
                    }
                }
                isLoadSuccess = true;
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("BanDo_Online Load_Data:", ex);
                isLoadSuccess = true;
            }
        }
        /// <summary>
        /// Thông tin xe ở bên bàn cờ
        /// </summary>
        /// <param name="SoHieuXe"></param>
        /// <returns></returns>
        public VehicleOnline ThongTinXe(string SoHieuXe)
        {
            ResetThongTinXe();
            if (!DesignMode && LicenseManager.UsageMode != LicenseUsageMode.Designtime)
            {
                //txtDiemDo.Text = "";
                if (SoHieuXe.IndexOf(".") >= 0)
                {
                    SoHieuXe = SoHieuXe.Split('.')[0];
                }

                //this.listXe = Maps.GMaps.lDsXe;
                var xeonline = new VehicleOnline();
                #region --Lap tim thong tin xe xe---
                if (CommonData.G_Dict_VehicleOnline != null && CommonData.G_Dict_VehicleOnline.Count > 0)
                {
                    if (CommonData.G_Dict_Vehicle.ContainsKey(SoHieuXe))
                    {
                        SoHieuXe = CommonData.G_Dict_Vehicle[SoHieuXe];
                    }
                    if (CommonData.G_Dict_VehicleOnline.ContainsKey(SoHieuXe))
                    {
                        VehicleOnline item = CommonData.G_Dict_VehicleOnline[SoHieuXe];
                        xeonline.BienSoXe                = item.BienSoXe;
                        xeonline.SoHieuXe                = item.SoHieuXe;
                        xeonline.ViDo                    = item.ViDo;
                        xeonline.KinhDo                  = item.KinhDo;
                        xeonline.LoaiXe                  = item.LoaiXe;
                        xeonline.TGCapNhat               = item.TGCapNhat;
                        xeonline.Gara                    = item.Gara;
                        xeonline.Trangthai               = item.Trangthai;
                        xeonline.VGPS                    = item.VGPS;
                        xeonline.VCo                     = item.VCo;
                        xeonline.TGGPS                   = item.TGGPS;
                        xeonline.VungID                  = item.VungID;
                        xeonline.ThoidiemChenDL          = item.ThoidiemChenDL;
                        xeonline.ThoiDiemDiChuyenGanNhat = item.ThoiDiemDiChuyenGanNhat;
                        xeonline.TrangThaiKhac           = item.TrangThaiKhac;
                    }
                    ShowHienTrangXe(xeonline, xeonline.SoHieuXe);
                }
                else
                {
                    ShowHienTrangXe(xeonline, SoHieuXe);
                }
                #endregion -------------End-----------------------

                return(xeonline);
            }
            return(null);
        }
Exemple #4
0
        public void TimXe(string f_SoHieuXe)
        {
            if (!Global.HasGPS)
            {
                return;
            }

            txtTimXe.Text = f_SoHieuXe;


            hienTrangXe1.Visible   = false;
            pnSearchDiaChi.Visible = false;

            VehicleOnline info = Search_Xe();

            if (info.SoHieuXe != null)
            {
                this.SoHieuXe = info.SoHieuXe;

                TXe.BienSoXe  = info.BienSoXe;
                TXe.SoHieuXe  = info.SoHieuXe;
                TXe.ViDo      = info.ViDo;
                TXe.KinhDo    = info.KinhDo;
                TXe.LoaiXe    = info.LoaiXe;
                TXe.TGCapNhat = info.TGCapNhat;
                TXe.Gara      = info.Gara;
                TXe.TrangThai = info.Trangthai;
                TXe.VGPS      = info.VGPS;
                TXe.VCo       = info.VCo;

                //set location map
                gmap.Position = new PointLatLng(p.Lat, p.Lng);
                gmap.Zoom     = 17;

                //dung control HienTrangXe
                hienTrangXe1.Refresh();
                hienTrangXe1.ThongTinXe(TXe, f_SoHieuXe);
                hienTrangXe1.Location = new Point(813, 160);
                hienTrangXe1.Visible  = true;
            }
            else
            {
                new MessageBox.MessageBoxBA().Show("Không tìm thấy xe!", "Thông báo");
            }
        }
        public VehicleOnline ThongTinXe(Taxi.Services.WCFServices.T_XeOnline objVehicleOnline, string soHieuXe)
        {
            ResetThongTinXe();
            if (!DesignMode && LicenseManager.UsageMode != LicenseUsageMode.Designtime)
            {
                //txtCanhBao.Visible = false;
                txtCanhBao.Text = "";
                //txtThoiDiemKD.Visible = false;
                txtThoiDiemKD.Text = "";
                //txtDiemDo.Text = "";
                var xeonline = new VehicleOnline
                {
                    BienSoXe                = objVehicleOnline.BienSoXe,
                    SoHieuXe                = objVehicleOnline.SoHieuXe,
                    ViDo                    = objVehicleOnline.ViDo,
                    KinhDo                  = objVehicleOnline.KinhDo,
                    LoaiXe                  = objVehicleOnline.LoaiXe,
                    TGCapNhat               = objVehicleOnline.TGCapNhat,
                    ThoidiemChenDL          = objVehicleOnline.ThoiDiemChenDuLieu,
                    ThoiDiemDiChuyenGanNhat = objVehicleOnline.TGDiChuyenGanNhat,
                    Gara                    = objVehicleOnline.Gara,
                    Trangthai               = objVehicleOnline.TrangThai,
                    VGPS                    = objVehicleOnline.VGPS,
                    TGGPS                   = objVehicleOnline.TGGPS,
                    VCo             = objVehicleOnline.VCo,
                    VungID          = objVehicleOnline.VungID,
                    TongCuoc        = objVehicleOnline.TongCuoc,
                    TongDoanhThu    = objVehicleOnline.TongDoanhThu,
                    KmCoKhach       = objVehicleOnline.KmCoKhach,
                    KmRong          = objVehicleOnline.KmRong,
                    Money           = objVehicleOnline.Money,
                    FreeWatingTime  = objVehicleOnline.FreeWatingTime,
                    WaitingTime     = objVehicleOnline.WaitingTime,
                    EmptyKm         = objVehicleOnline.EmptyKm,
                    KmWithPassenger = objVehicleOnline.KmWithPassenger
                };

                ShowHienTrangXe(xeonline, xeonline.SoHieuXe);
                return(xeonline);
            }
            return(null);
        }
Exemple #6
0
        //Tim xe
        private void txtTimXe_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    if (!Global.HasGPS)
                    {
                        return;
                    }
                    hienTrangXe1.Visible   = false;
                    pnSearchDiaChi.Visible = false;

                    VehicleOnline info = Search_Xe();
                    if (info.SoHieuXe != null)
                    {
                        SoHieuXe = info.SoHieuXe;
                        //set location map
                        gmap.Position = new PointLatLng(p.Lat, p.Lng);
                        gmap.Zoom     = 17;

                        //dung control HienTrangXe
                        hienTrangXe1.Refresh();
                        hienTrangXe1.ThongTinXe(info.SoHieuXe);
                        hienTrangXe1.Location = new Point(813, 160);
                        hienTrangXe1.Visible  = true;
                    }
                    else
                    {
                        new MessageBox.MessageBoxBA().Show("Không tìm thấy xe!", "Thông báo");
                    }
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("txtTimXe_KeyDown: ", 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-------------------------------
        }
Exemple #8
0
        public void UpdateListXeOnline(T_XeOnline[] sThongTinXe)
        {
            try
            {
                if (DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime)
                {
                    return;
                }
                if (!ThongTinCauHinh.GPS_TrangThai || !Global.HasGPS)
                {
                    return;
                }

                for (int i = 0; i < sThongTinXe.Length; i++)
                {
                    VehicleOnline xe = new VehicleOnline();
                    xe.SoHieuXe                = sThongTinXe[i].SoHieuXe;
                    xe.MaXN                    = sThongTinXe[i].MaCungXN;
                    xe.BienSoXe                = sThongTinXe[i].BienSoXe;
                    xe.KinhDo                  = sThongTinXe[i].KinhDo;
                    xe.ViDo                    = sThongTinXe[i].ViDo;
                    xe.Huong                   = sThongTinXe[i].HuongDiChuyen;
                    xe.SoChoNgoi               = sThongTinXe[i].SoCho;
                    xe.LoaiXeGPS               = sThongTinXe[i].LoaiXeGPS;
                    xe.LoaiXe                  = sThongTinXe[i].LoaiXe;
                    xe.TGCapNhat               = sThongTinXe[i].TGCapNhat;
                    xe.Gara                    = sThongTinXe[i].Gara;
                    xe.Trangthai               = sThongTinXe[i].TrangThai;
                    xe.TGDungXeNoMay           = sThongTinXe[i].TGDungXeNoMay;
                    xe.VCo                     = sThongTinXe[i].VCo;
                    xe.VGPS                    = sThongTinXe[i].VGPS;
                    xe.ThoidiemChenDL          = sThongTinXe[i].ThoiDiemChenDuLieu;
                    xe.ThoiDiemDiChuyenGanNhat = sThongTinXe[i].TGDiChuyenGanNhat;
                    xe.TGGPS                   = sThongTinXe[i].TGGPS;
                    xe.TrangThaiKhac           = sThongTinXe[i].TrangThaiKhac;
                    xe.TrangThaiKhacText       = sThongTinXe[i].TrangThaiKhacText;
                    xe.VungID                  = sThongTinXe[i].VungID;
                    if (CommonData.G_Dict_Vehicle == null)
                    {
                        CommonData.G_Dict_Vehicle = new Dictionary <string, string>();
                    }
                    if (CommonData.G_Dict_Vehicle.ContainsKey(sThongTinXe[i].BienSoXe))
                    {
                        CommonData.G_Dict_Vehicle[sThongTinXe[i].BienSoXe] = sThongTinXe[i].SoHieuXe;
                    }
                    else
                    {
                        CommonData.G_Dict_Vehicle.Add(sThongTinXe[i].BienSoXe, sThongTinXe[i].SoHieuXe);
                    }

                    if (CommonData.G_Dict_VehicleOnline == null)
                    {
                        CommonData.G_Dict_VehicleOnline = new Dictionary <string, VehicleOnline>();
                    }
                    if (CommonData.G_Dict_VehicleOnline.ContainsKey(sThongTinXe[i].SoHieuXe))
                    {
                        CommonData.G_Dict_VehicleOnline[sThongTinXe[i].SoHieuXe] = xe;
                    }
                    else
                    {
                        CommonData.G_Dict_VehicleOnline.Add(sThongTinXe[i].SoHieuXe, xe);
                    }
                }
            }
            catch (Exception ex)
            {
                new MessageBox.MessageBoxBA().Show("Không thể kết nối tới Service", "Thông báo", MessageBox.MessageBoxButtonsBA.OK, MessageBox.MessageBoxIconBA.Error);
            }
        }