private void timerCanhBao_Tick(object sender, EventArgs e)
 {
     _timeAutoDelete++;
     if (_timeAutoDelete >= 30)
     {
         if (grvCanhBaoSanBay.RowCount > 0)
         {
             List <CanhBaoCuocSanBay> lst = grvCanhBaoSanBay.DataSource as List <CanhBaoCuocSanBay>;
             if (lst != null)
             {
                 var lstObj = lst.Where(x => (CommonBL.GetTimeServer() - x.ThoiGianNhan).TotalMinutes >= 15).ToList();
                 foreach (var item in lstObj)
                 {
                     lst.Remove(item);
                 }
             }
             grcCanhBaoSanBay.RefreshDataSource();
             if (grvCanhBaoSanBay.RowCount == 0)
             {
                 this.Hide();
             }
         }
         _timeAutoDelete = 0;
     }
 }
        private void gridViewConfig_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e)
        {
            DataRow row = ((DataRowView)e.Row).Row;

            if (row != null)
            {
                if (row.RowState == DataRowState.Modified)
                {
                    string conFirm = new MessageBox.MessageBoxBA().Show("Bạn có muốn sửa thông tin cấu hình?", "Thông báo", MessageBox.MessageBoxButtonsBA.YesNo, MessageBox.MessageBoxIconBA.Question);
                    if (conFirm == "Yes")
                    {
                        _configCommon.Id          = int.Parse(row["Id"].ToString());
                        _configCommon.Name        = row["Name"].ToString();
                        _configCommon.HasValue    = row["HasValue"].ToString();
                        _configCommon.Description = row["Description"].ToString();
                        _configCommon.LastUpdate  = CommonBL.GetTimeServer();
                        _configCommon.Update();
                        gridViewConfig.RefreshData();
                    }
                }
            }
            else
            {
                gridConfig.DataSource = _configCommon.GetAll();
            }
        }
        /// <summary>
        /// Set data on the form!
        /// </summary>
        private void SetDataInput()
        {
            g_IDKhachDat = g_objKhachDat.PK_KhachDatID;
            if (g_objKhachDat.TenKhachHang == "")
            {
                txtTenKH.Text = g_objKhachDat.DiaChiDon;
            }
            else
            {
                txtTenKH.Text = g_objKhachDat.TenKhachHang;
            }
            txtDiaChi.Text    = g_objKhachDat.DiaChiDon;
            txtDienThoai.Text = g_objKhachDat.SoDienThoai;
            txtKenh.Value     = g_objKhachDat.VungKenh;
            rbLapLai.Checked  = g_objKhachDat.IsLapLai;
            rbMotLan.Checked  = !g_objKhachDat.IsLapLai;
            setNgayTrongTuan(g_objKhachDat.NgayTrongTuanLapLai);
            if (g_objKhachDat.GioDon.Year > 2000)
            {
                calGioDon.EditValue = g_objKhachDat.GioDon;
            }
            else
            {
                calGioDon.EditValue = CommonBL.GetTimeServer().Date.AddMinutes(10);
            }

            if (g_objKhachDat.ThoiDiemTiepNhan.Year > 2000)
            {
                lblTGTiepNhan.Text = string.Format("{0:HH:mm dd/MM/yyyy}", g_objKhachDat.ThoiDiemTiepNhan);
            }
            else
            {
                lblTGTiepNhan.Text = string.Format("{0:HH:mm dd/MM/yyyy}", CommonBL.GetTimeServer());
            }

            if (g_objKhachDat.ThoiDiemKetThuc.Year > 2000)
            {
                calNgayKetThuc.EditValue = g_objKhachDat.ThoiDiemKetThuc;
            }
            else
            {
                calNgayKetThuc.EditValue = CommonBL.GetTimeServer();
            }

            if (g_objKhachDat.ThoiDiemBatDau.Year > 2000)
            {
                calNgayBatDau.EditValue = g_objKhachDat.ThoiDiemBatDau;
            }
            else
            {
                calNgayBatDau.EditValue = CommonBL.GetTimeServer();
            }

            cbSoPhut.Value  = g_objKhachDat.SoPhutBaoTruoc;
            txtGhiChu.Text  = g_objKhachDat.GhiChu;
            txtSoLuong.Text = g_objKhachDat.SoLuongXe.ToString();
            txtGiaTien.Text = g_objKhachDat.SoTien.ToString();
            SetThongTinLoaiXe2(g_objKhachDat.LoaiXe);
        }
 private void Ini()
 {
     shiftNote = new GiamSatXe_ShiftNotes();
     shift.loadShift(ThongTinCauHinh.GetThongTinCa(1).Rows[0]);
     cbCa.SelectedItem = shift.GetCaNow();
     TrangThaiCa       = cbCa.EditValue.ToString();
     Time.EditValue    = CommonBL.GetTimeServer();
     user = Taxi.Business.ThongTinDangNhap.USER_ID;
 }
 public frmGiamSatXe_GhiChuTrongCa()
 {
     InitializeComponent();
     TimeServer = CommonBL.GetTimeServer();
     Ini();
     ID = -1;
     LoadData_ShiftNote();
     gridView2.IndicatorWidth = 40;
 }
