コード例 #1
0
    /// <summary>
    /// ใช้สำหรับแสดงรายละเอียดตัวแทน
    /// </summary>
    /// <param name="agentNumber">Agent Number</param>
    /// <returns>ผลลัพธ์ว่า completed พร้อมรายละเอียดอื่นๆ หรือ notcomplete_xxx</returns>
    private ApplinXGetAgentDetailResult GetAgentDetail(string agentNumber)
    {
        ApplinXGetAgentDetailResult resAdminObj = new ApplinXGetAgentDetailResult();
        MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService adminWSObj = new MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService();
        resAdminObj.fld_result = adminWSObj.getAgentDetail(this.admin_username, this.admin_password, agentNumber, out resAdminObj.fld_sessionID, out resAdminObj.fld_agent_addrdoc_line1, out resAdminObj.fld_agent_addrdoc_line2, out resAdminObj.fld_agent_addrdoc_phone, out resAdminObj.fld_agent_address_line1, out resAdminObj.fld_agent_address_line2, out resAdminObj.fld_agent_bank_account, out resAdminObj.fld_agent_client_number, out resAdminObj.fld_agent_department, out resAdminObj.fld_agent_dob, out resAdminObj.fld_agent_end_date, out resAdminObj.fld_agent_gender, out resAdminObj.fld_agent_license_expire_date, out resAdminObj.fld_agent_license_number, out resAdminObj.fld_agent_license_start_date, out resAdminObj.fld_agent_name, out resAdminObj.fld_agent_office, out resAdminObj.fld_agent_phone, out resAdminObj.fld_agent_pid, out resAdminObj.fld_agent_policy_out, out resAdminObj.fld_agent_position, out resAdminObj.fld_agent_remark_type, out resAdminObj.fld_agent_start_date, out resAdminObj.fld_agent_status_code, out resAdminObj.fld_agent_status_description, out resAdminObj.fld_agent_tax_number, out resAdminObj.fld_agent_type, out resAdminObj.fld_agent_under_to, out resAdminObj.fld_agent_surname, out resAdminObj.fld_agent_title, out resAdminObj.fld_agent_no);
        // TODO: ดึงรูปภาพตัวแทนจาก EDAS
        resAdminObj.AgentPictureURL = "";

        return resAdminObj;
    }
