Ejemplo n.º 1
0
        public static List <SortMainObject> GetMainData(ViewModeOptionEnum viewMode, int?orgMode, string orgOption)
        {
            var data = new List <SortMainObject>();

            orgMode = orgMode ?? 0;

            if (Config.User.IsInAnyRole("Admin,ReleaseOfficial,ReadAll"))
            {
                data = SortMainObject.GetAllSorts(viewMode);
            }
            else if (Config.User.IsInAnyRole("OrgManager"))
            {
                if (((OrgOptionEnum)orgMode) == OrgOptionEnum.OrgArtifacts)
                {
                    data = SortMainObject.GetSortForUserOrg(Config.User.EmployeeId, orgOption);
                }
                else
                {
                    data = SortMainObject.GetSortForUser(Config.User.EmployeeId);
                }
            }
            else
            {
                data = SortMainObject.GetSortForUser(Config.User.EmployeeId);
            }

            return(data);
        }
Ejemplo n.º 2
0
        public ActionResult Index()
        {
            HomeModel model = null;
            // check to see if there is a cookie
            var cookie = Request.Cookies[$"{Current.User.EmployeeId}_ViewMode"];

            if (cookie != null)
            {
                ViewModeOptionEnum viewMode = cookie.Value.ToEnum <ViewModeOptionEnum>();
                int    viewTime             = 12;
                int    orgMode   = 1;
                string orgOption = string.Empty;
                if (cookie.HasKeys)
                {
                    viewTime  = cookie.Values["viewTime"]?.ToInt() ?? 12;
                    viewMode  = cookie.Values["viewMode"].ToEnum <ViewModeOptionEnum>();
                    orgMode   = cookie.Values["orgMode"]?.ToInt() ?? 1;
                    orgOption = cookie.Values["orgOption"];
                }

                model = new HomeModel(viewMode, viewTime, orgMode, orgOption);
            }
            else
            {
                model = new HomeModel();
            }

            if (model.IsSmall)
            {
                return(View(Current.User.IsInAnyRole("Admin,ReleaseOfficial,GenericReleaseUser") ? "Manager" : (Current.User.IsInAnyRole("OrgManager") ? "OrgManager" : "Index"), model));
            }

            return(View(Current.User.IsInAnyRole("Admin,ReleaseOfficial,GenericReleaseUser") ? "ManagerLarge" : (Current.User.IsInAnyRole("OrgManager") ? "OrgManagerLarge" : "IndexLarge"), model));
        }
Ejemplo n.º 3
0
 public HomeModel(ViewModeOptionEnum viewMode, bool?showPublished, int?orgMode, string orgOption)
 {
     ViewMode      = viewMode;
     ShowPublished = showPublished ?? false;
     OrgMode       = orgMode ?? 0;
     OrgOption     = orgOption;
     HydrateData();
 }
Ejemplo n.º 4
0
 public HomeModel(ViewModeOptionEnum viewMode, int?viewTime, int?orgMode, string orgOption)
 {
     ViewMode  = viewMode;
     ViewTime  = viewTime ?? 12;
     OrgMode   = orgMode ?? 0;
     OrgOption = orgOption;
     HydrateData();
 }
Ejemplo n.º 5
0
        public ActionResult Index(ViewModeOptionEnum viewMode, bool showPublished, int?orgMode, string orgOption)
        {
            orgMode = orgMode ?? 1;
            var        view   = Config.User.IsInAnyRole("Admin,ReleaseOfficial,ReadAll") ? "Manager" : (Config.User.IsInAnyRole("OrgManager") ? "OrgManager" : "Index");
            HttpCookie cookie = new HttpCookie($"{UserObject.CurrentUser.EmployeeId}_ViewMode", viewMode.ToString());

            cookie.Values["ShowPublished"] = showPublished.ToString();
            cookie.Values["viewMode"]      = viewMode.ToString();
            cookie.Values["OrgMode"]       = orgMode.ToString();
            cookie.Values["orgOption"]     = orgOption;
            cookie.Expires = DateTime.Now.AddDays(1);
            Response.SetCookie(cookie);

            var model = new HomeModel(viewMode, showPublished, orgMode, orgOption);

            if (model.IsSmall)
            {
                return(View(Config.User.IsInAnyRole("Admin,ReleaseOfficial,ReadAll") ? "Manager" : (Config.User.IsInAnyRole("OrgManager") ? "OrgManager" : "Index"), model));
            }

            return(View(Config.User.IsInAnyRole("Admin,ReleaseOfficial,ReadAll") ? "ManagerLarge" : (Config.User.IsInAnyRole("OrgManager") ? "OrgManagerLarge" : "IndexLarge"), model));
        }
