public Response AllocationManualCompletion(bool ALLOCATE, int SEQ_NO, string COMPANY_NO_BOX, string YEAR_MONTH, string RECEIPT_ALLOCATION_DATE, string INVOICE_ALLOCATION_DATE) { DateTime run_date = DateTime.Now; string strMessage = ""; using (TransactionScope dbtnx = new TransactionScope()) { try { RECEIPT_DETAILS oRCP = new RECEIPT_DETAILS(Properties.Settings.Default.MyConnection); INVOICE_INFO oInv = new INVOICE_INFO(Properties.Settings.Default.MyConnection); if (ALLOCATE) { if (string.IsNullOrEmpty(RECEIPT_ALLOCATION_DATE)) { oRCP.UpdateAllocation(SEQ_NO, 3, run_date, out strMessage); } if (string.IsNullOrEmpty(strMessage) && string.IsNullOrEmpty(INVOICE_ALLOCATION_DATE)) { oInv.UpdateAllocation(COMPANY_NO_BOX, YEAR_MONTH, 3, run_date, out strMessage); } } else { if (!string.IsNullOrEmpty(RECEIPT_ALLOCATION_DATE)) { oRCP.UpdateAllocation(SEQ_NO, 1, null, out strMessage); } if (string.IsNullOrEmpty(strMessage) && !string.IsNullOrEmpty(INVOICE_ALLOCATION_DATE)) { oInv.UpdateAllocation(COMPANY_NO_BOX, YEAR_MONTH, 1, null, out strMessage); } } if (!string.IsNullOrEmpty(strMessage)) { response.Status = 0; } else { dbtnx.Complete(); response.Status = 1; } response.Message = strMessage; return(response); } catch (Exception ex) { response.Status = 0; response.Message = ex.Message + "\n" + ex.StackTrace; return(response); } } }
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 do3A_BatchProcess() { using (TransactionScope dbTxn = new TransactionScope()) { try { convertDataToDataTable(_UploadData); seperateAmigo_NonAmigo(); string strMessage = ""; for (int i = 0; i < lstAmigo.Count; i++) { strMessage = ""; RECEIPT_DETAILS oDetail = new RECEIPT_DETAILS(Properties.Settings.Default.MyConnection); if (oDetail.GetDataByDuplicateKeys(lstAmigo[i], out strMessage).Rows.Count <= 0) { oDetail.insert(lstAmigo[i], out strMessage); } } for (int i = 0; i < lstNonAmigo.Count; i++) { strMessage = ""; RECEIPT_DETAILS_NON_AMIGO oDetail = new RECEIPT_DETAILS_NON_AMIGO(Properties.Settings.Default.MyConnection); if (oDetail.GetDataByDuplicateKeys(lstNonAmigo[i], out strMessage).Rows.Count <= 0) { oDetail.insert(lstNonAmigo[i], out strMessage); } } if (strMessage == "") { dbTxn.Complete(); response.Status = 1; } else { dbTxn.Dispose(); response.Status = 0; } return(response); } catch (Exception ex) { response.Status = 0; response.Message = ex.Message + "\n" + ex.StackTrace; dbTxn.Dispose(); return(response); } } }
public Response ConvertAmigoToNoAmigo(string strData) { try { string strMessage = ""; DataTable dtAmigo = Utility.Utility_Component.JsonToDt(strData); for (int i = 0; i < dtAmigo.Rows.Count; i++) { int intSEQNO = int.Parse(dtAmigo.Rows[i]["SEQNO"] == null ? "0" : dtAmigo.Rows[i]["SEQNO"].ToString()); RECEIPT_DETAILS_NON_AMIGO oRecpNonAmigo = new RECEIPT_DETAILS_NON_AMIGO(Properties.Settings.Default.MyConnection); RECEIPT_DETAILS oRecpAmigo = new RECEIPT_DETAILS(Properties.Settings.Default.MyConnection); oRecpNonAmigo.ConvertFromAmigoToNonAmigo(intSEQNO, out strMessage); if (strMessage == "") { oRecpAmigo.removeAmigo(intSEQNO, out strMessage); } } if (strMessage != "") { response.Status = 0; response.Message = strMessage; } else { response.Status = 1; response.Message = "Successfully converted."; } return(response); } catch (Exception ex) { response.Status = 0; response.Message = ex.Message + "\n" + ex.StackTrace; return(response); } }
public Response GetDataGridfor31(string strFrom, string stringTo) { try { DateTime dtmFrom = DateTime.ParseExact(strFrom, "yyyyMMdd", CultureInfo.InvariantCulture); DateTime dtmTo = DateTime.ParseExact(stringTo, "yyyyMMdd", CultureInfo.InvariantCulture); RECEIPT_DETAILS oRecpt = new RECEIPT_DETAILS(Properties.Settings.Default.MyConnection); string strMessage = ""; DataTable dt = oRecpt.GetDateFor31_Grid(dtmFrom, dtmTo, out strMessage); response.Data = Utility.Utility_Component.DtToJSon(dt, "31Result"); if (dt.Rows.Count > 0) { response.Status = 1; } else { if (strMessage == "") { response.Status = 1; response.Message = "There is no data to display."; } else { response.Status = 0; response.Message = strMessage; } } return(response); } catch (Exception ex) { response.Status = 0; response.Message = ex.Message + "\n" + ex.StackTrace; return(response); } }
private void PrepareDataForUpdate(DataRow dtReceiptDetail_Customer, DataTable dtBatch_Invoice, DateTime run_date) { decimal ALLOCATED_MONEY = 0; decimal.TryParse((dtReceiptDetail_Customer["ALLOCATED_MONEY"] == null ? "" : dtReceiptDetail_Customer["ALLOCATED_MONEY"].ToString()), out ALLOCATED_MONEY); decimal DEPOSIT_AMOUNT = 0; decimal.TryParse((dtReceiptDetail_Customer["DEPOSIT_AMOUNT"] == null ? "" : dtReceiptDetail_Customer["DEPOSIT_AMOUNT"].ToString()), out DEPOSIT_AMOUNT); decimal decAvailableAmount = DEPOSIT_AMOUNT - ALLOCATED_MONEY; int SEQ_NO = 0; int.TryParse((dtReceiptDetail_Customer["SEQ_NO"] == null ? "" : dtReceiptDetail_Customer["SEQ_NO"].ToString()), out SEQ_NO); DateTime DEPOSIT_DATE; DateTime.TryParse((dtReceiptDetail_Customer["DEPOSIT_AMOUNT"] == null ? "" : dtReceiptDetail_Customer["DEPOSIT_DATE"].ToString()), out DEPOSIT_DATE); int ALLOCATED_QUANTITY = 0; int.TryParse((dtReceiptDetail_Customer["ALLOCATED_QUANTITY"] == null ? "" : dtReceiptDetail_Customer["ALLOCATED_QUANTITY"].ToString()), out ALLOCATED_QUANTITY); decimal CalculateForType = 0; if (decAvailableAmount != 0) { BOL_RECEIPT_DETAILS oRECEIPT_DETAILS = new BOL_RECEIPT_DETAILS(); oRECEIPT_DETAILS.ALLOCATED_QUANTITY = ALLOCATED_QUANTITY; oRECEIPT_DETAILS.ALLOCATED_MONEY = ALLOCATED_MONEY; //20201117_追加_ALLOCATED_MONEYを初期値でセット #region Prepare Invoice, Reserve Info and Receipt Detail for (int i = 0; i < dtBatch_Invoice.Rows.Count; i++) { //BILL PRICE decimal BILL_PRICE = 0; decimal.TryParse((dtBatch_Invoice.Rows[i]["BILL_PRICE"] == null ? "" : dtBatch_Invoice.Rows[i]["BILL_PRICE"].ToString()), out BILL_PRICE); //ALLOCATATION TOTAL AMOUNT calculate decimal ALLOCATION_TOTAL_AMOUNT = 0; decimal.TryParse((dtBatch_Invoice.Rows[i]["ALLOCATION_TOTAL_AMOUNT"] == null ? "" : dtBatch_Invoice.Rows[i]["ALLOCATION_TOTAL_AMOUNT"].ToString()), out ALLOCATION_TOTAL_AMOUNT); //BILL TRANSFER FEE decimal BILL_TRANSFER_FEE = 0; decimal.TryParse((dtBatch_Invoice.Rows[i]["BILL_TRANSFER_FEE"] == null ? "" : dtBatch_Invoice.Rows[i]["BILL_TRANSFER_FEE"].ToString()), out BILL_TRANSFER_FEE); string strYear_Month = (dtBatch_Invoice.Rows[i]["YEAR_MONTH"] == null ? "" : dtBatch_Invoice.Rows[i]["YEAR_MONTH"].ToString()); string strCompanyNoBox = (dtBatch_Invoice.Rows[i]["COMPANY_NO_BOX"] == null ? "" : dtBatch_Invoice.Rows[i]["COMPANY_NO_BOX"].ToString()); CalculateForType = BILL_PRICE - ALLOCATION_TOTAL_AMOUNT + BILL_TRANSFER_FEE; CalculateForType = (CalculateForType < 0 ? CalculateForType * -1 : CalculateForType); BOL_RESERVE_INFO oRESERVE_INFO = new BOL_RESERVE_INFO(); BOL_INVOICE_INFO oInvoiceInfo = new BOL_INVOICE_INFO(); if (decAvailableAmount >= CalculateForType) //Type A { //Prepare Update For Invoice oInvoiceInfo.ALLOCATION_TOTAL_AMOUNT = ALLOCATION_TOTAL_AMOUNT + CalculateForType; oInvoiceInfo.ALLOCATED_COMPLETION_DATE = run_date; oInvoiceInfo.YEAR_MONTH = strYear_Month; oInvoiceInfo.COMPANY_NO_BOX = strCompanyNoBox; oInvoiceInfo.TYPE_OF_ALLOCATION = 1; oInvoiceInfo.STATUS_ACTUAL_DEPOSIT_YYMM = DEPOSIT_DATE.ToString("yyMM"); oInvoiceInfo.STATUS_ACTUAL_DEPOSIT_DATE = DEPOSIT_DATE.ToString("yyyy-MM-dd"); lstInvoiceInfo.Add(oInvoiceInfo); //Prepare Insert For Reserve Info oRESERVE_INFO.SEQ_NO = SEQ_NO; oRESERVE_INFO.BILLING_CODE = strCompanyNoBox + strYear_Month; oRESERVE_INFO.PAYMENT_DAY = run_date; oRESERVE_INFO.TYPE_OF_ALLOCATION = 1; oRESERVE_INFO.RESERVE_AMOUNT = CalculateForType; oRESERVE_INFO.DIFF_ALLOCATION_AMOUNT = decAvailableAmount - CalculateForType; lstReserveInfo.Add(oRESERVE_INFO); //Prepare Update for receipt detail oRECEIPT_DETAILS.ALLOCATED_MONEY += CalculateForType; if (DEPOSIT_AMOUNT == oRECEIPT_DETAILS.ALLOCATED_MONEY) { oRECEIPT_DETAILS.ALLOCATED_COMPLETION_DATE = run_date; } oRECEIPT_DETAILS.SEQ_NO = SEQ_NO; oRECEIPT_DETAILS.PAYMENT_DAY = run_date; oRECEIPT_DETAILS.TYPE_OF_ALLOCATION = 1; oRECEIPT_DETAILS.ALLOCATED_QUANTITY += 1; lstReceiptDetail.Add(oRECEIPT_DETAILS); decAvailableAmount = decAvailableAmount - CalculateForType; } else if (decAvailableAmount < CalculateForType) //Type B { //Prepare Update For Invoice Info oInvoiceInfo.ALLOCATION_TOTAL_AMOUNT = ALLOCATION_TOTAL_AMOUNT + decAvailableAmount; if (CalculateForType == 0) { oInvoiceInfo.ALLOCATED_COMPLETION_DATE = run_date; } oInvoiceInfo.YEAR_MONTH = strYear_Month; oInvoiceInfo.COMPANY_NO_BOX = strCompanyNoBox; oInvoiceInfo.TYPE_OF_ALLOCATION = 1; oInvoiceInfo.STATUS_ACTUAL_DEPOSIT_YYMM = DEPOSIT_DATE.ToString("yyMM"); oInvoiceInfo.STATUS_ACTUAL_DEPOSIT_DATE = DEPOSIT_DATE.ToString("yyyy-MM-dd"); lstInvoiceInfo.Add(oInvoiceInfo); //Prepare Insert For Reserve Info oRESERVE_INFO.SEQ_NO = SEQ_NO; oRESERVE_INFO.BILLING_CODE = strCompanyNoBox + strYear_Month; oRESERVE_INFO.PAYMENT_DAY = run_date; oRESERVE_INFO.TYPE_OF_ALLOCATION = 1; oRESERVE_INFO.RESERVE_AMOUNT = decAvailableAmount; oRESERVE_INFO.DIFF_ALLOCATION_AMOUNT = decAvailableAmount - CalculateForType; lstReserveInfo.Add(oRESERVE_INFO); //Prepare Update for Receipt Detail oRECEIPT_DETAILS.ALLOCATED_COMPLETION_DATE = run_date; oRECEIPT_DETAILS.ALLOCATED_MONEY = DEPOSIT_AMOUNT; oRECEIPT_DETAILS.SEQ_NO = SEQ_NO; oRECEIPT_DETAILS.PAYMENT_DAY = run_date; oRECEIPT_DETAILS.TYPE_OF_ALLOCATION = 1; oRECEIPT_DETAILS.ALLOCATED_QUANTITY += 1; lstReceiptDetail.Add(oRECEIPT_DETAILS); decAvailableAmount = decAvailableAmount - CalculateForType; } ALLOCATED_MONEY += oRECEIPT_DETAILS.ALLOCATED_MONEY; if (oRECEIPT_DETAILS.ALLOCATED_COMPLETION_DATE != null) { break; } } #endregion RECEIPT_DETAILS oRCP = new RECEIPT_DETAILS(Properties.Settings.Default.MyConnection); INVOICE_INFO oInv = new INVOICE_INFO(Properties.Settings.Default.MyConnection); RESERVE_INFO oReseve = new RESERVE_INFO(Properties.Settings.Default.MyConnection); string strMessage = ""; for (int i = 0; i < lstReceiptDetail.Count; i++) { oRCP.UpdateReceipt_Detail(lstReceiptDetail[i], out strMessage); } for (int i = 0; i < lstInvoiceInfo.Count; i++) { oInv.UpdateInvoice_Info(lstInvoiceInfo[i], out strMessage); } for (int i = 0; i < lstReserveInfo.Count; i++) { oReseve.insert(lstReserveInfo[i], out strMessage); } } }
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); } } }
public Response GetAmigoDetailByRunDate(string dtmID) { try { RECEIPT_DETAILS oRecpt = new RECEIPT_DETAILS(Properties.Settings.Default.MyConnection); string strMessage = ""; DataTable dt = oRecpt.GetAmigoDetailByRunDate(dtmID, out strMessage); if (dt.Rows.Count > 0) { response.Status = 1; //add column for BILL_COMPANY_NAME dt.Columns.Add("BILL_COMPANY_NAME", typeof(System.String)); CUSTOMER_MASTER oCustomer = new CUSTOMER_MASTER(Properties.Settings.Default.MyConnection); DataTable dtCustomer = oCustomer.getBillBankAccounts(); for (int i = 0; i < dt.Rows.Count; i++)//loop through Amigo Detail { //Customer Name from Receipt Detail string CustomerName = dt.Rows[i]["CUSTOMER_NAME"] == null ? "" : dt.Rows[i]["CUSTOMER_NAME"].ToString(); //Bill Company Name from Customer Master //Search with Customer Name DataRow result = dtCustomer .AsEnumerable() .Where(myRow => ( (myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-1") == null ? null :myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-1").Trim()) == CustomerName || (myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-2") == null ? null : myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-2").Trim()) == CustomerName || (myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-3") == null ? null : myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-3").Trim()) == CustomerName || (myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-4") == null ? null : myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-4").Trim()) == CustomerName) && myRow.Field <DateTime>("EFFECTIVE_DATE") < DateTime.Now) .OrderByDescending(s => s.Field <DateTime>("EFFECTIVE_DATE")).ThenByDescending(s => s.Field <int>("REQ_SEQ")) .FirstOrDefault(); if (result != null) { //append BILL COMPANY NAME dt.Rows[i]["BILL_COMPANY_NAME"] = result["BILL_COMPANY_NAME"].ToString(); } } } else { if (strMessage == "") { response.Status = 1; response.Message = "There is no data to display."; } else { response.Status = 0; response.Message = strMessage; } } response.Data = Utility.Utility_Component.DtToJSon(dt, "32Result"); return(response); } catch (Exception ex) { response.Status = 0; response.Message = ex.Message + "\n" + ex.StackTrace; return(response); } }
public Response GetDataGridfor36(string strFrom, string stringTo) { try { RECEIPT_DETAILS oRecpt = new RECEIPT_DETAILS(Properties.Settings.Default.MyConnection); string strMessage = ""; DateTime dtmFrom = DateTime.ParseExact(strFrom, "yyyyMMdd", CultureInfo.InvariantCulture); DateTime dtmTo = DateTime.ParseExact(stringTo, "yyyyMMdd", CultureInfo.InvariantCulture); DataTable dt = oRecpt.GetDateFor36_Grid(dtmFrom, dtmTo, out strMessage); if (dt.Rows.Count > 0) { response.Status = 1; //append columns to RECEIPT DETAIL Results dt.Columns.Add("BILL_COMPANY_NAME", typeof(System.String)); dt.Columns.Add("BILL_CONTACT_NAME", typeof(System.String)); dt.Columns.Add("BILL_PHONE_NUMBER", typeof(System.String)); dt.Columns.Add("BILL_MAIL_ADDRESS", typeof(System.String)); //Get Data from CUSTOMER MASTER CUSTOMER_MASTER oCustomer = new CUSTOMER_MASTER(Properties.Settings.Default.MyConnection); DataTable dtCustomer = oCustomer.getDataByAll(); for (int i = 0; i < dt.Rows.Count; i++) //loop through Amigo Detail { string CustomerName = dt.Rows[i]["CUSTOMER_NAME"].ToString(); //Customer Name from Receipt Detail //Search with Customer Name DataRow result = dtCustomer .AsEnumerable() .Where(myRow => ( (myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-1") == null ? null : myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-1").Trim()) == CustomerName || (myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-2") == null ? null : myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-2").Trim()) == CustomerName || (myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-3") == null ? null : myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-3").Trim()) == CustomerName || (myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-4") == null ? null : myRow.Field <string>("BILL_BANK_ACCOUNT_NAME-4").Trim()) == CustomerName) && myRow.Field <DateTime>("EFFECTIVE_DATE") < DateTime.Now) .OrderByDescending(s => s.Field <DateTime>("EFFECTIVE_DATE")) .FirstOrDefault(); if (result != null) { //insert columns values from CUSTOMER MASTER to RECEIPT DETAIL Result dt.Rows[i]["BILL_COMPANY_NAME"] = result["BILL_COMPANY_NAME"].ToString(); dt.Rows[i]["BILL_CONTACT_NAME"] = result["BILL_CONTACT_NAME"].ToString(); dt.Rows[i]["BILL_PHONE_NUMBER"] = result["BILL_PHONE_NUMBER"].ToString(); dt.Rows[i]["BILL_MAIL_ADDRESS"] = result["BILL_MAIL_ADDRESS"].ToString(); } } response.Data = Utility.Utility_Component.DtToJSon(dt, "36Result"); } else { if (strMessage == "") { response.Status = 1; response.Message = "There has no data to display."; } else { response.Status = 0; response.Message = strMessage; } } response.Data = Utility.Utility_Component.DtToJSon(dt, "36Result"); return(response); } catch (Exception ex) { response.Status = 0; response.Message = ex.Message + "\n" + ex.StackTrace; return(response); } }
public Response CancelAllocation(string strData) { using (TransactionScope dbTxn = new TransactionScope()) { try { string strReturnMsg = ""; string strMSG = ""; DataTable dtData = AmigoProcessManagement.Utility.Utility_Component.JsonToDt(strData); if (dtData.Rows.Count > 0) { for (int i = 0; i < dtData.Rows.Count; i++) { int GRID_SEQ_NO = AmigoProcessManagement.Utility.Utility_Component.dtColumnToInt((dtData.Rows[i]["SEQ_NO"] == null ? "" : dtData.Rows[i]["SEQ_NO"].ToString())); string GRID_COMPANY_NO_BOX = dtData.Rows[i]["COMPANY_NO_BOX"] == null ? "" : dtData.Rows[i]["COMPANY_NO_BOX"].ToString(); string GRID_YEAR_MONTH = dtData.Rows[i]["YEAR_MONTH"] == null ? "" : dtData.Rows[i]["YEAR_MONTH"].ToString(); string GRID_BILLING_CODE = GRID_COMPANY_NO_BOX + GRID_YEAR_MONTH; //getAllocatedAmount RESERVE_INFO oRI = new RESERVE_INFO(Properties.Settings.Default.MyConnection); DataTable dt = oRI.GetReservceInfoByBillingCode(GRID_BILLING_CODE); if (dt.Rows.Count > 0) { for (int j = 0; j < dt.Rows.Count; j++) { //UpdateReceiptDetail RECEIPT_DETAILS oRecep = new RECEIPT_DETAILS(Properties.Settings.Default.MyConnection); int RESERVE_SEQ_NO = int.Parse(dt.Rows[j][0].ToString()); oRecep.CancelAllocation(RESERVE_SEQ_NO, out strMSG); strReturnMsg = strMSG; //GET COMPANY_NO_BOX from Reserve By SEQ_N0 DataTable BILLING_CODES = oRI.GetCompanyNoBoxBySEQNO(RESERVE_SEQ_NO, out strMSG); for (int k = 0; k < BILLING_CODES.Rows.Count; k++) { string MATCHED_BILLING_CODE = BILLING_CODES.Rows[k][0].ToString(); //UpdateInvoiceInfo INVOICE_INFO oINV = new INVOICE_INFO(Properties.Settings.Default.MyConnection); oINV.UpdateInvoiceForCancel(MATCHED_BILLING_CODE.Substring(0, 10), MATCHED_BILLING_CODE.Substring(10, 5), out strMSG); strReturnMsg = strReturnMsg + strMSG; //DeleteReserveInfo strMSG = oRI.removeReserve(RESERVE_SEQ_NO, MATCHED_BILLING_CODE); strReturnMsg = strReturnMsg + strMSG; } } } if (strReturnMsg != "") { break; } } } else { strReturnMsg = "Data Error."; } if (strReturnMsg != "") { dbTxn.Dispose(); //rollback response.Status = 0; } else { dbTxn.Complete(); //commit operation response.Status = 1; } response.Message = strReturnMsg; return(response); } catch (Exception ex) { response.Status = 0; response.Message = ex.Message + "\n" + ex.StackTrace; dbTxn.Dispose(); return(response); } } }