Beispiel #1
0
        /// <summary>
        /// Load phan len bieu mau
        /// </summary>
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            if (TimKiem_BaoCao.CheckTuNgayDenNgay(calTuNgay.Value, calDenNgay.Value))
            {
                DateTime dateGioDauCa;

                DataTable dt = ThongTinCauHinh.GetThongTinCa(1);
                try
                {
                    dateGioDauCa = Convert.ToDateTime(dt.Rows[0]["DauCa1"].ToString());
                }
                catch
                {
                    dateGioDauCa = new DateTime(1900, 1, 1, 6, 0, 0);
                }
                DateTime TuNgay  = new DateTime(calTuNgay.Value.Year, calTuNgay.Value.Month, calTuNgay.Value.Day, dateGioDauCa.Hour, 0, 0);
                DateTime DenNgay = calDenNgay.Value;
                DenNgay           = DenNgay.AddDays(1);
                DenNgay           = new DateTime(DenNgay.Year, DenNgay.Month, DenNgay.Day, dateGioDauCa.Hour - 1, 59, 59);
                lblTuNgayDen.Text = string.Format("({0:HH:mm dd/MM} - {1:HH:mm dd/MM})", TuNgay, DenNgay);
                LoadData(TuNgay, DenNgay);
            }
            else
            {
                MessageBox.MessageBoxBA msgDialog = new MessageBox.MessageBoxBA();
                msgDialog.Show(this, "Bạn phải nhập [Từ ngày] nhỏ hơn hoặc bằng [Đến ngày].", "Thông báo", MessageBox.MessageBoxButtonsBA.OK, MessageBox.MessageBoxIconBA.Warning);
            }
        }
        /// <summary>
        /// Khoi tao du lieu luc dau
        /// </summary>
        private void Init()
        {
            // Lay thong tin he thong
            ThongTinCauHinh.LayThongTinCauHinh();
            g_ConnecString = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];


            // check connection
            if (!DieuHanhTaxi.CheckConnection())
            {
                MessageBox.Show("Không kết nối được với cơ sở dữ liệu.Cần liên lạc với quản trị hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(1);
                return;
            }
            /// end check connection
            timerCapture          = new System.Timers.Timer(5000); // nửa giây quét một lần. 15 giay
            timerCapture.Elapsed += new System.Timers.ElapsedEventHandler(timerCapture_Elapsed);
            timerCapture.Enabled  = true;

            // Thong tin status bar
            statusLblKhoiDongLuc.Text   = " Khởi động : " + string.Format("{0:HH:mm dd/MM}", DateTime.Now);
            statusLblSoCuocChoXuLy.Text = " Cuộc chờ xử lý : 0";
            statusLblServer.Text        = " Server: " + GetServerName(g_ConnecString);
            statusLblDatabase.Text      = " DB: " + GetDatabaseName(g_ConnecString);

            this.Text = Configuration.GetCompanyName() + " - " + this.Text;
        }
Beispiel #3
0
 private void lnkGopKenh_CapNhat_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     try
     {
         TimeSpan GioDB  = time_GopKenh_GioBatDau.Value.TimeOfDay;
         TimeSpan GioKT  = time_GopKenh_GioKetThuc.Value.TimeOfDay;
         bool     status = chkGopKenh_TrangThai.Checked;
         if (Config_Common.Update(Enum_Config_Common.GopLine, chkGopKenh_TrangThai_Config.Checked ? "1" : ""))
         {
             Config_Common.GopLine = chkGopKenh_TrangThai_Config.Checked;
         }
         else
         {
             new MessageBox.MessageBoxBA().Show(this, "Có lỗi cập nhật cấu hình gộp kênh.");
             return;
         }
         if (ThongTinCauHinh.Update_GopKenh(status, GioKT, GioDB))
         {
             new MessageBox.MessageBoxBA().Show(this, "Cập nhật cấu hình gộp kênh thành công.");
             ThongTinCauHinh.GopKenh_GioBD     = GioDB;
             ThongTinCauHinh.GopKenh_GioKT     = GioKT;
             ThongTinCauHinh.GopKenh_TrangThai = status;
         }
         else
         {
             new MessageBox.MessageBoxBA().Show(this, "Có lỗi cập nhật cấu hình gộp kênh.");
         }
     }
     catch (Exception)
     {
         new MessageBox.MessageBoxBA().Show(this, "Có lỗi cấu hình gộp kênh.");
     }
 }
Beispiel #4
0
        private void btnGetLicenseCode_Click(object sender, EventArgs e)
        {
            string textError = string.Empty;
            Color  color     = Color.Red;

            lblMsg.Visible = false;
            try
            {
                ThongTinCauHinh.LayThongTinCauHinh();//Lấy cấu hình trực tiếp luôn
                string userName = txtUserName.Text.Trim();
                string password = txtPassword.Text.Trim();
                if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password))
                {
                    lblMsg.Text = "Vui lòng nhập thông tin tài khoản!!!";
                    txtUserName.Focus();
                    lblMsg.Visible = true;
                    return;
                }

                string strSDT       = ThongTinCauHinh.SoDienThoaiCongTy;
                string strTenCongTy = ThongTinCauHinh.TenCongTy;
                string strCPUID     = "BinhAnh";
                MacAddress = _objLicense.GetServerInformation(out strCPUID);
                CPUID      = strCPUID;
                if (MacAddress == "" || strCPUID == "")
                {
                    textError = "Thông tin yêu cầu bản quyền không hợp lệ";
                    return;
                }
                int result = StaxiManServices.RequestLicenseKey(userName, password, MacAddress, strCPUID, strSDT, strTenCongTy);
                switch (result)
                {
                case 0:
                    textError = "Xử lý thông tin yêu cầu lỗi (0)";
                    break;

                case -1:
                    textError = "Tài khoản không tồn tại trong hệ thống. Nhập đúng tài khoản để yêu cầu cấp bản quyền";
                    break;

                case -2:
                    textError = "Xử lý thông tin yêu cầu lỗi (-2)";
                    break;

                case 1:
                    color     = Color.Blue;
                    textError = "Gửi thông tin yêu cầu Thành Công, Vui lòng liên hệ nhà cung cấp để lấy thông tin bản quyền";
                    break;
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("btnGetLicenseCode_Click: ", ex);
                textError = "Gửi thông tin yêu cầu lỗi";
            }
            lblMsg.ForeColor = color;
            lblMsg.Text      = textError;
            lblMsg.Visible   = true;
        }
