コード例 #1
0
        /// <summary>
        /// Get header data of screen BLS090
        /// </summary>
        /// <param name="ContractCode"></param>
        /// <returns></returns>
        public ActionResult BLS090_GetHeader(string ContractCode)
        {
            CommonUtil cm = new CommonUtil();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
            List <dtBillingContract> list = new List <dtBillingContract>();

            try
            {
                BLS090_ScreenParameter param = GetScreenObject <BLS090_ScreenParameter>();

                if (CommonUtil.IsNullOrEmpty(ContractCode))
                {
                    string lblContractCode = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_BILLING, "BLS090", "lblContractCode");
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, new string[] { lblContractCode }, new string[] { "ContractCode" });
                    return(Json(res));
                }

                //string strContract_long = cm.ConvertContractCode(ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG);
                string strContract_long = cm.ConvertBillingCode(ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG);

                IBillingHandler handlerBilling = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler;
                list = handlerBilling.GetBillingContract(strContract_long, CurrencyUtil.C_CURRENCY_LOCAL, CurrencyUtil.C_CURRENCY_US);


                if (list.Count > 0)
                {
                    var detailList = handlerBilling.GetBillingBasicForRentalList(strContract_long);


                    if (detailList.Count > 0)
                    {
                        param.DetailData = detailList;

                        // Akat K. : ContractFee get from OrderContractFee (see sp_BL_GetBillingContract)
                        var sumOfFee = detailList.Sum(m => m.MonthlyBillingAmount);
                        //list[0].ContractFeeForDisplay = CommonUtil.TextNumeric(sumOfFee, 2);
                        //list[0].ContractFee = sumOfFee;
                        param.TotalFee = sumOfFee;

                        list[0].ContractFeeForDisplay = CommonUtil.TextNumeric(list[0].ContractFee, 2);
                        list[0].TotalFee           = sumOfFee;
                        list[0].TotalFeeForDisplay = CommonUtil.TextNumeric(sumOfFee, 2);
                        list[0].details            = detailList;

                        param.OrderContractFee = list[0].ContractFee;
                        //list[0].ContractFeeCurrency = MiscellaneousTypeUtil.getCurrenctName(list[0].ContractFeeCurrency) + " " + list[0].ContractFee?.ToString("#,##0.00");
                        ViewBag.Currency = MiscellaneousTypeCommon.getCurrencyName(list[0].ContractFeeCurrencyType);

                        res.ResultData = list[0];
                    }
                    else
                    {
                        res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                        res.AddErrorMessage(MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6082,
                                            new string[] { "lblContractCode" },
                                            new string[] { "ContractCode" });
                    }
                }
                else
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    res.AddErrorMessage(MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6057,
                                        new string[] { "lblContractCode" },
                                        new string[] { "ContractCode" });
                }
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }