Пример #1
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();
        }
        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)
            {
                g_DaLoadDuLieu = false;
                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)
            {
                g_DaLoadDuLieu = false;
                // new Taxi.MessageBox.MessageBox().Show("Processing cancelled.");
                return;
            }
            g_DaLoadDuLieu           = true;
            gridDienThoai.DataMember = "ListDienThoai";
            gridDienThoai.SetDataBinding(g_lstBacCao_CuocGoiMoiGioi, "ListDienThoai");
        }
        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.Close();
                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;
            }
        }
Пример #4
0
        /// <summary>
        /// Load phan len bieu mau
        /// </summary>

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            if (TimKiem_BaoCao.CheckTuNgayDenNgay(calTuNgay.Value, calDenNgay.Value))
            {
                BackgroundWorker bw = new BackgroundWorker();
                bw.DoWork             += bw_DoWork;
                bw.RunWorkerCompleted += bw_RunWorkerCompleted;
                g_fmProgress           = new fmProgress();
                bw.RunWorkerAsync();
                try
                {
                    g_fmProgress.ShowDialog(this);
                    g_fmProgress = null;
                }
                catch (Exception)
                {
                }

                SetUnActiveRefreshButton();
            }
            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", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning);
            }
        }
        /// <summary>
        /// Load phan len bieu mau
        /// </summary>

        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)
                {
                }

                SetUnActiveRefreshButton();
            }
            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;
            }
        }
Пример #6
0
        private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // SqlHelper.ExecuteNonQuery(connection, "dw_sp_SCStockRecon");

            // 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)
            {
                MessageBox.Show(e.Error.Message);
                return;
            }

            // Check to see if the background process was cancelled.
            if (e.Cancelled)
            {
                MessageBox.Show("Processing cancelled.");
                return;
            }

            // Everything completed normally.
            // process the response using e.Result
            //   MessageBox.Show("Processing is complete.");
        }
        private void bwWorker_Completed(object sender, RunWorkerCompletedEventArgs e)
        {
            if (_frmProgress != null)
            {
                _frmProgress.Hide();
                _frmProgress = null;
            }

            if (e.Error != null)
            {
                new Taxi.MessageBox.MessageBoxBA().Show(this, "Có lỗi trong quá trình xử lý dữ liệu. [" + e.Error.Message + "]");
            }
        }