コード例 #2
0
    public GetPolicyDetailForPayment_Result GetPolicyDetailForPayment(string partnerUsername, string partnerPassword, string policyNumber)
    {
        GetPolicyDetailForPayment_Result obj   = new GetPolicyDetailForPayment_Result();
        PremiumDetail_Result             pmobj = new PremiumDetail_Result();
        RefRunningTBBLL runningobj             = new RefRunningTBBLL();

        this.refnum = runningobj.AddRefRunningTBAndReturn();
        WSLogBLL logobj     = new WSLogBLL();
        string   methodName = "GetPolicyDetailForPayment";

        try
        {
            if (partnerUsername == "" || partnerPassword == "" || policyNumber == "")
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                obj.Result = "notcomplete_กรุณาระบุข้อมูลให้ครบถ้วน";
            }
            else if (policyNumber.Trim().Substring(0, 2) == "PA")
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                obj.Result = "notcomplete_กรมธรรม์นี้ไม่รับชำระค่าเบี้ยประกันต่ออายุออนไลน์";
            }
            else if (policyNumber.Length != 10 || !MTL.Utils.ThisWeb.CheckIsNumeric(policyNumber))
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                obj.Result = "notcomplete_กรุณาระบุเลขกรมธรรม์ให้ถูกต้อง";
            }
            else
            {
                // พิสูจน์ตัวตนของพันธมิตรก่อนที่จะให้ใช้งานจริง
                NETWS_ForPartnerAuthenticationChecking.CheckPartnerAuthentication_Result pacobj = CheckPartnerAuthenticationReturnDetail(partnerUsername, partnerPassword, this.ipaddress);
                if (pacobj.Result.Trim().ToLower() == "passed")
                {
                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                    // ดึงข้อมูลรายละเอียดของกรมธรรม์กับ ApplinX WS_Admin
                    //ApplinXGetShortPolicyDetail2Result resAdminObj = new ApplinXGetShortPolicyDetail2Result();
                    //MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService adminWSObj = new MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService();
                    //resAdminObj.fld_result = adminWSObj.GetpolicyDetail(this.admin_username, this.admin_password, policyNumber, out resAdminObj.fld_sessionID, out resAdminObj.fld_service_agent, out resAdminObj.fld_client_name, out resAdminObj.fld_face_amount, out resAdminObj.fld_paid_mode, out resAdminObj.fld_plan_code, out resAdminObj.fld_plan_name, out resAdminObj.fld_total_premium, out resAdminObj.fld_policy_status, out resAdminObj.fld_issue_date, out resAdminObj.fld_warning_message);
                    ApplinXGetPolicyDetail2Result resAdminObj = new ApplinXGetPolicyDetail2Result();

                    MTL.WS_Admin.WS_Admin_SmileServices.WS_Admin_ForSmartCardService adminWSObj = new MTL.WS_Admin.WS_Admin_SmileServices.WS_Admin_ForSmartCardService();
                    MTL.WS_Admin.WS_Admin_SmileServices.CPINQ02C_F6_PolicyList[]     fld_f6_policy_list;
                    MTL.WS_Admin.WS_Admin_SmileServices.CPINQ02_PolicyRiderList[]    fld_f8_policy_rider_list;

                    resAdminObj.fld_result = adminWSObj.GetPolicyDetail2(this.admin_username, this.admin_password, policyNumber, out resAdminObj.fld_sessionID,
                                                                         out resAdminObj.fld_approve_date, out resAdminObj.fld_attained_date, out resAdminObj.fld_belong_to_agent, out resAdminObj.fld_billed_to_date, out resAdminObj.fld_client_address, out resAdminObj.fld_client_dob, out resAdminObj.fld_client_name, out resAdminObj.fld_coverage_period, out resAdminObj.fld_disability_premium, out resAdminObj.fld_dividend_method,
                                                                         out resAdminObj.fld_extra_paid_period, out resAdminObj.fld_extra_premium, out resAdminObj.fld_face_amount, out resAdminObj.fld_issue_date, out resAdminObj.fld_last_paid_by, out resAdminObj.fld_last_paid_date, out resAdminObj.fld_luanch_date, out resAdminObj.fld_maturity_date, out resAdminObj.fld_next_paid_age, out resAdminObj.fld_owner_agent,
                                                                         out resAdminObj.fld_paid_date, out resAdminObj.fld_paid_mode, out resAdminObj.fld_paid_period, out resAdminObj.fld_payor, out resAdminObj.fld_plan_code, out resAdminObj.fld_plan_name, out resAdminObj.fld_rate_age, out resAdminObj.fld_rider_premium, out resAdminObj.fld_sale_department, out resAdminObj.fld_service_agent,
                                                                         out resAdminObj.fld_total_premium, out resAdminObj.fld_tranche_billed_to, out resAdminObj.fld_tranche_paid, out resAdminObj.fld_year_billed_to, out resAdminObj.fld_year_paid, out resAdminObj.fld_f2_mode_01, out resAdminObj.fld_f2_mode_03, out resAdminObj.fld_f2_mode_06, out resAdminObj.fld_f2_mode_12, out resAdminObj.fld_f4_address1,
                                                                         out resAdminObj.fld_f4_address2, out resAdminObj.fld_f4_business_phone, out resAdminObj.fld_f4_client_number, out resAdminObj.fld_f4_face_amount, out resAdminObj.fld_f4_mobile_phone, out resAdminObj.fld_f4_policy_status, out resAdminObj.fld_f4_resident_phone, out resAdminObj.fld_f4_responsible_team, out resAdminObj.fld_f4_sum_insured, out resAdminObj.fld_f5_misc_susp_date,
                                                                         out resAdminObj.fld_f5_misc_susp_value, out resAdminObj.fld_f5_prem_susp_date, out resAdminObj.fld_f5_prem_susp_value, out fld_f6_policy_list, out resAdminObj.fld_f7_assurance_code, out resAdminObj.fld_f7_hazard_health, out resAdminObj.fld_f7_hazard_occupation, out resAdminObj.fld_f7_health_check_code, out resAdminObj.fld_f8_disability_extra_premium, out resAdminObj.fld_f8_disability_premium,
                                                                         out resAdminObj.fld_f8_disability_total_premium, out resAdminObj.fld_f8_life_extra_premium, out resAdminObj.fld_f8_life_premium, out resAdminObj.fld_f8_life_total_premium, out resAdminObj.fld_f8_sum_extra_premium, out resAdminObj.fld_f8_sum_premium, out resAdminObj.fld_f8_sum_total_premium, out resAdminObj.fld_f8_tranche, out resAdminObj.fld_f8_year, out fld_f8_policy_rider_list,
                                                                         out resAdminObj.fld_warning_message, out resAdminObj.fld_f4_paid_by, out resAdminObj.fld_f4_paid_by_text, out resAdminObj.fld_f4_paid_by_create_date, out resAdminObj.fld_f4_paid_by_cancel_date, out resAdminObj.fld_f4_paid_by_account_number, out resAdminObj.fld_f4_MDC_bank, out resAdminObj.fld_f4_MDC_create_date, out resAdminObj.fld_f4_MDC_cancel_date, out resAdminObj.fld_f4_MDC_account_number,
                                                                         out resAdminObj.fld_f7_preserve_code, out resAdminObj.fld_f7_reinsurance, out resAdminObj.fld_f7_fpo_at, out resAdminObj.fld_f7_message, out resAdminObj.fld_f7_f11_message, out resAdminObj.fld_last_paid_by_text, out resAdminObj.fld_policyIsTakaful, out resAdminObj.fld_policy_status_code, out resAdminObj.fld_policy_status_subcode);
                    //, out resAdminObj.fld_smile_club, out resAdminObj.fld_topup_loan);


                    if (resAdminObj.fld_result.Trim().ToLower() == "found")
                    {
                        //// ตรวจสอบว่าสถานะกรมธรรม์เป็น 1/B/7/9 หรือไม่ ถ้าไม่เป็นจะไม่ยอมให้ชำระต่ออายุออนไลน์
                        //if (resAdminObj.fld_policy_status.Trim().ToUpper() != "1" && resAdminObj.fld_policy_status.Trim().ToUpper() != "B" && resAdminObj.fld_policy_status.Trim().ToUpper() != "7" && resAdminObj.fld_policy_status.Trim().ToUpper() != "9")
                        // 20150115 พี่ไร, พี่มด ให้รองรับเฉพาะสถานะกรมธรรม์เป็น 1 เท่านั้น
                        // ตรวจสอบว่าสถานะกรมธรรม์เป็น 1 หรือไม่ ถ้าไม่เป็นจะไม่ยอมให้ชำระต่ออายุออนไลน์
                        // ตรวจสอบfld_billed_to_date (Next due date กำหนดชำระครั้งต่อไป) ต้องมีค่า
                        // ตรวจสอบ ไม่รับกรมธรรม์ที่เป็นกองทุน IL  จะใช้กรมธรรม์ที่ขึ้นด้วย 9 ใน 10 หลัก(ของเดิม) และ เป็นกรมธรรม์ที่เป็น 8 หลัก จะไม่รับชำระทุกช่องทาง
                        if ((resAdminObj.fld_policy_status_code.Trim().ToUpper() != "1" || resAdminObj.fld_billed_to_date.Trim() == "" || (policyNumber.Trim().Substring(0, 1) == "9" && policyNumber.Trim().Length == 10) || (policyNumber.Trim().Length == 8)))
                        {
                            obj.Result = "notcomplete_กรมธรรม์นี้ไม่รับชำระค่าเบี้ยประกันต่ออายุออนไลน์";
                        }
                        else
                        { // กรณีค้างจ่ายตรวจสอบเงื่อนไขวันกำหนดชำระ ไม่เกิน 31 วัน
                            DateTime nextDue   = Convert.ToDateTime(resAdminObj.fld_billed_to_date);
                            DateTime nextDue_2 = Convert.ToDateTime(resAdminObj.fld_billed_to_date).AddDays(31);
                            DateTime paid_date = Convert.ToDateTime(resAdminObj.fld_paid_date);

                            //กรณีจ่ายก่อนล่วงหน้างวด รับเงื่อนไขnextduedate -วันที่จ่าย <= ตามงวด(1ปี ,รายเดือน ,3เดือน ,6เดือน)
                            long diff   = DateDiff(DateInterval.Month, DateTime.Today, nextDue);
                            long period = DateDiff(DateInterval.Month, paid_date, nextDue);


                            int compareValue = nextDue.CompareTo(DateTime.Today);
                            if (compareValue < 0)
                            {
                                obj.Result = "notcomplete_กรมธรรม์นี้ไม่รับชำระค่าเบี้ยประกันต่ออายุออนไลน์ เนื่องจากเกินกำหนดที่รับชำระ กรุณาชำระช่องทางอื่นๆ";
                            }
                            else if (diff > period)
                            {
                                obj.Result = "notcomplete_กรมธรรม์นี้ไม่รับชำระค่าเบี้ยประกันต่ออายุออนไลน์ เนื่องจากยังไม่ถึงกำหนดชำระ";
                            }
                            else
                            {
                                obj.TypePaid = "ชำระเบี้ยประกันภัย";
                                // ตรวจสอบว่าเป็นกรมธรรม์ที่สามารถรับชำระด้วยวิธีการใดได้บ้าง
                                if (resAdminObj.fld_warning_message.Contains("อนุโลม"))
                                {
                                    obj.PaymentTypeToPay = "CCP|CDC";
                                }
                                else if (resAdminObj.fld_warning_message.Contains("ไม่รับบัตรเครดิต"))
                                {
                                    obj.PaymentTypeToPay = "CCP";
                                }
                                else
                                {
                                    obj.PaymentTypeToPay = "CCP|CDC";
                                }

                                // ตรวจสอบว่าเป็นกรมธรรม์ประเภท PA แบบรายเดือนหรือไม่ (เลขกรมธรรม์ขึ้นต้นด้วย 8) ถ้าใช่จะต้องไปเอาค่าเบี้ยประกันรวมจากหน้าจอใบเสร็จ
                                if (policyNumber.Trim().Substring(0, 1) == "8")
                                {
                                    MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService adminWSObj_mPos = new MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService();

                                    MTL.WS_Admin.WS_Admin_ForMTLmPOS.CPINQ03_ReceiptDetailList[] receiptList;
                                    string receiptResult = adminWSObj_mPos.GetReceiptDetailList(this.admin_username, this.admin_password, policyNumber, "", "", out resAdminObj.fld_sessionID, out receiptList);
                                    if (receiptResult.Trim().ToLower() == "completed")
                                    {
                                        var lastListResult = receiptList.Last();

                                        obj.TotalPremium = lastListResult.Amount.Trim();
                                    }
                                    else
                                    {
                                        obj.TotalPremium = resAdminObj.fld_total_premium.Trim();
                                    }
                                }
                                else
                                {
                                    obj.TotalPremium = resAdminObj.fld_total_premium.Trim();
                                }

                                obj.Result          = "completed";
                                obj.PolicyNumber    = policyNumber;
                                obj.PlanCode        = resAdminObj.fld_plan_code.Trim();
                                obj.PlanName        = resAdminObj.fld_plan_name.Trim();
                                obj.IssueBilledDate = resAdminObj.fld_year_billed_to.Trim() + "/" + resAdminObj.fld_tranche_billed_to.Trim();
                                obj.BilledToDate    = resAdminObj.fld_billed_to_date.Trim();
                                obj.FaceAmount      = resAdminObj.fld_face_amount.Trim();
                                obj.PaidMode        = resAdminObj.fld_paid_mode.Trim();
                                obj.PolicyStatus    = resAdminObj.fld_policy_status_code.Trim();


                                //obj.WarningMessage = resAdminObj.fld_warning_message.Trim();
                                //obj.SessionID = resAdminObj.fld_sessionID.Trim();
                                //obj.ClientName = resAdminObj.fld_client_name.Trim();
                                //obj.IssueDate = resAdminObj.fld_issue_date.Trim();
                                //obj.ServiceAgent = resAdminObj.fld_service_agent.Trim();
                            }
                        }
                    }
                    else
                    {
                        obj.Result = resAdminObj.fld_result.Trim().Replace("notfound_", "notcomplete_");
                    }
                }
                else
                {
                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                    obj.Result = pacobj.Result.Trim().Replace("notpass_", "notcomplete_");
                }
            }

            // LogResponse: Insert Log Response
            logobj.AddWSLog(this.partnerName, this.ipaddress, "Response", this.webserviceName, methodName, obj.Result + "|" + obj.PolicyStatus + "|" + obj.TotalPremium + "|" + "|" + obj.WarningMessage + "|" + obj.PlanCode + "|" + obj.PlanName + "|" + obj.ClientName + "|" + obj.SessionID, this.refnum);

            return(obj);
        }
        catch (Exception ex)
        {
            obj.Result = "notcomplete_" + ex.Message.ToString();

            // LogResponse: Insert Log Response
            logobj.AddWSLog(this.partnerName, this.ipaddress, "Response", this.webserviceName, methodName, obj.Result, this.refnum);

            return(obj);
        }
    }