Пример #6
0
 private void frmXuLyDieuXe_Load(object sender, System.EventArgs e)
 {
     SendKeys.Send("%");
     SendKeys.Send("%");
     lupTrangThai.Properties.DataSource = CommonBL.GetTrangThaiDatLichDonKhach();
     lupTrangThai.ItemIndex             = 1;
     thoigianDieu         = CommonBL.GetTimeServer();
     lblThoiGianDieu.Text = thoigianDieu.ToString("HH:mm dd/MM/yyyy");
     this.Activate();
     txtXeDon.Focus();
 }
Пример #7
0
 private void frmDieuXe_Load(object sender, EventArgs e)
 {
     reLoaiXe.DataSource    = CommonBL.GetLoaiXe();
     reLoaiXe.DisplayMember = "TenLoaiXe";
     reLoaiXe.ValueMember   = "LoaiXeID";
     _s = splitContainer1.SplitterDistance;
     LoadData();
     deNgayLichDon.EditValue = CommonBL.GetTimeServer().Date;
     deNgayXeDon.EditValue   = CommonBL.GetTimeServer().Date;
     _timeKhachHen           = CommonBL.GetTimeServer();
     _timeXeDon = CommonBL.GetTimeServer();
 }
Пример #8
0
 private void shGridControl2_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == Keys.F5)
     {
         shGridControl2.SetDataSource(_khachhenXedk);
         shGridControl2.RefreshDataSource();
         timeXeDon             = -1;
         deNgayXeDon.EditValue = CommonBL.GetTimeServer();
         txtSoxe.Text          = string.Empty;
         txtDiemDo.Text        = string.Empty;
     }
 }
Пример #9
0
 private void shGridControl1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == Keys.F5)
     {
         shGridControl1.SetDataSource(_khachhen);
         shGridControl1.RefreshDataSource();
         timeKhachHen            = -1;
         deNgayLichDon.EditValue = CommonBL.GetTimeServer();
         txtSDT.Text             = string.Empty;
         txtDiaChi.Text          = string.Empty;
         txtTenKhachHang.Text    = string.Empty;
     }
 }
Пример #10
0
        /// <summary>
        /// Get data on the form (Adding / Updating)
        /// </summary>
        /// <returns>false : không lấy được ID cuộc gọi</returns>
        private bool GetDataInsert()
        {
            try
            {
                if (g_IDCuocGoi < 0)
                {
                    lblMsg.Text      = "Vui lòng chọn cuộc gọi cần đặt xe";
                    lblMsg.ForeColor = Color.Red;
                    return(false);
                }
                g_objKhachDat.ThoiDiemTiepNhan = DieuHanhTaxi.GetTimeServer();
                g_objKhachDat.FK_CuocGoiID     = g_IDCuocGoi;
                g_objKhachDat.TenKhachHang     = txtTenKH.Text.Trim();
                g_objKhachDat.DiaChiDon        = txtDiaChi.Text.Trim();

                g_objKhachDat.SoDienThoai = txtDienThoai.Text.Trim();
                g_objKhachDat.VungKenh    = Convert.ToInt16(txtKenh.Value);
                g_objKhachDat.TenLoaiXe   = GetThongTinLoaiXeChon();
                g_objKhachDat.LoaiXe      = ipLoaiXe.EditValue.ToString();
                g_objKhachDat.SoLuongXe   = Convert.ToInt16(txtSoLuong.EditValue);
                if (rbLapLai.Checked)
                {
                    g_objKhachDat.IsLapLai            = true;
                    g_objKhachDat.ThoiDiemKetThuc     = calNgayKetThuc.DateTime;
                    g_objKhachDat.NgayTrongTuanLapLai = getNgayTrongTuan();
                }
                else
                {
                    g_objKhachDat.IsLapLai            = false;
                    g_objKhachDat.ThoiDiemKetThuc     = calNgayBatDau.DateTime.Date.AddDays(1).AddSeconds(-1);
                    g_objKhachDat.NgayTrongTuanLapLai = "";
                }
                double giatien = 0.0;
                double.TryParse(txtGiaTien.Text, out giatien);
                g_objKhachDat.SoTien         = giatien;
                g_objKhachDat.GioDon         = calGioDon.DateTime;
                g_objKhachDat.ThoiDiemBatDau = calNgayBatDau.DateTime;
                g_objKhachDat.SoPhutBaoTruoc = Convert.ToInt16(cbSoPhut.Value);
                g_objKhachDat.CreatedBy      = ThongTinDangNhap.USER_ID;
                g_objKhachDat.CreatedDate    = CommonBL.GetTimeServer();
                g_objKhachDat.UpdatedDate    = CommonBL.GetTimeServer();
                g_objKhachDat.GhiChu         = txtGhiChu.Text.Trim();
                return(true);
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("GetDataInsert: ", ex);
                return(false);
            }
        }
