private string MarkAttendingIntention(int code)
 {
     if (person == null)
     {
         return(GetNoPersonMessage());
     }
     try
     {
         row.Args = $"{{ \"MeetingId\": \"{action.MeetingId}\"}}";
         if (action.MeetingId == null)
         {
             throw new Exception("meetingid null");
         }
         meeting = CurrentDatabase.Meetings.FirstOrDefault(mm => mm.MeetingId == action.MeetingId);
         if (meeting == null)
         {
             throw new Exception($"meetingid {action.MeetingId} not found");
         }
         organization = CurrentDatabase.LoadOrganizationById(meeting.OrganizationId);
         Attend.MarkRegistered(CurrentDatabase, person.PeopleId, meeting.MeetingId, code);
         markedas = code == AttendCommitmentCode.Attending ? "Attending" : "Regrets";
     }
     catch (Exception e)
     {
         return(GetError($"No Meeting on action {action.Action}, {e.Message}"));
     }
     return(GetActionReplyMessage());
 }
Exemple #2
0
        public ActionResult UpdateNotifyIds(int id, int topid, string field)
        {
            var t             = CurrentDatabase.FetchOrCreateTag(CurrentDatabase.CurrentSessionId, CurrentDatabase.UserPeopleId, DbUtil.TagTypeId_AddSelected);
            var selected_pids = (from p in t.People(CurrentDatabase)
                                 orderby p.PeopleId == topid ? "0" : "1"
                                 select p.PeopleId).ToArray();
            var o         = CurrentDatabase.LoadOrganizationById(id);
            var notifyids = string.Join(",", selected_pids);

            switch (field.ToLower())
            {
            case "notifyids":
                o.NotifyIds = notifyids;
                break;

            case "giftnotifyids":
                o.GiftNotifyIds = notifyids;
                break;
            }
            CurrentDatabase.TagPeople.DeleteAllOnSubmit(t.PersonTags);
            CurrentDatabase.Tags.DeleteOnSubmit(t);
            CurrentDatabase.SubmitChanges();
            ViewBag.OrgId = id;
            ViewBag.field = field;
            var view = ViewExtensions2.RenderPartialViewToString(this, "Registration/NotifyList", notifyids);

            return(Content(view));
            //return View("NotifyList2", notifyids);
        }
Exemple #3
0
        public ActionResult AddContactReceived(int id)
        {
            var o = CurrentDatabase.LoadOrganizationById(id);

            DbUtil.LogPersonActivity($"Adding contact to organization: {o.FullName}", id, o.FullName);
            var c = new Contact
            {
                CreatedDate    = Util.Now,
                CreatedBy      = Util.UserId1,
                ContactDate    = Util.Now.Date,
                OrganizationId = o.OrganizationId
            };

            CurrentDatabase.Contacts.InsertOnSubmit(c);
            CurrentDatabase.SubmitChanges();

            c.contactsMakers.Add(new Contactor {
                PeopleId = Util.UserPeopleId.Value
            });
            CurrentDatabase.SubmitChanges();

            var defaultRole = CurrentDatabase.Setting("Contacts-DefaultRole", null);

            if (!string.IsNullOrEmpty(defaultRole) && CurrentDatabase.Roles.Any(x => x.RoleName == defaultRole))
            {
                TempData["SetRole"] = defaultRole;
            }

            TempData["ContactEdit"] = true;
            return(Content($"/Contact2/{c.ContactId}"));
        }
        public ActionResult Submit(int id, NewOrganizationModel m)
        {
            var org = CurrentDatabase.LoadOrganizationById(id);

            m.org.CreatedDate        = Util.Now;
            m.org.CreatedBy          = CurrentDatabase.UserId1;
            m.org.EntryPointId       = org.EntryPointId;
            m.org.OrganizationTypeId = org.OrganizationTypeId;
            if (m.org.CampusId == 0)
            {
                m.org.CampusId = null;
            }

            if (!m.org.OrganizationName.HasValue())
            {
                m.org.OrganizationName = $"New organization needs a name ({Util.UserFullName})";
            }

            m.org.OrganizationStatusId = 30;
            m.org.DivisionId           = org.DivisionId;

            CurrentDatabase.Organizations.InsertOnSubmit(m.org);
            CurrentDatabase.SubmitChanges();
            foreach (var div in org.DivOrgs)
            {
                m.org.DivOrgs.Add(new DivOrg {
                    Organization = m.org, DivId = div.DivId
                });
            }

            if (m.copysettings)
            {
                foreach (var sc in org.OrgSchedules)
                {
                    m.org.OrgSchedules.Add(new OrgSchedule
                    {
                        OrganizationId = m.org.OrganizationId,
                        AttendCreditId = sc.AttendCreditId,
                        SchedDay       = sc.SchedDay,
                        SchedTime      = sc.SchedTime,
                        Id             = sc.Id
                    });
                }

                m.org.CopySettings(CurrentDatabase, id);
            }
            else
            {
                Settings os = new Settings()
                {
                    ShowDOBOnFind   = true,
                    ShowPhoneOnFind = true
                };
                m.org.RegSettingXml = Util.Serialize(os);
            }

            CurrentDatabase.SubmitChanges();
            DbUtil.LogActivity($"Add new org {m.org.OrganizationName}");
            return(Redirect($"/Org/{m.org.OrganizationId}"));
        }
