コード例 #1
0
        /// <summary>
        /// Retrieve billing target data
        /// </summary>
        /// <param name="BillingClientCode"></param>
        /// <param name="BillingTargetNo"></param>
        /// <param name="BillingTargetCode"></param>
        /// <returns></returns>
        public ActionResult BLS020_RetrieveBillingTargetData(string BillingClientCode, string BillingTargetNo, string BillingTargetCode)
        {
            ObjectResultData       res     = new ObjectResultData();
            CommonUtil             comUtil = new CommonUtil();
            BLS020_ScreenParameter sParam  = GetScreenObject <BLS020_ScreenParameter>();

            try
            {
                //Check mandatory
                List <string> lstControl = new List <string>();
                if (CommonUtil.IsNullOrEmpty(BillingTargetCode))
                {
                    if (String.IsNullOrEmpty(BillingClientCode))
                    {
                        lstControl.Add("BillingClientCode");
                    }
                    if (String.IsNullOrEmpty(BillingTargetNo))
                    {
                        lstControl.Add("BillingTargetNo");
                    }
                    if (lstControl.Count > 0)
                    {
                        res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                        res.AddErrorMessage(MessageUtil.MODULE_BILLING,
                                            ScreenID.C_SCREEN_ID_REGIST_BILL_TARGET,
                                            MessageUtil.MODULE_COMMON,
                                            MessageUtil.MessageList.MSG0007,
                                            new string[] { "lblBillingTargetCode" },
                                            lstControl.ToArray());

                        return(Json(res));
                    }
                }

                //Retrieve billing target data
                string strBillingTargetCode = BillingTargetCode;
                if (CommonUtil.IsNullOrEmpty(strBillingTargetCode) ||
                    strBillingTargetCode.Length != 14)
                {
                    strBillingTargetCode = comUtil.ConvertBillingClientCode(BillingClientCode, CommonUtil.CONVERT_TYPE.TO_LONG) +
                                           "-" + BillingTargetNo;
                }

                IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler;
                sParam.doBillingTarget = handler.GetTbt_BillingTargetForViewData(strBillingTargetCode, MiscType.C_CUST_TYPE);
                if (sParam.doBillingTarget == null)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    res.AddErrorMessage(MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6040, null, null);
                    return(Json(res));
                }
                else
                {
                    if (!BLS020_ValidExistOffice(sParam.doBillingTarget.BillingOfficeCode))
                    {
                        res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                        res.AddErrorMessage(MessageUtil.MODULE_COMMON,
                                            MessageUtil.MessageList.MSG0063,
                                            null,
                                            new string[] { "BillingClientCode", "BillingTargetNo" });
                        return(Json(res));
                    }
                    sParam.doBillingTarget.BillingClientCode = comUtil.ConvertBillingClientCode(sParam.doBillingTarget.BillingClientCode, CommonUtil.CONVERT_TYPE.TO_SHORT);
                    res.ResultData = sParam.doBillingTarget;
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }
            return(Json(res));
        }