Esempio n. 1
0
        /// <summary>
        /// Generate html of combobox for billing type information which display billing type name
        /// </summary>
        /// <param name="helper">html helper</param>
        /// <param name="id">control id</param>
        /// <param name="attribute">html attribute</param>
        /// <returns></returns>
        public static MvcHtmlString BillingTypeNameComboBox(this HtmlHelper helper, string id, object attribute = null)
        {
            List <tbm_BillingType> vw_list    = new List <tbm_BillingType>();
            IBillingMasterHandler  masHandler = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler;

            List <tbm_BillingType> listOrder = masHandler.GetTbm_BillingType();

            vw_list = CommonUtil.ConvertObjectbyLanguage <tbm_BillingType, tbm_BillingType>(listOrder, "BillingTypeName");

            return(CommonUtil.CommonComboBox <tbm_BillingType>(id, vw_list, "BillingTypeName", "BillingTypeCode", attribute));
        }
        ///<summary>
        ///Purpose:
        ///     Get billing client data
        ///
        ///Parameters:
        ///     strBillingClientCode: 0000000036
        ///
        ///Expected:
        ///     Expect test case 4
        ///</summary>
        public string Case3()
        {
            IBillingMasterHandler target        = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler;
            string strBillingClientCode         = "0000000036";
            List <dtBillingClientData> expected = new List <dtBillingClientData>();
            List <dtBillingClientData> actual   = null;

            dtBillingClientData billing = new dtBillingClientData();

            billing.BillingClientCode  = "0000000036";
            billing.NameEN             = "FUJI XEROX (THAILAND)";
            billing.NameLC             = "ฟูจิ ซีร็อกซ์ (ประเทศไทย)";
            billing.FullNameEN         = "FUJI XEROX (THAILAND) CO.,LTD.";
            billing.FullNameLC         = "บริษัท ฟูจิ ซีร็อกซ์ (ประเทศไทย) จำกัด";
            billing.BranchNameEN       = "Head office";
            billing.BranchNameLC       = "สำนักงานใหญ่";
            billing.CustTypeCode       = "0";
            billing.CustTypeNameEN     = "Juristic";
            billing.CustTypeNameJP     = "法人";
            billing.CustTypeNameLC     = "JuristicLC";
            billing.CompanyTypeCode    = "03";
            billing.CompanyTypeNameEN  = "Limited company";
            billing.CompanyTypeNameLC  = "บริษัทจำกัด";
            billing.BusinessTypeCode   = "013";
            billing.BusinessTypeNameEN = "Electrical Equipment";
            billing.BusinessTypeNameJP = "電気機器";
            billing.BusinessTypeNameLC = "อุปกรณ์อิเล็กทรอนิกส์";
            billing.PhoneNo            = "0868965423";
            billing.IDNo          = "1234567890000";
            billing.RegionCode    = "TH";
            billing.NationalityEN = "Thai";
            billing.NationalityJP = "タイ人";
            billing.NationalityLC = "คนไทย";
            billing.AddressEN     = "123 SUNTOWERS  BUILDING A,23rd-26th FLOOR,VIBHAVADI-RANGSIT,CHOMPHON,JATUJAK,BANGKOK 10700";
            billing.AddressLC     = "123 อาคารทานตะวัน A ชั้น 23-26 ถ.วิภาวดีรังสิต แขวงจอมพล เขตจตุจักร จ.กรุงเทพมหานคร 10700";
            billing.CreateDate    = new DateTime(2011, 7, 13, 12, 9, 0);
            billing.CreateBy      = "500576";
            billing.UpdateDate    = new DateTime(2011, 7, 13, 12, 9, 0);
            billing.UpdateBy      = "500576";
            expected.Add(billing);
            CommonUtil.MappingObjectLanguage <dtBillingClientData>(expected);

            try {
                actual = target.GetBillingClient(strBillingClientCode);
            } catch (ApplicationErrorException ex) {
                actual = new List <dtBillingClientData>();
            } catch (Exception ex) {
                actual = new List <dtBillingClientData>();
            }

            return(string.Format(RESULT_FORMAT, 3, expected[0].BillingClientCode, actual[0].BillingClientCode, CompareObjectList <dtBillingClientData>(expected, actual, BILLING_CLIENT_FIELD) ? "Pass" : "Fail"));
        }
        ///<summary>
        ///Purpose:
        ///     Get billing client data (Max length all columns)
        ///
        ///Parameters:
        ///     strBillingClientCode: 0000000179
        ///
        ///Expected:
        ///     1. Expect test case 5
        ///     Note: At end character of text column will be 'z' or 'ฮ'
        ///
        ///</summary>
        public string Case4()
        {
            IBillingMasterHandler target        = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler;
            string strBillingClientCode         = "0000000179";
            List <dtBillingClientData> expected = new List <dtBillingClientData>();
            List <dtBillingClientData> actual   = null;

            dtBillingClientData billing = new dtBillingClientData();

            billing.BillingClientCode  = "0000000179";
            billing.NameEN             = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz";
            billing.NameLC             = "กกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกฮ";
            billing.FullNameEN         = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz";
            billing.FullNameLC         = "กกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกฮกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกฮ";
            billing.BranchNameEN       = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz";
            billing.BranchNameLC       = "กกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกฮ";
            billing.CustTypeCode       = "0";
            billing.CustTypeNameEN     = "Juristic";
            billing.CustTypeNameJP     = "法人";
            billing.CustTypeNameLC     = "JuristicLC";
            billing.CompanyTypeCode    = "03";
            billing.CompanyTypeNameEN  = "Limited company";
            billing.CompanyTypeNameLC  = "บริษัทจำกัด";
            billing.BusinessTypeCode   = "005";
            billing.BusinessTypeNameEN = "Automotive Auto Parts";
            billing.BusinessTypeNameJP = "自動車産業・部品";
            billing.BusinessTypeNameLC = "ชิ้นส่วนรถยนต์";
            billing.PhoneNo            = "12345678901234567890";
            billing.IDNo          = "12345678901234567890";
            billing.RegionCode    = "TH";
            billing.NationalityEN = "Thai";
            billing.NationalityJP = "タイ人";
            billing.NationalityLC = "คนไทย";
            billing.AddressEN     = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz";
            billing.AddressLC     = "กกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกฮ";
            billing.CreateDate    = new DateTime(2011, 7, 13, 12, 9, 0);
            billing.CreateBy      = "500576";
            billing.UpdateDate    = new DateTime(2011, 7, 13, 12, 9, 0);
            billing.UpdateBy      = "500576";
            expected.Add(billing);
            CommonUtil.MappingObjectLanguage <dtBillingClientData>(expected);

            try {
                actual = target.GetBillingClient(strBillingClientCode);
            } catch (ApplicationErrorException ex) {
                actual = new List <dtBillingClientData>();
            } catch (Exception ex) {
                actual = new List <dtBillingClientData>();
            }

            return(string.Format(RESULT_FORMAT, 4, expected[0].BillingClientCode, actual[0].BillingClientCode, CompareObjectList <dtBillingClientData>(expected, actual, BILLING_CLIENT_FIELD) ? "Pass" : "Fail"));
        }
        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));
        }
