public ActionResult CreateCheck(int id, string code, int type, int label = 0) { var tabName = type == 1 ? "tab_backgroundChecks" : "tab_creditChecks"; ProtectMyMinistryHelper.Create(id, code, type, label); return(Redirect($"/Volunteering/{id}#{tabName}")); }
public ActionResult SubmitCheck(int id, int type, int iPeopleID, string sSSN, string sDLN, string sUser = "", string sPassword = "", int iStateID = 0, string sPlusCounty = "", string sPlusState = "") { var tabName = type == 1 ? "tab_backgroundChecks" : "tab_creditChecks"; var responseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + ProtectMyMinistryHelper.PMM_Append; var p = (from e in DbUtil.Db.People where e.PeopleId == iPeopleID select e).Single(); // Check for Existing SSN if (sSSN != null && sSSN.Length > 1) { if (sSSN.Substring(0, 1) == "X") { sSSN = Util.Decrypt(p.Ssn, "People"); } else { sSSN = sSSN.Replace("-", "").Replace(" ", "");; p.Ssn = Util.Encrypt(sSSN, "People"); } } else { sSSN = Util.Decrypt(p.Ssn, "People"); } // Check for Existing DLN and DL State if (sDLN != null && sDLN.Length > 1) { if (sDLN.Substring(0, 1) == "X") { sDLN = Util.Decrypt(p.Dln, "People"); iStateID = p.DLStateID ?? 0; } else { p.Dln = Util.Encrypt(sDLN, "People"); p.DLStateID = iStateID; } } DbUtil.Db.SubmitChanges(); ProtectMyMinistryHelper.Submit(id, sSSN, sDLN, responseUrl, iStateID, sUser, sPassword, sPlusCounty, sPlusState); var bc = (from e in DbUtil.Db.BackgroundChecks where e.Id == id select e).Single(); if (bc != null && (bc.ServiceCode == "Combo" || bc.ServiceCode == "ComboPC" || bc.ServiceCode == "ComboPS")) { var vol = DbUtil.Db.Volunteers.SingleOrDefault(e => e.PeopleId == iPeopleID); vol.ProcessedDate = DateTime.Now; DbUtil.Db.SubmitChanges(); } return(Redirect($"/Volunteering/{iPeopleID}#{tabName}")); }
public void Should_Create_BackgroundChecks() { using (var db = CMSDataContext.Create(DatabaseFixture.Host)) { var bgChLabel = CreateLabel(db); var bgCheck = ProtectMyMinistryHelper.Create(db, 1, 1, "Combo", 1, bgChLabel.Id); var result = db.BackgroundChecks.FirstOrDefault(b => b.Id == bgCheck.Id); result.PeopleID.ShouldBe(1); result.UserID.ShouldBe(1); result.ServiceCode.ShouldBe("Combo"); result.ReportTypeID.ShouldBe(1); result.ReportLabelID.ShouldBe(bgChLabel.Id); db.BackgroundChecks.DeleteOnSubmit(result); db.BackgroundCheckLabels.DeleteOnSubmit(bgChLabel); db.SubmitChanges(); } }
public ActionResult CreateCheck(int id, string code, int type, int label = 0) { ProtectMyMinistryHelper.create(id, code, type, label); return(Redirect("/Volunteering/" + id)); }