Beispiel #5
0
 private void llCapNhatCauHinhStaxi_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (ThongTinCauHinh.Update_CauHinhStaxi(ckSuDungStaxi.Checked, ckbSuDungStaxiChieuVe.Checked))
     {
         ThongTinCauHinh.FT_Active         = ckSuDungStaxi.Checked;
         ThongTinCauHinh.FT_ChieuVe_Active = ckbSuDungStaxiChieuVe.Checked;
     }
 }
        /// <summary>
        /// Khoi tao du lieu luc dau
        /// </summary>
        private void Init()
        {
            timerCapture          = new System.Timers.Timer(1000); // nửa giây quét một lần.
            timerCapture.Elapsed += new System.Timers.ElapsedEventHandler(timerCapture_Elapsed);
            timerCapture.Enabled  = true;


            g_ConnecString = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];
            // Lay thong tin he thong
            ThongTinCauHinh.LayThongTinCauHinh();

            g_ThoiDiemLayTruocVOC = DateTime.Now;

            if (ThongTinCauHinh.SoDauCuaTongDai.Length > 0)
            {
                g_HasSoDauTongDai = true;
            }
            else
            {
                g_HasSoDauTongDai = false;
            }

            g_SoCuocGoiGiuLai = Configuration.GetSoCuocGoiGiuLai();
            g_FileVOCPath     = Configuration.VocFilePath();

            if ((!FileTools.IsExsitFile(g_FileVOCPath)))
            {
                MessageBox.Show("Không tồn tại file thông tin cuộc gọi.Liên lạc với quản trị hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(1);
                return;
            }
            else
            {
                TaxiCapture.DeletePhoneCallVocFile(DateTime.Now, g_FileVOCPath);
            }


            // check connection
            if (!DieuHanhTaxi.CheckConnection())
            {
                MessageBox.Show("Không kết nối được với cơ sở dữ liệu.Cần liên lạc với quản trị hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(1);
                return;
            }
            /// end check connection


            // Thong tin status bar
            statusLblKhoiDongLuc.Text   = " Khởi động : " + string.Format("{0:HH:mm dd/MM}", DateTime.Now);
            statusLblSoCuocChoXuLy.Text = " Cuộc chờ xử lý : 0";
            statusLblServer.Text        = " Server: " + GetServerName(g_ConnecString);
            statusLblDatabase.Text      = " DB: " + GetDatabaseName(g_ConnecString);
            this.Text = Configuration.GetCompanyName() + " - " + this.Text;

            g_ListLines = TaxiCapture.GetLineDialOutCS(g_ConnecString);  // lấy line của CS

            g_TimeSecondOnDay = (int)DateTime.Now.TimeOfDay.TotalSeconds;
        }
 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;
 }
