コード例 #1
0
        public ActionResult Lookups(string id)
        {
            var ret = AuthenticateDeveloper();

            if (ret.StartsWith("!"))
            {
                return(Content($"<Lookups error=\"{ret.Substring(1)}\" />"));
            }

            if (!id.HasValue())
            {
                return(Content("Lookups error=\"not found\">"));
            }

            var q = CurrentDatabase.ExecuteQuery <LookupController.Row>("select * from lookup." + id);
            var w = new APIWriter();

            w.Start("Lookups");
            w.Attr("name", id);
            foreach (var i in q)
            {
                w.Start("Lookup");
                w.Attr("Id", i.Id);
                w.AddText(i.Description);
                w.End();
            }
            w.End();
            DbUtil.LogActivity("APIMeta Lookups");
            return(Content(w.ToString(), "text/xml"));
        }
コード例 #2
0
        public ActionResult Index()
        {
            var involvementTypes = CurrentDatabase.ExecuteQuery <InvolvementTabModel.OrgType>("select * from lookup.OrganizationType");

            var model = new CustomizeInvolvementModel(involvementTypes);

            model.Current.ReadXml(CurrentDatabase.Contents.SingleOrDefault(c => c.Name == model.Current.Name)?.Body ?? Resource1.InvolvementTableCurrent);
            model.Pending.ReadXml(CurrentDatabase.Contents.SingleOrDefault(c => c.Name == model.Pending.Name)?.Body ?? Resource1.InvolvementTablePending);
            model.Previous.ReadXml(CurrentDatabase.Contents.SingleOrDefault(c => c.Name == model.Previous.Name)?.Body ?? Resource1.InvolvementTablePrevious);

            return(View(model));
        }
コード例 #3
0
        public ActionResult Create(int?id, string type)
        {
            if (id.HasValue)
            {
                var q = CurrentDatabase.ExecuteQuery <Row>("select * from lookup." + type + " where id = {0}", id);
                if (!q.Any())
                {
                    CurrentDatabase.ExecuteCommand("insert lookup." + type + " (id, code, description) values ({0}, '', '')", id);
                }
            }

            return(Redirect($"/Lookup/{type}/#{id}"));
        }
コード例 #4
0
        public ActionResult Index(string id)
        {
            if (!id.HasValue())
            {
                ViewData["MeetingCategories"] = CurrentDatabase.Setting("AttendanceUseMeetingCategory", false);
                return(View("list"));
            }

            if (!User.IsInRole("Admin") && string.Compare(id, "funds", ignoreCase: true) != 0)
            {
                return(Content("must be admin"));
            }

            ViewData["type"]        = id;
            ViewData["description"] = Regex.Replace(id, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ");
            var q = CurrentDatabase.ExecuteQuery <Row>("select * from lookup." + id);

            // hide the add button on appropriate views.
            switch (id)
            {
            case "AddressType":
            case "EnvelopeOption":
            case "OrganizationStatus":
            case "BundleStatusTypes":
            case "ContributionStatus":
                ViewData["HideAdd"] = true;
                break;

            case "Gender":
                if (!CurrentDatabase.Setting("AllowNewGenders"))
                {
                    ViewData["HideAdd"] = true;
                }

                break;

            case "OrganizationType":
                ViewData["LinkValue"] = "/Involvement/Index";
                ViewData["LinkText"]  = "Involvement Tab Editor";
                break;
            }

            return(View(q));
        }