Пример #1
0
        private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // 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.");
        }
Пример #2
0
        private void AddNewItem()
        {
            if (myPOS.NCategoryID == 1 || myPOS.NCategoryID == 2 ||
                myPOS.NCategoryID == 3 || myPOS.NCategoryID == 4 ||
                myPOS.NCategoryID == 5 || myPOS.NCategoryID == 6 ||
                myPOS.NCategoryID == 7 || myPOS.NCategoryID == 8 ||
                myPOS.NCategoryID == 9 || myPOS.NCategoryID == 11 ||
                myPOS.NCategoryID == 12 || myPOS.NCategoryID == 14 ||
                myPOS.NCategoryID == 36 || myPOS.NCategoryID == 37 ||
                myPOS.NCategoryID == 23 || myPOS.NCategoryID == 24)
            {

                if (myPOS.NCategoryID == 11 || myPOS.NCategoryID == 12)
                {

                    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;
                    }
                }

                ACMSPOS2.FormAddCreditPackage form = new ACMS.ACMSPOS2.FormAddCreditPackage(myPOS);

                form.ShowDialog(this);
                if (myPOS.ReceiptItemsTable.Rows.Count > 0)
                {
                    if (myPOS.ReceiptItemsTable.Rows[myPOS.ReceiptItemsTable.Rows.Count - 1]["strCode"].ToString() == "ADMIN")
                        gridColumnListPrice.OptionsColumn.AllowEdit = true;
                }
            }
        }