コード例 #1
0
        private void btnSaoLuu1_Click(object sender, EventArgs e)
        {
            // kiem tra thong tin duong dẫn


            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork             += new DoWorkEventHandler(bw_DoWork);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);

            // Create a progress form on the UI thread
            m_fmProgress = new fmProgress();

            // Kick off the Async thread
            bw.RunWorkerAsync();

            // Lock up the UI with this modal progress form.
            try
            {
                m_fmProgress.ShowDialog(this);
                m_fmProgress = null;
            }
            catch (Exception ex)
            {
            }
        }
コード例 #2
0
        private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // The background process is complete. First we should hide the
            // modal Progress Form to unlock the UI. The we need to inspect our
            // response to see if an error occured, a cancel was requested or
            // if we completed succesfully.

            // Hide the Progress Form
            if (m_fmProgress != null)
            {
                m_fmProgress.Hide();
                m_fmProgress = null;
            }

            // Check to see if an error occured in the
            // background process.
            if (e.Error != null)
            {
                new MessageBox.MessageBoxBA().Show(this, "Có lỗi trong quá trình xử lý dữ liệu. [" + e.Error.Message + "]");
                return;
            }

            // Check to see if the background process was cancelled.
            if (e.Cancelled)
            {
                // new Taxi.MessageBox.MessageBox().Show("Processing cancelled.");
                return;
            }
        }
コード例 #3
0
        private void btnSaoLuu2_Click(object sender, EventArgs e)
        {
            if (StringTools.TrimSpace(txtBrowse2.Text).Length <= 0)
            {
                new Taxi.MessageBox.MessageBoxBA().Show("Không có đường dẫn, bạn phải nhập file lưu..", "Thông báo");
            }
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork             += new DoWorkEventHandler(bw_DoWork2);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted2);

            // Create a progress form on the UI thread
            m_fmProgress = new fmProgress();

            // Kick off the Async thread
            bw.RunWorkerAsync();

            // Lock up the UI with this modal progress form.
            try
            {
                m_fmProgress.ShowDialog(this);
                m_fmProgress = null;
            }
            catch (Exception ex)
            {
            }
        }
コード例 #4
0
        private void bw_RunWorkerCompleted2(object sender, RunWorkerCompletedEventArgs e)
        {
            // The background process is complete. First we should hide the
            // modal Progress Form to unlock the UI. The we need to inspect our
            // response to see if an error occured, a cancel was requested or
            // if we completed succesfully.

            // Hide the Progress Form
            if (m_fmProgress != null)
            {
                m_fmProgress.Hide();
                m_fmProgress = null;
            }
            // Check to see if an error occured in the
            // background process.
            if (e.Error != null)
            {
                new Taxi.MessageBox.MessageBoxBA().Show("Có lỗi sao lưu dữ liệu. Bạn cần kiểm tra đường dẫn xem có quyền ghi không.", "Thông báo");
            }
            else
            {
                new Taxi.MessageBox.MessageBoxBA().Show("Sao lưu dữ liệu thành công.", "Thông báo");
                Configuration.SetNgaySaoLuuMotPhanGanDay(string.Format("{0: dd/MM/yyyy}", DateTime.Now));
                this.Close();
            }
            // Check to see if the background process was cancelled.
            if (e.Cancelled)
            {
                return;
            }
        }
コード例 #5
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            DateTime timeServer = DieuHanhTaxi.GetTimeServer();

            if (calTuNgay.Value > timeServer)
            {
                MessageBox.MessageBoxBA msgDialog = new Taxi.MessageBox.MessageBoxBA();
                msgDialog.Show(this, "Bạn phải nhập  nhỏ hơn hoặc bằng tháng hiện tại.", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning);
                return;
            }
            // Create a background thread
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork             += new DoWorkEventHandler(bw_DoWorkNew);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);

            // Create a progress form on the UI thread
            m_fmProgress = new fmProgress();

            // Kick off the Async thread
            bw.RunWorkerAsync();

            // Lock up the UI with this modal progress form.
            try
            {
                m_fmProgress.ShowDialog(this);
                m_fmProgress = null;
            }
            catch (Exception ex)
            {
            }
            SetUnActiveRefreshButton();
        }
