Пример #1
0
        public ActionResult Menu()
        {
            if (MissingEmployeeID) return RedirectToLogin();

            Tracker tracker = new Tracker(ViewBag.EmployeeID);
            return View(tracker);
        }
Пример #2
0
        public ActionResult Menu(Tracker tracker)
        {
            if (MissingEmployeeID) return RedirectToLogin();

            if (!ModelState.IsValid || !tracker.IsValid)
            {
                return View(tracker);
            }

            string selection = tracker.SelectedPeriod;
            if (selection.IndexOf(' ') != -1)
            {
                return RedirectToAction("SelectGroup", new { EmployeeID = ViewBag.EmployeeID, CCApp = ViewBag.CCApp, Period = tracker.SelectedPeriod });
            }

            return View(tracker);
        }
Пример #3
0
        public ActionResult SelectGroup(string period, bool? showPTM, int? level, string areaName, string lowerArea)
        {
            if (MissingEmployeeID) return RedirectToLogin();

            Tracker tracker = new Tracker(ViewBag.EmployeeID);

            //if (level == 4 && !string.IsNullOrWhiteSpace(areaName))
            //{
            //    if (areaName.IndexOf("Region") < 0)
            //    {
            //        areaName += " Region";
            //    }
            //}

            if (!string.IsNullOrEmpty(lowerArea) && level.HasValue)
            {
                if (((ReportingScope)level.Value) != ReportingScope.Company)
                {
                    //Find the parent area.
                    tracker.AreaName = tracker.ParentAreaOf(lowerArea, (ReportingScope)level.Value);
                }
            }

            if (level.HasValue)
            {
                if (level.Value > (int)tracker.MaxScope)
                {
                    return RedirectToAction("Menu", new { EmployeeID = ViewBag.EmployeeID, CCApp = ViewBag.CCApp });
                }
                tracker.CurrentScope = (ReportingScope)level.Value;
                if (!string.IsNullOrEmpty(areaName))
                {
                    if (tracker.CurrentScope == ReportingScope.Region)
                    {
                        areaName = areaName + " Region";
                    }
                    tracker.AreaName = areaName;
                }
            }
            else if (tracker.Employee != null)
            {
                ReportingScope currentScope;
                object tempAreaName = tracker.Employee.Area.EffectiveAreaNameAndScope(out currentScope);
                if (tempAreaName != null)
                {
                    tracker.AreaName = tempAreaName.ToString();
                }
                tracker.CurrentScope = currentScope;
            }
            else if (!string.IsNullOrEmpty(areaName))
            {
                tracker.AreaName = areaName;
            }

            tracker.SelectedPeriod = period;

            if (showPTM.HasValue)
            {
                tracker.ShowPTM = showPTM.Value ? "Part-time" : "Full-time";
            }

            if (tracker.CurrentScope == ReportingScope.District)
            {
                return View("ViewDistrict", tracker);
            }
            else
            {
                return View(tracker);
            }
        }