/// <summary>
        /// validate input data confirm and register data into database
        /// </summary>
        /// <returns></returns>
        public ActionResult ICS032_Confirm()
        {
            string conModeRadio1rdo1Invoice       = "1";
            string conModeRadio1rdo1BillingTarget = "2";

            ICS032_ScreenParameter param        = GetScreenObject <ICS032_ScreenParameter>();
            ICS032_RegisterData    RegisterData = new ICS032_RegisterData();
            CommonUtil             comUtil      = new CommonUtil();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;

            try
            {
                // Common Check Sequence

                // System Suspend
                ICommonHandler handlerCommon  = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;
                IIncomeHandler iincomeHandler = ServiceContainer.GetService <IIncomeHandler>() as IIncomeHandler;

                tbt_InvoiceDebtTracing       _dotbt_InvoiceDebtTracing       = new tbt_InvoiceDebtTracing();
                tbt_BillingTargetDebtTracing _dotbt_BillingTargetDebtTracing = new tbt_BillingTargetDebtTracing();

                //Already checked at ICS032_Register()
                //if (handlerCommon.IsSystemSuspending())
                //{
                //    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                //    return Json(res);
                //}

                // Check User Permission

                //if (!CheckUserPermission(ScreenID.C_SCREEN_ID_REGISTER_CREDIT_NOTE, FunctionID.C_FUNC_ID_DEL) )
                //{
                //    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053);
                //    return Json(res);
                //}

                string strBillingTargetCode = string.Empty;
                string strInvoiceNo         = string.Empty;
                int    intInvoiceOCC        = 0;

                if (param.doBillingTargetDebtSummaryList != null)
                {
                    if (param.doBillingTargetDebtSummaryList.Count != 0)
                    {
                        strBillingTargetCode = param.doBillingTargetDebtSummaryList[0].BillingTargetCode;
                    }
                }

                if (param.doGetUnpaidInvoiceDebtSummaryByBillingTargetList != null)
                {
                    if (param.doGetUnpaidInvoiceDebtSummaryByBillingTargetList.Count != 0)
                    {
                        strInvoiceNo  = param.doGetUnpaidInvoiceDebtSummaryByBillingTargetList[0].InvoiceNo;
                        intInvoiceOCC = param.doGetUnpaidInvoiceDebtSummaryByBillingTargetList[0].InvoiceOCC;
                    }
                }

                using (TransactionScope scope = new TransactionScope())
                {
                    try
                    {
                        if (strInvoiceNo != string.Empty)
                        {
                            if (param.RegisterData.Header.rdoProcessType == conModeRadio1rdo1Invoice)
                            {
                                #region Tbt_InvoiceDebtTracing
                                _dotbt_InvoiceDebtTracing                   = new tbt_InvoiceDebtTracing();
                                _dotbt_InvoiceDebtTracing.InvoiceNo         = strInvoiceNo;
                                _dotbt_InvoiceDebtTracing.InvoiceOCC        = intInvoiceOCC;
                                _dotbt_InvoiceDebtTracing.TracingResult     = param.RegisterData.Header.cboTracingResault;
                                _dotbt_InvoiceDebtTracing.LastContactDate   = param.RegisterData.Header.dtpLastContractDate;
                                _dotbt_InvoiceDebtTracing.ExpectPaymentDate = param.RegisterData.Header.dtpExpectedPaymentdate;
                                _dotbt_InvoiceDebtTracing.PaymentMethod     = param.RegisterData.Header.cboPaymentMethods;
                                _dotbt_InvoiceDebtTracing.Memo              = param.RegisterData.Header.txtaMemo;

                                if (iincomeHandler.InsertTbt_InvoiceDebtTracing(_dotbt_InvoiceDebtTracing) <= 0)
                                {
                                    //res.AddErrorMessage(MessageUtil.MODULE_INCOME,
                                    //             "ICS032",
                                    //             MessageUtil.MODULE_INCOME,
                                    //             MessageUtil.MessageList.MSG7006,
                                    //             new string[] { },
                                    //             new string[] { });
                                    //return Json(res);

                                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_INCOME, MessageUtil.MessageList.MSG7006, null);
                                }
                                #endregion
                            }
                        }
                        if (strBillingTargetCode != string.Empty)
                        {
                            if (param.RegisterData.Header.rdoProcessType == conModeRadio1rdo1BillingTarget)
                            {
                                #region Tbt_BillingTargetDebtTracing
                                _dotbt_BillingTargetDebtTracing = new tbt_BillingTargetDebtTracing();
                                _dotbt_BillingTargetDebtTracing.BillingTargetCode = strBillingTargetCode;
                                _dotbt_BillingTargetDebtTracing.TracingResult     = param.RegisterData.Header.cboTracingResault;
                                _dotbt_BillingTargetDebtTracing.LastContactDate   = param.RegisterData.Header.dtpLastContractDate;
                                _dotbt_BillingTargetDebtTracing.ExpectPaymentDate = param.RegisterData.Header.dtpExpectedPaymentdate;
                                _dotbt_BillingTargetDebtTracing.PaymentMethod     = param.RegisterData.Header.cboPaymentMethods;
                                _dotbt_BillingTargetDebtTracing.Memo = param.RegisterData.Header.txtaMemo;

                                if (iincomeHandler.InsertTbt_BillingTargetDebtTracing(_dotbt_BillingTargetDebtTracing) <= 0)
                                {
                                    //res.AddErrorMessage(MessageUtil.MODULE_INCOME,
                                    //             "ICS032",
                                    //             MessageUtil.MODULE_INCOME,
                                    //             MessageUtil.MessageList.MSG7006,
                                    //             new string[] { },
                                    //             new string[] { });
                                    //return Json(res);
                                    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_INCOME, MessageUtil.MessageList.MSG7006, null);
                                }
                                #endregion
                            }
                        }
                        scope.Complete();
                    }
                    catch (Exception ex)
                    {
                        // Fail rollback all record
                        scope.Dispose();
                        res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                        res.AddErrorMessage(ex);
                        return(Json(res));
                    }
                }

                // return "1" to js is every thing OK
                if (res.MessageList == null || res.MessageList.Count == 0)
                {
                    res.ResultData = "1";
                }
                else
                {
                    res.ResultData = null;
                }

                return(Json(res));
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }
            return(Json(res));
        }