Esempio n. 1
0
 public ActionResult RenameGroup(OrgGroupsModel m)
 {
     if (!m.GroupName.HasValue() || m.groupid == 0)
         return Content("error: no group name");
     var group = DbUtil.Db.MemberTags.SingleOrDefault(d => d.Id == m.groupid);
     if (group != null) 
         group.Name = m.GroupName;
     DbUtil.Db.SubmitChanges();
     m.GroupName = null;
     return Redirect("/OrgGroups/Management/" + m.orgid);
 }
Esempio n. 2
0
 public ActionResult RemoveSelectedFromTargetGroup(OrgGroupsModel m)
 {
     var a = m.List.ToArray();
     var sgname = DbUtil.Db.MemberTags.Single(mt => mt.Id == m.groupid).Name;
     var q1 = from omt in DbUtil.Db.OrgMemMemTags
              where omt.OrgId == m.orgid
              where omt.MemberTag.Name == sgname
              where a.Contains(omt.PeopleId)
              select omt;
     DbUtil.Db.OrgMemMemTags.DeleteAllOnSubmit(q1);
     DbUtil.Db.SubmitChanges();
     return View("Rows", m);
 }
Esempio n. 3
0
 public ActionResult AssignSelectedToTargetGroup(OrgGroupsModel m)
 {
     var a = m.List.ToArray();
     var sgname = DbUtil.Db.MemberTags.Single(mt => mt.Id == m.groupid).Name;
     var q2 = from om in m.OrgMembers()
              where om.OrgMemMemTags.All(mt => mt.MemberTag.Name != sgname)
              where a.Contains(om.PeopleId)
              select om;
     foreach (var om in q2)
         om.AddToGroup(DbUtil.Db, sgname);
     DbUtil.Db.SubmitChanges();
     return View("Rows", m);
 }
Esempio n. 4
0
 public ActionResult RemoveAsLeaderOfTargetGroup(OrgGroupsModel m)
 {
     var a = m.List.ToArray();
     var q2 = from om in m.OrgMembers()
              where a.Contains(om.PeopleId)
              select om;
     if (m.groupid != null)
     {
         foreach (var om in q2)
         {
             om.RemoveAsLeaderOfGroup(DbUtil.Db, m.groupid.GetValueOrDefault());
         }
     }
     DbUtil.Db.SubmitChanges();
     return View("Rows", m);
 }
Esempio n. 5
0
 public ActionResult MakeNewGroup(OrgGroupsModel m)
 {
     if (!m.GroupName.HasValue())
         return Content("error: no group name");
     var Db = DbUtil.Db;
     var group = Db.MemberTags.SingleOrDefault(g =>
         g.Name == m.GroupName && g.OrgId == m.orgid);
     if (group == null)
     {
         group = new MemberTag
         {
             Name = m.GroupName,
             OrgId = m.orgid
         };
         Db.MemberTags.InsertOnSubmit(group);
         Db.SubmitChanges();
     }
     m.groupid = group.Id;
     ViewData["newgid"] = group.Id;
     return Redirect("/OrgGroups/Management/" + m.orgid);
 }
Esempio n. 6
0
        public ActionResult CreateTeams(int id)
        {
            var m = new OrgGroupsModel(id);
            m.createTeamGroups();

            return Content("Complete");
        }
Esempio n. 7
0
 public ActionResult Management( int id )
 {
     var m = new OrgGroupsModel(id);
     return View(m);
 }
Esempio n. 8
0
 public ActionResult Filter(OrgGroupsModel m)
 {
     return View("Rows", m);
 }
Esempio n. 9
0
 public ActionResult Index(int id)
 {
     var m = new OrgGroupsModel( id );
     return View(m);
 }
Esempio n. 10
0
 public ActionResult DeleteGroup(OrgGroupsModel m)
 {
     var group = DbUtil.Db.MemberTags.SingleOrDefault(g => g.Id == m.groupid);
     if (group != null)
     {
         DbUtil.Db.OrgMemMemTags.DeleteAllOnSubmit(group.OrgMemMemTags);
         DbUtil.Db.MemberTags.DeleteOnSubmit(group);
         DbUtil.Db.SubmitChanges();
         m.groupid = (from v in m.Groups()
                      where v.Value != "0"
                      select v.Value).FirstOrDefault().ToInt();
         ViewData["groupid"] = m.groupid.ToString();
     }
     return Redirect("/OrgGroups/Management/" + m.orgid);
 }