IsInGroup() public method

public IsInGroup ( string name ) : bool
name string
return bool
Beispiel #1
0
 private static OrganizationMember AddSender(OrganizationMember om)
 {
     if (!om.IsInGroup("Goer"))
         om.MemberTypeId = MemberTypeCode.InActive;
     om.AddToGroup(DbUtil.Db, "Sender");
     return om;
 }
 private void PopulateDropdownChoices(OrganizationMember om, Ask ask)
 {
     if (option == null)
         option = new List<string>();
     if (setting.TargetExtraValues)
     {
         foreach (var dd in ((AskDropdown)ask).list)
             if (person.GetExtra(dd.SmallGroup) == "true")
                 option.Add(dd.SmallGroup);
     }
     else
         foreach (var dd in ((AskDropdown)ask).list)
             if (om.IsInGroup(dd.SmallGroup))
                 option.Add(dd.SmallGroup);
 }
 private void PopulateCheckboxChoices(OrganizationMember om, Ask ask)
 {
     if (setting.TargetExtraValues)
     {
         foreach (var ck in ((AskCheckboxes)ask).list)
             if (person.GetExtra(ck.SmallGroup).ToBool())
                 Checkbox.Add(ck.SmallGroup);
     }
     else
         foreach (var ck in ((AskCheckboxes)ask).list)
             if (om.IsInGroup(ck.SmallGroup))
                 Checkbox.Add(ck.SmallGroup);
 }
 private void PopulateYesNoChoices(OrganizationMember om, Ask ask)
 {
     if (setting.TargetExtraValues == false)
         foreach (var yn in ((AskYesNoQuestions)ask).list)
         {
             {
                 if (om.IsInGroup("Yes:" + yn.SmallGroup))
                     YesNoQuestion[yn.SmallGroup] = true;
                 if (om.IsInGroup("No:" + yn.SmallGroup))
                     YesNoQuestion[yn.SmallGroup] = false;
             }
         }
     else
         foreach (var yn in ((AskYesNoQuestions)ask).list)
         {
             if (person.GetExtra(yn.SmallGroup) == "Yes")
                 YesNoQuestion[yn.SmallGroup] = true;
             if (person.GetExtra(yn.SmallGroup) == "No")
                 YesNoQuestion[yn.SmallGroup] = false;
         }
 }
