public Response do3B_BatchProcess()
        {
            DateTime run_date   = DateTime.Now;
            string   strMessage = "";

            using (TransactionScope dbTxn = new TransactionScope())
            {
                try
                {
                    RECEIPT_DETAILS oRCP = new RECEIPT_DETAILS(Properties.Settings.Default.MyConnection);
                    DataTable       dtReceiptDetail_Customer = oRCP.getUncompleteReceiptDetail();
                    for (int i = 0; i < dtReceiptDetail_Customer.Rows.Count; i++)
                    {
                        string       COMPANY_NO_BOXES = (dtReceiptDetail_Customer.Rows[i]["COMPANIES"] == null ? "" : dtReceiptDetail_Customer.Rows[i]["COMPANIES"].ToString());
                        INVOICE_INFO oInv             = new INVOICE_INFO(Properties.Settings.Default.MyConnection);
                        DataTable    dtInvoice        = oInv.getInvoiceByCustomer(COMPANY_NO_BOXES);

                        int SEQ_NO = 0;
                        int.TryParse((dtReceiptDetail_Customer.Rows[i]["SEQ_NO"] == null ? "" : dtReceiptDetail_Customer.Rows[i]["SEQ_NO"].ToString()), out SEQ_NO);

                        lstReserveInfo   = new List <BOL_RESERVE_INFO>();
                        lstReceiptDetail = new List <BOL_RECEIPT_DETAILS>();
                        lstInvoiceInfo   = new List <BOL_INVOICE_INFO>();
                        if (dtInvoice.Rows.Count > 0)
                        {
                            PrepareDataForUpdate(dtReceiptDetail_Customer.Rows[i], dtInvoice, run_date);
                        }

                        BOL_RECEIPT_DETAILS oRECEIPT_DETAILS = new BOL_RECEIPT_DETAILS();
                        oRECEIPT_DETAILS.PAYMENT_DAY = run_date;
                        oRECEIPT_DETAILS.SEQ_NO      = SEQ_NO;
                        oRCP.UpdatePaymentDay(oRECEIPT_DETAILS, out strMessage);
                    }
                    dbTxn.Complete();
                    if (strMessage != "")
                    {
                        response.Status = 0;
                    }
                    else
                    {
                        response.Status = 1;
                    }
                    response.Message = strMessage;
                    return(response);
                }
                catch (Exception ex)
                {
                    response.Status  = 0;
                    response.Message = ex.Message + "\n" + ex.StackTrace;
                    dbTxn.Dispose();
                    return(response);
                }
            }
        }
        public Response ManualAllocation(string COMPANY_NO_BOX, string YEAR_MONTH)
        {
            DateTime run_date   = DateTime.Now;
            string   strMessage = "";

            using (TransactionScope dbTxn = new TransactionScope())
            {
                try
                {
                    //to return matched SEQ_NO
                    DataTable Matched = new DataTable();
                    Matched.Columns.Add("Matched");

                    //GET uncompleted RECEIPT_DETAILS
                    RECEIPT_DETAILS oRCP = new RECEIPT_DETAILS(Properties.Settings.Default.MyConnection);
                    DataTable       dtReceiptDetail_Customer = oRCP.getUncompleteReceiptDetail();
                    for (int i = 0; i < dtReceiptDetail_Customer.Rows.Count; i++)
                    {
                        string       COMPANY_NO_BOXES = (dtReceiptDetail_Customer.Rows[i]["COMPANIES"] == null ? "" : dtReceiptDetail_Customer.Rows[i]["COMPANIES"].ToString());
                        INVOICE_INFO oInv             = new INVOICE_INFO(Properties.Settings.Default.MyConnection);

                        if (COMPANY_NO_BOXES.Contains(COMPANY_NO_BOX)) //IF there is matched COMPANY_NO_BOX
                        {
                            DataTable dtInvoice = oInv.getInvoiceByCustomerManualAllocate("'" + COMPANY_NO_BOX + "'", "'" + YEAR_MONTH + "'");

                            if (dtInvoice.Rows.Count > 0)
                            {
                                lstReserveInfo   = new List <BOL_RESERVE_INFO>();
                                lstReceiptDetail = new List <BOL_RECEIPT_DETAILS>();
                                lstInvoiceInfo   = new List <BOL_INVOICE_INFO>();

                                PrepareDataForUpdate(dtReceiptDetail_Customer.Rows[i], dtInvoice, run_date);
                                DataRow dr = Matched.NewRow();
                                dr["Matched"] = dtReceiptDetail_Customer.Rows[i]["SEQ_NO"];
                                Matched.Rows.Add(dr);
                            }
                        }
                    }
                    dbTxn.Complete();//commit changes

                    response.Data = Utility.Utility_Component.DtToJSon(Matched, "Matched");

                    if (strMessage != "")
                    {
                        response.Status = 0;
                    }
                    else
                    {
                        response.Status = 1;
                    }
                    response.Message = strMessage;
                    return(response);
                }
                catch (Exception ex)
                {
                    response.Status  = 0;
                    response.Message = ex.Message + "\n" + ex.StackTrace;
                    dbTxn.Dispose();
                    return(response);
                }
            }
        }