コード例 #1
0
            public EventsResult(ElmcityController controller, CalendarRenderer cr, string id, string type, string view, string jsonp, string count, string from, string to, string eventsonly, string mobile, string test, string raw, string raw_sentinel, string style, string theme, string taglist, string tags, string template, string jsurl, string days, string bare_events, string hub, string source, string first)
            {
                this.controller      = controller;
                this.cr              = cr;
                this.cr.cache        = new ElmcityUtils.AspNetCache(controller.HttpContext.Cache);
                this.id              = id;
                this.type            = type;
                this.view            = view;
                this.jsonp           = jsonp;
                this.from            = from == null ? DateTime.MinValue : Utils.DateTimeFromISO8601DateStr(from, DateTimeKind.Local);
                this.to              = from == null ? DateTime.MinValue : Utils.DateTimeFromISO8601DateStr(to, DateTimeKind.Local);
                this.eventsonly      = String.IsNullOrEmpty(eventsonly) ? false : eventsonly.ToLower().StartsWith("y");
                this.mobile_declared = String.IsNullOrEmpty(mobile) ? false : mobile.ToLower().StartsWith("y");
                this.mobile_refused  = String.IsNullOrEmpty(mobile) ? false : mobile.ToLower().StartsWith("n");
                this.test            = String.IsNullOrEmpty(test) ? false : test.ToLower().StartsWith("y");
                this.raw             = String.IsNullOrEmpty(raw) ? false : raw.ToLower().StartsWith("y");
                this.raw_sentinel    = raw_sentinel;
                this.style           = style;
                this.theme           = theme;
                this.taglist         = String.IsNullOrEmpty(taglist) ? true : taglist.ToLower().StartsWith("y");
                this.tags            = String.IsNullOrEmpty(tags) ? false : tags.ToLower().StartsWith("y");
                this.template        = template;
                this.jsurl           = jsurl;
                this.bare_events     = String.IsNullOrEmpty(bare_events) ? false : bare_events.ToLower().StartsWith("y");
                this.hub             = hub;
                this.source          = source;

                try
                {
                    if (!String.IsNullOrEmpty(first))
                    {
                        this.first = Convert.ToInt32(first);
                    }
                    else
                    {
                        this.first = 0;
                    }
                }
                catch (Exception e)
                {
                    GenUtils.LogMsg("warning", "EventsResult: cannot convert first " + first, e.Message);
                }

                int _count = 0;

                try
                {
                    if ((type == "html") && (count != "0"))
                    {
                        _count = Convert.ToInt32(settings["max_html_events_default"]);
                    }
                    if (this.bare_events)
                    {
                        _count = 0;
                    }
                }
                catch (Exception e)
                {
                    GenUtils.PriorityLogMsg("exception", "EventsResult", e.Message);
                }

                this.count = (count == null) ? _count : Convert.ToInt32(count);

                if (!String.IsNullOrEmpty(days))
                {
                    try
                    {
                        this.days = Convert.ToInt32(days);
                        if (this.days > 0)
                        {
                            var calinfo = ElmcityApp.wrd.renderers[this.id].calinfo;
                            var from_to = Utils.ConvertDaysIntoFromTo(this.days, calinfo);
                            this.from = (DateTime)from_to["from_date"];
                            this.to   = (DateTime)from_to["to_date"];
                        }
                    }
                    catch (Exception e)
                    {
                        GenUtils.LogMsg("GetEvents", "days", e.Message);
                        this.days = 0;
                    }
                }
            }