Exemple #5
0
        public ActionResult Join(int oid, int pid)
        {
            var org = CurrentDatabase.LoadOrganizationById(oid);

            if (org.AllowAttendOverlap != true)
            {
                var om = CurrentDatabase.OrganizationMembers.FirstOrDefault(mm =>
                                                                            mm.OrganizationId != oid &&
                                                                            mm.MemberTypeId != 230 && // inactive
                                                                            mm.MemberTypeId != 500 && // inservice
                                                                            mm.Organization.AllowAttendOverlap != true &&
                                                                            mm.PeopleId == pid &&
                                                                            mm.Organization.OrgSchedules.Any(ss =>
                                                                                                             CurrentDatabase.OrgSchedules.Any(os =>
                                                                                                                                              os.OrganizationId == oid &&
                                                                                                                                              os.ScheduleId == ss.ScheduleId)));
                if (om != null)
                {
                    DbUtil.LogActivity($"Same Hour Joining Org {org.OrganizationName}({pid})");
                    return(Content($"Already a member of {om.OrganizationId} at this hour"));
                }
            }
            OrganizationMember.InsertOrgMembers(CurrentDatabase,
                                                oid, pid, MemberTypeCode.Member,
                                                DateTime.Now, null, false);
            CurrentDatabase.UpdateMainFellowship(oid);
            DbUtil.LogActivity($"Joining Org {org.OrganizationName}({pid})");
            return(Content("ok"));
        }
Exemple #6
0
        public ActionResult MakeChildrenOf(int id, OrgSearchModel m)
        {
            var t = (id == -1 ? (int?)null : id);

            if (t == 0)
            {
                return(Content(""));
            }

            var org = CurrentDatabase.LoadOrganizationById(id);

            if (t.HasValue || org != null)
            {
                var q = from o in CurrentDatabase.Organizations
                        join os in m.FetchOrgs() on o.OrganizationId equals os.OrganizationId
                        where o.OrganizationId != id
                        select o;
                foreach (var o in q)
                {
                    o.ParentOrgId = t;
                }
            }
            else
            {
                return(Content("error: missing type"));
            }

            CurrentDatabase.SubmitChanges();
            return(Content("ok"));
        }