Beispiel #8
0
        /// <summary>
        /// Khoi tao du lieu luc dau
        /// </summary>
        private void Init()
        {
            // Lay thong tin he thong
            ThongTinCauHinh.LayThongTinCauHinh();
            if (ThongTinCauHinh.SoDauCuaTongDai.Length > 0)
            {
                g_HasSoDauTongDai = true;
            }
            else
            {
                g_HasSoDauTongDai = false;
            }
            g_ConnecString = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];


            g_FileLogIncomingPath = Configuration.LogIncomingPath();
            g_FileInComPath       = Configuration.InComFilenamePath();
            g_FileVOCPath         = Configuration.VocFilePath();

            if ((!FileTools.IsExsitFile(g_FileLogIncomingPath)) || (!FileTools.IsExsitFile(g_FileInComPath)) || (!FileTools.IsExsitFile(g_FileVOCPath)))
            {
                MessageBox.Show("Không tồn tại file thông tin cuộc gọi.Liên lạc với quản trị hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            // check connection
            if (!DieuHanhTaxi.CheckConnection())
            {
                MessageBox.Show("Không kết nối được với cơ sở dữ liệu.Cần liên lạc với quản trị hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            /// end check connection
            timerCapture          = new System.Timers.Timer(500); // nửa giây quét một lần.
            timerCapture.Elapsed += new System.Timers.ElapsedEventHandler(timerCapture_Elapsed);
            timerCapture.Enabled  = true;
            try
            {
                // Xoa toan bo du lieu hien tai cua he thong phan cung
                TaxiCapture.DeletePhoneCallInCom(DateTime.Now, g_FileInComPath);
                TaxiCapture.DeletePhoneCallLogIncomming(DateTime.Now, g_FileLogIncomingPath);
                TaxiCapture.DeletePhoneCallVocFile(DateTime.Now, g_FileVOCPath);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Có lỗi thiết lập (reset) các cuộc gọi.Cần liên lạc với quản trị hệ thống.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }

            CaptureCuocGoiDi();
            TaxiCapture.DeletePhoneCallVocFile_CuocGoiDi(g_FileVOCPath);

            g_bKetThucBackgroundWork = true;
            g_bTimerHoanThanh        = true;
            g_iKhoiDongLai           = 0;
        }
 void frmDMKhachAo_Load(object sender, EventArgs e)
 {
     if (DieuHanhTaxi.CheckConnection())
     {
         // Lay thong tin he thong
         ThongTinCauHinh.LayThongTinCauHinh();
         LoadListKhachQuen();
         //CheckIn();
         LoadListKhachQuen_Type();
         LoadListKhachQuen_Rank();
     }
 }
Beispiel #10
0
 private void frmThongTinKhachHangPhanAnh_Load(object sender, EventArgs e)
 {
     if (DieuHanhTaxi.CheckConnection())
     {// Lay thong tin he thong
         ThongTinCauHinh.LayThongTinCauHinh();
         g_TimeServer = DieuHanhTaxi.GetTimeServer();
     }
     LoadPhanAnh_ChuaGiaiQuyet(0);
     CheckIn();
     grdGiaiQuyetPA.Focus();
     // Khoi tao cong COM
     KhoiTaoCOMPort(); // khoi dong kiem tra COM, lay cong co the mo duoc
 }
Beispiel #11
0
        private void lnkCapNhat_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            DateTime DauCa1     = new DateTime(1900, 1, 1, calDauCa1.Value.Hour, calDauCa1.Value.Minute, 0);
            DateTime KetThucCa1 = new DateTime(1900, 1, 1, calKetThucCa1.Value.Hour, calKetThucCa1.Value.Minute, 0);
            DateTime KetThucCa2 = new DateTime(1900, 1, 1, calKetThucCa2.Value.Hour, calKetThucCa2.Value.Minute, 0);

            if (ThongTinCauHinh.CapNhatThongTinCa(1, DauCa1, KetThucCa1, KetThucCa2))
            {
                new MessageBox.MessageBoxBA().Show(this, "Cập nhật thông tin ca thành công.");
            }
            else
            {
                new MessageBox.MessageBoxBA().Show(this, "Có lỗi cập nhật thông tin ca.");
            }
        }
Beispiel #12
0
        private void llCapNhatCauHinhChieuVe_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var coDuyet = chkFT_ChieuVe_CoDuyet.Checked;
            var coChot  = chkFT_ChieuVe_CoChotCo.Checked;
            var km      = txtGioiHanKm.EditValue.To <int>();
            var sermap  = inputEnumLookUp_ServiceMap1.EditValue.To <int>();

            if (ThongTinCauHinh.Update_CauHinhStaxiChieuVe(coDuyet, coChot, sermap, km))
            {
                ThongTinCauHinh.FT_SoKM             = km;
                ThongTinCauHinh.FT_ChieuVe_CoChotCo = coChot;
                ThongTinCauHinh.FT_ChieuVe_CoDuyet  = coDuyet;
                ThongTinCauHinh.FT_ServiceMap       = (Taxi.Utils.Enums.Enum_FT_ServiceMap)Enum.Parse(typeof(Taxi.Utils.Enums.Enum_FT_ServiceMap), sermap.ToString());
            }
        }
Beispiel #13
0
 private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (TabCauHinh.SelectedTab.Name == "tabCauHinhHeThong")
         {
             btnHuyBo.Visible          = true;
             btnLuu.Visible            = true;
             TimerCapturePhone.Enabled = false;
         }
         else if (TabCauHinh.SelectedTab.Name == "tabIPSetting")
         {
             btnHuyBo.Visible          = false;
             btnLuu.Visible            = false;
             TimerCapturePhone.Enabled = false;
         }
         else if (TabCauHinh.SelectedTab.Name == "tabThongTinCa")
         {
             DataTable dt = ThongTinCauHinh.GetThongTinCa(1);
             if (dt != null && dt.Rows.Count > 0)
             {
                 DataRow dr = dt.Rows[0];
                 calDauCa1.Value     = Convert.ToDateTime(dr["DauCa1"].ToString());
                 calKetThucCa1.Value = Convert.ToDateTime(dr["KetThucCa1"].ToString());
                 calKetThucCa2.Value = Convert.ToDateTime(dr["KetThucCa2"].ToString());
             }
             btnHuyBo.Visible          = false;
             btnLuu.Visible            = false;
             TimerCapturePhone.Enabled = false;
         }
         else if (TabCauHinh.SelectedTab.Name == "tabThoatCuoc999")
         {
             HienThiDSCauHinhThoatCuoc();
             btnHuyBo.Visible          = false;
             btnLuu.Visible            = false;
             TimerCapturePhone.Enabled = true;
         }
         else
         {
             btnHuyBo.Visible = true;
             btnLuu.Visible   = true;
         }
     }
     catch (Exception Ex)
     {
     }
 }
        private static void LoadDataCommon()
        {
            Config_Common.LoadConfigCommon();
            ThongTinCauHinh.LayThongTinCauHinh();
            CommonBL.LoadDrivers_Active();
            CommonBL.LoadVehicles();

            //CommonBL.LoadStaxiLoaiXe();
            if (Config_Common.NhapTuyenDuongDai || Config_Common.App_DieuXeHopDong)
            {
                CommonBL.LoadTuyenDuongDai();
            }
            try
            {
                using (DataTable dt = QuanTriCauHinh.G5_GetLines_LoaiXeOfPCDienThoai(IpAddress))
                {
                    if (dt.Rows != null && dt.Rows.Count > 0)
                    {
                        LineVung = dt.Rows[0]["Line_Vung"].ToString();

                        if (Config_Common.DienThoai_DieuTuDong)
                        {
                            Config_Common.DienThoai_DieuTuDong = dt.Columns.Contains("G5_Type") &&
                                                                 dt.Rows[0]["G5_Type"].ToString() == "1";
                        }
                        Config_Common.G5_PinMap = dt.Columns.Contains("G5_PinMap") &&
                                                  dt.Rows[0]["G5_PinMap"].ToString() == "1";

                        if (Config_Common.GopLine || ThongTinCauHinh.GopKenh_TrangThai)
                        {
                            LineGop = dt.Rows[0]["LineGop"] == DBNull.Value
                                ? LineVung
                                : dt.Rows[0]["LineGop"].ToString();
                        }
                        QuanTriCauHinh.MoHinh = dt.Columns.Contains("MoHinh") && dt.Rows[0]["MoHinh"] != DBNull.Value && (string)dt.Rows[0]["MoHinh"] != "" && (string)dt.Rows[0]["MoHinh"] != "0" ? (MoHinh)dt.Rows[0]["MoHinh"].To <int>() : MoHinh.TD_DT;
                    }
                    else
                    {
                        LineVung = string.Empty;
                    }
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("GetLines_LoaiXeOfPCDienThoai", ex);
            }
        }
Beispiel #15
0
 private void ctrlDanhSachXeChieuVe_Load(object sender, EventArgs e)
 {
     if (this.DesignMode)
     {
         return;
     }
     if (ThongTinCauHinh.CacLineCuaTaxiOperation == "")
     {
         ThongTinCauHinh.LayThongTinCauHinh();
     }
     if (!ThongTinCauHinh.FT_ChieuVe_Active)
     {
         this.Visible = false;
         return;
     }
     TaxiReturn_Process.StartTimeServer();
     _dulieu = new List <XeDiDuongDai>();
     gridView1.Add <RepositoryItemEnum_TrangThaiXeBaoDiDuongDai>("TrangThai");
     gridView1.Add <RepositoryItemEnum_TrangThaiDuyetXeBaoDiDuongDai>("TrangThaiDuyet");
     try
     {
         panel1.BindShControl();
     }
     catch (Exception ex)
     {
         new MessageBox.MessageBoxBA().Show(ex.Message);
     }
     if (IsDieuXe)
     {
         lblDenNgay.Visible = false;
         lblTuNgay.Visible  = false;
         deDenNgay.Visible  = false;
         deTuNgay.Visible   = false;
         //btnSearch.Visible = true;
         btnSearch.Visible = false;
         //panel1.Visible = false;
         Start();
     }
     else
     {
         btnSearch.Visible = true;
     }
     _first = false;
     LoadFull();
     ReSearch();
 }
Beispiel #16
0
        private DataTable LoadReportData()
        {
            DateTime dateGioDauCa;
            // lay gio cua ca
            DataTable dt = ThongTinCauHinh.GetThongTinCa(1);

            try
            {
                dateGioDauCa = Convert.ToDateTime(dt.Rows[0]["DauCa1"].ToString());
            }
            catch
            {
                dateGioDauCa = new DateTime(1900, 1, 1, 6, 0, 0);
            }
            DateTime TuNgay  = new DateTime(this.FromDate.Value.Year, this.FromDate.Value.Month, this.FromDate.Value.Day, dateGioDauCa.Hour, dateGioDauCa.Minute, dateGioDauCa.Second);
            DateTime DenNgay = this.ToDate.Value.Date;

            DenNgay = DenNgay.AddDays(1).Add(TuNgay.TimeOfDay.Add(new TimeSpan(0, 0, -1)));
            DataTable dtDHTheoNgay = new BC_4_9_TKeSoLieuDieuHanh().BaoCaoKQDieuHanhTheoNgay(TuNgay, DenNgay);

            lblTuNgayDen.Text = string.Format("({0:HH:mm dd/MM} - {1:HH:mm dd/MM})", TuNgay, DenNgay);
            //Tính tỷ trọng!
            object objSum;
            float  tyTrong;

            for (int i = 0; i < dtDHTheoNgay.Rows.Count; i++)
            {
                if (i != 0)
                {
                    string ngayInGroup = dtDHTheoNgay.Rows[i - 1]["NgayHienThi"].ToString();
                    if (dtDHTheoNgay.Rows[i]["NgayHienThi"].ToString() != ngayInGroup || i == (dtDHTheoNgay.Rows.Count - 1))
                    {
                        objSum = dtDHTheoNgay.Compute("Sum(TongGoiTaxi)", "NgayHienThi = " + "'" + ngayInGroup + "'");
                        foreach (DataRow dr in dtDHTheoNgay.Rows)
                        {
                            if (dr["NgayHienThi"].ToString() == ngayInGroup)
                            {
                                tyTrong       = (float.Parse(dr["TongGoiTaxi"].ToString()) / float.Parse(objSum.ToString())) * 100;
                                dr["TyTrong"] = tyTrong;
                            }
                        }
                    }
                }
            }
            return(dtDHTheoNgay);
        }
Beispiel #17
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            try
            {
                if (DieuHanhTaxi.CheckConnection())
                {
                    // Lay thong tin he thong
                    ThongTinCauHinh.LayThongTinCauHinh();
                    //----------------------------------------------------
                    HeThong_DangNhap frmDangNhap = new HeThong_DangNhap();
                    DialogResult     dlgResult   = frmDangNhap.ShowDialog();
                    if (dlgResult == DialogResult.Cancel)
                    {
                        Application.Exit();
                    }
                    strUser_Id = ThongTinDangNhap.USER_ID;

                    this.Text  = Configuration.GetCompanyName() + " - " + this.Text;
                    G_IsActive = true;

                    LoadData();
                    g_TimeServer = DieuHanhTaxi.GetTimeServer();
                    InitTimerCapturePhone();
                }
                else
                {
                    new MessageBox.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", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Error);
                    Application.Exit();
                }

                statusBar.Panels["TenDangNhap"].Text = ThongTinDangNhap.FULLNAME;

                if (ThongTinDangNhap.USER_ID != "admin")
                {
                    //thực hiện phân quyền trên menu
                    PhanQuyenMenu(EF02_mnuMain, ThongTinDangNhap.PermissionsFull);
                }
            }
            catch (Exception ex)
            {
                new MessageBox.MessageBox().Show(this, ex.Message, "Thông báo lỗi", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Error);
            }
        }