コード例 #3
0
    public GetPolicyDetailForPayment_Result GetPolicyDetailForPayment(string partnerUsername, string partnerPassword, string policyNumber)
    {
        GetPolicyDetailForPayment_Result obj = new GetPolicyDetailForPayment_Result();
        RefRunningTBBLL runningobj = new RefRunningTBBLL();
        this.refnum = runningobj.AddRefRunningTBAndReturn();
        WSLogBLL logobj = new WSLogBLL();
        string methodName = "GetPolicyDetailForPayment";

        try
        {
            if (partnerUsername == "" || partnerPassword == "" || policyNumber == "")
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                obj.Result = "notcomplete_กรุณาระบุข้อมูลให้ครบถ้วน";
            }
            else if (policyNumber.Trim().Substring(0, 2) == "PA")
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                obj.Result = "notcomplete_กรมธรรม์นี้ไม่รับชำระค่าเบี้ยประกันต่ออายุออนไลน์";
            }
            else if (policyNumber.Length != 10 || !MTL.Utils.ThisWeb.CheckIsNumeric(policyNumber))
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                obj.Result = "notcomplete_กรุณาระบุเลขกรมธรรม์ให้ถูกต้อง";
            }
            else
            {
                // พิสูจน์ตัวตนของพันธมิตรก่อนที่จะให้ใช้งานจริง
                NETWS_ForPartnerAuthenticationChecking.CheckPartnerAuthentication_Result pacobj = CheckPartnerAuthenticationReturnDetail(partnerUsername, partnerPassword, this.ipaddress);
                if (pacobj.Result.Trim().ToLower() == "passed")
                {
                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                    // ดึงข้อมูลรายละเอียดของกรมธรรม์กับ ApplinX WS_Admin
                    ApplinXGetShortPolicyDetail2Result resAdminObj = new ApplinXGetShortPolicyDetail2Result();
                    MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService adminWSObj = new MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService();
                    resAdminObj.fld_result = adminWSObj.GetShortPolicyDetail2(this.admin_username, this.admin_password, policyNumber, out resAdminObj.fld_sessionID, out resAdminObj.fld_service_agent, out resAdminObj.fld_client_name, out resAdminObj.fld_face_amount, out resAdminObj.fld_paid_mode, out resAdminObj.fld_plan_code, out resAdminObj.fld_plan_name, out resAdminObj.fld_total_premium, out resAdminObj.fld_policy_status, out resAdminObj.fld_issue_date, out resAdminObj.fld_warning_message);
                    if (resAdminObj.fld_result.Trim().ToLower() == "found")
                    {
                        //// ตรวจสอบว่าสถานะกรมธรรม์เป็น 1/B/7/9 หรือไม่ ถ้าไม่เป็นจะไม่ยอมให้ชำระต่ออายุออนไลน์
                        //if (resAdminObj.fld_policy_status.Trim().ToUpper() != "1" && resAdminObj.fld_policy_status.Trim().ToUpper() != "B" && resAdminObj.fld_policy_status.Trim().ToUpper() != "7" && resAdminObj.fld_policy_status.Trim().ToUpper() != "9")
                        // 20150115 พี่ไร, พี่มด ให้รองรับเฉพาะสถานะกรมธรรม์เป็น 1 เท่านั้น
                        // ตรวจสอบว่าสถานะกรมธรรม์เป็น 1 หรือไม่ ถ้าไม่เป็นจะไม่ยอมให้ชำระต่ออายุออนไลน์
                        if (resAdminObj.fld_policy_status.Trim().ToUpper() != "1")
                        {
                            obj.Result = "notcomplete_กรมธรรม์นี้ไม่รับชำระค่าเบี้ยประกันต่ออายุออนไลน์";
                        }
                        else
                        {
                            // ตรวจสอบว่าเป็นกรมธรรม์ที่สามารถรับชำระด้วยวิธีการใดได้บ้าง
                            if (resAdminObj.fld_warning_message.Contains("อนุโลม"))
                            {
                                obj.PaymentTypeToPay = "CCP|CDC";
                            }
                            else if (resAdminObj.fld_warning_message.Contains("ไม่รับบัตรเครดิต"))
                            {
                                obj.PaymentTypeToPay = "CCP";
                            }
                            else
                            {
                                obj.PaymentTypeToPay = "CCP|CDC";
                            }

                            // ตรวจสอบว่าเป็นกรมธรรม์ประเภท PA หรือไม่ (เลขกรมธรรม์ขึ้นต้นด้วย 8) ถ้าใช่จะต้องไปเอาค่าเบี้ยประกันรวมจากหน้าจอใบเสร็จ
                            if (policyNumber.Trim().Substring(0, 1) == "8")
                            {
                                MTL.WS_Admin.WS_Admin_ForMTLmPOS.CPINQ03_ReceiptDetailList[] receiptList;
                                string receiptResult = adminWSObj.GetReceiptDetailList(this.admin_username, this.admin_password, policyNumber, "", "", out resAdminObj.fld_sessionID, out receiptList);
                                if (receiptResult.Trim().ToLower() == "completed")
                                {
                                    var lastListResult = receiptList.Last();

                                    obj.TotalPremium = lastListResult.Amount.Trim();
                                }
                                else
                                {
                                    obj.TotalPremium = resAdminObj.fld_total_premium.Trim();
                                }
                            }
                            else
                            {
                                obj.TotalPremium = resAdminObj.fld_total_premium.Trim();
                            }

                            obj.Result = "completed";
                            obj.SessionID = resAdminObj.fld_sessionID.Trim();
                            obj.ClientName = resAdminObj.fld_client_name.Trim();
                            obj.FaceAmount = resAdminObj.fld_face_amount.Trim();
                            obj.IssueDate = resAdminObj.fld_issue_date.Trim();
                            obj.PaidMode = resAdminObj.fld_paid_mode.Trim();
                            obj.PlanCode = resAdminObj.fld_plan_code.Trim();
                            obj.PlanName = resAdminObj.fld_plan_name.Trim();
                            obj.PolicyStatus = resAdminObj.fld_policy_status.Trim();
                            obj.ServiceAgent = resAdminObj.fld_service_agent.Trim();
                            obj.WarningMessage = resAdminObj.fld_warning_message.Trim();
                        }
                    }
                    else
                    {
                        obj.Result = resAdminObj.fld_result.Trim().Replace("notfound_", "notcomplete_");
                    }
                }
                else
                {
                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                    obj.Result = pacobj.Result.Trim().Replace("notpass_", "notcomplete_");
                }
            }

            // LogResponse: Insert Log Response
            logobj.AddWSLog(this.partnerName, this.ipaddress, "Response", this.webserviceName, methodName, obj.Result + "|" + obj.PolicyStatus + "|" + obj.TotalPremium + "|" + "|" + obj.WarningMessage + "|" + obj.PlanCode + "|" + obj.PlanName + "|" + obj.ClientName + "|" + obj.SessionID, this.refnum);

            return obj;
        }
        catch (Exception ex)
        {
            obj.Result = "notcomplete_" + ex.Message.ToString();

            // LogResponse: Insert Log Response
            logobj.AddWSLog(this.partnerName, this.ipaddress, "Response", this.webserviceName, methodName, obj.Result, this.refnum);

            return obj;
        }
    }