Exemple #7
0
        public ActionResult NotifyIds(int id, string field)
        {
            Response.NoCache();
            var t = CurrentDatabase.FetchOrCreateTag(CurrentDatabase.CurrentSessionId, CurrentDatabase.UserPeopleId, DbUtil.TagTypeId_AddSelected);

            CurrentDatabase.TagPeople.DeleteAllOnSubmit(t.PersonTags);
            CurrentDatabase.SetCurrentOrgId(id);
            CurrentDatabase.SubmitChanges();
            var    o         = CurrentDatabase.LoadOrganizationById(id);
            string notifyids = null;

            switch (field.ToLower())
            {
            case "notifyids":
                notifyids = o.NotifyIds;
                break;

            case "giftnotifyids":
                notifyids = o.GiftNotifyIds;
                break;
            }
            var q = CurrentDatabase.PeopleFromPidString(notifyids).Select(p => p.PeopleId);

            foreach (var pid in q)
            {
                t.PersonTags.Add(new TagPerson {
                    PeopleId = pid
                });
            }
            CurrentDatabase.SubmitChanges();
            return(Redirect("/SearchUsers?ordered=true&topid=" + q.FirstOrDefault()));
        }
 private string AddToSmallGroup()
 {
     if (person == null)
     {
         return(GetNoPersonMessage());
     }
     try
     {
         row.Args = $"{{ \"OrgId\": \"{action.OrgId}\", \"SmallGroup\": \"{action.SmallGroup}\"}}";
         if (action.OrgId == null)
         {
             throw new Exception("OrgId is null");
         }
         organization = CurrentDatabase.LoadOrganizationById(action.OrgId);
         if (organization == null)
         {
             throw new Exception($"OrgId {action.OrgId} not found");
         }
         if (action.SmallGroup == null)
         {
             throw new Exception("SmallGroup is null");
         }
         var om = OrganizationMember.InsertOrgMembers(CurrentDatabase, action.OrgId.Value, person.PeopleId, 220, Util.Now, null, false);
         om.AddToGroup(CurrentDatabase, action.SmallGroup);
     }
     catch (Exception e)
     {
         return(GetError(e.Message));
     }
     return(GetActionReplyMessage());
 }
Exemple #9
0
        public ActionResult DropFromOrgLink(string id, FormCollection formCollection)
        {
            var li = new LinkInfo("dropfromorg", confirmSTR, id);

            if (li.error.HasValue())
            {
                return(Message(li.error));
            }

            if (!li.oid.HasValue)
            {
                throw new Exception("orgid missing");
            }

            if (!li.pid.HasValue)
            {
                throw new Exception("peopleid missing");
            }

            var org = CurrentDatabase.LoadOrganizationById(li.oid);

            if (org == null)
            {
                throw new Exception("no such organization");
            }

            var om = CurrentDatabase.OrganizationMembers.SingleOrDefault(mm => mm.OrganizationId == li.oid && mm.PeopleId == li.pid);

            om?.Drop(CurrentDatabase);
            li.ot.Used = true;
            CurrentDatabase.SubmitChanges();

            DbUtil.LogActivity($"dropfromorg confirm: {id}", li.oid, li.pid);
            return(Message($"You have been successfully removed from {org.Title ?? org.OrganizationName}"));
        }
Exemple #10
0
        public ActionResult ToggleTag(int id, int tagdiv)
        {
            //var Db = Db;
            var organization = CurrentDatabase.LoadOrganizationById(id);

            if (tagdiv == 0)
            {
                return(Json(new { error = "bad tagdiv" }));
            }

            var t = organization.ToggleTag(CurrentDatabase, tagdiv);

            CurrentDatabase.SubmitChanges();
            var m = new OrgSearchModel(CurrentDatabase)
            {
                StatusId = 0, TagDiv = tagdiv, Name = id.ToString()
            };
            var o = m.OrganizationList().SingleOrDefault();

            if (o == null)
            {
                return(Content("error"));
            }

            return(View("Row", o));
        }
 private string AddToOrg()
 {
     if (person == null)
     {
         return(GetNoPersonMessage());
     }
     try
     {
         row.Args = $"{{ \"OrgId\": \"{action.OrgId}\"}}";
         if (action.OrgId == null)
         {
             throw new Exception("orgid null");
         }
         organization = CurrentDatabase.LoadOrganizationById(action.OrgId);
         if (organization == null)
         {
             throw new Exception($"orgid {action.OrgId} not found");
         }
         organization = CurrentDatabase.LoadOrganizationById(action.OrgId);
         OrganizationMember.InsertOrgMembers(CurrentDatabase, action.OrgId.Value, person.PeopleId, 220, Util.Now, null, false);
     }
     catch (Exception e)
     {
         return(GetError($"Org not found on action {action.Action}, {e.Message}"));
     }
     return(GetActionReplyMessage());
 }
 private string RecordAttendance()
 {
     if (person == null)
     {
         return(GetNoPersonMessage());
     }
     try
     {
         row.Args = $"{{ \"MeetingId\": \"{action.MeetingId}\"}}";
         if (action.MeetingId == null)
         {
             throw new Exception("meetingid null");
         }
         meeting = CurrentDatabase.Meetings.FirstOrDefault(mm => mm.MeetingId == action.MeetingId);
         if (meeting == null)
         {
             throw new Exception($"meetingid {action.MeetingId} not found");
         }
         organization = CurrentDatabase.LoadOrganizationById(meeting.OrganizationId);
         Attend.RecordAttendance(CurrentDatabase, person.PeopleId, meeting.MeetingId, attended: true);
     }
     catch (Exception e)
     {
         return(GetError($"No Meeting on action {action.Action}, {e.Message}"));
     }
     return(GetActionReplyMessage());
 }
