public string UploadDocument(DocumentViewModel model) { try { using (var CADocRepo = new ClientApplicationDocumentRepository()) { ClientApplicationDocument CADoc = CADocRepo.Find(x => x.IDNumber == model.IDNumber && x.fullname == model.fullname && x.documentName == model.documentName).SingleOrDefault(); CADoc.documentID = CADoc.documentID; CADoc.applicationID = model.applicationID; CADoc.IDNumber = model.IDNumber; CADoc.documentName = model.documentName; CADoc.document = model.document; CADocRepo.Update(CADoc); } } catch (Exception ex) { feedback = "Unable to upload documents, our servers are currently down, please try again."; } return(feedback); }
public void Delete(ClientApplicationDocument model) { _ClientApplicationDocumentRepository.Delete(model); _datacontext.SaveChanges(); }
public void Insert(ClientApplicationDocument model) { _ClientApplicationDocumentRepository.Insert(model); _datacontext.SaveChanges(); }
//Add Personal information public void CreateApplication(RegisterModel objRegisterModel) { try { ClientApplication capp = new ClientApplication { IDNumber = objRegisterModel.identityNumber, title = objRegisterModel.title, firstName = objRegisterModel.firstName, lastName = objRegisterModel.lastName, province = objRegisterModel.province, contactNumber = objRegisterModel.contactNumber, emailAdress = objRegisterModel.Email, physicalAddress = renderPhysicalAddressSave(objRegisterModel.streetAddress, objRegisterModel.suburb, objRegisterModel.city, objRegisterModel.postalCode.ToString()), packageID = 1, dateSubmitted = DateTime.Now, status = "Awaiting outstanding supporting documents" }; if (objRegisterModel.postalOffice == null) { capp.postalAddress = renderPhysicalAddressSave(objRegisterModel.streetAddress, objRegisterModel.suburb, objRegisterModel.city, objRegisterModel.postalCode.ToString()); } else { capp.postalAddress = renderPostalAddressSave(objRegisterModel.postalOffice, objRegisterModel.town, objRegisterModel.boxpostalCode); } using (var CArepo = new ClientApplicationRepository()) { CArepo.Insert(capp); ClientApplication client = CArepo.Find(x => x.IDNumber == capp.IDNumber).SingleOrDefault(); ClientApplicationDocument docmnt = new ClientApplicationDocument() { applicationID = client.applicationID, IDNumber = client.IDNumber, fullname = client.firstName + " " + client.lastName, documentName = "ID Document", document = null, }; using (var CADocRepo = new ClientApplicationDocumentRepository()) { CADocRepo.Insert(docmnt); } ClientApplicationDocument doc = new ClientApplicationDocument() { applicationID = client.applicationID, IDNumber = client.IDNumber, fullname = client.firstName + " " + client.lastName, documentName = "Signed Policy Document", document = null, }; using (var CADocRepo = new ClientApplicationDocumentRepository()) { CADocRepo.Insert(doc); } feedback = "We recieved your Personal Information, please indicate your Beneficiaries."; //send email } } catch (Exception ex) { feedback += " : " + ex; } }
public void addBeneficiary(BeneficiaryViewModel model, string ID) { var BenefitiaryArepo = new ClientApplicationBeneficiaryRepository(); if (BenefitiaryArepo.Find(x => x.benIDNumber == model.benIDNumber).SingleOrDefault() == null) { ClientApplicationBeneficiary ben = new ClientApplicationBeneficiary() { benIDNumber = model.benIDNumber, IDNumber = ID, firstName = model.firstName, lastName = model.lastName, relationship = model.relationship, age = calcAge(model.benIDNumber) }; var ClientArepo = new ClientApplicationRepository(); var CADocRepo = new ClientApplicationDocumentRepository(); ClientApplication client = ClientArepo.Find(x => x.IDNumber == ID).SingleOrDefault(); if (ben.age >= 65) { feedback = "We cannot cover a beneficiary of more than 65 years of age"; return; } if (ben.relationship == "Spouse") { if (ben.age < 18) { feedback = "Spouse must be at least 18 years of age"; return; } } if (ben.relationship == "Parent" || ben.relationship == "Grandparent" || ben.relationship == "Parent-in-law") { if (ben.age < (calcAge(client.IDNumber))) { feedback = "Parent cannot be younger than the Applicant"; return; } else if (ben.age == (calcAge(client.IDNumber))) { feedback = "Parent cannot be at the same age as the Applicant"; return; } else if (ben.age > calcAge(client.IDNumber) && (ben.age - calcAge(client.IDNumber)) < 13) { feedback = "Parent must be at least 13 years older than the Applicant"; return; } } if (ben.relationship == "Uncle" || ben.relationship == "Aunt") { if (ben.age < (calcAge(client.IDNumber))) { feedback = "Uncle or Aunt cannot be younger than the Applicant"; return; } else if (ben.age == (calcAge(client.IDNumber))) { feedback = "Uncle or Aunt cannot be at the same age as the Applicant"; return; } else if (ben.age > calcAge(client.IDNumber) && (ben.age - calcAge(client.IDNumber)) < 5) { feedback = "Uncle or Aunt must be at least 5 years older than the Applicant"; return; } } if (ben.relationship == "Child" || ben.relationship == "Grandchild") { if (ben.age > (calcAge(client.IDNumber))) { feedback = "Child cannot be older than you, " + client.firstName; return; } else if (ben.age == (calcAge(client.IDNumber))) { feedback = "Child cannot be at the same age as the Applicant"; return; } else if (ben.age < calcAge(client.IDNumber) && (calcAge(client.IDNumber) - ben.age) < 13) { feedback = "Applicant must be at least 13 years older than the Child"; return; } } BenefitiaryArepo.Insert(ben); if (ben.relationship == "Spouse") { ClientApplicationDocument doc = new ClientApplicationDocument() { applicationID = client.applicationID, IDNumber = client.IDNumber, fullname = client.firstName + " " + client.lastName, documentName = "Marriage Certificate", document = null, }; CADocRepo.Insert(doc); ClientApplicationDocument docmnt = new ClientApplicationDocument() { applicationID = client.applicationID, IDNumber = ben.IDNumber, fullname = ben.firstName + " " + ben.lastName, documentName = "ID Document", document = null, }; CADocRepo.Insert(docmnt); } else if (ben.age >= 21) { ClientApplicationDocument docmnt = new ClientApplicationDocument() { applicationID = client.applicationID, IDNumber = ben.IDNumber, fullname = ben.firstName + " " + ben.lastName, documentName = "ID Document", document = null, }; CADocRepo.Insert(docmnt); ClientApplicationDocument doc = new ClientApplicationDocument() { applicationID = client.applicationID, IDNumber = ben.benIDNumber, fullname = ben.firstName + " " + ben.lastName, documentName = "Institutional Proof of Registration | (Full time study)", document = null, }; CADocRepo.Insert(doc); } else if (ben.age < 18) { ClientApplicationDocument doc = new ClientApplicationDocument() { applicationID = client.applicationID, IDNumber = ben.benIDNumber, fullname = ben.firstName + " " + ben.lastName, documentName = "Birth Certificate", document = null, }; CADocRepo.Insert(doc); } else if (ben.age >= 18 && ben.age < 21) { ClientApplicationDocument doc = new ClientApplicationDocument() { applicationID = client.applicationID, IDNumber = ben.benIDNumber, fullname = ben.firstName + " " + ben.lastName, documentName = "ID Document", document = null, }; CADocRepo.Insert(doc); } } else { feedback = "ID Number already exist!"; } }