Esempio n. 5
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>
        ///Purpose:
        ///     Get billing client data when billing client code dose not exist
        ///
        ///Parameters:
        ///     strBillingClientCode: 0000000007
        ///
        ///Expected:
        ///     Return dtBillingClient is null
        ///</summary>
        public string Case2()
        {
            IBillingMasterHandler target        = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler;
            string strBillingClientCode         = "0000000007";
            List <dtBillingClientData> expected = null;
            List <dtBillingClientData> actual   = new List <dtBillingClientData>();

            try {
                actual = target.GetBillingClient(strBillingClientCode);
            } catch (ApplicationErrorException ex) {
                actual = new List <dtBillingClientData>();
            } catch (Exception ex) {
                actual = new List <dtBillingClientData>();
            }

            return(string.Format(RESULT_FORMAT, 2, expected, actual, CompareResult_Object(expected, actual)));
        }
        ///<summary>
        ///Purpose:
        ///     Mandatory check  when billing client code is not specified.
        ///
        ///Parameters:
        ///     strBillingClientCode: NULL
        ///
        ///Expected:
        ///     MSG0007: "These field was required: strBillingClientCode."
        ///</summary>
        public string Case1()
        {
            IBillingMasterHandler target = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler;
            string strBillingClientCode  = null;
            string expected = "MSG0007";
            string actual   = null;

            try {
                target.GetBillingClient(strBillingClientCode);
            } catch (ApplicationErrorException ex) {
                actual = ex.ErrorResult.Message.Code;
            } catch (Exception ex) {
                actual = ex.StackTrace;
            }

            return(string.Format(RESULT_FORMAT, 1, expected, actual, CompareResult_String(expected, actual)));
        }