Beispiel #18
0
 private void ctrlDieuXe_Load(object sender, EventArgs e)
 {
     if (DesignMode)
     {
         return;
     }
     if (ThongTinCauHinh.CacLineCuaTaxiOperation == "")
     {
         ThongTinCauHinh.LayThongTinCauHinh();
     }
     if (!ThongTinCauHinh.FT_ChieuVe_Active)
     {
         this.Visible = false;
         return;
     }
     TaxiReturn_Process.StartTimeServer();
     try
     {
         MenuItem_ChuyenSangChuaGiaiQuyet.Visible = !IsDieuXe;
         menuKetThuc.Visible = IsDieuXe;
         gridView_Bookings.Add <RepositoryItemEnum_TrangThaiDieuXe>("OpStatus");
         panel2.BindShControl();
         if (IsDieuXe)
         {
             // panel2.Visible = true;
             DieuXe();
             lblNgayDon.Visible = false;
             lblNgayDen.Visible = false;
             deDenNgay.Visible  = false;
             deTuNgay.Visible   = false;
             btnSearch.Visible  = false;
         }
         else
         {
             deDenNgay.Bind();
             deTuNgay.Bind();
         }
     }
     catch (Exception ex)
     {
         new MessageBox.MessageBoxBA().Show(ex.Message);
     }
 }
