public int SaveBVNDetails(BVNC bvnc) { int i = 0; try { BanksManager bObj = new BanksManager { BankName = bvnc.EnrollmentBank, ContactAddress = bvnc.address, DateOfBirth = bvnc.Dateofbirth, EnrollmentBranch = bvnc.EnrollmentBranch, Firstname = bvnc.FirstNAme, Gender = bvnc.gender, IsVisible = 1, Lastname = bvnc.LastName, Marital_Status = bvnc.marital_status, Nationlaity = bvnc.Nationality, Othernames = bvnc.MiddleName, ValueDate = MyUtility.getCurrentLocalDateTime().ToString("yyyy/MM/dd"), VerifiedStatus = bvnc.respCode == "00" ? 1 : 0, ServiceResponse = bvnc.respDescription }; uvDb.BanksManagers.Add(bObj); uvDb.SaveChanges(); } catch (Exception ex) { WebLog.Log(ex.Message); } return(i); }
public static BVNC BVNValidationResps(string bvnNumber) { BVNC BC = new BVNC(); //errormessage = "Enquiry failed"; try { if (bvnNumber.Length < 11) { BC.errormessage = "Please enter valid BVN number"; BC.respCode = "0001"; BC.respDescription = BC.errormessage; return(BC); } var Url = ConfigurationManager.AppSettings["ValidateBVN"]; var secKey = ConfigurationManager.AppSettings["secKey"]; Url = Url.Replace("{$BVNnumber}", bvnNumber.ToString()).Trim().Replace("{$secKey}", secKey.ToString()).Trim(); var resp = DoGet(Url); dynamic resps = JObject.Parse(resp); if (resps.status != "success") { BC.respCode = "009"; BC.respDescription = resps.message; BC.errormessage = "Please enter valid BVN number"; } else { BC.respCode = "00"; BC.respDescription = "Request Successful"; BC.FirstNAme = resps.data.first_name; BC.MiddleName = resps.data.middle_name; BC.LastName = resps.data.last_name; BC.Dateofbirth = resps.data.date_of_birth; BC.Phone = resps.data.phone_number; BC.RegistrationDate = resps.data.registration_date; BC.EnrollmentBank = resps.data.enrollment_bank == null ? "" : resps.data.enrollment_bank; BC.EnrollmentBank = DataManager.DataReader.GetBankNameByCode(BC.EnrollmentBank); BC.EnrollmentBranch = resps.data.enrollment_branch; //BC.image_base_64 = resps.data.image_base_64; BC.address = resps.data.address; BC.gender = resps.data.gender; BC.email = resps.data.email; BC.watch_listed = resps.data.watch_listed; BC.Nationality = resps.data.nationality; BC.marital_status = resps.data.marital_status; BC.state_of_residence = resps.data.state_of_residence; BC.lga_of_residence = resps.data.lga_of_residence; BC.errormessage = ""; } } catch (Exception ex) { BC.respCode = "0091"; BC.respDescription = "Error validating BVN"; BC.errormessage = BC.respDescription; WebLog.Log(ex.Message); } return(BC); }