public void GetCouplesBothList_Should_Pull_Proper_HoHPeopleID() { /* Excel export should pull proper Head of Household PeopleID*/ var requestManager = FakeRequestManager.Create(); var db = requestManager.CurrentDatabase; var controller = new OnlineRegController(requestManager); var routeDataValues = new Dictionary <string, string> { { "controller", "OnlineReg" } }; controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues); var m = OrganizationModel.Create(db, requestManager.CurrentUser); var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager); var oid = FakeOrg.org.OrganizationId; m.OrgId = oid; var wife = CreateUser(RandomString(), RandomString()); //Create family and then Execute GetCouplesBothList to see if the right HeadOfHouseHoldId is retrieved... var p = CreateFakeFamily(oid, m, controller); var mailingModel = new MailingController(requestManager); var ExcelCouplesBoth = mailingModel.GetCouplesBothList(m.QueryId, 500); FakeOrganizationUtils.DeleteOrg(FakeOrg.org.OrganizationId); RemoveFakePeopleFromDB(ToPeople(ExcelCouplesBoth), db); }
public ActionResult CommunityGroup(int id) { var m = OrganizationModel.Create(CurrentDatabase, CurrentUser); m.OrgId = id; return(PartialView(m)); }
public ActionResult Registrations(int id) { var m = OrganizationModel.Create(CurrentDatabase, CurrentUser); m.OrgId = id; return(PartialView(m)); }
public ActionResult MainEdit(int id) { var m = OrganizationModel.Create(CurrentDatabase, CurrentUser); m.OrgId = id; m.OrgMain.Divisions = GetOrgDivisions(id); return(PartialView("Settings/MainEdit", m.OrgMain)); }
public ActionResult DeleteExtra(int id, string field) { var e = CurrentDatabase.OrganizationExtras.Single(ee => ee.OrganizationId == id && ee.Field == field); CurrentDatabase.OrganizationExtras.DeleteOnSubmit(e); CurrentDatabase.SubmitChanges(); var m = OrganizationModel.Create(CurrentDatabase, CurrentUser); return(PartialView("Settings/ExtrasGrid", m.Org)); }
public ActionResult Index(int id, int?peopleid = null) { if (id == 0) { var recent = Util2.MostRecentOrgs; id = recent.Any() ? recent[0].Id : 1; return(Redirect($"/Org/{id}")); } var m = OrganizationModel.Create(CurrentDatabase, CurrentUser); m.OrgId = id; if (peopleid.HasValue) { m.NameFilter = peopleid.ToString(); } if (m.Org == null) { return(Content("organization not found")); } if (Util2.OrgLeadersOnly) { var oids = CurrentDatabase.GetLeaderOrgIds(Util.UserPeopleId); if (!oids.Contains(m.Org.OrganizationId)) { return(NotAllowed("You must be a leader of this organization", m.Org.OrganizationName)); } var sgleader = CurrentDatabase.SmallGroupLeader(id, Util.UserPeopleId); if (sgleader.HasValue()) { m.SgFilter = sgleader; } } if (m.Org.LimitToRole.HasValue()) { if (!User.IsInRole(m.Org.LimitToRole)) { return(NotAllowed("no privilege to view ", m.Org.OrganizationName)); } } DbUtil.LogOrgActivity($"Viewing Org({m.Org.OrganizationName})", id, m.Org.OrganizationName); m.OrgMain.Divisions = GetOrgDivisions(id); ViewBag.OrganizationContext = true; ViewBag.orgname = m.Org.FullName; ViewBag.model = m; ViewBag.selectmode = 0; InitExportToolbar(m); Session["ActiveOrganization"] = m.Org.OrganizationName; return(View(m)); }
public ActionResult NewExtraValue(int id, string field, string value, bool multiline) { var m = OrganizationModel.Create(CurrentDatabase, CurrentUser); try { m.Org.AddEditExtra(CurrentDatabase, field, value, multiline); CurrentDatabase.SubmitChanges(); } catch (Exception ex) { return(Content("error: " + ex.Message)); } return(PartialView("Settings/ExtrasGrid", m.Org)); }
public void Application_Export_Should_Pull_HoHPeopleID() { var requestManager = FakeRequestManager.Create(); var db = requestManager.CurrentDatabase; var controller = new OnlineRegController(requestManager); var routeDataValues = new Dictionary <string, string> { { "controller", "OnlineReg" } }; controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues); var m = OrganizationModel.Create(db, requestManager.CurrentUser); var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager); var oid = FakeOrg.org.OrganizationId; m.OrgId = oid; var wife = CreateUser(RandomString(), RandomString()); username = RandomString(); password = RandomString(); string roleName = "role_" + RandomString(); var user = CreateUser(username, password, roles: new string[] { "Access", "Edit", "Admin", "Membership" }); Login(); //Create family and then Execute GetCouplesBothList to see if the right HeadOfHouseHoldId is retrieved... var p = CreateFakeFamily(oid, m, controller); var mailingModel = new MailingController(requestManager); var ExcelCouplesBoth = mailingModel.GetCouplesBothList(m.QueryId, 500); //assert //Finalize FakeOrganizationUtils.DeleteOrg(FakeOrg.org.OrganizationId); RemoveFakePeopleFromDB(ToPeople(ExcelCouplesBoth), db); Logout(); }
public void InvolvementList_Should_Have_FamilyId() { var requestManager = FakeRequestManager.Create(); var db = requestManager.CurrentDatabase; var controller = new CmsWeb.Areas.OnlineReg.Controllers.OnlineRegController(requestManager); var routeDataValues = new Dictionary <string, string> { { "controller", "OnlineReg" } }; controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues); var m = OrganizationModel.Create(db, requestManager.CurrentUser); var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager); var model = FakeOrganizationUtils.GetFakeOnlineRegModel(FakeOrg.org.OrganizationId); m.OrgId = FakeOrg.org.OrganizationId; var resultSubmitQuestions = controller.SubmitQuestions(0, model); var resultCompleteRegistration = controller.CompleteRegistration(model); var TestInvolvementList = ExportInvolvements.InvolvementList(m.QueryId); var pkg = typeof(EpplusResult).GetField("pkg", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(TestInvolvementList); using (ExcelPackage package = (ExcelPackage)pkg) { ExcelWorksheet worksheet = package.Workbook.Worksheets[1]; object[,] cellValues = (object[, ])worksheet.Cells.Value; List <string> ReportColumns = cellValues.Cast <object>().ToList().ConvertAll(x => Convert.ToString(x)); var FamilyId = worksheet.Cells[1, 2].Value.ToString().Trim(); ReportColumns.ShouldContain("FamilyId"); FamilyId.ShouldBe("FamilyId"); } FakeOrganizationUtils.DeleteOrg(FakeOrg.org.OrganizationId); }