コード例 #4
0
    public CheckAgentAuthentication_Result CheckAgentAuthentication(string partnerUsername, string partnerPassword, string agentNumber, string agentPassword)
    {
        CheckAgentAuthentication_Result obj = new CheckAgentAuthentication_Result();
        RefRunningTBBLL runningobj          = new RefRunningTBBLL();

        this.refnum = runningobj.AddRefRunningTBAndReturn();
        WSLogBLL logobj     = new WSLogBLL();
        string   methodName = "CheckAgentAuthentication";

        try
        {
            if (partnerUsername == "" || partnerPassword == "" || agentNumber == "" || agentPassword == "")
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword, this.refnum);

                obj.Result = "notpass_กรุณาระบุข้อมูลให้ครบถ้วน";
            }
            else if (agentNumber.Length != 6 || !MTL.Utils.ThisWeb.CheckIsNumeric(agentNumber))
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword, this.refnum);

                obj.Result = "notpass_กรุณาระบุเลขที่ตัวแทนให้ถูกต้อง";
            }
            else if (agentPassword.Length != 6 || !MTL.Utils.ThisWeb.CheckIsNumeric(agentPassword))
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword, this.refnum);

                obj.Result = "notpass_กรุณาระบุรหัสผ่านตัวแทนให้ถูกต้อง";
            }
            else
            {
                // พิสูจน์ตัวตนของพันธมิตรก่อนที่จะให้ใช้งานจริง
                NETWS_ForPartnerAuthenticationChecking.CheckPartnerAuthentication_Result pacobj = CheckPartnerAuthenticationReturnDetail(partnerUsername, partnerPassword, this.ipaddress);
                if (pacobj.Result.Trim().ToLower() == "passed")
                {
                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword, this.refnum);

                    // ตรวจสอบสิทธิ์ของตัวแทนกับ ApplinX WS_Agent
                    ApplinXCheckAgentAuthenticationResult resAgentObj = new ApplinXCheckAgentAuthenticationResult();
                    MTL.WS_Agent.WS_Agent_ForMTLmPOS.WS_Agent_ForMPosService agentWSObj = new MTL.WS_Agent.WS_Agent_ForMTLmPOS.WS_Agent_ForMPosService();
                    resAgentObj.fld_result = agentWSObj.CheckAgentAuthentication(ref agentNumber, agentPassword, out resAgentObj.fld_sessionID, out resAgentObj.fld_agent_name, out resAgentObj.fld_agent_department, out resAgentObj.fld_agent_position, out resAgentObj.fld_agent_type);
                    if (resAgentObj.fld_result.Trim().ToLower() == "passed")
                    {
                        // ดึงข้อมูลรายละเอียดของตัวแทนกับ ApplinX WS_Admin
                        ApplinXGetAgentDetailResult resAdminObj = new ApplinXGetAgentDetailResult();
                        MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService adminWSObj = new MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService();
                        resAdminObj.fld_result = adminWSObj.getAgentDetail(this.admin_username, this.admin_password, agentNumber, out resAdminObj.fld_sessionID, out resAdminObj.fld_agent_addrdoc_line1, out resAdminObj.fld_agent_addrdoc_line2, out resAdminObj.fld_agent_addrdoc_phone, out resAdminObj.fld_agent_address_line1, out resAdminObj.fld_agent_address_line2, out resAdminObj.fld_agent_bank_account, out resAdminObj.fld_agent_client_number, out resAdminObj.fld_agent_department, out resAdminObj.fld_agent_dob, out resAdminObj.fld_agent_end_date, out resAdminObj.fld_agent_gender, out resAdminObj.fld_agent_license_expire_date, out resAdminObj.fld_agent_license_number, out resAdminObj.fld_agent_license_start_date, out resAdminObj.fld_agent_name, out resAdminObj.fld_agent_office, out resAdminObj.fld_agent_phone, out resAdminObj.fld_agent_pid, out resAdminObj.fld_agent_policy_out, out resAdminObj.fld_agent_position, out resAdminObj.fld_agent_remark_type, out resAdminObj.fld_agent_start_date, out resAdminObj.fld_agent_status_code, out resAdminObj.fld_agent_status_description, out resAdminObj.fld_agent_tax_number, out resAdminObj.fld_agent_type, out resAdminObj.fld_agent_under_to, out resAdminObj.fld_agent_surname, out resAdminObj.fld_agent_title, out resAdminObj.fld_agent_no);
                        if (resAdminObj.fld_result.Trim().ToLower() == "found")
                        {
                            // เช็คใบอนุญาติตัวแทนว่าหมดอายุหรือยัง?
                            CovertToDateResult dateObj = new CovertToDateResult();
                            dateObj = ConvertToDate(resAdminObj.fld_agent_license_expire_date.Trim());

                            DateTime agentLicenseExpiryDate = new DateTime(dateObj.Year, dateObj.Month, dateObj.Day);

                            if (agentLicenseExpiryDate > DateTime.Now)
                            {
                                obj.Result          = "passed";
                                obj.SessionID       = resAdminObj.fld_sessionID.Trim();
                                obj.AgentName       = resAdminObj.fld_agent_name.Trim() + " " + resAdminObj.fld_agent_surname.Trim();
                                obj.AgentStatus     = resAdminObj.fld_agent_status_code.Trim();
                                obj.AgentType       = resAdminObj.fld_agent_type.Trim();
                                obj.AgentPosition   = resAdminObj.fld_agent_position.Trim();
                                obj.AgentDepartment = resAdminObj.fld_agent_department.Trim();
                            }
                            else
                            {
                                obj.Result = "notpass_ท่านไม่สามารถใช้งานได้ เนื่องจากเลขที่ตัวแทนที่ท่านระบุไม่มีผลบังคับแล้ว";
                            }
                        }
                        else
                        {
                            obj.Result = resAdminObj.fld_result.Trim().Replace("notfound_", "notpass_");
                        }
                    }
                    else
                    {
                        obj.Result = resAgentObj.fld_result.Trim();
                    }
                }
                else
                {
                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword, this.refnum);

                    obj.Result = pacobj.Result.Trim();
                }
            }

            // LogResponse: Insert Log Response
            logobj.AddWSLog(this.partnerName, this.ipaddress, "Response", this.webserviceName, methodName, obj.Result + "|" + obj.AgentName + "|" + obj.AgentStatus + "|" + obj.AgentType + "|" + obj.AgentPosition + "|" + obj.AgentDepartment + "|" + obj.SessionID, this.refnum);

            return(obj);
        }
        catch (Exception ex)
        {
            obj.Result = "notpass_" + ex.Message.ToString();

            // LogResponse: Insert Log Response
            logobj.AddWSLog(this.partnerName, this.ipaddress, "Response", this.webserviceName, methodName, obj.Result + "|" + obj.SessionID, this.refnum);

            return(obj);
        }
    }
