public async Task <List <Providers> > GetProvidersByNationalId() { string nationalId = TempData["NationalId"].ToString(); string yob = TempData["YOB"].ToString(); TempData.Keep("YOB"); TempData.Keep("NationalId"); var result = new List <Providers>(); try { if (nationalId != null && yob != null) { var clsInput = new ClsInput(); clsInput.code = "CI"; clsInput.nationalID = nationalId; DateTime date = Convert.ToDateTime(yob); clsInput.yearOfBirth = date.Year.ToString(); clsInput.insPolicyNo = ""; result = await _providersHandler.GetProvidersByNationalId(clsInput); } return(result); } catch (Exception ex) { _logger.LogInformation(_className + "::GetReImDetailsById:: " + ex.Message); } return(result); }
public async Task <List <PaidClaims> > GetPaidClaimsByNationalId() { string nationalId = TempData["NationalId"].ToString(); string yob = TempData["YOB"].ToString(); TempData.Keep("YOB"); TempData.Keep("NationalId"); var result = new List <PaidClaims>(); try { if (nationalId != null && yob != null) { var clsInput = new ClsInput(); clsInput.code = ""; clsInput.nationalID = nationalId; DateTime date = DateTime.ParseExact(yob, "dd-MM-yyyy", null); clsInput.yearOfBirth = date.Year.ToString(); clsInput.insPolicyNo = ""; result = await _claimsHandler.GetPaidClaimsByNationalId(clsInput); } return(result); } catch (Exception ex) { _logger.LogInformation(_className + "::GetPaidClaimsByNationalId:: " + ex.Message); } return(result); }
public async Task <List <Approvals> > GetApprovalsByNationalId(ClsInput clsInput) { List <Approvals> _approvals = null; HttpMessageHandler handler = new HttpClientHandler(); var httpClient = new HttpClient(handler) { BaseAddress = new Uri(WebConstants.HostAddress + "api/GetApprovals"), Timeout = new TimeSpan(0, 2, 0) }; httpClient.DefaultRequestHeaders.Add("ContentType", "application/json"); //Getting the input paramters as json string content = GetJson(clsInput); var httpContent = new StringContent(content, Encoding.UTF8, "application/json"); HttpResponseMessage response = await httpClient.PostAsync(WebConstants.HostAddress + "api/GetApprovals", httpContent); if (response.StatusCode == HttpStatusCode.OK) { var res = JsonConvert.DeserializeObject <GetApprovalsResponse>(response.Content.ReadAsStringAsync().Result); _approvals = res.responseData; } return(_approvals); }
public async Task <List <CoverageBalance> > GetCoveragesByNationalId(ClsInput clsInput) { List <CoverageBalance> _coverageBalance = null; HttpMessageHandler handler = new HttpClientHandler(); var httpClient = new HttpClient(handler) { BaseAddress = new Uri("https://localhost:44328/api/GetCoverageBalances"), Timeout = new TimeSpan(0, 2, 0) }; httpClient.DefaultRequestHeaders.Add("ContentType", "application/json"); //Getting the input paramters as json string content = GetJson(clsInput); var httpContent = new StringContent(content, Encoding.UTF8, "application/json"); HttpResponseMessage response = await httpClient.PostAsync("https://localhost:44328/api/GetCoverageBalances", httpContent); if (response.StatusCode == HttpStatusCode.OK) { var res = JsonConvert.DeserializeObject <CoverageBalanceResponse>(response.Content.ReadAsStringAsync().Result); _coverageBalance = res.responseData; } return(_coverageBalance); }
public async Task <IActionResult> VerifyDetails(string nid, string dob) { ViewBag.lang = langcode; if (!string.IsNullOrWhiteSpace(nid) && !string.IsNullOrWhiteSpace(dob)) { try { var result = ValidateIDByNIC(nid, ""); if (result == true) { //var dateTime = Convert.ToDateTime(dob); //var date = dateTime.ToString("dd-MM-yyyy"); ClsInput clsInput = new ClsInput() { nationalID = nid, yearOfBirth = dob }; _logger.LogInformation(_className + "::VerifyDetails::GetMemberByNationalId::START::" + clsInput.yearOfBirth); RegistrationResponse res = await CustomerHandler.GetMemberByNationalId(clsInput); _logger.LogInformation(_className + "::VerifyDetails::GetMemberByNationalId::Response::" + res.ResponseMessage); if (res.Members != null && res.Members.Count > 0) { Registration _userdetails = new Registration(); _userdetails = res.Members.Where(c => c.MemberType == "EMPLOYEE").FirstOrDefault(); _logger.LogInformation(_className + "::VerifyDetails::GetMemberByNationalId::_userdetails::" + _userdetails.MemberName); setsession(nid, dob, _userdetails.MemberMobileNo); return(Json(new { success = true })); } else { var responseMessage = string.Empty; if (res.Errors != null && res.Errors.Count > 0) { responseMessage = "Invalid National ID or Date of Birth.Please check again."; } else { responseMessage = res.ResponseMessage; } return(Json(new { success = false, responseText = responseMessage })); } } else { return(Json(new { success = false, responseText = "Invalid Credentials." })); } } catch (Exception ex) { _logger.LogInformation(_className + "::VerifyDetails::" + ex.Message + "::InnerException::" + ex.InnerException?.Message); } return(View()); } else { _logger.LogInformation(_className + "::VerifyDetails::nationalId is NULL"); return(View()); } }
public async Task <List <Policies> > GetPoliciesByNationalId() { string nationalId = TempData["NationalId"].ToString(); string yob = TempData["YOB"].ToString(); TempData.Keep("YOB"); TempData.Keep("NationalId"); var result = new List <Policies>(); try { if (nationalId != null && yob != null) { var clsInput = new ClsInput(); clsInput.code = "CI"; clsInput.nationalID = nationalId; //DateTime date = DateTime.Parse(yob); //DateTime date = Convert.ToDateTime(yob); DateTime dt = Convert.ToDateTime(yob); int year = dt.Year; clsInput.yearOfBirth = year.ToString(); clsInput.insPolicyNo = ""; result = await _policyHandler.GetPoliciesByNationalId(clsInput); } return(result); } catch (Exception ex) { _logger.LogInformation("PolicyController::GetPoliciesByNationalId::" + ex.Message); } return(result); }
public async Task <List <Approvals> > GetApprovalsByNationalId() { var regUser = _authenticationService.GetAuthenticatedUser(); string nationalId = regUser.Iqama_NationalID; string yob = TempData["YOB"].ToString(); TempData.Keep("YOB"); TempData.Keep("NationalId"); var result = new List <Approvals>(); try { if (nationalId != null && yob != null) { var clsInput = new ClsInput(); clsInput.code = "CI"; clsInput.nationalID = nationalId; DateTime date = Convert.ToDateTime(yob); clsInput.yearOfBirth = date.Year.ToString(); clsInput.insPolicyNo = ""; result = await _approvalsHandler.GetApprovalsByNationalId(clsInput); } return(result); } catch (Exception ex) { _logger.LogWarning(_className + "::GetApprovalsByNationalId::" + ex.Message); } return(result); }
public async Task <RegistrationResponse> GetMemberByNationalId(ClsInput clsInput) { RegistrationResponse users = null; try { HttpMessageHandler handler = new HttpClientHandler(); string url = WebConstants.HostAddress + "api/CheckMemberByNationalId"; string cpath = url; var httpClient = new HttpClient(handler) { BaseAddress = new Uri(cpath), Timeout = new TimeSpan(0, 2, 0) }; httpClient.DefaultRequestHeaders.Add("ContentType", "application/json"); string content = GetJson(clsInput); var httpContent = new StringContent(content, Encoding.UTF8, "application/json"); HttpResponseMessage response = await httpClient.PostAsync(WebConstants.HostAddress + "api/CheckMemberByNationalId", httpContent); if (response.StatusCode == HttpStatusCode.OK) { var a = JsonConvert.DeserializeObject <RegistrationResponse>(response.Content.ReadAsStringAsync().Result); users = a; if (users == null) { users = new RegistrationResponse(); users.Errors = new List <RequestError>() { new RequestError() { Message = "Something went wrong" } }; } } else { users = new RegistrationResponse(); } } catch (Exception ex) { throw ex; } return(users); }
public async Task <List <Approvals> > GetApprovalsByNationalId(string nationalId, string yob) { var result = new List <Approvals>(); if (nationalId != null && yob != null) { var clsInput = new ClsInput(); clsInput.code = "CI"; clsInput.nationalID = nationalId; DateTime date = Convert.ToDateTime(yob); clsInput.yearOfBirth = date.Year.ToString(); clsInput.insPolicyNo = ""; result = await GetApprovalsByNationalId(clsInput); } return(result); }
public async Task <List <Providers> > GetProvidersByNationalId() { string nationalId = TempData["NationalId"].ToString(); string yob = TempData["YOB"].ToString(); TempData.Keep("YOB"); TempData.Keep("NationalId"); var result = new List <Providers>(); if (nationalId != null && yob != null) { var clsInput = new ClsInput(); clsInput.code = "CI"; clsInput.nationalID = nationalId; DateTime date = Convert.ToDateTime(yob); clsInput.yearOfBirth = date.Year.ToString(); clsInput.insPolicyNo = ""; result = await _providersHandler.GetProvidersByNationalId(clsInput); } return(result); }
public async Task <List <Approvals> > GetApprovalsByNationalId(string nationalId, string yob) { var result = new List <Approvals>(); try { if (nationalId != null && yob != null) { var clsInput = new ClsInput(); clsInput.code = "CI"; clsInput.nationalID = nationalId; DateTime date = Convert.ToDateTime(yob); clsInput.yearOfBirth = date.Year.ToString(); clsInput.insPolicyNo = ""; result = await GetApprovalsByNationalId(clsInput); } } catch (Exception ex) { _logger.LogError(_className + "::GetApprovalsByNationalId::" + ex.Message); } return(result); }
public string GetJson(ClsInput clsInput) { string clientSecret = "{\r\n\"code\":\"CI\",\r\n\"nationalID\": \"" + clsInput.nationalID + "\",\r\n\"yearOfBirth\": \"" + clsInput.yearOfBirth + "\",\r\n\"insPolicyNo\": \"" + clsInput.insPolicyNo + "\"\r\n}\r\n"; return(clientSecret); }
public async Task <IActionResult> RegisterUser(string enterpin, string confirmpin) { string status = "false"; try { var nationalId = HttpContext.Session.GetString(SessionNId); var dateofbirth = HttpContext.Session.GetString(SessionDOB); ClsInput input = new ClsInput(); input.nationalID = nationalId; input.yearOfBirth = dateofbirth; _logger.LogInformation(_className + "::RegisterUser::START"); var response = await CustomerHandler.GetMemberByNationalId(input); _logger.LogInformation(_className + "::RegisterUser::response::MemberCount" + response.ResponseMessage); if (response.Members != null && response.Members.Count > 0) { _logger.LogInformation(_className + "::RegisterUser::response::MemberCount" + response.Members.Count); var EmpMember = response.Members.Where(c => c.MemberType == "EMPLOYEE").FirstOrDefault(); EmpMember.Iqama_NationalID = nationalId; EmpMember.DOB = dateofbirth; EmpMember.CreatePin = enterpin; EmpMember.ConfirmPin = confirmpin; EmpMember.MemberMobileNumber = EmpMember.MemberMobileNo; EmpMember.Role = (int)RegistrationRole.Customer; _customerService.Insert(EmpMember); var members = response.Members.FindAll(c => c.MemberType != "EMPLOYEE"); if (members != null) { List <Relations> relations = new List <Relations>(); foreach (var member in members) { var relation = new Relations(); relation.RegistrationId = EmpMember.Id; relation.CardNo = member.CardNo; relation.ClassCode = member.ClassCode; relation.ClassName = member.ClassName; relation.DOB = member.DOB; relation.Iqama_NationalID = nationalId; relation.MemberName = member.MemberName; relation.MemberType = member.MemberType; relation.TPAID = member.TPAID; relation.TPAName = member.TPAName; relation.TushfaMemberNo = member.TushfaMemberNo; relation.NetworkName = member.NetworkName; relation.NetworkCode = member.NetworkCode; relation.PolicyToDate = member.PolicyToDate; relation.PolicyFromDate = member.PolicyFromDate; relation.MemberStatus = member.MemberStatus; relation.Iqama_NationalID = nationalId; relation.DOB = dateofbirth; relation.MemberMobileNumber = member.MemberMobileNo; relations.Add(relation); } foreach (var rel in relations) { _customerService.InsertRelations(rel); } } await _authService.SignIn(EmpMember); TempData["NationalId"] = nationalId; TempData["YOB"] = dateofbirth; TempData.Keep("YOB"); TempData.Keep("NationalId"); status = "true"; } } catch (Exception ex) { _logger.LogInformation(_className + "::RegisterUser::Exception" + ex.Message); } if (status == "false") { return(Json(new { success = false, responseText = "User Registration Failed." })); } else { return(Json(new { success = true, responseText = "User Registration Success." })); } }