Пример #1
0
        public void ProcessRequest(HttpContext context)
        {
            if (context.Request.RequestType == "PUT")
            {
                string retJSON = string.Empty;
                using (StreamReader sr = new StreamReader(context.Request.InputStream))
                {
                    retJSON = sr.ReadToEnd();
                    sr.Close();
                    sr.Dispose();
                }

                //process the JSON
                List<vw_Assignment_Allocation> allocations = (List<vw_Assignment_Allocation>) new JavaScriptSerializer().Deserialize(retJSON, typeof(List<vw_Assignment_Allocation>));

                Regex rex = new Regex(@"^C\d{2}_\d{2}_\d{4}$");

                AllocationEntities ae = new AllocationEntities();
                foreach (vw_Assignment_Allocation allocation in allocations)
                {
                    foreach (var prop in allocation.GetType().GetProperties())
                    {
                        //allocation.C06_17_2016
                        Match m = rex.Match(prop.Name);
                        if(m.Success)
                            ae.upds_Assignment_Allocation_Update(null, allocation.Assignment_ID, GetDate(prop.Name), (double)prop.GetValue(allocation));
                    }

                }
            }

            context.Response.ContentType = "application/json";
            context.Response.Write("{\"status\":\"ok\"}");
        }
Пример #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";

            AllocationEntities ae = new AllocationEntities();
            string json = new JavaScriptSerializer().Serialize(ae.Resources.OrderBy(o => o.Resource_Name));
            context.Response.Write(json);
        }
Пример #3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";

            AllocationEntities ae = new AllocationEntities();
            string json = new JavaScriptSerializer().Serialize(ae.WeekEnding.AsQueryable().Where(o => o.Week_Ending > DateTime.Today).OrderBy(o => o.Week_Ending_Text));

            context.Response.Write(json);
        }
Пример #4
0
        public void ProcessRequest(HttpContext context)
        {
            string resource = context.Request.QueryString.Get(0);
            context.Response.ContentType = "application/json";

            AllocationEntities ae = new AllocationEntities();
            var query = ae.vw_Assignment_Allocation.AsQueryable().Where(o => o.Developer == resource);
            string json = new JavaScriptSerializer().Serialize(query);
            context.Response.Write(json);
        }