Exemple #13
0
        public void DropSingleMember(int orgId, int peopleId)
        {
            var org = CurrentDatabase.LoadOrganizationById(orgId);
            var om  = org.OrganizationMembers.Single(mm => mm.PeopleId == peopleId);

            om.Drop(CurrentDatabase, CMSImageDataContext.Create(CurrentDatabase.Host));
            CurrentDatabase.SubmitChanges();
        }
Exemple #14
0
        public ActionResult RecordTest(int id, string v)
        {
            var o = CurrentDatabase.LoadOrganizationById(id);

            o.AddEditExtra(CurrentDatabase, "tested", v);
            CurrentDatabase.SubmitChanges();
            return(Content(v));
        }
Exemple #15
0
        public ActionResult CreateMeeting(string id)
        {
            var a            = id.SplitStr(".");
            var orgid        = a[1].ToInt();
            var organization = CurrentDatabase.LoadOrganizationById(orgid);

            if (organization == null)
            {
                return(Content($"error:Bad Orgid ({id})"));
            }

            var re = new Regex(@"\A(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])([0-9]{2})([012][0-9])([0-5][0-9])\Z");

            if (!re.IsMatch(a[2]))
            {
                return(Content($"error:Bad Date and Time ({id})"));
            }

            var g  = re.Match(a[2]);
            var dt = new DateTime(
                g.Groups[3].Value.ToInt() + 2000,
                g.Groups[1].Value.ToInt(),
                g.Groups[2].Value.ToInt(),
                g.Groups[4].Value.ToInt(),
                g.Groups[5].Value.ToInt(),
                0);
            var newMtg = CurrentDatabase.Meetings.FirstOrDefault(m => m.OrganizationId == orgid && m.MeetingDate == dt);

            if (newMtg == null)
            {
                var attsch = (from s in CurrentDatabase.OrgSchedules
                              where s.OrganizationId == organization.OrganizationId
                              where s.MeetingTime.Value.TimeOfDay == dt.TimeOfDay
                              where s.MeetingTime.Value.DayOfWeek == dt.DayOfWeek
                              select s).SingleOrDefault();
                int?attcred = null;
                if (attsch != null)
                {
                    attcred = attsch.AttendCreditId;
                }

                newMtg = new Meeting
                {
                    CreatedDate      = Util.Now,
                    CreatedBy        = Util.UserId1,
                    OrganizationId   = orgid,
                    GroupMeetingFlag = false,
                    Location         = organization.Location,
                    MeetingDate      = dt,
                    AttendCreditId   = attcred,
                    NoAutoAbsents    = !CurrentDatabase.Setting("AttendanceAutoAbsents")
                };
                CurrentDatabase.Meetings.InsertOnSubmit(newMtg);
                CurrentDatabase.SubmitChanges();
                DbUtil.LogActivity($"Created new meeting for {organization.OrganizationName}");
            }
            return(Content($"/Meeting/{newMtg.MeetingId}?showall=true"));
        }
        public ActionResult Index(int id, int?pid)
        {
            var o = OrgContentInfo.Get(id);

            if (o == null)
            {
                return(Content("<h2>Not an Organization</h2>"));
            }

            if (!Util.UserPeopleId.HasValue)
            {
                return(Redirect("/OrgContent/Login/" + id));
            }

            if (o.TryRunPython(pid ?? Util.UserPeopleId.Value))
            {
                return(View("ScriptResults", o));
            }

            var org = CurrentDatabase.LoadOrganizationById(o.OrgId);

            // Try to load a template specific to this org type
            var template = CurrentDatabase.ContentHtml($"OrgContent-{org.OrganizationType?.Description}", null);

            // Try to fall back on a standard template
            if (template == null)
            {
                template = CurrentDatabase.ContentHtml("OrgContent", null);
            }

            if (template != null)
            {
                template = template.Replace("{content}", o.Html ?? string.Empty)
                           .Replace("{location}", org.Location ?? string.Empty)
                           .Replace("{type}", org.OrganizationType?.Description ?? string.Empty)
                           .Replace("{division}", org.Division?.Name ?? string.Empty)
                           .Replace("{campus}", org.Campu?.Description ?? string.Empty)
                           .Replace("{orgid}", org.OrganizationId.ToString())
                           .Replace("{name}", org.OrganizationName ?? string.Empty);

                org.GetOrganizationExtras()
                .ForEach(
                    ev =>
                {
                    template = template.Replace($"{{{ev.Field}}}", ev.Data ?? ev.StrValue ?? string.Empty);
                });

                if (template.Contains("{directory}"))
                {
                    ViewBag.qid = CurrentDatabase.NewOrgFilter(id).QueryId;
                }

                ViewBag.template = template;
                return(View(o));
            }

            return(View(o));
        }