コード例 #5
0
    public GetAgentPolicyDetailForPayment_Result GetAgentPolicyDetailForPayment(string partnerUsername, string partnerPassword, string agentNumber, string agentPassword, string policyNumber)
    {
        GetAgentPolicyDetailForPayment_Result obj = new GetAgentPolicyDetailForPayment_Result();
        RefRunningTBBLL runningobj = new RefRunningTBBLL();
        this.refnum = runningobj.AddRefRunningTBAndReturn();
        WSLogBLL logobj = new WSLogBLL();
        string methodName = "GetAgentPolicyByPolicyNumber";

        try
        {
            if (partnerUsername == "" || partnerPassword == "" || policyNumber == "" || agentNumber == "" || agentPassword == "")
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword + "|" + policyNumber, this.refnum);

                obj.Result = "notpass_กรุณาระบุข้อมูลให้ครบถ้วน";
            }
            else if (policyNumber.Length != 10 || !MTL.Utils.ThisWeb.CheckIsNumeric(policyNumber))
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword + "|" + policyNumber, this.refnum);

                obj.Result = "notcomplete_กรุณาระบุเลขกรมธรรม์ให้ถูกต้อง";
            }
            else if (agentNumber.Length != 6 || !MTL.Utils.ThisWeb.CheckIsNumeric(agentNumber))
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword + "|" + policyNumber, this.refnum);

                obj.Result = "notcomplete_กรุณาระบุเลขที่ตัวแทนให้ถูกต้อง";
            }
            else if (agentPassword.Length != 6 || !MTL.Utils.ThisWeb.CheckIsNumeric(agentPassword))
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword + "|" + policyNumber, this.refnum);

                obj.Result = "notcomplete_กรุณาระบุรหัสผ่านตัวแทนให้ถูกต้อง";
            }
            else
            {
                // พิสูจน์ตัวตนของพันธมิตรก่อนที่จะให้ใช้งานจริง
                NETWS_ForPartnerAuthenticationChecking.CheckPartnerAuthentication_Result pacobj = CheckPartnerAuthenticationReturnDetail(partnerUsername, partnerPassword, this.ipaddress);
                if (pacobj.Result.Trim().ToLower() == "passed")
                {
                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword + "|" + policyNumber, this.refnum);

                    //// ตรวจสอบว่าเลขกรมธรรม์ที่ระบุเป็นกรมธรรม์ของตัวแทนจริงกับ ApplinX WS_Agent
                    //ApplinXCheckAgentOwnerPolicyResult resAgentObj = new ApplinXCheckAgentOwnerPolicyResult();
                    //MTL.WS_Agent.WS_Agent_ForMTLmPOS.WS_Agent_ForMPosService agentWSObj = new MTL.WS_Agent.WS_Agent_ForMTLmPOS.WS_Agent_ForMPosService();
                    //resAgentObj.fld_result = agentWSObj.CheckAgentOwnerPolicy(agentNumber, agentPassword, policyNumber, out resAgentObj.fld_sessionID, out resAgentObj.fld_belong_to_agent, out resAgentObj.fld_client_name, out resAgentObj.fld_face_amount, out resAgentObj.fld_plan_code, out resAgentObj.fld_plan_name, out resAgentObj.fld_total_premium);
                    //if (resAgentObj.fld_result.Trim().ToLower() == "หมายเลขกรมธรรม์ถูกต้อง")
                    //{
                        // ดึงข้อมูลรายละเอียดของกรมธรรม์กับ ApplinX WS_Admin
                        ApplinXGetShortPolicyDetail2Result resAdminObj = new ApplinXGetShortPolicyDetail2Result();
                        MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService adminWSObj = new MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService();
                        resAdminObj.fld_result = adminWSObj.GetShortPolicyDetail2(this.admin_username, this.admin_password, policyNumber, out resAdminObj.fld_sessionID, out resAdminObj.fld_service_agent, out resAdminObj.fld_client_name, out resAdminObj.fld_face_amount, out resAdminObj.fld_paid_mode, out resAdminObj.fld_plan_code, out resAdminObj.fld_plan_name, out resAdminObj.fld_total_premium, out resAdminObj.fld_policy_status, out resAdminObj.fld_issue_date, out resAdminObj.fld_warning_message);
                        if (resAdminObj.fld_result.Trim().ToLower() == "found")
                        {
                            if (resAdminObj.fld_policy_status.Trim().ToUpper() != "1" && resAdminObj.fld_policy_status.Trim().ToUpper() != "B" && resAdminObj.fld_policy_status.Trim().ToUpper() != "7" && resAdminObj.fld_policy_status.Trim().ToUpper() != "8" && resAdminObj.fld_policy_status.Trim().ToUpper() != "9")
                            {
                                obj.Result = "notcomplete_กรมธรรม์นี้ไม่สามารถรับชำระผ่านช่องทาง mPOS ได้ กรุณาชำระผ่านช่องทางอื่นๆ ของบริษัทฯ";
                            }
                            else if (resAdminObj.fld_warning_message.Contains("ไม่รับบัตรเครดิต"))
                            {
                                obj.Result = "notcomplete_กรมธรรม์นี้ไม่รับชำระด้วยบัตรเครดิต";
                                obj.WarningMessage = "";
                            }
                            else
                            {
                                obj.Result = "completed";
                                obj.SessionID = resAdminObj.fld_sessionID.Trim();
                                obj.ClientName = resAdminObj.fld_client_name.Trim();
                                obj.FaceAmount = resAdminObj.fld_face_amount.Trim();
                                obj.IssueDate = resAdminObj.fld_issue_date.Trim();
                                obj.PaidMode = resAdminObj.fld_paid_mode.Trim();
                                obj.PlanCode = resAdminObj.fld_plan_code.Trim();
                                obj.PlanName = resAdminObj.fld_plan_name.Trim();
                                obj.PolicyStatus = resAdminObj.fld_policy_status.Trim();
                                obj.ServiceAgent = resAdminObj.fld_service_agent.Trim();
                                obj.TotalPremium = resAdminObj.fld_total_premium.Trim();
                                obj.WarningMessage = resAdminObj.fld_warning_message.Trim();
                            }

                            if (resAdminObj.fld_policy_status.Trim().ToUpper() == "8")
                            {
                                obj.TotalPremium = "";
                            }
                        }
                        else
                        {
                            obj.Result = resAdminObj.fld_result.Trim().Replace("notfound_", "notcomplete_");
                        }
                    //}
                    //else
                    //{
                    //    obj.Result = "notcomplete_" + resAgentObj.fld_result.Trim();
                    //}
                }
                else
                {
                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword + "|" + policyNumber, this.refnum);

                    obj.Result = pacobj.Result.Trim().Replace("notpass_", "notcomplete_");
                }
            }

            // LogResponse: Insert Log Response
            logobj.AddWSLog(this.partnerName, this.ipaddress, "Response", this.webserviceName, methodName, obj.Result + "|" + obj.PolicyStatus + "|" + obj.TotalPremium + "|" + "|" + obj.WarningMessage + "|" + obj.PlanCode + "|" + obj.PlanName + "|" + obj.ClientName + "|" + obj.SessionID, this.refnum);

            return obj;
        }
        catch (Exception ex)
        {
            obj.Result = "notcomplete_" + ex.Message.ToString();

            // LogResponse: Insert Log Response
            logobj.AddWSLog(this.partnerName, this.ipaddress, "Response", webserviceName, methodName, obj.Result + "|" + obj.SessionID, this.refnum);

            return obj;
        }
    }