Beispiel #19
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            if (TimKiem_BaoCao.CheckTuNgayDenNgay(calTuNgay.Value, calDenNgay.Value))
            {
                //-------------------------------------------------------------------
                // congnt them tinh thoi gian theo ca
                //-------------------------------------------------------------------
                DateTime dateGioDauCa;
                // lay gio cua ca
                DataTable dt = ThongTinCauHinh.GetThongTinCa(1);
                try
                {
                    dateGioDauCa = Convert.ToDateTime(dt.Rows[0]["DauCa1"].ToString());
                }
                catch (Exception ex)
                {
                    dateGioDauCa = new DateTime(1900, 1, 1, 6, 0, 0);
                }
                DateTime TuNgay  = new DateTime(calTuNgay.Value.Year, calTuNgay.Value.Month, calTuNgay.Value.Day, dateGioDauCa.Hour, 0, 0);
                DateTime DenNgay = calDenNgay.Value;
                DenNgay           = DenNgay.AddDays(1);
                DenNgay           = new DateTime(DenNgay.Year, DenNgay.Month, DenNgay.Day, dateGioDauCa.Hour - 1, 59, 59);
                lblTuNgayDen.Text = string.Format("({0:HH:mm dd/MM} - {1:HH:mm dd/MM})", TuNgay, DenNgay);
                //-------------------------------------------------------------------

                string strCongtyID = cboCongTy.SelectedValue.ToString();
                string strMaKH     = cboKH.SelectedValue.ToString();
                g_dtDuLieu            = (new BangKe()).BaoCaoChiTietCuocKhachMoGioi_DiaChi(strMaKH, strCongtyID, TuNgay, DenNgay);
                gridReport.DataMember = "tblBaoCao";
                gridReport.SetDataBinding(g_dtDuLieu, "tblBaoCao");

                gridEX1.DataMember = "tblDSBangKe";
                gridEX1.SetDataBinding(g_dtDuLieu, "tblDSBangKe");
                SetUnActiveRefreshButton();
            }
            else
            {
                MessageBox.MessageBox msgDialog = new Taxi.MessageBox.MessageBox();
                msgDialog.Show(this, "Bạn phải nhập [Từ ngày] nhỏ hơn hoặc bằng [Đến ngày].", "Thông báo", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Warning);
                return;
            }
        }
Beispiel #20
0
 private void frmTestMain_Load(object sender, EventArgs e)
 {
     // Lay thong tin he thong
     ThongTinCauHinh.LayThongTinCauHinh();
 }