コード例 #2
0
            public EventsResult(ElmcityController controller, CalendarRenderer cr, string id, string type, string view, string jsonp, string count, string from, string to, string eventsonly, string mobile, string test, string raw, string raw_sentinel, string style, string theme, string taglist)
            {
                this.controller = controller;
                this.cr = cr;
                this.cr.cache = new ElmcityUtils.AspNetCache(controller.HttpContext.Cache);
                this.id = id;
                this.type = type;
                this.view = view;
                this.jsonp = jsonp;
                this.from = from == null ? DateTime.MinValue : Utils.DateTimeFromISO8601DateStr(from, DateTimeKind.Local);
                this.to = from == null ? DateTime.MinValue : Utils.DateTimeFromISO8601DateStr(to, DateTimeKind.Local);
                this.eventsonly = eventsonly;
                this.mobile = !String.IsNullOrEmpty(mobile) ? mobile.ToLower() : "";
                this.test = !String.IsNullOrEmpty(test) && test.ToLower().StartsWith("y");
                this.raw = !String.IsNullOrEmpty(raw) && raw.ToLower().StartsWith("y");
                this.raw_sentinel = raw_sentinel;
                this.style = style;
                this.theme = theme;
                this.taglist = !String.IsNullOrEmpty(taglist) ? taglist.ToLower() : "";

                int _count = 0;
                try
                {
                    if ((type == "html") && (count != "0"))
                        _count = Convert.ToInt32(settings["max_html_events_default"]);
                    if (this.raw)
                        _count = 0;
                }
                catch (Exception e)
                {
                    GenUtils.PriorityLogMsg("exception", "EventsResult", e.Message);
                }

                this.count = (count == null) ? _count : Convert.ToInt32(count);
            }
コード例 #3
0
ファイル: ServicesController.cs プロジェクト: judell/elmcity
            public EventsResult(ElmcityController controller, CalendarRenderer cr, string id, string type, string view, string jsonp, string count, string from, string to, string eventsonly, string mobile, string test, string raw, string raw_sentinel, string style, string theme, string taglist, string tags, string template, string jsurl, string days, string bare_events, string hub, string source, string first)
            {
                this.controller = controller;
                this.cr = cr;
                this.cr.cache = new ElmcityUtils.AspNetCache(controller.HttpContext.Cache);
                this.id = id;
                this.type = type;
                this.view = view;
                this.jsonp = jsonp;
                this.from = from == null ? DateTime.MinValue : Utils.DateTimeFromISO8601DateStr(from, DateTimeKind.Local);
                this.to = from == null ? DateTime.MinValue : Utils.DateTimeFromISO8601DateStr(to, DateTimeKind.Local);
                this.eventsonly = String.IsNullOrEmpty(eventsonly) ? false : eventsonly.ToLower().StartsWith("y");
                this.mobile_declared = String.IsNullOrEmpty(mobile) ? false : mobile.ToLower().StartsWith("y");
                this.mobile_refused = String.IsNullOrEmpty(mobile) ? false : mobile.ToLower().StartsWith("n");
                this.test = String.IsNullOrEmpty(test) ? false : test.ToLower().StartsWith("y");
                this.raw = String.IsNullOrEmpty(raw) ? false : raw.ToLower().StartsWith("y");
                this.raw_sentinel = raw_sentinel;
                this.style = style;
                this.theme = theme;
                this.taglist = String.IsNullOrEmpty(taglist) ? true : taglist.ToLower().StartsWith("y");
                this.tags = String.IsNullOrEmpty(tags) ? false : tags.ToLower().StartsWith("y");
                this.template = template;
                this.jsurl = jsurl;
                this.bare_events = String.IsNullOrEmpty(bare_events) ? false : bare_events.ToLower().StartsWith("y");
                this.hub = hub;
                this.source = source;

                try
                {
                    if (!String.IsNullOrEmpty(first))
                        this.first = Convert.ToInt32(first);
                    else
                        this.first = 0;
                }
                catch (Exception e)
                {
                    GenUtils.LogMsg("warning", "EventsResult: cannot convert first " + first, e.Message);
                }

                int _count = 0;
                try
                {
                    if ((type == "html") && (count != "0"))
                        _count = Convert.ToInt32(settings["max_html_events_default"]);
                    if (this.bare_events)
                        _count = 0;
                }
                catch (Exception e)
                {
                    GenUtils.PriorityLogMsg("exception", "EventsResult", e.Message);
                }

                this.count = (count == null) ? _count : Convert.ToInt32(count);

                if (!String.IsNullOrEmpty(days))
                {
                    try
                    {
                        this.days = Convert.ToInt32(days);
                        if (this.days > 0)
                        {
                            var calinfo = ElmcityApp.wrd.renderers[this.id].calinfo;
                            var from_to = Utils.ConvertDaysIntoFromTo(this.days, calinfo);
                            this.from = (DateTime)from_to["from_date"];
                            this.to = (DateTime) from_to["to_date"];
                        }
                    }
                    catch (Exception e)
                    {
                        GenUtils.LogMsg("GetEvents", "days", e.Message);
                        this.days = 0;
                    }
                }
            }