Ejemplo n.º 6
0
        public ActionResult Index(ViewModeOptionEnum viewMode, int?viewTime, int?orgMode, string orgOption)
        {
            viewTime = viewTime ?? 0;
            orgMode  = orgMode ?? 1;
            var cookie = new HttpCookie($"{Current.User.EmployeeId}_ViewMode", viewMode.ToString());

            cookie.Values["viewMode"]  = viewMode.ToString();
            cookie.Values["viewTime"]  = viewTime.ToString();
            cookie.Values["OrgMode"]   = orgMode.ToString();
            cookie.Values["orgOption"] = orgOption;
            cookie.Expires             = DateTime.Now.AddDays(1);
            Response.SetCookie(cookie);

            var model = new HomeModel(viewMode, viewTime, orgMode, orgOption);

            if (model.IsSmall)
            {
                return(View(Current.User.IsInAnyRole("Admin,ReleaseOfficial,GenericReleaseUser") ? "Manager" : (Current.User.IsInAnyRole("OrgManager") ? "OrgManager" : "Index"), model));
            }

            return(View(Current.User.IsInAnyRole("Admin,ReleaseOfficial,GenericReleaseUser") ? "ManagerLarge" : (Current.User.IsInAnyRole("OrgManager") ? "OrgManagerLarge" : "IndexLarge"), model));
        }
Ejemplo n.º 7
0
        public static List <MainObject> GetMainData(ViewModeOptionEnum viewMode, int?viewTime, int?orgMode, string orgOption)
        {
            var data = new List <MainObject>();

            viewTime = viewTime ?? 12;
            if (viewTime <= 0)
            {
                viewTime = 12;
            }
            if (viewTime > 360)
            {
                viewTime = 360;
            }
            orgMode = orgMode ?? 0;

            if (Current.User.IsInAnyRole("Admin,ReleaseOfficial,GenericReleaseUser"))
            {
                data = MainObject.GetAllMains(viewMode, viewTime.Value);
            }
            else if (Current.User.IsInAnyRole("OrgManager"))
            {
                if (((OrgOptionEnum)orgMode) == OrgOptionEnum.OrgArtifacts)
                {
                    data = MainObject.GetAllForOrg(viewMode, viewTime.Value, Current.User.EmployeeId, orgOption);
                }
                else
                {
                    data = MainObject.GetAllForUser(viewMode, viewTime.Value, Current.User.EmployeeId);
                }
            }
            else
            {
                data = MainObject.GetAllForUser(viewMode, viewTime.Value, Current.User.EmployeeId);
            }

            return(data);
        }
Ejemplo n.º 8
0
        public ActionResult Index()
        {
            var       view  = Config.User.IsInAnyRole("Admin,ReleaseOfficial,ReadAll") ? "Manager" : (Config.User.IsInAnyRole("OrgManager") ? "OrgManager" : "Index");
            HomeModel model = null;

            // check to see if there is a cookie
            var cookie = Request.Cookies[$"{UserObject.CurrentUser.EmployeeId}_ViewMode"];

            if (cookie != null)
            {
                ViewModeOptionEnum viewMode = cookie.Value.ToEnum <ViewModeOptionEnum>();
                bool?  showPublished        = null;
                int    orgMode   = 1;
                string orgOption = string.Empty;
                if (cookie.HasKeys)
                {
                    showPublished = cookie.Values["ShowPublished"]?.ToBool();
                    viewMode      = cookie.Values["viewMode"].ToEnum <ViewModeOptionEnum>();
                    orgMode       = cookie.Values["orgMode"]?.ToInt() ?? 1;
                    orgOption     = cookie.Values["orgOption"];
                }

                model = new HomeModel(viewMode, showPublished, orgMode, orgOption);
            }
            else
            {
                model = new HomeModel();
            }

            if (model.IsSmall)
            {
                return(View(Config.User.IsInAnyRole("Admin,ReleaseOfficial,ReadAll") ? "Manager" : (Config.User.IsInAnyRole("OrgManager") ? "OrgManager" : "Index"), model));
            }

            return(View(Config.User.IsInAnyRole("Admin,ReleaseOfficial,ReadAll") ? "ManagerLarge" : (Config.User.IsInAnyRole("OrgManager") ? "OrgManagerLarge" : "IndexLarge"), model));
        }
Ejemplo n.º 9
0
 public JsonResult HomGridData(GridDataRequestObject <SortMainObject> req, ViewModeOptionEnum viewMode, int?orgMode, string orgOption)
 {
     return(Json(req.GetResult(HomeModel.GetMainData(viewMode, orgMode, orgOption))));
 }