Beispiel #21
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            string TenCongTy = StringTools.TrimSpace(txtTenCongTy.Text);

            string LogoPath = g_LogoCongTy;

            if (g_bCoThayLogo)
            {
                // lấy file name

                FileInfo info = new FileInfo(g_LogoCongTy);

                LogoPath = info.Name;
                string DesFile = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + "\\Reports\\" + LogoPath;
                FileTools.CopyFileTo(g_LogoCongTy, DesFile);
            }

            string SoDauCuaTongDai = "";

            if (chkCoSuDungTongDai.Checked)
            {
                SoDauCuaTongDai = StringTools.TrimSpace(txtSoDauTongDai.Text);
            }
            bool   bTinhTienCuoc2ChieuNgatCuoc          = chkTinhTienCuocHaiChieuKhongNgatCuoc.Checked;
            int    SoGiayGioiHanThoiGianChuyenTongDai   = int.Parse(StringTools.TrimSpace(txtThoiGianChuyenTongDai.Text));
            int    SoGiayGioiHanThoiGianDieuXe          = int.Parse(StringTools.TrimSpace(txtThoiGianDieuXe.Text));
            int    SoGiayGioiHanThoiGianDonKhach        = int.Parse(StringTools.TrimSpace(txtThoiGianDonKhach.Text));
            int    SoPhutGioiHanMatLienLac              = int.Parse(StringTools.TrimSpace(txtGioiHanMLL.Text));
            int    SoPhutGioiHanMatLienLacBaoNghi       = int.Parse(StringTools.TrimSpace(txtGioiHanMLLBaoNghi.Text));
            int    SoPhutGioiHanMatLienLacBaoDiSanBay   = int.Parse(StringTools.TrimSpace(txtGioiHanMLLDiSanBay.Text));
            int    SoPhutGioiHanMatLienLacBaoDiDuongDai = int.Parse(StringTools.TrimSpace(txtGioiHanMLLDiSanBay.Text));
            string ThuMucDuLieuTanasonic = txtThuMucDuLieuTanasonic.Text;
            string ThuMucFileAmThanh     = txtThuMucFileAmThanh.Text;
            string TatCaLinesHeThong     = StringTools.TrimSpace(txtLineHeThong.Text);
            string CacLineTaxi           = StringTools.TrimSpace(txtLineTaxi.Text);
            string CacVungTongDai        = StringTools.TrimSpace(txtCacVungTongDai.Text);

            if (CacVungTongDai.Length <= 0)
            {
                CacVungTongDai = "1";
            }
            string PhoneTaxi  = StringTools.TrimSpace(txtPhoneTaxi.Text);
            bool   HasTongDai = chkHasCOMPort.Checked;
            int    SoDongCuocGoiDaGiaiQuyet = Convert.ToInt16(txtDongCuocGoiDaGiaiQuyet.Text);
            bool   bKiemTraXeDaRaHoatDong   = chkKiemTraXeDaRaHoatDong.Checked;

            bool KichHoachTaxiGroupDon      = chkKichHoatTaxiGroupDon.Checked;
            byte SoPhutGiuKhachChuaCoXeNhan = 0;
            byte SoPhutGiuKhachCoXeNhan     = 0;
            byte SoPhutGiuKhachLai          = 0;

            try
            {
                SoPhutGiuKhachChuaCoXeNhan = Convert.ToByte(txtSoPhutChuaCoXeNhan.Text);
            }
            catch (Exception ex) { SoPhutGiuKhachChuaCoXeNhan = 5; }
            try
            {
                SoPhutGiuKhachCoXeNhan = Convert.ToByte(txtSoPhutCoXeNhan.Text);
            }
            catch (Exception ex) { SoPhutGiuKhachCoXeNhan = 10; }
            try
            {
                SoPhutGiuKhachLai = Convert.ToByte(txtSoPhutGiuKhachLai.Text);
            }
            catch (Exception ex) { SoPhutGiuKhachLai = 15; }


            if (PhoneTaxi.Length <= 0)
            {
                new MessageBox.MessageBoxBA().Show(this, "Bạn phải nhập số điện thoại công ty.");
                txtPhoneTaxi.Focus();
                return;
            }
            if (CacVungTongDai.Length <= 0)
            {
                new MessageBox.MessageBoxBA().Show(this, "Bạn phải nhập các vùng tổng đài.");
                txtCacVungTongDai.Focus();
                return;
            }
            if (!ValidateLinesHeThong(TatCaLinesHeThong, CacLineTaxi))
            {
                new MessageBox.MessageBoxBA().Show(this, "Bạn cần phải đặt lại thông tin lines hệ thống,(0<Lines <=32) và lines taxi phải thuộc trong lines hệ thống.");
                txtLineTaxi.Focus();
                return;
            }

            #region Tab Config GPS
            string MaCungXn  = "";
            string BanDo     = "";
            int    Zoom      = 0;
            float  KinhDo    = 0;
            float  ViDo      = 0;
            bool   TrangThai = false;
            string TenTinh   = string.Empty;

            if (!validConfigGPS())
            {
                return;
            }

            MaCungXn = txtGPS_MaCungXN.Text;
            BanDo    = lblGPS_LoaiBanDo.Text.Trim();
            Zoom     = Convert.ToInt32(lblGPS_mucZoom.Text);
            KinhDo   = float.Parse(lblGPS_KinhDo.Text);
            ViDo     = float.Parse(lblGPS_ViDo.Text);
            TenTinh  = txtGPS_TenTinh.Text;

            TrangThai = ckGPS_KetNoi.Checked ? true : false;

            int BKGioiHan = 500;
            int BKXeNhan  = 500;
            int.TryParse(txtGPS_BanKinhTimXe.Text.Trim(), out BKGioiHan);
            int.TryParse(txtBKXeNhan.Text.Trim(), out BKXeNhan);

            #endregion

            TimeSpan GioDB               = time_GopKenh_GioBatDau.Value.TimeOfDay;
            TimeSpan GioKT               = time_GopKenh_GioKetThuc.Value.TimeOfDay;
            bool     status              = chkGopKenh_TrangThai.Checked;
            bool     ft_ChieuVe_CoDuyet  = chkFT_ChieuVe_CoDuyet.Checked;
            bool     ft_ChieuVe_CoChotCo = chkFT_ChieuVe_CoChotCo.Checked;
            bool     fT_Active           = ckSuDungStaxi.Checked;
            bool     fT_ChieuVe_Active   = ckbSuDungStaxiChieuVe.Checked;
            int      fT_ServiceMap       = inputEnumLookUp_ServiceMap1.EditValue.To <int>();
            int      fT_SoKM             = txtGioiHanKm.EditValue.To <int>();

            if (ThongTinCauHinh.UpdateInsetThongTinCauHinh(TenCongTy, LogoPath, SoDauCuaTongDai,
                                                           SoGiayGioiHanThoiGianChuyenTongDai, SoGiayGioiHanThoiGianDieuXe, SoGiayGioiHanThoiGianDonKhach,
                                                           SoPhutGioiHanMatLienLac, SoPhutGioiHanMatLienLacBaoNghi, SoPhutGioiHanMatLienLacBaoDiSanBay,
                                                           SoPhutGioiHanMatLienLacBaoDiDuongDai, ThuMucDuLieuTanasonic, ThuMucFileAmThanh, TatCaLinesHeThong,
                                                           CacLineTaxi, PhoneTaxi, HasTongDai, SoDongCuocGoiDaGiaiQuyet, bKiemTraXeDaRaHoatDong, CacVungTongDai,
                                                           bTinhTienCuoc2ChieuNgatCuoc, KichHoachTaxiGroupDon, SoPhutGiuKhachChuaCoXeNhan, SoPhutGiuKhachCoXeNhan, SoPhutGiuKhachLai,
                                                           MaCungXn, BanDo, Zoom, KinhDo, ViDo, TenTinh, TrangThai, BKGioiHan, BKXeNhan, status, GioDB, GioKT, ft_ChieuVe_CoDuyet, ft_ChieuVe_CoChotCo, fT_Active, fT_ChieuVe_Active, fT_ServiceMap, fT_SoKM))
            {
                new MessageBox.MessageBoxBA().Show(this, "Lưu thông tin cấu hình thành công.");
                new MessageBox.MessageBoxBA().Show(this, "Cần phải khởi động lại chương trình các máy con để để thiết lập thông tin.");
                Application.Restart();
            }
            else
            {
                new MessageBox.MessageBoxBA().Show(this, "Lỗi lưu thông tin cấu hình thành công");
            }
        }