Beispiel #5
0
        public void PopulateRegistrationFromDb(OrganizationMember om)
        {
            var reg = person.RecRegs.SingleOrDefault();
            if (reg == null)
            {
                reg = new RecReg();
                person.RecRegs.Add(reg);
            }
            foreach (var ask in setting.AskItems)
            {
                switch (ask.Type)
                {
                    case "AskSize":
                        shirtsize = om.ShirtSize;
                        break;
                    case "AskChurch":
                        otherchurch = reg.ActiveInAnotherChurch ?? false;
                        memberus = reg.Member ?? false;
                        break;
                    case "AskAllergies":
                        medical = reg.MedicalDescription;
                        break;
                    case "AskParents":
                        mname = reg.Mname;
                        fname = reg.Fname;
                        break;
                    case "AskEmContact":
                        emcontact = reg.Emcontact;
                        emphone = reg.Emphone;
                        break;
                    case "AskTylenolEtc":
                        tylenol = reg.Tylenol;
                        advil = reg.Advil;
                        robitussin = reg.Robitussin;
                        maalox = reg.Maalox;
                        break;
                    case "AskDoctor":
                        docphone = reg.Docphone;
                        doctor = reg.Doctor;
                        break;
                    case "AskCoaching":
                        coaching = reg.Coaching;
                        break;
                    //                    case "AskSMS":
                    //                        sms = person.ReceiveSMS;
                    //                        break;
                    case "AskInsurance":
                        insurance = reg.Insurance;
                        policy = reg.Policy;
                        break;
                    case "AskTickets":
                        ntickets = om.Tickets;
                        break;
                    case "AskYesNoQuestions":
                        if (setting.TargetExtraValues == false)
                            foreach (var yn in ((AskYesNoQuestions)ask).list)
                            {
                                {
                                    if (om.IsInGroup("Yes:" + yn.SmallGroup))
                                        YesNoQuestion[yn.SmallGroup] = true;
                                    if (om.IsInGroup("No:" + yn.SmallGroup))
                                        YesNoQuestion[yn.SmallGroup] = false;
                                }
                            }
                        else
                            foreach (var yn in ((AskYesNoQuestions)ask).list)
                            {
                                if (person.GetExtra(yn.SmallGroup) == "Yes")
                                    YesNoQuestion[yn.SmallGroup] = true;
                                if (person.GetExtra(yn.SmallGroup) == "No")
                                    YesNoQuestion[yn.SmallGroup] = false;
                            }
                        break;
                    case "AskCheckboxes":
                        if (setting.TargetExtraValues)
                        {
                            foreach (var ck in ((AskCheckboxes)ask).list)
                                if (person.GetExtra(ck.SmallGroup).ToBool())
                                    Checkbox.Add(ck.SmallGroup);
                        }
                        else
                            foreach (var ck in ((AskCheckboxes)ask).list)
                                if (om.IsInGroup(ck.SmallGroup))
                                    Checkbox.Add(ck.SmallGroup);
                        break;
                    case "AskExtraQuestions":
                        if (ExtraQuestion == null)
                            ExtraQuestion = new List<Dictionary<string, string>>();
                        var eq = new Dictionary<string, string>();
                        ExtraQuestion.Add(eq);
                        var lines = (om.UserData ?? "").Split('\n');
                        foreach (var q in ((AskExtraQuestions)ask).list)
                        {
                            if (setting.TargetExtraValues)
                            {
                                var v = person.GetExtra(q.Question);
                                if (v.HasValue())
                                    eq[q.Question] = v;
                            }
                            else
                            {
                                var v = (from li in lines
                                         where li.StartsWith(q.Question + ": ")
                                         select li.Substring(q.Question.Length + 2)).FirstOrDefault();
                                if (v.HasValue())
                                    eq[q.Question] = v;
                            }
                        }
                        break;

                    case "AskMenu":
                        //                        foreach (var i in MenuItem)
                        //                            om.AddToGroup(DbUtil.Db, i.Key, i.Value);
                        //                        {
                        //                            var menulabel = "Menu Items";
                        //                            foreach (var i in ((AskMenu)ask).MenuItemsChosen(MenuItem))
                        //                            {
                        //                                om.AddToMemberData(menulabel);
                        //                                string desc;
                        //                                if (i.amt > 0)
                        //                                    desc = "{0} {1} (at {2:N2})".Fmt(i.number, i.desc, i.amt);
                        //                                else
                        //                                    desc = "{0} {1}".Fmt(i.number, i.desc);
                        //                                om.AddToMemberData(desc);
                        //                                menulabel = string.Empty;
                        //                            }
                        //                        }
                        break;
                    case "AskDropdown":
                        if (option == null)
                            option = new List<string>();
                        if (setting.TargetExtraValues)
                        {
                            foreach (var dd in ((AskDropdown)ask).list)
                                if (person.GetExtra(dd.SmallGroup) == "true")
                                    option.Add(dd.SmallGroup);
                        }
                        else
                            foreach (var dd in ((AskDropdown)ask).list)
                                if (om.IsInGroup(dd.SmallGroup))
                                    option.Add(dd.SmallGroup);
                        break;
                    case "AskGradeOptions":
                        gradeoption = person.Grade.ToString();
                        if (!setting.TargetExtraValues)
                            gradeoption = om.Grade.ToString();
                        break;
                }
            }
            //            if (setting.TargetExtraValues)
            //            {
            //                foreach (var ag in setting.AgeGroups)
            //                    person.RemoveExtraValue(DbUtil.Db, ag.SmallGroup);
            //                if (setting.AgeGroups.Count > 0)
            //                    person.AddEditExtraValue(AgeGroup(), "true");
            //            }
            //            else
            //            {
            //                foreach (var ag in setting.AgeGroups)
            //                    om.RemoveFromGroup(DbUtil.Db, ag.SmallGroup);
            //                if (setting.AgeGroups.Count > 0)
            //                    om.AddToGroup(DbUtil.Db, AgeGroup());
            //            }
        }