IEnumerable <ExistingProductData> InquiryCustomerSingleView(string IDNumber, string IDTypeCode, string IDIssueCountryCode) { CBSCustomerService.CBSCustomerService ws = new CBSCustomerService.CBSCustomerService(); ws.Timeout = AppConstant.CBSTimeout; IEnumerable <ExistingProductData> result = new List <ExistingProductData>(); try { InquiryCustomerSingleView req = new InquiryCustomerSingleView(); req.Header = new InquiryCustomerSingleViewHeader { ReferenceNo = DateTime.Now.ToString("yyyyMMddhhmmss", new System.Globalization.CultureInfo("en-US")), TransactionDateTime = DateTime.Now, ServiceName = AppConstant.CBSInquiryCustomerSingleView, SystemCode = AppConstant.CBSSystemCode, ChannelID = AppConstant.CBSChannelID }; _log.Info("InquiryCustomerSingleView => ReferenceNo:" + req.Header.ReferenceNo + " IDNumber:" + IDNumber + " IDTypeCode : " + IDTypeCode + " IDIssueCountryCode : " + IDIssueCountryCode); req.InquiryCustomerSingleViewRequest = new InquiryCustomerSingleViewInquiryCustomerSingleViewRequest(); req.InquiryCustomerSingleViewRequest.IDNumber = IDNumber; req.InquiryCustomerSingleViewRequest.IDTypeCode = IDTypeCode; req.InquiryCustomerSingleViewRequest.IDIssueCountryCode = IDIssueCountryCode; _log.DebugFormat("XML Request " + Environment.NewLine + "{0}", req.SerializeObject()); InquiryCustomerSingleViewResponse res = new InquiryCustomerSingleViewResponse(); res = ws.InquiryCustomerSingleView(req); if (res != null) { if (res.Header.ResponseStatusInfo.ResponseStatus.ResponseCode == "CBS-I-1000") { IEnumerable <ExistingProductData> awb = new List <ExistingProductData>(); IEnumerable <ExistingProductData> swb = new List <ExistingProductData>(); IEnumerable <ExistingProductData> iwb = new List <ExistingProductData>(); if (res.Header.ProductList != null) { var tmpAwb = (from c in res.Header.ProductList select new ExistingProductData { CitizenId = txtCitizenId.Text, ProductGroup = (!string.IsNullOrEmpty(c.AccountTypeCode) ? c.AccountTypeCode : ""), ProductName = (!string.IsNullOrEmpty(c.ProductCode) ? c.ProductCode : ""), //Grade = , ContactNo = (!string.IsNullOrEmpty(c.AccountNumber) ? c.AccountNumber : ""), //StartDate = c.EffectiveDate, //EndDate = c.ValidTill, //PaymentTerm = , Status = (string.IsNullOrEmpty(c.AccountStatus) == false ? AccountStatusBiz.GetAccountStatusByCode(c.AccountStatus).AccountStatusName : "") }); awb = (tmpAwb != null ? tmpAwb : new List <ExistingProductData>()); } if (res.Header.ServiceList != null) { var tmpSwb = (from c in res.Header.ServiceList select new ExistingProductData { CitizenId = txtCitizenId.Text, ProductGroup = (!string.IsNullOrEmpty(c.AccountTypeCode) ? c.AccountTypeCode : ""), ProductName = (!string.IsNullOrEmpty(c.ProductCode) ? c.ProductCode : ""), //Grade = , ContactNo = (!string.IsNullOrEmpty(c.AccountNumber) ? c.AccountNumber : ""), StartDate = SLMUtil.ConvertTimeZoneFromUtc(c.EffectiveDate), EndDate = SLMUtil.ConvertTimeZoneFromUtc(c.ValidTill), //PaymentTerm = , Status = (string.IsNullOrEmpty(c.AccountStatus) == false ? AccountStatusBiz.GetAccountStatusByCode(c.AccountStatus).AccountStatusName : "") }); swb = (tmpSwb != null ? tmpSwb : new List <ExistingProductData>()); } if (res.Header.InstructionList != null) { var tmpIwb = (from c in res.Header.InstructionList select new ExistingProductData { CitizenId = txtCitizenId.Text, ProductGroup = (!string.IsNullOrEmpty(c.AccountTypeCode) ? c.AccountTypeCode : ""), ProductName = (!string.IsNullOrEmpty(c.InstructionDescription) ? c.InstructionDescription : ""), //Grade = , ContactNo = BankBiz.GetBankByNo(c.BankNumber.ToString()) + c.AccountNumber, StartDate = SLMUtil.ConvertTimeZoneFromUtc(c.EffectiveDate), //EndDate = c.ValidTill, //PaymentTerm = , Status = (string.IsNullOrEmpty(c.SubscriptionStatus) == false ? AccountStatusBiz.GetAccountStatusByCode(c.SubscriptionStatus).AccountStatusName : "") }); iwb = (tmpIwb != null ? tmpIwb : new List <ExistingProductData>()); } result = awb.Union(swb).Union(iwb); } else if (res.Header.ResponseStatusInfo.ResponseStatus.ResponseCode == "CBS-M-2001") { _log.Info(res.Header.ResponseStatusInfo.ResponseStatus.ResponseMessage); gvExistProduct.EmptyDataText = "<center><span style='color:Red;'>ไม่พบข้อมูล</span></center>"; } else { _log.Error(res.Header.ResponseStatusInfo.ResponseStatus.ResponseMessage); gvExistProduct.EmptyDataText = "<center><span style='color:Red;'>เกิดข้อผิดพลาดในการเชื่อมต่อ Webservice InquiryCustomerSingleView</span></center>"; } } _log.DebugFormat("XML Response " + Environment.NewLine + "{0}", res.SerializeObject()); } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; _log.Error(message); gvExistProduct.EmptyDataText = "<center><span style='color:Red;'>ไม่สามารถเชื่อมต่อ Webservice InquiryCustomerSingleView</span></center>"; } return(result); }