Пример #11
0
 private void frmBaoCaoBieuMau3_Load(object sender, EventArgs e)
 {
     try
     {
         LoadNhanVien();
         btnTimKiem.Enabled   = false;
         btnXuatExcel.Enabled = btnTimKiem.Enabled;
         calTuNgay.EditValue  = CommonBL.GetTimeServer();
         calDenNgay.EditValue = CommonBL.GetTimeServer().AddHours(12);
     }
     catch (Exception ex)
     {
         LogError.WriteLogError("frmBaoCaoBieuMau3_Load: ", ex);
     }
 }
Пример #12
0
 private void ListMessages_Load(object sender, EventArgs e)
 {
     try
     {
         calDateSearch.EditValue = CommonBL.GetTimeServer();
         if (g_IsAdmin == 0)
         {
             setValueDetail();
         }
     }
     catch (Exception ex)
     {
         LogError.WriteLogError("ListMessages_Load: ", ex);
     }
 }
 /// <summary>
 /// Khởi tạo dữ liệu cấu hình và timer để xử lý RealTime
 /// </summary>
 public static void IniRealTime()
 {
     try
     {
         Timer_RealTime.Tick    += Timer_RealTime_Tick;
         Timer_RealTime.Interval = 1000;
         TimeServer              = CommonBL.GetTimeServer();
         bw_LoadInitData.DoWork += bw_LoadInitData_DoWork;
         bw_LoadInitData.RunWorkerAsync();
     }
     catch (Exception ex)
     {
         LogError.WriteLogError("IniRealTime", ex);
     }
 }
        private void gridView_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e)
        {
            try
            {
                if (cbType.SelectedIndex < 2)
                {
                    return;
                }
                POICommon row = (POICommon)e.Row;
                if (row != null)
                {
                    double       kinhdo = double.Parse(txtKinhDo.Text.Trim());
                    double       vido   = double.Parse(txtViDo.Text.Trim());
                    DialogResult conFirm;
                    if (kinhdo != row.KinhDo || vido != row.ViDo)
                    {
                        conFirm = MessageBox.Show("Bạn có muốn thay đổi vị trí?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    }
                    else
                    {
                        conFirm = System.Windows.Forms.DialogResult.Yes;
                    }

                    if (conFirm == System.Windows.Forms.DialogResult.Yes)
                    {
                        {
                            G_POI.ID      = row.ID;
                            G_POI.NameVN  = row.NameVN;
                            G_POI.VietTat = row.VietTat;
                            G_POI.DiaChi  = row.DiaChi;

                            G_POI.KinhDo     = kinhdo;
                            G_POI.ViDo       = vido;
                            G_POI.LastUpdate = CommonBL.GetTimeServer();
                            G_POI.Update();
                            gridView.RefreshData();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("CapNhatToaDo gridView_RowUpdated", ex);
            }
        }
Пример #15
0
 private void btnLamMoi_Click(object sender, EventArgs e)
 {
     this.FindAllChildrenByType <IShInput>().ToList().ForEach(p => p.Clear());
     lblThoiGianGoi.Text = string.Empty;
     SetError("");
     if (_model != null && _model.Id > 0)
     {
         SetModel(_model);
     }
     else
     {
         SetModel(null);
         ThoiDiemGoi             = CommonBL.GetTimeServer();
         deThoiGianDon.EditValue = CommonBL.GetTimeServer();
         lblThoiGianGoi.Text     = ThoiDiemGoi.ToString("HH:mm dd/MM/yyyy");
     }
     IsChangeData = false;
 }
        /// <summary>
        /// Get data on the form (Adding / Updating)
        /// </summary>
        private void GetDataInput()
        {
            g_KhachDat.StatusRow        = 0;
            g_KhachDat.PK_KhachDatID    = g_IDKhachDat;
            g_KhachDat.FK_CuocGoiID     = g_IDCuocGoi;
            g_KhachDat.TenKhachHang     = txtTenKH.Text.Trim();
            g_KhachDat.DiaChiDon        = txtDiaChi.Text.Trim();
            g_KhachDat.ThoiDiemTiepNhan = calThoiDiemTiepNhan.DateTime;
            g_KhachDat.SoDienThoai      = txtDienThoai.Text.Trim();
            g_KhachDat.VungKenh         = Convert.ToInt16(txtKenh.Value);
            g_KhachDat.TenLoaiXe        = GetThongTinLoaiXeChon2() + " - " + txtLoaiXe.Text;
            g_KhachDat.LoaiXe           = ipLoaiXe.EditValue.ToString();
            g_KhachDat.SoLuongXe        = Convert.ToInt16(txtSoLuong.Text);
            if (rbLapLai.Checked)
            {
                g_KhachDat.IsLapLai            = true;
                g_KhachDat.ThoiDiemKetThuc     = calNgayKetThuc.DateTime.Date.AddDays(1).AddSeconds(-1);
                g_KhachDat.NgayTrongTuanLapLai = GetNgayTrongTuan();
            }
            else
            {
                g_KhachDat.IsLapLai            = false;
                g_KhachDat.ThoiDiemKetThuc     = calNgayKetThuc.DateTime.Date.AddDays(1).AddSeconds(-1);//*sign
                g_KhachDat.NgayTrongTuanLapLai = "";
            }
            g_KhachDat.GioDon         = new DateTime(calNgayBatDau.DateTime.Date.Year, calNgayBatDau.DateTime.Date.Month, calNgayBatDau.DateTime.Date.Day, calGioDon.DateTime.Hour, calGioDon.DateTime.Minute, 0);
            g_KhachDat.ThoiDiemBatDau = calNgayBatDau.DateTime.Date;
            g_KhachDat.SoPhutBaoTruoc = Convert.ToInt16(cbSoPhut.Value);
            g_KhachDat.CreatedBy      = ThongTinDangNhap.USER_ID;
            g_KhachDat.UpdatedBy      = ThongTinDangNhap.USER_ID;
            g_KhachDat.GhiChu         = txtGhiChu.Text.Trim();
            double soTien;

            double.TryParse(txtSoTien.Text.Trim(), out soTien);
            g_KhachDat.SoTien      = soTien;
            g_KhachDat.UpdatedDate = CommonBL.GetTimeServer();
            g_KhachDat.CreatedDate = CommonBL.GetTimeServer();
        }
        public void SetValue(Taxi.Business.CheckCoDuongDai.CheckCoDuongDai objCheckCo)
        {
            if (objCheckCo == null)
            {
                return;
            }
            ValidatePermission();

            lbID.Text        = objCheckCo.ID.ToString();
            txtSoHieuXe.Text = objCheckCo.SoHieuXe;
            txtNoiDi.Text    = objCheckCo.NoiDi;
            txtNoiDen.Text   = objCheckCo.NoiDen;
            txtCoDau.Text    = objCheckCo.CoDau.ToString();
            txtCoCuoi.Text   = objCheckCo.CoCuoi.ToString();

            if (objCheckCo.ThoiDiemDi == DateTime.Parse("01/01/1900 00:00:00"))
            {
                cbThoiDiemDon.EditValue = CommonBL.GetTimeServer().Date;
            }
            else
            {
                cbThoiDiemDon.EditValue = objCheckCo.ThoiDiemDi;
            }

            if (objCheckCo.ThoiDiemVe == DateTime.Parse("01/01/1900 00:00:00") || objCheckCo.ThoiDiemVe == DateTime.Parse("01/01/0001 00:00:00"))
            {
                cbThoiDiemTra.EditValue = CommonBL.GetTimeServer().Date;
            }
            else
            {
                cbThoiDiemTra.EditValue = objCheckCo.ThoiDiemVe;
            }

            cbTinh_Den.SelectedValue = objCheckCo.TinhThanhDenID;
            if (objCheckCo.ChieuDi == "Một chiều")
            {
                chkMotChieu.Checked = true;
                chkHaiChieu.Checked = false;
            }
            else
            {
                chkHaiChieu.Checked = true;
                chkMotChieu.Checked = false;
            }
            txtTongTien.Text             = objCheckCo.TongTien.ToString();
            txtGhiChu.Text               = objCheckCo.GhiChu;
            txtDienThoai.Text            = objCheckCo.SoDienThoai;
            txtTenLaiXe.Text             = objCheckCo.TenLaiXe;
            chkChiaSe.Checked            = objCheckCo.isChiaSeChuyenDi;
            cb_PhuongXaDi.SelectedValue  = objCheckCo.FK_PhuongXaDiID;
            cb_PhuongXaDen.SelectedValue = objCheckCo.FK_PhuongXaDenID;
            cbQH_Di.SelectedValue        = objCheckCo.FK_QuanHuyenDiID;
            cbQH_Den.SelectedValue       = objCheckCo.FK_QuanHuyenDenID;
            cbTinh_Di.SelectedValue      = objCheckCo.FK_TinhThanhDiID;
            if (objCheckCo.NguoiDuyet != null)
            {
                G_isDaDuyet = true;
                if (objCheckCo.TrangThaiDuyet == true)
                {
                    cbDuyet.SelectedIndex = 2;
                }
                else
                {
                    cbDuyet.SelectedIndex = 1;
                }
            }
            else
            {
                G_isDaDuyet           = false;
                cbDuyet.SelectedIndex = 0;
            }

            btnDelete.Visible = true;
        }
Пример #18
0
 private void btnExportExcel_Click(object sender, EventArgs e)
 {
     try
     {
         string FilenameDefault = string.Format("12_BaoCaoKhachQuenTheoThang-{0:yyyy-MM-dd-HH-mm}.xls", CommonBL.GetTimeServer().Date);
         saveFileDialog1.FileName = FilenameDefault;
         if (saveFileDialog1.ShowDialog() == DialogResult.OK)
         {
             FileStream objFile = new FileStream(saveFileDialog1.FileName, FileMode.OpenOrCreate);
             gridEXExporter1.Export(objFile);
             new MessageBox.MessageBoxBA().Show("Tạo file Excel thành công.", "Thông báo");
         }
     }
     catch (Exception ex)
     {
         LogError.WriteLogError("btnExportExcel_Click: ", ex);
     }
 }
Пример #19
0
        private bool IsValid()
        {
            lblMsg.Text      = "";
            lblMsg.ForeColor = Color.Red;
            if (txtTenKH.Text.Trim() == String.Empty)
            {
                lblMsg.Text = "Vui lòng nhập Tên khách hàng";
                txtTenKH.Focus();
                return(false);
            }
            if (txtDiaChi.Text.Trim() == String.Empty)
            {
                lblMsg.Text = "Vui lòng nhập Địa chỉ";
                txtDiaChi.Focus();
                return(false);
            }
            if (txtDienThoai.Text.Trim() == String.Empty)
            {
                lblMsg.Text = "Vui lòng nhập Số điện thoại";
                txtDienThoai.Focus();
                return(false);
            }
            if (txtKenh.Text.Trim() == String.Empty || Convert.ToInt16(txtKenh.Value) <= 0)
            {
                lblMsg.Text = "Vui lòng nhập Vùng/Kênh";
                txtKenh.Focus();
                return(false);
            }
            if (txtSoLuong.Text.Trim() == String.Empty || Convert.ToInt16(txtSoLuong.EditValue) <= 0)
            {
                lblMsg.Text = "Vui lòng nhập Số lượng xe";
                txtSoLuong.Focus();
                return(false);
            }
            if (rbLapLai.Checked && calNgayBatDau.DateTime > DateTime.MinValue && calNgayKetThuc.DateTime > DateTime.MinValue &&
                calNgayBatDau.DateTime.Date > calNgayKetThuc.DateTime.Date)
            {
                lblMsg.Text = "Vui lòng nhập ngày bắt đầu nhỏ hơn hoặc bằng ngày kết thúc";
                calNgayBatDau.Focus();
                return(false);
            }

            if (calNgayBatDau.DateTime.Date < CommonBL.GetTimeServer().Date&& !rbLapLai.Checked)
            {
                lblMsg.Text = "Ngày bắt đầu không được nhỏ hơn thời điểm tiếp nhận!";
                calNgayBatDau.Focus();
                return(false);
            }

            if (calGioDon.DateTime.TimeOfDay < CommonBL.GetTimeServer().TimeOfDay&& calNgayBatDau.DateTime.Date == CommonBL.GetTimeServer().Date&& !rbLapLai.Checked)
            {
                lblMsg.Text = "Giờ đón không được nhỏ hơn thời điểm tiếp nhận";
                calGioDon.Focus();
                return(false);
            }

            double giaTien;

            if (!double.TryParse(txtGiaTien.Text.Trim(), out giaTien))
            {
                lblMsg.Text = "Giá tiền không hợp lệ";
                txtGiaTien.Focus();
                return(false);
            }

            return(true);
        }
        private void btnExportExcel_Click(object sender, EventArgs e)
        {
            string FilenameDefault = "BaoCaoCuocGoiKhongNhacMay_" + string.Format("{0:yyyy-MM-dd-HH-mm}", CommonBL.GetTimeServer()) + ".xls";

            saveFileDialog1.FileName = FilenameDefault;
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                FileStream objFile = new FileStream(saveFileDialog1.FileName, FileMode.OpenOrCreate);
                gridEXExporter1.Export(objFile);
                if (new MessageBox.MessageBoxBA().Show(this, "Tạo file Excel thành công. Bạn có muốn mở file?", "Thông báo", MessageBox.MessageBoxButtonsBA.YesNoCancel, MessageBox.MessageBoxIconBA.Question) == DialogResult.Yes.ToString())
                {
                    FileTools.OpenFileExcel(saveFileDialog1.FileName);
                }
            }
        }
Пример #21
0
        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 void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (!CheckValidate())
         {
             return;
         }
         T_DOITAC.Inst.UpdateNewAddress(MaDoiTac, txtDiaChiMoi.Text, TraceID, ThongTinDangNhap.USER_ID, CommonBL.GetTimeServer());
         new MessageBox.MessageBoxBA().Show("Duyệt địa chỉ mới thành công!", "Thông báo");
         IsSuccess = true;
         this.Close();
     }
     catch
     {
         new MessageBox.MessageBoxBA().Show("Có lỗi khi lưu dữ liệu!", "Thông báo");
     }
 }
Пример #23
0
        private void XuLyDuLieu()
        {
            //if (timeKhachHen>-1)
            //    timeKhachHen--;
            //if (timeXeDon > -1)
            //    timeXeDon--;
            //Thêm dữ liệu
            var db = new DUONGDAI_KHACHHEN().GetByTime(_timeKhachHen);

            if (db.Count > 0)
            {
                _timeKhachHen = CommonBL.GetTimeServer();
                db.ForEach(p =>
                {
                    var ldb = _khachhen.Where(p1 => p1.Id == p.Id).ToList();
                    //Khi có trạng thái chưa điều thì sẽ thêm mới hoặc là thay đổi.
                    if (p.TrangThai == 1)
                    {
                        if (ldb.Count > 0) // tồn tại thì sẽ khi sửa
                        {
                            ldb.ForEach(p1 => _khachhen.Remove(p1));
                        }
                        _khachhen.Add(p);
                    }
                    else
                    {
                        ldb.ForEach(p1 => _khachhen.Remove(p1));
                    }
                });
            }
            var db1 = new DUONGDAI_KHACHHEN_XEDK().GetByTime(_timeXeDon);

            if (db1.Count > 0)
            {
                db1.ForEach(p =>
                {
                    var ldb = _khachhenXedk.Where(p1 => p1.Id == p.Id && p1.IsXeDangKy == p.IsXeDangKy).ToList();
                    if (p.TrangThai == 1)
                    {
                        if (ldb.Count > 0)
                        {
                            ldb.ForEach(p1 => _khachhenXedk.Remove(p1));
                        }
                        _khachhenXedk.Add(p);
                    }
                    else
                    {
                        ldb.ForEach(p1 => _khachhenXedk.Remove(p1));
                    }
                });
                _timeXeDon = CommonBL.GetTimeServer();
            }
            if (timeKhachHen == -1)
            {
                shGridControl1.RefreshDataSource();
            }
            if (timeKhachHen == 0)
            {
                shGridControl1.SetDataSource(_khachhen);
                shGridControl1.RefreshDataSource();
                timeKhachHen = -1;
            }
            //--
            if (timeXeDon == -1)
            {
                shGridControl2.RefreshDataSource();
            }
            if (timeXeDon == 0)
            {
                shGridControl2.SetDataSource(_khachhenXedk);
                shGridControl2.RefreshDataSource();
                timeXeDon = -1;
            }
            // Khách hẹn
        }