Exemplo n.º 1
0
        public void CopySettings(CMSDataContext db, int fromid)
        {
            var frorg = db.LoadOrganizationById(fromid);

            CopySettings2(frorg, this);
            db.SubmitChanges();
        }
Exemplo n.º 2
0
 public bool UseBootstrap(CMSDataContext db)
 {
     if (usebootstrap.HasValue)
         return usebootstrap.Value;
     var org = db.LoadOrganizationById(OrgId);
     return (usebootstrap = org.UseBootstrap) ?? false;
 }
Exemplo n.º 3
0
        public static bool VolunteerLeaderInOrg(CMSDataContext db, int?orgid)
        {
            if (orgid == null)
            {
                return(false);
            }

            var o = db.LoadOrganizationById(orgid);

            if (o == null || o.RegistrationTypeId != RegistrationTypeCode.ChooseVolunteerTimes)
            {
                return(false);
            }

            if (db.CurrentUser?.InAnyRole("Admin", "ManageVolunteers") ?? false)
            {
                return(true);
            }

            var leaderorgs = db.GetLeaderOrgIds(db.UserPeopleId);

            if (leaderorgs == null)
            {
                return(false);
            }

            return(leaderorgs.Contains(orgid.Value));
        }
Exemplo n.º 4
0
 public static Settings ParseSettings(string s, CMSDataContext Db, int OrgId)
 {
     var settings = ParseSettings(s);
     settings.Db = Db;
     settings.OrgId = OrgId;
     settings.org = Db.LoadOrganizationById(OrgId);
     return settings;
 }
Exemplo n.º 5
0
        public bool UseBootstrap(CMSDataContext db)
        {
            if (usebootstrap.HasValue)
            {
                return(usebootstrap.Value);
            }
            var org = db.LoadOrganizationById(OrgId);

            return((usebootstrap = org.UseBootstrap) ?? false);
        }
Exemplo n.º 6
0
        public void EmailReminders(int orgId)
        {
            var org = db.LoadOrganizationById(orgId);
            var m   = new API.APIOrganization(db);

            if (org.RegistrationTypeId == RegistrationTypeCode.ChooseVolunteerTimes)
            {
                m.SendVolunteerReminders(orgId, false);
            }
            else
            {
                m.SendEventReminders(orgId);
            }
        }
Exemplo n.º 7
0
        public void EmailReminders(object orgId)
        {
            var oid = orgId.ToInt();
            var org = db.LoadOrganizationById(oid);
            var m   = new API.APIOrganization(db);

            Util.IsInRoleEmailTest = TestEmail;
            if (org.RegistrationTypeId == RegistrationTypeCode.ChooseVolunteerTimes)
            {
                m.SendVolunteerReminders(oid, false);
            }
            else
            {
                m.SendEventReminders(oid);
            }
        }
Exemplo n.º 8
0
        public void CopySettings(CMSDataContext Db, int fromid)
        {
            var frorg = Db.LoadOrganizationById(fromid);

            //only Copy settings
            NotifyIds          = frorg.NotifyIds;
            FirstMeetingDate   = frorg.FirstMeetingDate;
            LastDayBeforeExtra = frorg.LastDayBeforeExtra;
            LastMeetingDate    = frorg.LastMeetingDate;
            Limit = frorg.Limit;
            RegistrationTypeId = frorg.RegistrationTypeId;

            RegSetting = frorg.RegSetting;

            CopySettings2(frorg, this);
            Db.SubmitChanges();
        }
Exemplo n.º 9
0
        public void CopySettings(CMSDataContext db, int fromid)
        {
            var frorg = db.LoadOrganizationById(fromid);

            //only Copy settings
            NotifyIds          = frorg.NotifyIds;
            FirstMeetingDate   = frorg.FirstMeetingDate;
            LastDayBeforeExtra = frorg.LastDayBeforeExtra;
            LastMeetingDate    = frorg.LastMeetingDate;
            Limit = frorg.Limit;
            RegistrationTypeId = frorg.RegistrationTypeId;
            RegStart           = frorg.RegStart;
            RegEnd             = frorg.RegEnd;
            IsMissionTrip      = frorg.IsMissionTrip;

            RegSetting    = frorg.RegSetting;
            RegSettingXml = frorg.RegSettingXml;

            CopySettings2(frorg, this);
            db.SubmitChanges();
        }