Esempio n. 8
0
        /// <summary>
        /// Generate bank code combobox
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="id"></param>
        /// <param name="attribute"></param>
        /// <param name="include_idx0"></param>
        /// <param name="autoTransferOnly"></param>
        /// <returns></returns>
        public static MvcHtmlString BankCodeComboBox(this HtmlHelper helper, string id, object attribute = null, bool include_idx0 = true, bool autoTransferOnly = false)
        {
            List <tbm_Bank> list           = new List <tbm_Bank>();
            string          strDisplayName = "BankNameEN";

            try
            {
                if (autoTransferOnly == true)
                {
                    //return only support autotransfer
                    IBillingMasterHandler handler = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler;
                    list = handler.GetAutoTransferBank();
                }
                else
                {
                    //return all bank
                    IMasterHandler handler = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler;
                    list = handler.GetTbm_Bank();
                }


                CultureInfo culture = null;
                if (CommonUtil.GetCurrentLanguage() == CommonValue.DEFAULT_LANGUAGE_EN ||
                    CommonUtil.GetCurrentLanguage() == CommonValue.DEFAULT_LANGUAGE_JP)
                {
                    strDisplayName = "BankNameEN";
                    culture        = new CultureInfo(CommonValue.DEFAULT_LANGUAGE_EN);
                    list           = list.OrderBy(p => p.BankNameEN, StringComparer.Create(culture, false)).ToList();
                }
                else
                {
                    strDisplayName = "BankNameLC";
                    culture        = new CultureInfo(CommonValue.DEFAULT_LANGUAGE_LC);
                    list           = list.OrderBy(p => p.BankNameLC, StringComparer.Create(culture, false)).ToList();
                }
            }
            catch
            {
                list = new List <tbm_Bank>();
            }

            return(CommonUtil.CommonComboBox <tbm_Bank>(id, list, strDisplayName, "BankCode", attribute, include_idx0));
        }
        ///<summary>
        ///Purpose:
        ///    New billing client
        ///
        ///Parameters:
        ///     Refer to: "SECOM-AJIS-STC.MAP030-ManageBillingClient" tab 'Test Data(Input DO)'
        ///
        ///Expected:
        ///     Refer to: "SECOM-AJIS-STC.MAP030-ManageBillingClient" tab 'Expect Result'
        ///</summary>
        public string Case2()
        {
            IBillingMasterHandler target = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler;
            tbm_BillingClient     param  = new tbm_BillingClient();
            string expected = null;
            string actual   = null;

            param.BillingClientCode = null;
            param.NameEN            = "C.S.I. INTERHOLDINGS";
            param.NameLC            = "ซีเอสไอ อินเตอร์โฮลดิ้ง";
            param.FullNameEN        = "C.S.I. INTERHOLDINGS CO., LTD.";
            param.FullNameLC        = "บริษัท ซีเอสไอ อินเตอร์โฮลดิ้ง จำกัด";
            param.BranchNameEN      = "Head office";
            param.BranchNameLC      = "สำนักงานใหญ่";
            param.CustTypeCode      = "0";
            //param.CustTypeName=null;
            param.CompanyTypeCode = "03";
            //param.CompanyTypeName=null;
            param.BusinessTypeCode = "047";
            param.BusinessTypeName = null;
            param.PhoneNo          = "021234567";
            param.IDNo             = "1234567890123";
            param.RegionCode       = "TH";
            param.Nationality      = null;
            param.AddressEN        = "SILOM COMPLEX TOWER, 28th FLOOR, NO.191,SILOM,SILOM,BANGRAK,BANGKOK 10210";
            param.AddressLC        = "191 อาคารสีลมคอมเพล็กซ์ ชั้น 28 เอฟ ถ.สีลม แขวงสีลม เขตบางรัก จ.กรุงเทพมหานคร 10210";
            param.DeleteFlag       = false;

            try {
                target.ManageBillingClient(param);
            } catch (ApplicationErrorException ex) {
                actual = ex.ErrorResult.Message.Code;
            } catch (Exception ex) {
                actual = ex.StackTrace;
            }

            return(string.Format(RESULT_FORMAT, 2, expected, actual, CompareResult_String(expected, actual)));
        }
        ///<summary>
        ///Purpose:
        ///    New billing client (max length)
        ///
        ///Parameters:
        ///     Refer to: "SECOM-AJIS-STC.MAP030-ManageBillingClient" tab 'Test Data(Input DO)'
        ///
        ///Expected:
        ///     Refer to: "SECOM-AJIS-STC.MAP030-ManageBillingClient" tab 'Expect Result'
        ///</summary>
        public string Case3()
        {
            IBillingMasterHandler target = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler;
            tbm_BillingClient     param  = new tbm_BillingClient();
            string expected = null;
            string actual   = null;

            param.BillingClientCode = null;
            param.NameEN            = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz";
            param.NameLC            = "กกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกฮ";
            param.FullNameEN        = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz";
            param.FullNameLC        = "กกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกฮกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกฮ";
            param.BranchNameEN      = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz";
            param.BranchNameLC      = "กกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกฮ";
            param.CustTypeCode      = "0";
            //param.CustTypeName=null;
            param.CompanyTypeCode = "03";
            //param.CompanyTypeName=null;
            param.BusinessTypeCode = "005";
            param.BusinessTypeName = null;
            param.PhoneNo          = "12345678901234567890";
            param.IDNo             = "12345678901234567890";
            param.RegionCode       = "TH";
            param.Nationality      = null;
            param.AddressEN        = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz";
            param.AddressLC        = "กกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกกฮ";
            param.DeleteFlag       = false;

            try {
                target.ManageBillingClient(param);
            } catch (ApplicationErrorException ex) {
                actual = ex.ErrorResult.Message.Code;
            } catch (Exception ex) {
                actual = ex.StackTrace;
            }

            return(string.Format(RESULT_FORMAT, 3, expected, actual, CompareResult_String(expected, actual)));
        }
