public ActionResult BLS030_GetBillingType(string ProductTypeCode)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                BLS030_ScreenParameter sParam    = GetScreenObject <BLS030_ScreenParameter>();
                string strBillingServiceTypeCode = "";
                if (sParam.ProductTypeCode == ProductType.C_PROD_TYPE_AL || sParam.ProductTypeCode == ProductType.C_PROD_TYPE_ONLINE)
                {
                    strBillingServiceTypeCode = BillingServiceTypeCode.C_BILLING_SERVICE_TYPE_CODE_N;
                }
                else if (sParam.ProductTypeCode == ProductType.C_PROD_TYPE_MA)
                {
                    strBillingServiceTypeCode = BillingServiceTypeCode.C_BILLING_SERVICE_TYPE_CODE_MA;
                }
                else if (sParam.ProductTypeCode == ProductType.C_PROD_TYPE_BE || sParam.ProductTypeCode == ProductType.C_PROD_TYPE_SG)
                {
                    strBillingServiceTypeCode = BillingServiceTypeCode.C_BILLING_SERVICE_TYPE_CODE_SG;
                }
                else if (sParam.ProductTypeCode == ProductType.C_PROD_TYPE_SALE)
                {
                    strBillingServiceTypeCode = BillingServiceTypeCode.C_BILLING_SERVICE_TYPE_CODE_Q;
                }
                else if (sParam.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_PROJECT)
                {
                    strBillingServiceTypeCode = null;
                }

                sParam.strBillingServiceTypeCode = strBillingServiceTypeCode;
                IBillingMasterHandler  billingMasterHandler = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler;
                List <tbm_BillingType> BillingTypeList      = billingMasterHandler.GetBillingTypeOneTimeListData(strBillingServiceTypeCode);
                CommonUtil.MappingObjectLanguage <tbm_BillingType>(BillingTypeList);
                ComboBoxModel cboModel = new ComboBoxModel();
                cboModel.SetList <tbm_BillingType>(BillingTypeList, "BillingTypeCodeName", "BillingTypeCode");


                return(Json(cboModel));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
                return(Json(res));
            }
            return(Json(res));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generate billing type combobox
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="id"></param>
        /// <param name="attribute"></param>
        /// <param name="include_idx0"></param>
        /// <returns></returns>
        public static MvcHtmlString BillingTypeComboBox(this HtmlHelper helper, string id, object attribute = null, bool include_idx0 = true)
        {
            List <tbm_BillingType> BillingTypeList = new List <tbm_BillingType>();

            try
            {
                IBillingMasterHandler billingMasterHandler = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler;
                BillingTypeList = billingMasterHandler.GetBillingTypeOneTimeListData(null);
                CommonUtil.MappingObjectLanguage <tbm_BillingType>(BillingTypeList);
            }
            catch
            {
                BillingTypeList = new List <tbm_BillingType>();
            }

            return(CommonUtil.CommonComboBox <tbm_BillingType>(id, BillingTypeList, "BillingTypeCodeName", "BillingTypeCode", attribute));
        }
        /// <summary>
        /// Add billing type to selected list
        /// </summary>
        /// <param name="BillingTypeCode"></param>
        /// <returns></returns>
        public ActionResult BLS030_AddBillingType(string BillingTypeCode)
        {
            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            if (string.IsNullOrEmpty(BillingTypeCode))
            {
                res.AddErrorMessage(MessageUtil.MODULE_BILLING, MessageUtil.MessageList.MSG6090);
                return(Json(res));
            }

            try
            {
                BLS030_ScreenParameter sParam = GetScreenObject <BLS030_ScreenParameter>();

                IBillingMasterHandler  billingMasterHandler = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler;
                List <tbm_BillingType> BillingTypeList      = billingMasterHandler.GetBillingTypeOneTimeListData(sParam.strBillingServiceTypeCode);
                CommonUtil.MappingObjectLanguage <tbm_BillingType>(BillingTypeList);

                List <tbm_BillingType> BillingTypeList2 = (from t in BillingTypeList
                                                           where t.BillingTypeCode == BillingTypeCode
                                                           select t).ToList <tbm_BillingType>();

                if (sParam.doBillingTypeList == null)
                {
                    sParam.doBillingTypeList = new List <tbt_BillingTypeDetail>();
                }

                List <tbt_BillingTypeDetail> BillingTypeDetailExistList = (from t in sParam.doBillingTypeList
                                                                           where t.BillingTypeCode == BillingTypeCode
                                                                           select t).ToList <tbt_BillingTypeDetail>();

                if (BillingTypeDetailExistList.Count > 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_BILLING,
                                        "BLS030",
                                        MessageUtil.MODULE_BILLING,
                                        MessageUtil.MessageList.MSG6004,
                                        new string[] { BillingTypeList2[0].BillingTypeCodeName },
                                        null);
                    return(Json(res));
                }

                tbt_BillingTypeDetail BillingTypeDetail = new tbt_BillingTypeDetail();

                ISaleContractHandler handlerSaleContract = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler;
                var saleContractBasic_list = handlerSaleContract.GetSaleContractBasicForView(sParam.ContractProjectCodeLong);

                foreach (tbm_BillingType BillType in BillingTypeList2)
                {
                    BillingTypeDetail.BillingTypeCode = BillType.BillingTypeCode;

                    if (BillingTypeCode == BillingType.C_BILLING_TYPE_SALE_PRODUCT_PRICE ||
                        BillingTypeCode == BillingType.C_BILLING_TYPE_SALE_PRICE ||
                        BillingTypeCode == BillingType.C_BILLING_TYPE_SALE_PRICE_DOWN ||
                        BillingTypeCode == BillingType.C_BILLING_TYPE_SALE_PRICE_PARTIAL)
                    {
                        // ==
                        if (saleContractBasic_list.Count > 0)
                        {
                            if (BillingTypeCode == BillingType.C_BILLING_TYPE_SALE_PRODUCT_PRICE)
                            {
                                BillingTypeDetail.InvoiceDescriptionEN = BillingType.C_BILLING_TYPE_SALE_PRODUCT_PRICE_PREFIX_EN + " " + saleContractBasic_list[0].ProductNameEN;
                                BillingTypeDetail.InvoiceDescriptionLC = BillingType.C_BILLING_TYPE_SALE_PRODUCT_PRICE_PREFIX_LC + " " + saleContractBasic_list[0].ProductNameLC;

                                BillType.BillingTypeNameEN = BillingType.C_BILLING_TYPE_SALE_PRODUCT_PRICE_PREFIX_EN + " " + saleContractBasic_list[0].ProductNameEN;
                                BillType.BillingTypeNameLC = BillingType.C_BILLING_TYPE_SALE_PRODUCT_PRICE_PREFIX_LC + " " + saleContractBasic_list[0].ProductNameLC;
                            }

                            else if (BillingTypeCode == BillingType.C_BILLING_TYPE_SALE_PRICE)
                            {
                                BillingTypeDetail.InvoiceDescriptionEN = BillingType.C_BILLING_TYPE_SALE_PRICE_PREFIX_EN + " " + saleContractBasic_list[0].ProductNameEN;
                                BillingTypeDetail.InvoiceDescriptionLC = BillingType.C_BILLING_TYPE_SALE_PRICE_PREFIX_LC + " " + saleContractBasic_list[0].ProductNameLC;

                                BillType.BillingTypeNameEN = BillingType.C_BILLING_TYPE_SALE_PRICE_PREFIX_EN + " " + saleContractBasic_list[0].ProductNameEN;
                                BillType.BillingTypeNameLC = BillingType.C_BILLING_TYPE_SALE_PRICE_PREFIX_LC + " " + saleContractBasic_list[0].ProductNameLC;
                            }
                            else if (BillingTypeCode == BillingType.C_BILLING_TYPE_SALE_PRICE_DOWN)
                            {
                                BillingTypeDetail.InvoiceDescriptionEN = BillingType.C_BILLING_TYPE_SALE_PRICE_DOWN_SUBFIX_EN + " " + saleContractBasic_list[0].ProductNameEN;
                                BillingTypeDetail.InvoiceDescriptionLC = BillingType.C_BILLING_TYPE_SALE_PRICE_DOWN_SUBFIX_LC + " " + saleContractBasic_list[0].ProductNameLC;

                                BillType.BillingTypeNameEN = BillingType.C_BILLING_TYPE_SALE_PRICE_DOWN_SUBFIX_EN + " " + saleContractBasic_list[0].ProductNameEN;
                                BillType.BillingTypeNameLC = BillingType.C_BILLING_TYPE_SALE_PRICE_DOWN_SUBFIX_LC + " " + saleContractBasic_list[0].ProductNameLC;
                            }

                            else if (BillingTypeCode == BillingType.C_BILLING_TYPE_SALE_PRICE_PARTIAL)
                            {
                                BillingTypeDetail.InvoiceDescriptionEN = BillingType.C_BILLING_TYPE_SALE_PRICE_PARTIAL_SUBFIX_EN + " " + saleContractBasic_list[0].ProductNameEN;
                                BillingTypeDetail.InvoiceDescriptionLC = BillingType.C_BILLING_TYPE_SALE_PRICE_PARTIAL_SUBFIX_LC + " " + saleContractBasic_list[0].ProductNameLC;

                                BillType.BillingTypeNameEN = BillingType.C_BILLING_TYPE_SALE_PRICE_PARTIAL_SUBFIX_EN + " " + saleContractBasic_list[0].ProductNameEN;
                                BillType.BillingTypeNameLC = BillingType.C_BILLING_TYPE_SALE_PRICE_PARTIAL_SUBFIX_LC + " " + saleContractBasic_list[0].ProductNameLC;
                            }
                        }
                    }
                    else
                    {
                        BillingTypeDetail.InvoiceDescriptionEN = BillType.BillingTypeNameEN;
                        BillingTypeDetail.InvoiceDescriptionLC = BillType.BillingTypeNameLC;
                    }


                    BillingTypeDetail.BillingTypeGroup = BillType.BillingTypeCode;
                    sParam.doBillingTypeList.Add(BillingTypeDetail);
                }


                res.ResultData = BillingTypeList2;

                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
                return(Json(res));
            }
        }