Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            var stackID = context.Request["stackID"];

            var service = new com.dailyez.Service();
            var stack = service.GetStack(int.Parse(stackID));

            context.Response.Write(stack.Height);
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";

            var stacks = (string)context.Request["stacks"];
            var title = context.Request["title"];
            var sWidgetID = context.Request["widgetID"];
            _buttonClass = context.Request["buttonColor"];

            var widgetID = 1;

            int.TryParse(sWidgetID, out widgetID);

            if (widgetID == 0)
                widgetID = 1;

            if (stacks == null)
                return;
            string[] iStacks = stacks.Split(new char[] { ',' });
            var service = new com.dailyez.Service();

            var stacksList = new List<com.dailyez.Stack>();
            foreach (var s in iStacks)
            {
                var stackID = 0;
                int.TryParse(s, out stackID);
                if (stackID > 0)
                {
                    stacksList.Add(service.GetStack(stackID));
                }
            }

            var reader = new StreamReader(new FileStream(System.Web.HttpContext.Current.Server.MapPath("stackSelectorTemplate.html"), FileMode.Open, FileAccess.Read, FileShare.Read));
            var template = reader.ReadToEnd();
            reader.Close();

            template = template.Replace("[%STACKS%]", GetStacksHtml(stacksList));
            template = template.Replace("[%TITLE%]", title);
            template = template.Replace("[%WIDGET-ID%]", widgetID + "");
            template = template.Replace("[%BUTTON-CLASS%]", _buttonClass);

            context.Response.Write(template);
        }