Exemple #17
0
        public ActionResult OrgPickList(int id)
        {
            Response.NoCache();
            CurrentDatabase.SetCurrentOrgId(id);
            var o = CurrentDatabase.LoadOrganizationById(id);

            Util.OrgPickList = (o.OrgPickList ?? "").Split(',').Select(oo => oo.ToInt()).ToList();
            return(Redirect("/SearchOrgs/" + id));
        }
Exemple #18
0
        public ActionResult SetDescription(string id, string description)
        {
            var a   = id.Split('-');
            var org = CurrentDatabase.LoadOrganizationById(a[1].ToInt());

            org.Description = description;
            CurrentDatabase.SubmitChanges();
            return(Content("ok"));
        }
Exemple #19
0
        public ContentResult Edit(string id, string value)
        {
            var a = id.Split('-');
            var c = new ContentResult();

            c.Content = value;
            var org = CurrentDatabase.LoadOrganizationById(a[1].ToInt());

            if (org == null)
            {
                return(c);
            }

            switch (a[0])
            {
            case "bs":
                org.BirthDayStart = value.ToDate();
                break;

            case "be":
                org.BirthDayEnd = value.ToDate();
                break;

            case "rs":
                org.RegStart = value.ToDate();
                break;

            case "re":
                org.RegEnd = value.ToDate();
                break;

            case "ck":
                org.CanSelfCheckin = value == "yes";
                break;

            case "reg2":
                org.UseRegisterLink2 = value == "yes";
                c.Content            = org.UseRegisterLink2 == true ? "Family" : "Individual";
                break;

            case "so":
                org.PublicSortOrder = value.HasValue() ? value : null;
                break;

            case "ac":
                if (value == "Other")
                {
                    value = null;
                }

                org.AppCategory = value.HasValue() ? value : null;
                break;
            }
            CurrentDatabase.SubmitChanges();
            return(c);
        }
Exemple #20
0
        public ActionResult AddProspect(int oid, int pid)
        {
            var org = CurrentDatabase.LoadOrganizationById(oid);

            OrganizationMember.InsertOrgMembers(CurrentDatabase,
                                                oid, pid, MemberTypeCode.Prospect,
                                                DateTime.Now, null, false);
            DbUtil.LogActivity($"Adding Prospect {org.OrganizationName}({pid})");
            return(Content("ok"));
        }
Exemple #21
0
        public ActionResult OrgPickList(int id)
        {
            if (Util.SessionTimedOut())
            {
                return(Content("<script type='text/javascript'>window.onload = function() { parent.location = '/'; }</script>"));
            }
            Response.NoCache();
            CurrentDatabase.SetCurrentOrgId(id);
            var o = CurrentDatabase.LoadOrganizationById(id);

            Session["orgPickList"] = (o.OrgPickList ?? "").Split(',').Select(oo => oo.ToInt()).ToList();
            return(Redirect("/SearchOrgs/" + id));
        }
