private void btReference_Click(object sender, EventArgs e)
        {
            string MESSAGE_TYPE = tbMsg.Text.Trim();
                string CARD_NUMBER = tbCardNbr.Text.Trim();
                string TRACE_AUDIT_NUMBER = tbTrace.Text.Trim();
                string REFERENCE_NUMBER = tbReference.Text.Trim();
                string PROCESSING_CODE = tbProcessingCode.Text.Trim();
                string TRANSACTION_AMOUNT = tbTxnAmount.Text.Trim().Replace(",", "");//.Replace(".", "");
                string CODE_ACTION = tbCodeAction.Text.Trim();
                string TRANSACTION_LOCAL_DATE = tbTxnDate.Text.Trim();

                //string sql = "", err = "";
                if (check_process(MESSAGE_TYPE, CARD_NUMBER, TRACE_AUDIT_NUMBER, REFERENCE_NUMBER, PROCESSING_CODE, TRANSACTION_AMOUNT, CODE_ACTION, TRANSACTION_LOCAL_DATE) == true)
                {
                    Frm_Transactions_Monitor_Update a = new Frm_Transactions_Monitor_Update();
                    a.type = "1";
                    a.message_type = MESSAGE_TYPE;
                    a.card_nbr = CARD_NUMBER;// dgv_trans["", dgv_trans.CurrentCell.RowIndex].Value.ToString();
                    a.trace = TRACE_AUDIT_NUMBER;
                    a.reference = REFERENCE_NUMBER;
                    a.trans_amount = TRANSACTION_AMOUNT;
                    a.processing_code = PROCESSING_CODE;
                    a.code_action = CODE_ACTION;
                    a.trans_date = TRANSACTION_LOCAL_DATE;
                    // a.card_accept_ID = CARD_ACCEPTOR_TERM_ID;
                    a.ShowDialog();

                }
                else
                {
                    MessageBox.Show("Không có giao dịch hoặc giao dịch này chưa được xử lý.");
                    return;
                }
        }
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dgv_trans.Rows.Count == 0)
            {
                MessageBox.Show("Please choose 1 row for editing");
                return;
            }
            if (dgv_trans.Rows.Count > 0)
            {

                string MESSAGE_TYPE = dgv_trans["MESSAGE_TYPE", dgv_trans.CurrentCell.RowIndex].Value.ToString().Trim();
                string CARD_NUMBER = dgv_trans["CARD_NUMBER", dgv_trans.CurrentCell.RowIndex].Value.ToString().Trim();
                string TRACE_AUDIT_NUMBER = dgv_trans["TRACE_AUDIT_NUMBER", dgv_trans.CurrentCell.RowIndex].Value.ToString().Trim();
                string REFERENCE_NUMBER = dgv_trans["REFERENCE_NUMBER", dgv_trans.CurrentCell.RowIndex].Value.ToString().Trim();
                string PROCESSING_CODE = dgv_trans["PROCESSING_CODE", dgv_trans.CurrentCell.RowIndex].Value.ToString().Trim();
                string TRANSACTION_AMOUNT = dgv_trans["TRANSACTION_AMOUNT", dgv_trans.CurrentCell.RowIndex].Value.ToString().Trim();
                string TRANSACTION_CURRENCY = dgv_trans["TRANSACTION_CURRENCY", dgv_trans.CurrentCell.RowIndex].Value.ToString().Trim();
                string BILLING_AMOUNT = dgv_trans["BILLING_AMOUNT", dgv_trans.CurrentCell.RowIndex].Value.ToString().Trim();
                string BILLING_CURRENCY = "704";//dgv_trans["BILLING_CURRENCY", dgv_trans.CurrentCell.RowIndex].Value.ToString().Trim();
                string AUTHORIZATION_CODE = dgv_trans["AUTHORIZATION_CODE", dgv_trans.CurrentCell.RowIndex].Value.ToString().Trim();
                string CODE_ACTION = dgv_trans["CODE_ACTION", dgv_trans.CurrentCell.RowIndex].Value.ToString().Trim();
                string TRANSACTION_LOCAL_DATE = dgv_trans["TRANSACTION_LOCAL_DATE", dgv_trans.CurrentCell.RowIndex].Value.ToString().Trim();
                string CARD_ACCEPTOR_TERM_ID = dgv_trans["CARD_ACCEPTOR_TERM_ID", dgv_trans.CurrentCell.RowIndex].Value.ToString().Trim();
                string NOTE = "";
                Frm_Transactions_Monitor_Update a = new Frm_Transactions_Monitor_Update();
                a.type = "0";
                //string sql = "", err = "";
                if (check_process(MESSAGE_TYPE, CARD_NUMBER, TRACE_AUDIT_NUMBER, REFERENCE_NUMBER, PROCESSING_CODE, TRANSACTION_AMOUNT, TRANSACTION_CURRENCY, BILLING_AMOUNT, BILLING_CURRENCY, AUTHORIZATION_CODE, CODE_ACTION, TRANSACTION_LOCAL_DATE, CARD_ACCEPTOR_TERM_ID, NOTE) == true)
                {
                    #region 2014-11-13 (2) get_user_mofidy_info
                    string info = get_user_mofidy_info(MESSAGE_TYPE, CARD_NUMBER, TRACE_AUDIT_NUMBER, REFERENCE_NUMBER, PROCESSING_CODE, TRANSACTION_AMOUNT, TRANSACTION_CURRENCY, BILLING_AMOUNT, BILLING_CURRENCY, AUTHORIZATION_CODE, CODE_ACTION, TRANSACTION_LOCAL_DATE, CARD_ACCEPTOR_TERM_ID, NOTE);
                    if (MessageBox.Show("Giao dịch này đã được xử lý bởi " + info + ". Bạn có muốn kiểm tra lại?", "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    #endregion 2014-11-13 (2) get_user_mofidy_info
                    //if (MessageBox.Show("Giao dịch này đã được xử lý. Bạn có muốn kiểm tra lại?", "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                    a.type = "1";
                }
                else
                {
                    a.type = "0";
                }
                a.message_type = MESSAGE_TYPE;
                a.card_nbr = CARD_NUMBER;// dgv_trans["", dgv_trans.CurrentCell.RowIndex].Value.ToString();
                a.trace = TRACE_AUDIT_NUMBER;
                a.reference = REFERENCE_NUMBER;
                a.trans_amount = TRANSACTION_AMOUNT;
                a.processing_code = PROCESSING_CODE;
                a.code_action = CODE_ACTION;
                a.trans_date = TRANSACTION_LOCAL_DATE;
                a.card_accept_ID = CARD_ACCEPTOR_TERM_ID;
                a.ShowDialog();
                loadData();
            }
            else
                return;
        }