コード例 #6
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            if (TimKiem_BaoCao.CheckTuNgayDenNgay(calTuNgay.Value, calDenNgay.Value))
            {
                // Create a background thread
                BackgroundWorker bw = new BackgroundWorker();
                bw.DoWork             += new DoWorkEventHandler(bw_DoWork);
                bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);

                // Create a progress form on the UI thread
                m_fmProgress = new fmProgress();

                // Kick off the Async thread
                bw.RunWorkerAsync();

                // Lock up the UI with this modal progress form.
                try
                {
                    m_fmProgress.ShowDialog(this);
                    m_fmProgress = null;
                }
                catch (Exception ex)
                {
                }
                btnExportExcel.Enabled = true;
            }
            else
            {
                MessageBox.MessageBoxBA msgDialog = new Taxi.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", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning);
                return;
            }
        }
コード例 #7
0
        private void btnCapNhatThongtinMoiGioi_Click(object sender, EventArgs e)
        {
            if ((g_lstDoiTacChon == null) || (g_lstDoiTacChon.Count <= 0))
            {
                new MessageBox.MessageBox().Show(this, " Không có môi giới nào được chọn.");
                return;
            }

            // Create a background thread
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork             += new DoWorkEventHandler(bw_DoWork);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
            // Create a progress form on the UI thread
            m_fmProgress = new fmProgress();
            // Kick off the Async thread
            bw.RunWorkerAsync();
            // Lock up the UI with this modal progress form.
            try
            {
                m_fmProgress.ShowDialog(this);
                m_fmProgress = null;
                new MessageBox.MessageBox().Show(this, " Cập nhật cuộc gọi môi giới thành công.");
                return;
            }
            catch (Exception ex)
            {
            }
        }
コード例 #8
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            DateTime timeServer = DieuHanhTaxi.GetTimeServer();

            if ((calDenNgay.Value.Year > timeServer.Year) || ((calDenNgay.Value.Year == timeServer.Year) && (calDenNgay.Value.Month > timeServer.Month)))
            {
                MessageBox.MessageBoxBA msgDialog = new Taxi.MessageBox.MessageBoxBA();
                msgDialog.Show(this, "Bạn chọn [tháng-năm] nhỏ hơn hoặc bằng [tháng-năm] hiện tại.", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
                return;
            }

            // check thang co nho hơn hoặc bằng tháng hiện tại không.

            if (g_dtDuLieuBC17 == null)
            {
                MessageBox.MessageBoxBA msgDialog = new Taxi.MessageBox.MessageBoxBA();
                msgDialog.Show(this, "Không tạo được dữ liệu báo cáo.", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
                return;
            }


            // Create a background thread
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork             += new DoWorkEventHandler(bw_DoWork);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);

            // Create a progress form on the UI thread
            m_fmProgress = new fmProgress();

            // Kick off the Async thread
            bw.RunWorkerAsync();

            // Lock up the UI with this modal progress form.
            try
            {
                m_fmProgress.ShowDialog(this);
                m_fmProgress = null;
            }
            catch (Exception ex)
            {
            }



            btnPrint.Enabled       = true;
            btnExportExcel.Enabled = true;
        }
コード例 #9
0
        private void LoadData()
        {
            // Create a background thread

            bw.WorkerReportsProgress = true;
            bw.DoWork             += new DoWorkEventHandler(bw_DoWork);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
            bw.ProgressChanged    += new ProgressChangedEventHandler(bw_ProgressChanged);
            // Create a progress form on the UI thread
            m_fmProgress = new fmProgress();
            // Kick off the Async thread
            bw.RunWorkerAsync();
            // Lock up the UI with this modal progress form.
            try
            {
                m_fmProgress.ShowDialog(this);
                m_fmProgress = null;
                return;
            }
            catch (Exception ex)
            {
            }
        }