Beispiel #22
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            if (TimKiem_BaoCao.CheckTuNgayDenNgay(calTuNgay.Value, calDenNgay.Value))
            {
                //------------------------------------------------------------------
                // Congnt sua them lay ngay theo ca
                //------------------------------------------------------------------
                DateTime dateGioDauCa;
                // lay gio cua ca
                DataTable dtCa = ThongTinCauHinh.GetThongTinCa(1);
                try
                {
                    dateGioDauCa = Convert.ToDateTime(dtCa.Rows[0]["DauCa1"].ToString());
                }
                catch (Exception ex)
                {
                    dateGioDauCa = new DateTime(1900, 1, 1, 6, 0, 0);
                }
                DateTime TuNgay  = new DateTime(calTuNgay.Value.Year, calTuNgay.Value.Month, calTuNgay.Value.Day, dateGioDauCa.Hour, 0, 0);
                DateTime DenNgay = calDenNgay.Value;
                DenNgay           = DenNgay.AddDays(1);
                DenNgay           = new DateTime(DenNgay.Year, DenNgay.Month, DenNgay.Day, dateGioDauCa.Hour - 1, 59, 59);
                lblTuNgayDen.Text = string.Format("({0:HH:mm dd/MM} - {1:HH:mm dd/MM})", TuNgay, DenNgay);


                DataTable dt = (new BangKe()).BCTHMoiGioi_TT(TuNgay, DenNgay);

                g_dtDuLieuTongHop = new DataTable();
                g_dtDuLieuTongHop = dt.Clone();

                DataRow[] rows = dt.Select("rptGroup = 0");
                if (rows.Length > 0)
                {
                    foreach (DataRow row in rows)
                    {
                        g_dtDuLieuTongHop.ImportRow(row);
                    }
                }
                g_dtDuLieuDonVi = new DataTable();
                g_dtDuLieuDonVi = dt.Clone();
                DataRow[] rows2 = dt.Select("rptGroup = 1");
                if (rows2.Length > 0)
                {
                    foreach (DataRow row in rows2)
                    {
                        g_dtDuLieuDonVi.ImportRow(row);
                    }
                }

                gridDienThoai.DataMember = "tblTongHop";
                gridDienThoai.SetDataBinding(g_dtDuLieuTongHop, "tblTongHop");

                gridEX1.DataMember = "tblDonVi";
                gridEX1.SetDataBinding(g_dtDuLieuDonVi, "tblDonVi");
                SetUnActiveRefreshButton();
            }
            else
            {
                MessageBox.MessageBox msgDialog = new Taxi.MessageBox.MessageBox();
                msgDialog.Show(this, "Bạn phải nhập [Từ ngày] nhỏ hơn hoặc bằng [Đến ngày].", "Thông báo", Taxi.MessageBox.MessageBoxButtons.OK, Taxi.MessageBox.MessageBoxIcon.Warning);
                return;
            }
        }