Пример #8
0
 private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (g_fmProgress != null)
     {
         g_fmProgress.Hide();
         g_fmProgress = null;
     }
     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;
     }
 }
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            if (intUDTuThang.Value <= 0 || intUDTuThang.Value > 12 || (intUDDenThang.Value <= 0) || (intUDDenThang.Value > 12))
            {
                MessageBox.MessageBoxBA msgDialog = new Taxi.MessageBox.MessageBoxBA();
                msgDialog.Show(this, "Bạn phải nhập tháng trong khoảng [1..12].", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning);
                return;
            }

            if (intUDTuThang.Value > intUDDenThang.Value)
            {
                MessageBox.MessageBoxBA msgDialog = new Taxi.MessageBox.MessageBoxBA();
                msgDialog.Show(this, "Bạn phải nhập [Từ tháng] nhỏ hơn hoặc bằng [Đến tháng].", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning);
                return;
            }
            if (ddlNam.Text.Length < 4)
            {
                MessageBox.MessageBoxBA msgDialog = new Taxi.MessageBox.MessageBoxBA();
                msgDialog.Show(this, "Bạn phải nhập phải nhập dữ liệu năm.", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Warning);
                return;
            }
            else
            {
                g_Nam = int.Parse(ddlNam.Text);
            }
            // Create a background thread
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork             += bw_DoWork;
            bw.RunWorkerCompleted += 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
            {
                if (m_fmProgress == null)
                {
                    m_fmProgress = new fmProgress();
                }
                m_fmProgress.ShowDialog(this);
                m_fmProgress = null;
            }
            catch (Exception ex)
            {
            }
            SetUnActiveRefreshButton();
        }
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            if (!TimKiem_BaoCao.CheckTuNgayDenNgay(calTuNgay.Value, calDenNgay.Value))
            {
                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);
                return;
            }
            //Dùng backgroundworker để chia nhỏ dữ liệu lấy lên!
            BackgroundWorker bwWorker = new BackgroundWorker();

            bwWorker.DoWork             += bwWorker_DoWork;
            bwWorker.RunWorkerCompleted += bwWorker_Completed;
            _frmProgress = new fmProgress();
            bwWorker.RunWorkerAsync();
            // Lock up the UI with this modal progress form.
            try
            {
                _frmProgress.ShowDialog(this);
                _frmProgress = null;
                this.Activate();
                this.MinimizeBox = false;

                btnRefresh.Enabled     = false;
                btnExportExcel.Enabled = !btnRefresh.Enabled;
                if (!_blHaveData)
                {
                    new MessageBox.MessageBoxBA().Show("Không tìm thấy dữ liệu báo cáo!", "Thông báo", MessageBox.MessageBoxButtonsBA.OK, MessageBox.MessageBoxIconBA.Information);
                    _dtData     = new DataTable();
                    _dtBinhQuan = new DataTable();
                    griTongCuocGoiDen.DataMember = "ListDienThoai";
                    griTongCuocGoiDen.SetDataBinding(_dtData, "ListDienThoai");
                    // Su dung ID de lay phan binh quan voi id nay
                    gridBinhQuan.DataMember = "ListBQ";
                    gridBinhQuan.SetDataBinding(_dtBinhQuan, "ListBQ");
                }
            }
            catch (Exception ex)
            {
                new MessageBox.MessageBoxBA().Show(ex.ToString(), "Thông báo", MessageBox.MessageBoxButtonsBA.OK, MessageBox.MessageBoxIconBA.Error);
            }
        }
        protected override object GetData()
        {
            BackgroundWorker bwWorker = new BackgroundWorker();

            bwWorker.DoWork             += bwWorker_DoWork;
            bwWorker.RunWorkerCompleted += bwWorker_Completed;
            _frmProgress = new fmProgress();
            bwWorker.RunWorkerAsync();
            try
            {
                _frmProgress.ShowDialog(this);
                _frmProgress = null;
                this.Activate();
                this.MinimizeBox = false;
            }
            catch (Exception ex)
            {
                new Taxi.MessageBox.MessageBoxBA().Show(ex.ToString(), "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
            }

            return(_dataTable);
        }
        protected override object GetData()
        {
            //Dùng backgroundworker để chia nhỏ dữ liệu lấy lên giao diện!
            BackgroundWorker bwWorker = new BackgroundWorker();

            bwWorker.DoWork             += bwWorker_DoWork;
            bwWorker.RunWorkerCompleted += bwWorker_Completed;
            _frmProgress = new fmProgress();
            bwWorker.RunWorkerAsync();
            //Lock up the UI with this modal progress form.
            try
            {
                _frmProgress.ShowDialog(this);
                _frmProgress = null;
                this.Activate();
                this.MinimizeBox = false;
            }
            catch (Exception ex)
            {
                new Taxi.MessageBox.MessageBoxBA().Show(ex.ToString(), "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Error);
            }

            return(_dataTable);
        }
Пример #13
0
        private void simpleButtonOK_Click(object sender, System.EventArgs e)
        {
            if (lkpEdtPromotionCode.EditValue == null || lkpEdtPromotionCode.Text == "")
            {
                return;
            }

            int nPromotionTypeID = (int)lkpEdtPromotionCode.GetColumnValue("nPromotionTypeID");

            if (lkpEdtPromotionCode.EditValue != null && ValidatePackageQty())
            {
                // free Product
                //if (nPromotionTypeID == 1)
                //{
                ACMS.XtraUtils.GridViewUtils.UpdateData(gridView2);
                if (gridControl2.DataSource != null)
                {
                    DataRow[] rowList = ((DataTable)gridControl2.DataSource).Select("Checked = true");


                    if (rowList.Length > 0)
                    {
                        ValidateFreebieQty();



                        if (!myIsFinishLoadStockRecon)
                        {
                            connectionString = (string)ConfigurationSettings.AppSettings["Main.ConnectionString"];
                            connection       = new SqlConnection(connectionString);

                            // StartProgressBar

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

                            m_fmProgress = new fmProgress();
                            bw.RunWorkerAsync();
                            m_fmProgress.ShowDialog(this);
                            m_fmProgress = null;

                            //StartProgressBar
                            myIsFinishLoadStockRecon = true;
                        }
                        myPOS.NewBillReceiptFreebies(rowList, lkpEdtPromotionCode.EditValue.ToString(), false);
                    }
                }
                //}
                //else
                //{
                ACMS.XtraUtils.GridViewUtils.UpdateData(gridView1);

                if (gridControl1.DataSource != null)
                {
                    DataRow[] rowList1 = ((DataTable)gridControl1.DataSource).Select("Checked = true");

                    if (rowList1.Length > 0)
                    {
                        myPOS.NewBillReceiptFreebies(rowList1, lkpEdtPromotionCode.EditValue.ToString(), true);
                    }
                }
                //}
            }
        }
        private void simpleButtonOK_Click(object sender, System.EventArgs e)
        {
            ValidatePackageQty();

            myDataRow["strReferenceNo"] = txtEdtRefNo.Text;

            int nPromotionTypeID = -1;

            if (lkpEdtItemFreebiePromotionCode.EditValue != null && lkpEdtItemFreebiePromotionCode.Text.Length > 0)
            {
                nPromotionTypeID = (int)lkpEdtItemFreebiePromotionCode.GetColumnValue("nPromotionTypeID");
            }

            if (nPromotionTypeID == -1 && lkpEdtDiscount.EditValue != null && lkpEdtDiscount.Text.Length > 0)
            {
                myPOS.EditItemFreebieAndDiscount(myDataRow, null, "", lkpEdtDiscount.Text, true);
            }
            //else
            if (nPromotionTypeID == 1)
            {
                // free Product
                ACMS.XtraUtils.GridViewUtils.UpdateData(gridView2);
                if (gridControl2.DataSource != null)
                {
                    DataRow[] rowList = ((DataTable)gridControl2.DataSource).Select("Checked = true");

                    if (rowList.Length == 0)
                    {
                        MessageBox.Show(this, "Please select a product.");
                        this.DialogResult = DialogResult.None;
                        return;
                    }
                    else
                    {
                        if (!myIsFinishLoadStockRecon)
                        {
                            connectionString = (string)ConfigurationSettings.AppSettings["Main.ConnectionString"];
                            connection       = new SqlConnection(connectionString);

                            // StartProgressBar

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

                            m_fmProgress = new fmProgress();
                            bw.RunWorkerAsync();
                            m_fmProgress.ShowDialog(this);
                            m_fmProgress = null;

                            //StartProgressBar
                            myIsFinishLoadStockRecon = true;
                        }

                        myPOS.EditItemFreebieAndDiscount(myDataRow, rowList, lkpEdtItemFreebiePromotionCode.Text, lkpEdtDiscount.Text, false);
                    }
                }
            }
            ValidateFreebieQty();

            {
                ACMS.XtraUtils.GridViewUtils.UpdateData(gridView1);

                if (gridControl1.DataSource != null)
                {
                    DataRow[] rowList = ((DataTable)gridControl1.DataSource).Select("Checked = true");

                    myPOS.EditItemFreebieAndDiscount(myDataRow, rowList, lkpEdtItemFreebiePromotionCode.Text, lkpEdtDiscount.Text, true);
                }
            }
        }
        private void simpleButtonOK_Click(object sender, System.EventArgs e)
        {
            ValidatePackageQty();

            myDataRow["strReferenceNo"] = txtEdtRefNo.Text;

            int nPromotionTypeID = -1;

            if (lkpEdtItemFreebiePromotionCode.EditValue != null && lkpEdtItemFreebiePromotionCode.Text.Length > 0)
                nPromotionTypeID = (int)lkpEdtItemFreebiePromotionCode.GetColumnValue("nPromotionTypeID");

            if (nPromotionTypeID == -1 && lkpEdtDiscount.EditValue != null && lkpEdtDiscount.Text.Length > 0)
            {
                myPOS.EditItemFreebieAndDiscount(myDataRow, null, "", lkpEdtDiscount.Text, true);
            }
            //else
             if (nPromotionTypeID == 1)
            {
                // free Product
                ACMS.XtraUtils.GridViewUtils.UpdateData(gridView2);
                if (gridControl2.DataSource != null)
                {
                    DataRow[]  rowList = ((DataTable)gridControl2.DataSource).Select("Checked = true");

                    if (rowList.Length == 0)
                    {
                        MessageBox.Show(this, "Please select a product.");
                        this.DialogResult = DialogResult.None;
                        return;
                    }
                    else
                    {

                        if (!myIsFinishLoadStockRecon)
                        {
                            connectionString = (string)ConfigurationSettings.AppSettings["Main.ConnectionString"];
                            connection = new SqlConnection(connectionString);

                            // StartProgressBar

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

                            m_fmProgress = new fmProgress();
                            bw.RunWorkerAsync();
                            m_fmProgress.ShowDialog(this);
                            m_fmProgress = null;

                            //StartProgressBar
                            myIsFinishLoadStockRecon = true;
                        }

                        myPOS.EditItemFreebieAndDiscount(myDataRow, rowList, lkpEdtItemFreebiePromotionCode.Text, lkpEdtDiscount.Text, false);
                    }
                }
            }
            ValidateFreebieQty();

            {
                ACMS.XtraUtils.GridViewUtils.UpdateData(gridView1);

                if (gridControl1.DataSource != null)
                {
                    DataRow[] rowList = ((DataTable)gridControl1.DataSource).Select("Checked = true");

                    myPOS.EditItemFreebieAndDiscount(myDataRow, rowList, lkpEdtItemFreebiePromotionCode.Text, lkpEdtDiscount.Text, true);

                }
            }
        }
Пример #16
0
        private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // SqlHelper.ExecuteNonQuery(connection, "dw_sp_SCStockRecon");

            // 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)
            {
                MessageBox.Show(e.Error.Message);
                return;
            }

            // Check to see if the background process was cancelled.
            if (e.Cancelled)
            {
                MessageBox.Show("Processing cancelled.");
                return;
            }

            // Everything completed normally.
            // process the response using e.Result
            //   MessageBox.Show("Processing is complete.");
        }
Пример #17
0
        private void simpleButtonOK_Click(object sender, System.EventArgs e)
        {
            if (lkpEdtPromotionCode.EditValue == null || lkpEdtPromotionCode.Text == "") return;

            int nPromotionTypeID = (int)lkpEdtPromotionCode.GetColumnValue("nPromotionTypeID");

            if (lkpEdtPromotionCode.EditValue != null && ValidatePackageQty())
            {
                // free Product
                //if (nPromotionTypeID == 1)
                //{
                    ACMS.XtraUtils.GridViewUtils.UpdateData(gridView2);
                    if (gridControl2.DataSource != null)
                    {
                        DataRow[]  rowList = ((DataTable)gridControl2.DataSource).Select("Checked = true");

                        if (rowList.Length > 0)
                        {
                            ValidateFreebieQty();

                            if (!myIsFinishLoadStockRecon)
                            {
                                connectionString = (string)ConfigurationSettings.AppSettings["Main.ConnectionString"];
                                connection = new SqlConnection(connectionString);

                                // StartProgressBar

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

                                m_fmProgress = new fmProgress();
                                bw.RunWorkerAsync();
                                m_fmProgress.ShowDialog(this);
                                m_fmProgress = null;

                                //StartProgressBar
                                myIsFinishLoadStockRecon = true;
                            }
                            myPOS.NewBillReceiptFreebies(rowList, lkpEdtPromotionCode.EditValue.ToString(), false);
                        }

                    }
                //}
                //else
                //{
                    ACMS.XtraUtils.GridViewUtils.UpdateData(gridView1);

                    if (gridControl1.DataSource != null)
                    {
                        DataRow[] rowList1 = ((DataTable)gridControl1.DataSource).Select("Checked = true");

                        if (rowList1.Length > 0)
                            myPOS.NewBillReceiptFreebies(rowList1, lkpEdtPromotionCode.EditValue.ToString(), true);
                    }
                //}
            }
        }