Exemple #22
0
        public ActionResult Index(int id)
        {
            var org = CurrentDatabase.LoadOrganizationById(id);

            ViewData["OrganizationId"] = id;
            ViewData["orgname"]        = org.OrganizationName;
            var regsetting = org.RegSettingXml;
            var os         = CurrentDatabase.CreateRegistrationSettings(regsetting, id);

            regsetting       = os.ToString();
            ViewData["text"] = regsetting;
            return(View());
        }
Exemple #23
0
        private void SetHeaders(int id)
        {
            Settings setting = null;
            var      org     = CurrentDatabase.LoadOrganizationById(id);

            if (org != null)
            {
                SetHeaders2(id);
                return;
            }

            var shell = SetAlternativeManagedGivingShell();

            if (!shell.HasValue() && (settings == null || !settings.ContainsKey(id)))
            {
                setting = CurrentDatabase.CreateRegistrationSettings(id);
                shell   = DbUtil.Content(CurrentDatabase, setting.Shell, null);
            }
            if (!shell.HasValue() && settings != null && settings.ContainsKey(id))
            {
                shell = DbUtil.Content(CurrentDatabase, settings[id].Shell, null);
            }
            if (!shell.HasValue())
            {
                shell = DbUtil.Content(CurrentDatabase, "ShellDiv-" + id, DbUtil.Content(CurrentDatabase, "ShellDefault", ""));
            }

            var s = shell;

            if (s.HasValue())
            {
                var re = new Regex(@"(.*<!--FORM START-->\s*).*(<!--FORM END-->.*)", RegexOptions.Singleline);
                var t  = re.Match(s).Groups[1].Value.Replace("<!--FORM CSS-->",
                                                             ViewExtensions2.jQueryUICss() +
                                                             "\r\n<link href=\"/Content/styles/onlinereg.css?v=8\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
                ViewBag.hasshell = true;
                var b = re.Match(s).Groups[2].Value;
                ViewBag.bottom = b;
            }
            else
            {
                ViewBag.hasshell = false;
                ViewBag.header   = DbUtil.Content(CurrentDatabase, "OnlineRegHeader-" + id,
                                                  DbUtil.Content(CurrentDatabase, "OnlineRegHeader", ""));
                ViewBag.top = DbUtil.Content(CurrentDatabase, "OnlineRegTop-" + id,
                                             DbUtil.Content(CurrentDatabase, "OnlineRegTop", ""));
                ViewBag.bottom = DbUtil.Content(CurrentDatabase, "OnlineRegBottom-" + id,
                                                DbUtil.Content(CurrentDatabase, "OnlineRegBottom", ""));
            }
        }
Exemple #24
0
        public ActionResult UpdateOrg(int ParentOrg, int ChildOrg, bool Checked)
        {
            var o = CurrentDatabase.LoadOrganizationById(ChildOrg);

            if (Checked)
            {
                o.ParentOrgId = ParentOrg;
            }
            else
            {
                o.ParentOrgId = null;
            }

            CurrentDatabase.SubmitChanges();
            return(Content("ok"));
        }
Exemple #25
0
        public ActionResult Update(int id, string text)
        {
            var org = CurrentDatabase.LoadOrganizationById(id);

            try
            {
                var os = CurrentDatabase.CreateRegistrationSettings(text, id);
                org.UpdateRegSetting(os);
                CurrentDatabase.SubmitChanges();
            }
            catch (Exception ex)
            {
                Util.TempError = ex.Message;
            }
            return(Redirect("/RegSettings/" + id));
        }
Exemple #26
0
        public ActionResult VolunteerReminders(int id, bool?emailall)
        {
            var org = CurrentDatabase.LoadOrganizationById(id);

            if (org == null)
            {
                throw new Exception("Org not found");
            }
            var m = new APIOrganization(CurrentDatabase);

            try
            {
                m.SendVolunteerReminders(id, emailall ?? false);
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
            return(Content("ok"));
        }
Exemple #27
0
        public ActionResult ReGenPaylinks(int id)
        {
            var org = CurrentDatabase.LoadOrganizationById(id);
            var q   = from om in org.OrganizationMembers
                      select om;

            foreach (var om in q)
            {
                if (!om.TranId.HasValue)
                {
                    continue;
                }

                var estr = HttpUtility.UrlEncode(Util.Encrypt(om.TranId.ToString()));
                var link = Util.ResolveUrl("/OnlineReg/PayAmtDue?q=" + estr);
                om.PayLink = link;
            }
            CurrentDatabase.SubmitChanges();
            return(View("Other/ReGenPaylinks", org));
        }
Exemple #28
0
        private void SetHeaders2(int id)
        {
            var org   = CurrentDatabase.LoadOrganizationById(id);
            var shell = GetAlternativeManagedGivingShell(org.OrganizationId);

            if (!shell.HasValue() && (settings == null || !settings.ContainsKey(id)) && org != null)
            {
                var setting = CurrentDatabase.CreateRegistrationSettings(id);
                shell = CurrentDatabase.ContentOfTypeHtml(setting.ShellBs)?.Body;
            }
            if (!shell.HasValue() && settings != null && settings.ContainsKey(id))
            {
                shell = CurrentDatabase.ContentOfTypeHtml(settings[id].ShellBs)?.Body;
            }

            if (!shell.HasValue())
            {
                shell = CurrentDatabase.ContentOfTypeHtml("ShellDefaultBs")?.Body;
                if (!shell.HasValue())
                {
                    shell = CurrentDatabase.ContentOfTypeHtml("DefaultShellBs")?.Body;
                }
            }


            if (shell != null && shell.HasValue())
            {
                shell = shell.Replace("{title}", ViewBag.Title);
                var re = new Regex(@"(.*<!--FORM START-->\s*).*(<!--FORM END-->.*)", RegexOptions.Singleline);
                var t  = re.Match(shell).Groups[1].Value.Replace("<!--FORM CSS-->", ViewExtensions2.Bootstrap3Css());
                ViewBag.hasshell = true;
                ViewBag.top      = t;
                var b = re.Match(shell).Groups[2].Value;
                ViewBag.bottom = b;
            }
            else
            {
                ViewBag.hasshell = false;
            }
        }
        public ActionResult CreateNewMeeting(NewMeetingInfo model)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.ForRollsheet = false;
                return(View("MeetingInfo", model));
            }
            var organization = CurrentDatabase.LoadOrganizationById(model.OrganizationId);

            if (organization == null)
            {
                return(Content("error: no org"));
            }

            var mt = CurrentDatabase.Meetings.SingleOrDefault(m => m.MeetingDate == model.MeetingDate &&
                                                              m.OrganizationId == organization.OrganizationId);

            if (mt != null)
            {
                return(Redirect("/Meeting/" + mt.MeetingId));
            }

            mt = new Meeting
            {
                CreatedDate      = Util.Now,
                CreatedBy        = Util.UserId1,
                Description      = Request["DescriptionList.Value"] ?? Request["Description"],
                OrganizationId   = organization.OrganizationId,
                GroupMeetingFlag = model.ByGroup,
                Location         = organization.Location,
                MeetingDate      = model.MeetingDate,
                AttendCreditId   = model.AttendCredit.Value.ToInt(),
                NoAutoAbsents    = !CurrentDatabase.Setting("AttendanceAutoAbsents")
            };
            CurrentDatabase.Meetings.InsertOnSubmit(mt);
            CurrentDatabase.SubmitChanges();
            DbUtil.LogActivity($"Creating new meeting for {organization.OrganizationName}");
            return(Redirect("/Meeting/" + mt.MeetingId));
        }
Exemple #30
0
        public ActionResult Delete(int id)
        {
            var org = CurrentDatabase.LoadOrganizationById(id);

            if (org == null)
            {
                return(Content("error, bad orgid"));
            }
            if (id == 1)
            {
                return(Content("Cannot delete first org"));
            }
            var err = org.PurgeOrg(CurrentDatabase);

            if (err.HasValue())
            {
                return(Content($"error, {err}"));
            }
            DbUtil.LogActivity($"Delete Org {Session["ActiveOrganization"]}");
            Session.Remove("ActiveOrganization");
            return(Content("ok"));
        }