Exemplo n.º 10
0
        public Settings(string s, CMSDataContext Db, int OrgId)
            : this()
        {
            this.Db = Db;
            this.OrgId = OrgId;
            org = Db.LoadOrganizationById(OrgId);
            var parser = new Parser(s);

            while (parser.NextSection())
                ParseSection(parser);
            SetUniqueIds("AskDropdown");
            SetUniqueIds("AskExtraQuestions");
            SetUniqueIds("AskCheckboxes");
            SetUniqueIds("AskMenu");
            var sglist = new List<string>();
            AskItems.ForEach(a => sglist.AddRange(a.SmallGroups()));
            var q = sglist.GroupBy(mi => mi).Where(g => g.Count() > 1).Select(g => g.Key).ToList();
            if (q.Any())
                throw parser.GetException("Duplicate SmallGroup: " + string.Join(",", q));

            parser.data = null;
        }
Exemplo n.º 11
0
        public void CopySettings(CMSDataContext Db, int fromid)
        {
            var frorg = Db.LoadOrganizationById(fromid);

            //only Copy settings
            NotifyIds = frorg.NotifyIds;
            FirstMeetingDate = frorg.FirstMeetingDate;
            LastDayBeforeExtra = frorg.LastDayBeforeExtra;
            LastMeetingDate = frorg.LastMeetingDate;
            Limit = frorg.Limit;
            RegistrationTypeId = frorg.RegistrationTypeId;
            RegStart = frorg.RegStart;
            RegEnd = frorg.RegEnd;
            IsMissionTrip = frorg.IsMissionTrip;

            RegSetting = frorg.RegSetting;
            RegSettingXml = frorg.RegSettingXml;

            CopySettings2(frorg, this);
            Db.SubmitChanges();
        }
Exemplo n.º 12
0
 public static bool VolunteerLeaderInOrg(CMSDataContext db, int? orgid)
 {
     if (orgid == null)
         return false;
     var o = db.LoadOrganizationById(orgid);
     if (o == null || o.RegistrationTypeId != RegistrationTypeCode.ChooseVolunteerTimes)
         return false;
     if (HttpContext.Current.User.IsInRole("Admin") ||
         HttpContext.Current.User.IsInRole("ManageVolunteers"))
         return true;
     var leaderorgs = db.GetLeaderOrgIds(Util.UserPeopleId);
     if (leaderorgs == null)
         return false;
     return leaderorgs.Contains(orgid.Value);
 }
Exemplo n.º 13
0
 public static OrganizationMember InsertOrgMembers(CMSDataContext db, int organizationId, int peopleId, int memberTypeId, DateTime enrollmentDate, DateTime? inactiveDate = null, bool pending = false, bool skipTriggerProcessing = false)
 {
     var org = db.LoadOrganizationById(organizationId);
     return InsertOrgMembers(db, organizationId, peopleId, memberTypeId, enrollmentDate, inactiveDate, pending, org.OrganizationName, skipTriggerProcessing);
 }
Exemplo n.º 14
0
        public static OrganizationMember InsertOrgMembers(CMSDataContext db, int organizationId, int peopleId, int memberTypeId, DateTime enrollmentDate, DateTime?inactiveDate = null, bool pending = false, bool skipTriggerProcessing = false)
        {
            var org = db.LoadOrganizationById(organizationId);

            return(InsertOrgMembers(db, organizationId, peopleId, memberTypeId, enrollmentDate, inactiveDate, pending, org.OrganizationName, skipTriggerProcessing));
        }
Exemplo n.º 15
0
 public static decimal AmountDueTrans(CMSDataContext db, Transaction ti)
 {
     var org = db.LoadOrganizationById(ti.OrgId);
     var tt = (from t in db.ViewTransactionSummaries
               where t.RegId == ti.OriginalId
               select t).FirstOrDefault();
     if (tt == null)
         return 0;
     if (org.IsMissionTrip ?? false)
         return (tt.IndAmt ?? 0) - (db.TotalPaid(tt.OrganizationId, tt.PeopleId) ?? 0);
     return tt.TotDue ?? 0;
 }