/// <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;
    }
    public GetAgentStatus_Result GetAgentStatusByName(string partnerUsername, string partnerPassword, string agentName, string agentSurname)
    {
        GetAgentStatus_Result obj = new GetAgentStatus_Result();
        RefRunningTBBLL runningobj = new RefRunningTBBLL();
        this.refnum = runningobj.AddRefRunningTBAndReturn();
        WSLogBLL logobj = new WSLogBLL();
        string methodName = "GetAgentStatusByName";

        try
        {
            if (partnerUsername == "" || partnerPassword == "" || agentName == "" || agentSurname == "")
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentName + "|" + agentSurname, 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 + "|" + agentName + "|" + agentSurname, this.refnum);

                    // ค้นหาเลขที่ตัวแทนจากชื่อนามสกุล
                    ApplinXGetAgentNumberSearchByNameResult resAdminObj = new ApplinXGetAgentNumberSearchByNameResult();
                    MTL.WS_Admin.WS_Admin_ForCMS.WS_Admin_ForCMSService adminWSObj = new MTL.WS_Admin.WS_Admin_ForCMS.WS_Admin_ForCMSService();
                    resAdminObj.fld_result = adminWSObj.getAgentNumberSearchByName(this.admin_username, this.admin_password, agentName, agentSurname, out resAdminObj.fld_sessionID, out resAdminObj.fld_agent_number);
                    if (resAdminObj.fld_result.Trim() == "found")
                    {
                        // ตรวจสอบสถานะตัวแทน
                        ApplinXGetAgentDetailResult resAgentDetailObj = new ApplinXGetAgentDetailResult();
                        resAgentDetailObj = this.GetAgentDetail(resAdminObj.fld_agent_number.Trim());
                        if (resAgentDetailObj.fld_result.Trim().ToLower() == "found")
                        {
                            // เช็คสถานะตัวแทน
                            if (resAgentDetailObj.fld_agent_status_code.Trim() == "A")
                            {
                                obj.Result = "completed";
                                obj.AgentNumber = resAgentDetailObj.fld_agent_no.Trim();
                                obj.Name = resAgentDetailObj.fld_agent_title.Trim() + " " + resAgentDetailObj.fld_agent_name.Trim() + " " + resAgentDetailObj.fld_agent_surname.Trim();
                                obj.Gender = resAgentDetailObj.fld_agent_gender.Trim();
                                obj.DoB = resAgentDetailObj.fld_agent_dob.Trim();
                                obj.Phone = resAgentDetailObj.fld_agent_phone.Trim();
                                obj.LicenseNumber = resAgentDetailObj.fld_agent_license_number.Trim();
                                obj.Department = resAgentDetailObj.fld_agent_department.Trim();
                                obj.Position = resAgentDetailObj.fld_agent_position.Trim();
                                obj.AgentPictureURL = resAgentDetailObj.AgentPictureURL.Trim();
                            }
                            else
                            {
                                obj.Result = "notcomplete_ตัวแทนคนนี้ได้พ้นสภาพจากการเป็นตัวแทนกับบริษัทฯ แล้ว";
                            }
                        }
                        else
                        {
                            obj.Result = resAgentDetailObj.fld_result.Trim().Replace("notfound_", "notcomplete_");
                        }
                    }
                    else
                    {
                        obj.Result = "notcomplete_ไม่พบตัวแทนที่มีชื่อนามสกุลตามที่ท่านระบุ";
                    }
                }
                else
                {
                    this.partnerName = pacobj.PartnerName;
                    // LogRequest: Insert Log Request
                    logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentName + "|" + agentSurname, 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.AgentNumber + "|" + obj.Name + "|" + obj.LicenseNumber, 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 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);
        }
    }
    public GetAgentStatus_Result GetAgentStatusByAgentNumber(string partnerUsername, string partnerPassword, string agentNumber)
    {
        GetAgentStatus_Result obj = new GetAgentStatus_Result();
        RefRunningTBBLL runningobj = new RefRunningTBBLL();
        this.refnum = runningobj.AddRefRunningTBAndReturn();
        WSLogBLL logobj = new WSLogBLL();
        string methodName = "GetAgentStatusByAgentNumber";

        try
        {
            if (partnerUsername == "" || partnerPassword == "" || agentNumber == "")
            {
                this.partnerName = partnerUsername;
                // LogRequest: Insert Log Request
                logobj.AddWSLog(this.partnerName, this.ipaddress, "Request", this.webserviceName, methodName, partnerUsername + "|" + agentNumber, 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, 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, this.refnum);

                    // ตรวจสอบสถานะตัวแทน
                    ApplinXGetAgentDetailResult resAgentDetailObj = new ApplinXGetAgentDetailResult();
                    resAgentDetailObj = this.GetAgentDetail(agentNumber);
                    if (resAgentDetailObj.fld_result.Trim().ToLower() == "found")
                    {
                        // เช็คสถานะตัวแทน
                        if (resAgentDetailObj.fld_agent_status_code.Trim() == "A")
                        {
                            obj.Result = "completed";
                            obj.AgentNumber = resAgentDetailObj.fld_agent_no.Trim();
                            obj.Name = resAgentDetailObj.fld_agent_title.Trim() + " " + resAgentDetailObj.fld_agent_name.Trim() + " " + resAgentDetailObj.fld_agent_surname.Trim();
                            obj.Gender = resAgentDetailObj.fld_agent_gender.Trim();
                            obj.DoB = resAgentDetailObj.fld_agent_dob.Trim();
                            obj.Phone = resAgentDetailObj.fld_agent_phone.Trim();
                            obj.LicenseNumber = resAgentDetailObj.fld_agent_license_number.Trim();
                            obj.Department = resAgentDetailObj.fld_agent_department.Trim();
                            obj.Position = resAgentDetailObj.fld_agent_position.Trim();
                            obj.AgentPictureURL = resAgentDetailObj.AgentPictureURL.Trim();
                        }
                        else
                        {
                            obj.Result = "notcomplete_ตัวแทนคนนี้ได้พ้นสภาพจากการเป็นตัวแทนกับบริษัทฯ แล้ว";
                        }
                    }
                    else
                    {
                        obj.Result = resAgentDetailObj.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 + "|" + agentNumber, 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.AgentNumber + "|" + obj.Name + "|" + obj.LicenseNumber, 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;
        }
    }
    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;
        }
    }