Example #1
0
 public ActionResult Reverse(int id, string field, string value, string pf)
 {
     var m = new PersonModel(id);
     m.Reverse(field, value, pf);
     return View("ChangesGrid", m);
 }
Example #2
0
 public ActionResult Index(int? id)
 {
     if (!id.HasValue)
         return Content("no id");
     if (ViewExtensions2.UseNewLook())
         return Redirect("/Person2/" + id);
     var m = new PersonModel(id);
     if (User.IsInRole("Access"))
     {
         if (m == null)
             return Content("no person");
         if (m.displayperson == null)
             return Content("person not found");
     }
     else
         if (m.Person == null || !m.Person.CanUserSee)
             return Content("no access");
     if (Util2.OrgMembersOnly)
     {
         var omotag = DbUtil.Db.OrgMembersOnlyTag2();
         if (!DbUtil.Db.TagPeople.Any(pt => pt.PeopleId == id && pt.Id == omotag.Id))
         {
             DbUtil.LogActivity("Trying to view person: {0}".Fmt(m.displayperson.Name));
             return Content("<h3 style='color:red'>{0}</h3>\n<a href='{1}'>{2}</a>"
                 .Fmt("You must be a member one of this person's organizations to have access to this page",
                 "javascript: history.go(-1)", "Go Back"));
         }
     }
     else if (Util2.OrgLeadersOnly)
     {
         var olotag = DbUtil.Db.OrgLeadersOnlyTag2();
         if (!DbUtil.Db.TagPeople.Any(pt => pt.PeopleId == id && pt.Id == olotag.Id))
         {
             DbUtil.LogActivity("Trying to view person: {0}".Fmt(m.displayperson.Name));
             return Content("<h3 style='color:red'>{0}</h3>\n<a href='{1}'>{2}</a>"
                 .Fmt("You must be a leader of one of this person's organizations to have access to this page",
                 "javascript: history.go(-1)", "Go Back"));
         }
     }
     ViewBag.GearSpan = User.IsInRole("Admin") ? "span6" : "span12";
     ViewBag.Comments = Util.SafeFormat(m.Person.Comments);
     ViewBag.PeopleId = id.Value;
     Util2.CurrentPeopleId = id.Value;
     Session["ActivePerson"] = m.displayperson.Name;
     DbUtil.LogActivity("Viewing Person: {0}".Fmt(m.displayperson.Name), m.displayperson.Name, pid: id);
     InitExportToolbar(id);
     return View(m);
 }
Example #3
0
 public ActionResult BusinessCard(int id)
 {
     var m = new PersonModel(id);
     return View(m.displayperson);
 }
Example #4
0
 public ActionResult ChangesGrid(int id)
 {
     var m = new PersonModel(id);
     return View(m);
 }
Example #5
0
 public ActionResult Index(int? id)
 {
     if (!id.HasValue)
         return Content("no id");
     if (DbUtil.Db.UserPreference("newlook3", "false").ToBool()
         && DbUtil.Db.UserPreference("newpeoplepage", "false").ToBool())
     {
         var url = Regex.Replace(Request.RawUrl, @"(.*)/(Person/Index)/(\d*)", "$1/Person2/$3", RegexOptions.IgnoreCase);
         return Redirect(url);
     }
     var m = new PersonModel(id);
     if (User.IsInRole("Access"))
     {
         if (m == null)
             return Content("no person");
         if (m.displayperson == null)
             return Content("person not found");
     }
     else
         if (m.Person == null || !m.Person.CanUserSee)
             return Content("no access");
     if (Util2.OrgMembersOnly)
     {
         var omotag = DbUtil.Db.OrgMembersOnlyTag2();
         if (!DbUtil.Db.TagPeople.Any(pt => pt.PeopleId == id && pt.Id == omotag.Id))
         {
             DbUtil.LogActivity("Trying to view person: {0}".Fmt(m.displayperson.Name));
             return Content("<h3 style='color:red'>{0}</h3>\n<a href='{1}'>{2}</a>"
                 .Fmt("You must be a member one of this person's organizations to have access to this page",
                 "javascript: history.go(-1)", "Go Back"));
         }
     }
     else if (Util2.OrgLeadersOnly)
     {
         var olotag = DbUtil.Db.OrgLeadersOnlyTag2();
         if (!DbUtil.Db.TagPeople.Any(pt => pt.PeopleId == id && pt.Id == olotag.Id))
         {
             DbUtil.LogActivity("Trying to view person: {0}".Fmt(m.displayperson.Name));
             return Content("<h3 style='color:red'>{0}</h3>\n<a href='{1}'>{2}</a>"
                 .Fmt("You must be a leader of one of this person's organizations to have access to this page",
                 "javascript: history.go(-1)", "Go Back"));
         }
     }
     ViewData["Comments"] = Util.SafeFormat(m.Person.Comments);
     ViewData["PeopleId"] = id.Value;
     Util2.CurrentPeopleId = id.Value;
     Session["ActivePerson"] = m.displayperson.Name;
     DbUtil.LogActivity("Viewing Person: {0}".Fmt(m.displayperson.Name), m.displayperson.Name, pid: id);
     InitExportToolbar(id);
     return View(m);
 }