Esempio n. 11
0
        public ActionResult CTP060_UpdateEmailContentOfNotifyEmail()
        {
            ObjectResultData        res                  = new ObjectResultData();
            IContractHandler        conHandler           = ServiceContainer.GetService <IContractHandler>() as IContractHandler;
            IRentralContractHandler rentalConHandler     = ServiceContainer.GetService <IRentralContractHandler>() as IRentralContractHandler;
            IMasterHandler          masterHandler        = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler;
            IEmployeeMasterHandler  empMasterHandler     = ServiceContainer.GetService <IEmployeeMasterHandler>() as IEmployeeMasterHandler;
            IBillingMasterHandler   billingmasterhandler = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler;
            IOfficeMasterHandler    officehandler        = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler;
            IBillingHandler         billinghandler       = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler;

            List <tbm_Customer>  dtCustomer;
            List <doGetTbm_Site> dtSite;
            List <tbm_Employee>  dtEmployee;
            decimal?contractFeeBeforeChange;
            decimal?ChangeContractFee;

            try
            {
                CommonUtil comUtil = new CommonUtil();
                doNotifyChangeFeeContract doNotifyEmail           = new doNotifyChangeFeeContract();
                List <tbt_ContractEmail>  updateContractEmailList = new List <tbt_ContractEmail>();

                using (TransactionScope scope = new TransactionScope())
                {
                    List <tbt_ContractEmail> contractEmailList = conHandler.GetUnsentNotifyEmail();
                    foreach (tbt_ContractEmail data in contractEmailList)
                    {
                        List <tbt_BillingBasic>  doBillingBasic  = billinghandler.GetTbt_BillingBasic(data.ContractCode, "01");
                        List <tbt_BillingTarget> doBillingTarget = billinghandler.GetTbt_BillingTarget(doBillingBasic[0].BillingTargetCode, null, null);

                        dsRentalContractData dsRentalContract = rentalConHandler.GetEntireContract(data.ContractCode, data.OCC);
                        if (dsRentalContract.dtTbt_RentalSecurityBasic[0].ReturnToOriginalFeeDate != null)
                        {
                            var operationOfficeDat = officehandler.GetTbm_Office(dsRentalContract.dtTbt_RentalContractBasic[0].OperationOfficeCode);
                            var billingOfficeDat   = officehandler.GetTbm_Office(doBillingTarget[0].BillingOfficeCode);

                            EmailTemplateUtil mailUtil = new EmailTemplateUtil(EmailTemplateName.C_EMAIL_TEMPLATE_NAME_CHANGE_FEE);
                            dtCustomer = masterHandler.GetTbm_Customer(dsRentalContract.dtTbt_RentalContractBasic[0].ContractTargetCustCode);
                            dtSite     = masterHandler.GetTbm_Site(dsRentalContract.dtTbt_RentalContractBasic[0].SiteCode);
                            dtEmployee = empMasterHandler.GetTbm_Employee(data.CreateBy);
                            contractFeeBeforeChange = rentalConHandler.GetContractFeeBeforeChange(dsRentalContract.dtTbt_RentalContractBasic[0].ContractCode, dsRentalContract.dtTbt_RentalSecurityBasic[0].OCC, dsRentalContract);

                            doNotifyEmail.ContractCode            = comUtil.ConvertContractCode(dsRentalContract.dtTbt_RentalContractBasic[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT);
                            doNotifyEmail.ContractTargetNameEN    = dtCustomer[0].CustFullNameEN;
                            doNotifyEmail.ContractTargetNameLC    = dtCustomer[0].CustFullNameLC;
                            doNotifyEmail.SiteNameEN              = dtSite[0].SiteNameEN;
                            doNotifyEmail.SiteNameLC              = dtSite[0].SiteNameLC;
                            doNotifyEmail.ChangeDateOfContractFee = CommonUtil.TextDate(dsRentalContract.dtTbt_RentalSecurityBasic[0].ChangeImplementDate);
                            doNotifyEmail.ContractFeeBeforeChange = CommonUtil.TextNumeric(contractFeeBeforeChange);

                            if (dsRentalContract.dtTbt_RentalContractBasic[0].ContractStatus == ContractStatus.C_CONTRACT_STATUS_STOPPING)
                            {
                                ChangeContractFee = dsRentalContract.dtTbt_RentalSecurityBasic[0].ContractFeeOnStop;
                            }
                            else
                            {
                                ChangeContractFee = dsRentalContract.dtTbt_RentalSecurityBasic[0].OrderContractFee;
                            }

                            doNotifyEmail.ContractFeeAfterChange  = CommonUtil.TextNumeric(ChangeContractFee);
                            doNotifyEmail.ReturnToOriginalFeeDate = CommonUtil.TextDate(dsRentalContract.dtTbt_RentalSecurityBasic[0].ReturnToOriginalFeeDate);
                            doNotifyEmail.OperationOfficeEN       = operationOfficeDat[0].OfficeNameEN;
                            doNotifyEmail.OperationOfficeLC       = operationOfficeDat[0].OfficeNameLC;
                            doNotifyEmail.RegisterChangeEmpNameEN = dtEmployee[0].EmpFirstNameEN + ' ' + dtEmployee[0].EmpLastNameEN;
                            doNotifyEmail.RegisterChangeEmpNameLC = dtEmployee[0].EmpFirstNameLC + ' ' + dtEmployee[0].EmpLastNameLC;
                            doNotifyEmail.BillingOfficeEN         = billingOfficeDat[0].OfficeNameEN;
                            doNotifyEmail.BillingOfficeLC         = billingOfficeDat[0].OfficeNameLC;

                            var mailTemplate = mailUtil.LoadTemplate(doNotifyEmail);
                            data.EmailContent = mailTemplate.TemplateContent;

                            tbt_ContractEmail conEmailTemp = CommonUtil.CloneObject <tbt_ContractEmail, tbt_ContractEmail>(data);
                            updateContractEmailList.Add(conEmailTemp);
                        }
                    }

                    if (updateContractEmailList != null && updateContractEmailList.Count > 0)
                    {
                        conHandler.UpdateTbt_ContractEmail(updateContractEmailList);
                    }

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
        /// <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));
            }
        }