public void SortIsPromoter(object o, System.EventArgs e) { Cambro.Web.Helpers.WriteAlertHeader(); Cambro.Web.Helpers.WriteAlert("Selecting PromoterUsrs...", 1); Query q = new Query(); q.QueryCondition = new Q(Promoter.Columns.Status, Promoter.StatusEnum.Active); q.TableElement = new Join( new Join(Usr.Columns.K, PromoterUsr.Columns.UsrK), Promoter.Columns.K, PromoterUsr.Columns.PromoterK); UsrSet bs = new UsrSet(q); Group g = new Group(3684); //DontStayIn Promoters group try { for (int count = 0; count < bs.Count; count++) { Usr u = bs[count]; try { GroupUsr gu = u.GetGroupUsr(g.K); if (gu == null || !(gu.Status.Equals(GroupUsr.StatusEnum.Exited) || gu.Status.Equals(GroupUsr.StatusEnum.Barred))) { GroupUsr gu1 = g.ChangeUsr(false, u.K, false, false, false, false, Bobs.GroupUsr.StatusEnum.Member, u.DateTimeSignUp, false); gu1.Favourite = true; gu1.Update(); CommentAlert.Enable(u, g.K, Model.Entities.ObjectType.Group); } if (count % 10 == 0) Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count + " - " + u.NickName, 2); } catch (Exception ex) { Cambro.Web.Helpers.WriteAlert("Exception " + count + "/" + bs.Count + " - " + ex.ToString(), 3); } bs.Kill(count); } } finally { g.UpdateTotalMembers(); } Cambro.Web.Helpers.WriteAlert("Done!", 4); Cambro.Web.Helpers.WriteAlertFooter(); Response.End(); }
public void UpdateModerators() { if (this.IsEnabled) { foreach (Brand brand in this.AllBrands) { if (brand.PromoterStatus == Brand.PromoterStatusEnum.Confirmed) { foreach (Usr u in this.AdminUsrs) { brand.Group.ChangeUsr(false, u.K, true, true, true, true, Bobs.GroupUsr.StatusEnum.Member, u.DateTimeSignUp, false); } } brand.Group.UpdateTotalMembers(); } foreach (Usr u in this.AdminUsrs) u.UpdateIsPromoter(); if (this.Status.Equals(Promoter.StatusEnum.Active)) { Group dontStayInPromotersGroup = new Group(3684); //DontStayIn Promoters group foreach (Usr usr in this.AdminUsrs) { GroupUsr gu = usr.GetGroupUsr(dontStayInPromotersGroup.K); usr.AddToPromotersGroup(gu, dontStayInPromotersGroup); } dontStayInPromotersGroup.UpdateTotalMembers(); } } //CreatePromoterXmlFragmentStart(); //Not sure why it doesn't work... }