コード例 #6
0
    public CheckAgentAuthentication_Result CheckAgentAuthentication(string partnerUsername, string partnerPassword, string agentNumber, string agentPassword)
    {
        CheckAgentAuthentication_Result obj = new CheckAgentAuthentication_Result();
        RefRunningTBBLL runningobj = new RefRunningTBBLL();
        this.refnum = runningobj.AddRefRunningTBAndReturn();
        WSLogBLL logobj = new WSLogBLL();
        string methodName = "CheckAgentAuthentication";

        try
        {
            if (partnerUsername == "" || partnerPassword == "" || agentNumber == "" || agentPassword == "")
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword, this.refnum);

                obj.Result = "notpass_กรุณาระบุข้อมูลให้ครบถ้วน";
            }
            else if (agentNumber.Length != 6 || !MTL.Utils.ThisWeb.CheckIsNumeric(agentNumber))
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword, this.refnum);

                obj.Result = "notpass_กรุณาระบุเลขที่ตัวแทนให้ถูกต้อง";
            }
            else if (agentPassword.Length != 6 || !MTL.Utils.ThisWeb.CheckIsNumeric(agentPassword))
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword, this.refnum);

                obj.Result = "notpass_กรุณาระบุรหัสผ่านตัวแทนให้ถูกต้อง";
            }
            else
            {
                // พิสูจน์ตัวตนของพันธมิตรก่อนที่จะให้ใช้งานจริง
                NETWS_ForPartnerAuthenticationChecking.CheckPartnerAuthentication_Result pacobj = CheckPartnerAuthenticationReturnDetail(partnerUsername, partnerPassword, this.ipaddress);
                if (pacobj.Result.Trim().ToLower() == "passed")
                {
                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword, this.refnum);

                    // ตรวจสอบสิทธิ์ของตัวแทนกับ ApplinX WS_Agent
                    ApplinXCheckAgentAuthenticationResult resAgentObj = new ApplinXCheckAgentAuthenticationResult();
                    MTL.WS_Agent.WS_Agent_ForMTLmPOS.WS_Agent_ForMPosService agentWSObj = new MTL.WS_Agent.WS_Agent_ForMTLmPOS.WS_Agent_ForMPosService();
                    resAgentObj.fld_result = agentWSObj.CheckAgentAuthentication(ref agentNumber, agentPassword, out resAgentObj.fld_sessionID, out resAgentObj.fld_agent_name, out resAgentObj.fld_agent_department, out resAgentObj.fld_agent_position, out resAgentObj.fld_agent_type);
                    if (resAgentObj.fld_result.Trim().ToLower() == "passed")
                    {
                        // ดึงข้อมูลรายละเอียดของตัวแทนกับ ApplinX WS_Admin
                        ApplinXGetAgentDetailResult resAdminObj = new ApplinXGetAgentDetailResult();
                        MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService adminWSObj = new MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService();
                        resAdminObj.fld_result = adminWSObj.getAgentDetail(this.admin_username, this.admin_password, agentNumber, out resAdminObj.fld_sessionID, out resAdminObj.fld_agent_addrdoc_line1, out resAdminObj.fld_agent_addrdoc_line2, out resAdminObj.fld_agent_addrdoc_phone, out resAdminObj.fld_agent_address_line1, out resAdminObj.fld_agent_address_line2, out resAdminObj.fld_agent_bank_account, out resAdminObj.fld_agent_client_number, out resAdminObj.fld_agent_department, out resAdminObj.fld_agent_dob, out resAdminObj.fld_agent_end_date, out resAdminObj.fld_agent_gender, out resAdminObj.fld_agent_license_expire_date, out resAdminObj.fld_agent_license_number, out resAdminObj.fld_agent_license_start_date, out resAdminObj.fld_agent_name, out resAdminObj.fld_agent_office, out resAdminObj.fld_agent_phone, out resAdminObj.fld_agent_pid, out resAdminObj.fld_agent_policy_out, out resAdminObj.fld_agent_position, out resAdminObj.fld_agent_remark_type, out resAdminObj.fld_agent_start_date, out resAdminObj.fld_agent_status_code, out resAdminObj.fld_agent_status_description, out resAdminObj.fld_agent_tax_number, out resAdminObj.fld_agent_type, out resAdminObj.fld_agent_under_to, out resAdminObj.fld_agent_surname, out resAdminObj.fld_agent_title, out resAdminObj.fld_agent_no);
                        if (resAdminObj.fld_result.Trim().ToLower() == "found")
                        {
                            // เช็คใบอนุญาติตัวแทนว่าหมดอายุหรือยัง?
                            CovertToDateResult dateObj = new CovertToDateResult();
                            dateObj = ConvertToDate(resAdminObj.fld_agent_license_expire_date.Trim());

                            DateTime agentLicenseExpiryDate = new DateTime(dateObj.Year, dateObj.Month, dateObj.Day);

                            if (agentLicenseExpiryDate > DateTime.Now)
                            {
                                obj.Result = "passed";
                                obj.SessionID = resAdminObj.fld_sessionID.Trim();
                                obj.AgentName = resAdminObj.fld_agent_name.Trim() + " " + resAdminObj.fld_agent_surname.Trim();
                                obj.AgentStatus = resAdminObj.fld_agent_status_code.Trim();
                                obj.AgentType = resAdminObj.fld_agent_type.Trim();
                                obj.AgentPosition = resAdminObj.fld_agent_position.Trim();
                                obj.AgentDepartment = resAdminObj.fld_agent_department.Trim();
                            }
                            else
                            {
                                obj.Result = "notpass_ท่านไม่สามารถใช้งานได้ เนื่องจากเลขที่ตัวแทนที่ท่านระบุไม่มีผลบังคับแล้ว";
                            }
                        }
                        else
                        {
                            obj.Result = resAdminObj.fld_result.Trim().Replace("notfound_", "notpass_");
                        }
                    }
                    else
                    {
                        obj.Result = resAgentObj.fld_result.Trim();
                    }
                }
                else
                {
                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber + "|" + agentPassword, this.refnum);

                    obj.Result = pacobj.Result.Trim();
                }
            }

            // LogResponse: Insert Log Response
            logobj.AddWSLog(this.partnerName, this.ipaddress, "Response", this.webserviceName, methodName, obj.Result + "|" + obj.AgentName + "|" + obj.AgentStatus + "|" + obj.AgentType + "|" + obj.AgentPosition + "|" + obj.AgentDepartment + "|" + obj.SessionID, this.refnum);

            return obj;
        }
        catch (Exception ex)
        {
            obj.Result = "notpass_" + ex.Message.ToString();

            // LogResponse: Insert Log Response
            logobj.AddWSLog(this.partnerName, this.ipaddress, "Response", this.webserviceName, methodName, obj.Result + "|" + obj.SessionID, this.refnum);

            return obj;
        }
    }
