/// <summary>
        /// Confirm for edit billing target
        /// </summary>
        /// <param name="doBillingTarget"></param>
        /// <returns></returns>
        public ActionResult BLS020_ConfirmEditBillingTarget(dtTbt_BillingTargetForView doBillingTarget)
        {
            ObjectResultData       res                 = new ObjectResultData();
            CommonUtil             comUtil             = new CommonUtil();
            BLS020_ScreenParameter sParam              = GetScreenObject <BLS020_ScreenParameter>();
            tbt_BillingTarget      doTbt_BillingTarget = new tbt_BillingTarget();
            IBillingHandler        handler             = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler;

            try
            {
                ///////// Check Suspending //////////
                ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;

                if (chandler.IsSystemSuspending())
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049);
                    return(Json(res));
                }
                if (ModelState.IsValid == false)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    ValidatorUtil.BuildErrorMessage(res, this);
                    return(Json(res));
                }

                ///// Check permission //////////
                if (!CheckUserPermission(ScreenID.C_SCREEN_ID_EDIT_BILL_TARGET, FunctionID.C_FUNC_ID_OPERATE))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053);
                    return(Json(res));
                }

                ///////////////5.3 Validate Business
                //check duplicate
                List <tbt_BillingTarget> lst = new List <tbt_BillingTarget>();
                lst = handler.GetTbt_BillingTarget(null, comUtil.ConvertBillingClientCode(doBillingTarget.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG), doBillingTarget.BillingOfficeCode);
                if (lst.Count > 0)
                {
                    doTbt_BillingTarget = lst[0];
                }
                else
                {
                    doTbt_BillingTarget = null;
                }
                //doTbt_BillingTarget = handler.GetTbt_BillingTarget(null, comUtil.ConvertBillingClientCode(doBillingTarget.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG), doBillingTarget.BillingOfficeCode);
                doBillingTarget.BillingTargetCode = comUtil.ConvertBillingClientCode(doBillingTarget.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG) + "-" + doBillingTarget.BillingTargetNo;
                if (doTbt_BillingTarget != null &&
                    doTbt_BillingTarget.BillingTargetCode != doBillingTarget.BillingTargetCode)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    res.AddErrorMessage(MessageUtil.MODULE_BILLING,
                                        ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET,
                                        MessageUtil.MODULE_BILLING,
                                        MessageUtil.MessageList.MSG6002,
                                        new string[] { doTbt_BillingTarget.BillingTargetCode },
                                        new string[] { "BillingClientCode", "BillingTargetNo", "BillingOfficeCode" });

                    return(Json(res));
                }
                //Update Billing target
                doTbt_BillingTarget = new tbt_BillingTarget();
                doTbt_BillingTarget.BillingTargetCode = doBillingTarget.BillingTargetCode;
                doTbt_BillingTarget.BillingTargetNo   = doBillingTarget.BillingTargetNo;
                doTbt_BillingTarget.BillingClientCode = comUtil.ConvertBillingClientCode(doBillingTarget.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                doTbt_BillingTarget.BillingOfficeCode = doBillingTarget.BillingOfficeCode;
                doTbt_BillingTarget.ContactPersonName = doBillingTarget.ContactPersonName;
                doTbt_BillingTarget.Memo               = doBillingTarget.Memo;
                doTbt_BillingTarget.IssueInvTime       = doBillingTarget.IssueInvTime;
                doTbt_BillingTarget.IssueInvMonth      = doBillingTarget.IssueInvMonth;
                doTbt_BillingTarget.IssueInvDate       = doBillingTarget.IssueInvDate;
                doTbt_BillingTarget.InvFormatType      = doBillingTarget.InvFormatType;
                doTbt_BillingTarget.SignatureType      = doBillingTarget.SignatureType;
                doTbt_BillingTarget.DocLanguage        = doBillingTarget.DocLanguage;
                doTbt_BillingTarget.ShowDueDate        = doBillingTarget.ShowDueDate;
                doTbt_BillingTarget.IssueReceiptTiming = doBillingTarget.IssueReceiptTiming;
                doTbt_BillingTarget.ShowAccType        = doBillingTarget.ShowAccType;
                doTbt_BillingTarget.WhtDeductionType   = doBillingTarget.WhtDeductionType;
                doTbt_BillingTarget.ShowIssueDate      = doBillingTarget.ShowIssueDate;
                doTbt_BillingTarget.PayByChequeFlag    = doBillingTarget.PayByChequeFlag;
                doTbt_BillingTarget.ShowInvWHTFlag     = doBillingTarget.ShowInvWHTFlag;
                doTbt_BillingTarget.SeparateInvType    = doBillingTarget.SeparateInvType;
                doTbt_BillingTarget.SuppleInvAddress   = doBillingTarget.SuppleInvAddress;

                // tt
                doTbt_BillingTarget.RealBillingClientNameEN    = doBillingTarget.RealBillingClientNameEN;
                doTbt_BillingTarget.RealBillingClientNameLC    = doBillingTarget.RealBillingClientNameLC;
                doTbt_BillingTarget.RealBillingClientAddressEN = doBillingTarget.RealBillingClientAddressEN;
                doTbt_BillingTarget.RealBillingClientAddressLC = doBillingTarget.RealBillingClientAddressLC;

                // Akat K. 2014-05-23 : update PrintAdvanceDate
                doTbt_BillingTarget.PrintAdvanceDate = doBillingTarget.PrintAdvanceDate;

                using (TransactionScope scope = new TransactionScope())
                {
                    handler.UpdateTbt_BillingTarget(doTbt_BillingTarget);

                    // Akat K. 2014-05-21 also update billing office
                    handler.UpdateDebtTracingOffice(doBillingTarget.BillingTargetCode, doBillingTarget.BillingOfficeCode);

                    scope.Complete();
                }
                sParam.doBillingTarget     = doBillingTarget;
                sParam.doTbt_BillingTarget = doTbt_BillingTarget;
                res.ResultData             = sParam.doBillingTarget;
                res.MessageType            = MessageModel.MESSAGE_TYPE.INFORMATION_OK;
                res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0046, null, null);
                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }
            return(Json(res));
        }