Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            int    weekNumber = int.Parse(context.Request["weekNumber"]);
            String shiftName  = context.Request["shiftName"];

            SwarmProfileDataset swarmTeams = context.Application["SwarmProfileDataset"] as SwarmProfileDataset;
            RosterDataset       shift      = context.Application["RosterDataset"] as RosterDataset;

            if (shift.Rosters.Where(s => s.ShiftName == shiftName && s.Weeks.Keys.Contains(weekNumber)).Count() > 0)
            {
                Roster        targetRoster      = shift.Rosters.Where(s => s.ShiftName == shiftName && s.Weeks.Keys.Contains(weekNumber)).FirstOrDefault();
                List <string> resourcesForShift = new List <string>();

                foreach (int empId in targetRoster.Weeks[weekNumber])
                {
                    if (swarmTeams.Profiles.Where(p => p.EmpNumber == empId).Count() > 0)
                    {
                        SwarmProfile match = swarmTeams.Profiles.Where(p => p.EmpNumber == empId).FirstOrDefault();
                        resourcesForShift.Add(match.Name + @"/" + match.EmpNumber);
                    }
                }

                JavaScriptSerializer serializer = new JavaScriptSerializer();
                context.Response.ContentType = "text/plain";
                context.Response.Write(serializer.Serialize(resourcesForShift));
            }
        }
Exemplo n.º 2
0
        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // Init DataSets
            Application["IssueDataset"]        = new IssueDataset();
            Application["SwarmProfileDataset"] = new SwarmProfileDataset();
            Application["RosterDataset"]       = new RosterDataset();
        }
Exemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            int    empId     = int.Parse(context.Request["empId"]);
            int    weekNo    = int.Parse(context.Request["weekNo"]);
            String shiftName = "";

            RosterDataset shifts = context.Application["RosterDataset"] as RosterDataset;

            if (shifts.Rosters.Where(p => p.Weeks.ContainsKey(weekNo) && p.Weeks[weekNo].Contains(empId)).Count() > 0)
            {
                shiftName = shifts.Rosters.Where(p => p.Weeks.ContainsKey(weekNo) && p.Weeks[weekNo].Contains(empId)).FirstOrDefault().ShiftName;
            }

            context.Response.ContentType = "text/plain";
            context.Response.Write(shiftName);
        }