コード例 #7
0
    public GetPolicyDetailForPayment_Result GetPolicyDetailForPayment(string partnerUsername, string partnerPassword, string policyNumber)
    {
        GetPolicyDetailForPayment_Result obj = new GetPolicyDetailForPayment_Result();
        PremiumDetail_Result pmobj = new PremiumDetail_Result();
        RefRunningTBBLL runningobj = new RefRunningTBBLL();
        this.refnum = runningobj.AddRefRunningTBAndReturn();
        WSLogBLL logobj = new WSLogBLL();
        string methodName = "GetPolicyDetailForPayment";

        try
        {
            if (partnerUsername == "" || partnerPassword == "" || policyNumber == "")
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                obj.Result = "notcomplete_กรุณาระบุข้อมูลให้ครบถ้วน";
            }
            else if (policyNumber.Trim().Substring(0, 2) == "PA")
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                obj.Result = "notcomplete_กรมธรรม์นี้ไม่รับชำระค่าเบี้ยประกันต่ออายุออนไลน์";
            }
            else if (policyNumber.Length != 10 || !MTL.Utils.ThisWeb.CheckIsNumeric(policyNumber))
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                obj.Result = "notcomplete_กรุณาระบุเลขกรมธรรม์ให้ถูกต้อง";
            }
            else
            {
                // พิสูจน์ตัวตนของพันธมิตรก่อนที่จะให้ใช้งานจริง
                NETWS_ForPartnerAuthenticationChecking.CheckPartnerAuthentication_Result pacobj = CheckPartnerAuthenticationReturnDetail(partnerUsername, partnerPassword, this.ipaddress);
                if (pacobj.Result.Trim().ToLower() == "passed")
                {
                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                    // ดึงข้อมูลรายละเอียดของกรมธรรม์กับ ApplinX WS_Admin
                    //ApplinXGetShortPolicyDetail2Result resAdminObj = new ApplinXGetShortPolicyDetail2Result();
                    //MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService adminWSObj = new MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService();
                    //resAdminObj.fld_result = adminWSObj.GetpolicyDetail(this.admin_username, this.admin_password, policyNumber, out resAdminObj.fld_sessionID, out resAdminObj.fld_service_agent, out resAdminObj.fld_client_name, out resAdminObj.fld_face_amount, out resAdminObj.fld_paid_mode, out resAdminObj.fld_plan_code, out resAdminObj.fld_plan_name, out resAdminObj.fld_total_premium, out resAdminObj.fld_policy_status, out resAdminObj.fld_issue_date, out resAdminObj.fld_warning_message);
                    ApplinXGetPolicyDetail2Result resAdminObj = new ApplinXGetPolicyDetail2Result();

                    MTL.WS_Admin.WS_Admin_SmileServices.WS_Admin_ForSmartCardService adminWSObj = new MTL.WS_Admin.WS_Admin_SmileServices.WS_Admin_ForSmartCardService();
                    MTL.WS_Admin.WS_Admin_SmileServices.CPINQ02C_F6_PolicyList[] fld_f6_policy_list;
                    MTL.WS_Admin.WS_Admin_SmileServices.CPINQ02_PolicyRiderList[] fld_f8_policy_rider_list;

                    resAdminObj.fld_result = adminWSObj.GetPolicyDetail2(this.admin_username, this.admin_password, policyNumber, out resAdminObj.fld_sessionID,
                   out resAdminObj.fld_approve_date, out resAdminObj.fld_attained_date, out resAdminObj.fld_belong_to_agent, out resAdminObj.fld_billed_to_date, out resAdminObj.fld_client_address, out resAdminObj.fld_client_dob, out resAdminObj.fld_client_name, out resAdminObj.fld_coverage_period, out resAdminObj.fld_disability_premium, out resAdminObj.fld_dividend_method,
                   out resAdminObj.fld_extra_paid_period, out resAdminObj.fld_extra_premium, out resAdminObj.fld_face_amount, out resAdminObj.fld_issue_date, out resAdminObj.fld_last_paid_by, out resAdminObj.fld_last_paid_date, out resAdminObj.fld_luanch_date, out resAdminObj.fld_maturity_date, out resAdminObj.fld_next_paid_age, out resAdminObj.fld_owner_agent,
                   out resAdminObj.fld_paid_date, out resAdminObj.fld_paid_mode, out resAdminObj.fld_paid_period, out resAdminObj.fld_payor, out resAdminObj.fld_plan_code, out resAdminObj.fld_plan_name, out resAdminObj.fld_rate_age, out resAdminObj.fld_rider_premium, out  resAdminObj.fld_sale_department, out resAdminObj.fld_service_agent,
                   out resAdminObj.fld_total_premium, out resAdminObj.fld_tranche_billed_to, out resAdminObj.fld_tranche_paid, out resAdminObj.fld_year_billed_to, out resAdminObj.fld_year_paid, out resAdminObj.fld_f2_mode_01, out resAdminObj.fld_f2_mode_03, out resAdminObj.fld_f2_mode_06, out resAdminObj.fld_f2_mode_12, out resAdminObj.fld_f4_address1,
                   out resAdminObj.fld_f4_address2, out resAdminObj.fld_f4_business_phone, out resAdminObj.fld_f4_client_number, out resAdminObj.fld_f4_face_amount, out resAdminObj.fld_f4_mobile_phone, out resAdminObj.fld_f4_policy_status, out resAdminObj.fld_f4_resident_phone, out resAdminObj.fld_f4_responsible_team, out resAdminObj.fld_f4_sum_insured, out resAdminObj.fld_f5_misc_susp_date,
                   out resAdminObj.fld_f5_misc_susp_value, out resAdminObj.fld_f5_prem_susp_date, out resAdminObj.fld_f5_prem_susp_value, out  fld_f6_policy_list, out resAdminObj.fld_f7_assurance_code, out resAdminObj.fld_f7_hazard_health, out resAdminObj.fld_f7_hazard_occupation, out resAdminObj.fld_f7_health_check_code, out resAdminObj.fld_f8_disability_extra_premium, out resAdminObj.fld_f8_disability_premium,
                   out resAdminObj.fld_f8_disability_total_premium, out resAdminObj.fld_f8_life_extra_premium, out resAdminObj.fld_f8_life_premium, out resAdminObj.fld_f8_life_total_premium, out resAdminObj.fld_f8_sum_extra_premium, out resAdminObj.fld_f8_sum_premium, out resAdminObj.fld_f8_sum_total_premium, out resAdminObj.fld_f8_tranche, out resAdminObj.fld_f8_year, out fld_f8_policy_rider_list,
                   out resAdminObj.fld_warning_message, out resAdminObj.fld_f4_paid_by, out resAdminObj.fld_f4_paid_by_text, out resAdminObj.fld_f4_paid_by_create_date, out resAdminObj.fld_f4_paid_by_cancel_date, out resAdminObj.fld_f4_paid_by_account_number, out resAdminObj.fld_f4_MDC_bank, out resAdminObj.fld_f4_MDC_create_date, out resAdminObj.fld_f4_MDC_cancel_date, out resAdminObj.fld_f4_MDC_account_number,
                   out resAdminObj.fld_f7_preserve_code, out resAdminObj.fld_f7_reinsurance, out resAdminObj.fld_f7_fpo_at, out resAdminObj.fld_f7_message, out resAdminObj.fld_f7_f11_message, out resAdminObj.fld_last_paid_by_text, out resAdminObj.fld_policyIsTakaful, out resAdminObj.fld_policy_status_code, out resAdminObj.fld_policy_status_subcode);
                    //, out resAdminObj.fld_smile_club, out resAdminObj.fld_topup_loan);

                    if (resAdminObj.fld_result.Trim().ToLower() == "found")
                    {
                        //// ตรวจสอบว่าสถานะกรมธรรม์เป็น 1/B/7/9 หรือไม่ ถ้าไม่เป็นจะไม่ยอมให้ชำระต่ออายุออนไลน์
                        //if (resAdminObj.fld_policy_status.Trim().ToUpper() != "1" && resAdminObj.fld_policy_status.Trim().ToUpper() != "B" && resAdminObj.fld_policy_status.Trim().ToUpper() != "7" && resAdminObj.fld_policy_status.Trim().ToUpper() != "9")
                        // 20150115 พี่ไร, พี่มด ให้รองรับเฉพาะสถานะกรมธรรม์เป็น 1 เท่านั้น
                        // ตรวจสอบว่าสถานะกรมธรรม์เป็น 1 หรือไม่ ถ้าไม่เป็นจะไม่ยอมให้ชำระต่ออายุออนไลน์
                        // ตรวจสอบfld_billed_to_date (Next due date กำหนดชำระครั้งต่อไป) ต้องมีค่า
                        // ตรวจสอบ ไม่รับกรมธรรม์ที่เป็นกองทุน IL  จะใช้กรมธรรม์ที่ขึ้นด้วย 9 ใน 10 หลัก(ของเดิม) และ เป็นกรมธรรม์ที่เป็น 8 หลัก จะไม่รับชำระทุกช่องทาง
                        if ((resAdminObj.fld_policy_status_code.Trim().ToUpper() != "1" || resAdminObj.fld_billed_to_date.Trim() == "" || (policyNumber.Trim().Substring(0, 1) == "9" && policyNumber.Trim().Length == 10) || (policyNumber.Trim().Length == 8)))
                        {
                                obj.Result = "notcomplete_กรมธรรม์นี้ไม่รับชำระค่าเบี้ยประกันต่ออายุออนไลน์";
                        }
                        else
                        { // กรณีค้างจ่ายตรวจสอบเงื่อนไขวันกำหนดชำระ ไม่เกิน 31 วัน
                            DateTime nextDue = Convert.ToDateTime(resAdminObj.fld_billed_to_date);
                            DateTime nextDue_2 = Convert.ToDateTime(resAdminObj.fld_billed_to_date).AddDays(31);
                            DateTime paid_date = Convert.ToDateTime(resAdminObj.fld_paid_date);

                            //กรณีจ่ายก่อนล่วงหน้างวด รับเงื่อนไขnextduedate -วันที่จ่าย <= ตามงวด(1ปี ,รายเดือน ,3เดือน ,6เดือน)
                            long diff = DateDiff(DateInterval.Month, DateTime.Today, nextDue);
                            long period = DateDiff(DateInterval.Month, paid_date, nextDue);

                            int compareValue = nextDue.CompareTo(DateTime.Today);
                            if (compareValue < 0 )
                            {
                                obj.Result = "notcomplete_กรมธรรม์นี้ไม่รับชำระค่าเบี้ยประกันต่ออายุออนไลน์ เนื่องจากเกินกำหนดที่รับชำระ กรุณาชำระช่องทางอื่นๆ";

                            }
                            else if (diff > period)
                            {
                                obj.Result = "notcomplete_กรมธรรม์นี้ไม่รับชำระค่าเบี้ยประกันต่ออายุออนไลน์ เนื่องจากยังไม่ถึงกำหนดชำระ";
                            }
                            else
                            {
                                obj.TypePaid = "ชำระเบี้ยประกันภัย";
                                // ตรวจสอบว่าเป็นกรมธรรม์ที่สามารถรับชำระด้วยวิธีการใดได้บ้าง
                                if (resAdminObj.fld_warning_message.Contains("อนุโลม"))
                                {
                                    obj.PaymentTypeToPay = "CCP|CDC";
                                }
                                else if (resAdminObj.fld_warning_message.Contains("ไม่รับบัตรเครดิต"))
                                {
                                    obj.PaymentTypeToPay = "CCP";
                                }
                                else
                                {
                                    obj.PaymentTypeToPay = "CCP|CDC";
                                }

                                // ตรวจสอบว่าเป็นกรมธรรม์ประเภท PA แบบรายเดือนหรือไม่ (เลขกรมธรรม์ขึ้นต้นด้วย 8) ถ้าใช่จะต้องไปเอาค่าเบี้ยประกันรวมจากหน้าจอใบเสร็จ
                                if (policyNumber.Trim().Substring(0, 1) == "8" )
                                {
                                    MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService adminWSObj_mPos = new MTL.WS_Admin.WS_Admin_ForMTLmPOS.WS_Admin_ForMPosService();

                                    MTL.WS_Admin.WS_Admin_ForMTLmPOS.CPINQ03_ReceiptDetailList[] receiptList;
                                    string receiptResult = adminWSObj_mPos.GetReceiptDetailList(this.admin_username, this.admin_password, policyNumber, "", "", out resAdminObj.fld_sessionID, out receiptList);
                                    if (receiptResult.Trim().ToLower() == "completed")
                                    {
                                        var lastListResult = receiptList.Last();

                                        obj.TotalPremium = lastListResult.Amount.Trim();
                                    }
                                    else
                                    {
                                        obj.TotalPremium = resAdminObj.fld_total_premium.Trim();
                                    }
                                }
                                else
                                {
                                    obj.TotalPremium = resAdminObj.fld_total_premium.Trim();
                                }

                                obj.Result = "completed";
                                obj.PolicyNumber = policyNumber;
                                obj.PlanCode = resAdminObj.fld_plan_code.Trim();
                                obj.PlanName = resAdminObj.fld_plan_name.Trim();
                                obj.IssueBilledDate = resAdminObj.fld_year_billed_to.Trim() + "/" + resAdminObj.fld_tranche_billed_to.Trim();
                                obj.BilledToDate = resAdminObj.fld_billed_to_date.Trim();
                                obj.FaceAmount = resAdminObj.fld_face_amount.Trim();
                                obj.PaidMode = resAdminObj.fld_paid_mode.Trim();
                                obj.PolicyStatus = resAdminObj.fld_policy_status_code.Trim();

                                //obj.WarningMessage = resAdminObj.fld_warning_message.Trim();
                                //obj.SessionID = resAdminObj.fld_sessionID.Trim();
                                //obj.ClientName = resAdminObj.fld_client_name.Trim();
                                //obj.IssueDate = resAdminObj.fld_issue_date.Trim();
                                //obj.ServiceAgent = resAdminObj.fld_service_agent.Trim();

                            }

                        }
                    }
                    else
                    {
                        obj.Result = resAdminObj.fld_result.Trim().Replace("notfound_", "notcomplete_");
                    }
                }
                else
                {
                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + policyNumber, this.refnum);

                    obj.Result = pacobj.Result.Trim().Replace("notpass_", "notcomplete_");
                }
            }

            // LogResponse: Insert Log Response
            logobj.AddWSLog(this.partnerName, this.ipaddress, "Response", this.webserviceName, methodName, obj.Result + "|" + obj.PolicyStatus + "|" + obj.TotalPremium + "|" + "|" + obj.WarningMessage + "|" + obj.PlanCode + "|" + obj.PlanName + "|" + obj.ClientName + "|" + obj.SessionID, this.refnum);

            return obj;
        }
        catch (Exception ex)
        {
            obj.Result = "notcomplete_" + ex.Message.ToString();

            // LogResponse: Insert Log Response
            logobj.AddWSLog(this.partnerName, this.ipaddress, "Response", this.webserviceName, methodName, obj.Result, this.refnum);

            return obj;
        }
    }