Beispiel #23
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            if (TimKiem_BaoCao.CheckTuNgayDenNgay(calTuNgay.Value, calDenNgay.Value))
            {
                DateTime dateGioDauCa;
                // lay gio cua ca
                DataTable dt = ThongTinCauHinh.GetThongTinCa(1);
                try
                {
                    dateGioDauCa = Convert.ToDateTime(dt.Rows[0]["DauCa1"].ToString());
                }
                catch (Exception ex)
                {
                    dateGioDauCa = new DateTime(1900, 1, 1, 6, 0, 0);
                }
                DateTime TuNgay  = new DateTime(calTuNgay.Value.Year, calTuNgay.Value.Month, calTuNgay.Value.Day, dateGioDauCa.Hour, dateGioDauCa.Minute, dateGioDauCa.Second);
                DateTime DenNgay = calDenNgay.Value;
                DenNgay = DenNgay.AddDays(1).Add(TuNgay.TimeOfDay.Add(new TimeSpan(0, 0, -1)));
                //DenNgay = new DateTime(DenNgay.Year, DenNgay.Month, DenNgay.Day, dateGioDauCa.Hour - 1, 59, 59);
                lblTuNgayDen.Text = string.Format("({0:HH:mm dd/MM} - {1:HH:mm dd/MM})", TuNgay, DenNgay);
                //load du lieu
                //bang nay da co cot ty trong nhung chua co du lieu
                DataTable dtDHTheoNgay = new TimKiem_BaoCao().GROUP_BaoCaoKetQuaDieuHanh_TheoNgay(TuNgay, DenNgay);
                //khai bao doi tuong tong
                object objSum;

                float TyTrong;
                for (int i = 0; i < dtDHTheoNgay.Rows.Count; i++)
                {
                    if (i != 0)
                    {
                        string ngayInGroup = dtDHTheoNgay.Rows[i - 1]["NgayHienThi"].ToString();
                        if (dtDHTheoNgay.Rows[i]["NgayHienThi"].ToString() != ngayInGroup || i == (dtDHTheoNgay.Rows.Count - 1))
                        {
                            objSum = dtDHTheoNgay.Compute("Sum(TongGoiTaxi)", "NgayHienThi = " + "'" + ngayInGroup + "'");
                            foreach (DataRow dr in dtDHTheoNgay.Rows)
                            {
                                if (dr["NgayHienThi"].ToString() == ngayInGroup)
                                {
                                    TyTrong       = (float.Parse(dr["TongGoiTaxi"].ToString()) / float.Parse(objSum.ToString())) * 100;
                                    dr["TyTrong"] = TyTrong;
                                }
                            }
                        }
                    }
                }
                string sVung = StringTools.TrimSpace(txtVung.Text);
                // khi co dữ liệu thì bật expand/coll
                if (dtDHTheoNgay != null && dtDHTheoNgay.Rows.Count > 0)
                {
                    chkTongNgay.Enabled = true;
                }
                if (sVung.Length > 0)
                {
                    try
                    {
                        DataView dw = new DataView(dtDHTheoNgay, "Vung=" + sVung, "", DataViewRowState.ModifiedCurrent);

                        grdDieuHanhTheoNgay.DataMember = "KetQuaDieuHanh";
                        grdDieuHanhTheoNgay.SetDataBinding(dw, "KetQuaDieuHanh");
                        gridExport.DataMember = "KetQuaDieuHanh";
                        gridExport.SetDataBinding(dw, "KetQuaDieuHanh");
                    }
                    catch (Exception ex)
                    {
                    }
                }
                else
                {
                    grdDieuHanhTheoNgay.DataMember = "KetQuaDieuHanh";
                    grdDieuHanhTheoNgay.SetDataBinding(dtDHTheoNgay, "KetQuaDieuHanh");
                    gridExport.DataMember = "KetQuaDieuHanh";
                    gridExport.SetDataBinding(dtDHTheoNgay, "KetQuaDieuHanh");
                }
                btnExportExcel.Enabled = true;
            }
            else
            {
                MessageBox.Show(this, "Bạn phải nhập [Từ ngày] nhỏ hơn hoặc bằng [Đến ngày].", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            if (TimKiem_BaoCao.CheckTuNgayDenNgay(calTuNgay.Value, calDenNgay.Value))
            {
                DateTime  dateGioDauCa;
                DataTable dt = ThongTinCauHinh.GetThongTinCa(1);
                try
                {
                    dateGioDauCa = Convert.ToDateTime(dt.Rows[0]["DauCa1"].ToString());
                }
                catch
                {
                    dateGioDauCa = new DateTime(1900, 1, 1, 6, 0, 0);
                }
                DateTime TuNgay  = new DateTime(calTuNgay.Value.Year, calTuNgay.Value.Month, calTuNgay.Value.Day, dateGioDauCa.Hour, 0, 0);
                DateTime DenNgay = calDenNgay.Value;
                DenNgay           = DenNgay.AddDays(1);
                DenNgay           = new DateTime(DenNgay.Year, DenNgay.Month, DenNgay.Day, dateGioDauCa.Hour - 1, 59, 59);
                lblTuNgayDen.Text = string.Format("({0:HH:mm dd/MM} - {1:HH:mm dd/MM})", TuNgay, DenNgay);

                if (rbFilter.Checked)
                {
                    DataTable dtDHTheoDonVi = new BangKe().GetBaoCao_KQDieuHanh_DV(TuNgay, DenNgay, false);
                    if (dtDHTheoDonVi.Rows.Count > 0)
                    {
                        grdDieuHanhTheoDonVi.RootTable.Groups.Clear();
                        grdDieuHanhTheoDonVi.RootTable.Columns["Vung"].Visible        = true;
                        grdDieuHanhTheoDonVi.RootTable.Columns["NgayHienThi"].Visible = false;
                        grdDieuHanhTheoDonVi.RootTable.Groups.Add(grdDieuHanhTheoDonVi.RootTable.Columns["NgayHienThi"]);
                        grdDieuHanhTheoDonVi.RootTable.Groups[0].GroupFormatString = "dd/MM/yyyy";
                        grdDieuHanhTheoDonVi.RootTable.Groups[0].GroupPrefix       = "Ngày :";
                        grdDieuHanhTheoDonVi.RootTable.Groups[0].Column            = grdDieuHanhTheoDonVi.RootTable.Columns["NgayHienThi"];
                        btnVung.Text = "Vùng";

                        grdDieuHanhTheoDonVi.DataMember = "KetQuaDieuHanh";
                        grdDieuHanhTheoDonVi.SetDataBinding(dtDHTheoDonVi, "KetQuaDieuHanh");
                        btnExportExcel.Enabled = true;
                        lblMessage.Text        = "";
                        lblMessage.Visible     = false;
                    }
                    else
                    {
                        lblMessage.Text    = "Không có dữ liệu vào khoảng thời gian này.";
                        lblMessage.Visible = true;
                    }
                }
                else
                {
                    DataTable dtDHTheoDonVi = new BangKe().GetBaoCao_KQDieuHanh_DV(TuNgay, DenNgay, true);
                    if (dtDHTheoDonVi.Rows.Count > 0)
                    {
                        grdDieuHanhTheoDonVi.RootTable.Columns["Vung"].Visible        = false;
                        grdDieuHanhTheoDonVi.RootTable.Columns["NgayHienThi"].Visible = true;
                        grdDieuHanhTheoDonVi.RootTable.Groups.Clear();
                        btnVung.Text = "Ngày";

                        grdDieuHanhTheoDonVi.DataMember = "KetQuaDieuHanh";
                        grdDieuHanhTheoDonVi.SetDataBinding(dtDHTheoDonVi, "KetQuaDieuHanh");
                        btnExportExcel.Enabled = true;
                        lblMessage.Text        = "";
                        lblMessage.Visible     = false;
                    }
                    else
                    {
                        lblMessage.Text    = "Không có dữ liệu vào khoảng thời gian này.";
                        lblMessage.Visible = true;
                    }
                }
            }
            else
            {
                MessageBox.Show(this, "Bạn phải nhập [Từ ngày] nhỏ hơn hoặc bằng [Đến ngày].", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }