Example #1
0
        public ActionResult Index(int?Type)
        {
            var            defaultPageSize = 5;
            int?           page            = 1;
            List <Batches> batches         = new List <Batches>();

            if (Session["UserId"] != null)
            {
                int UserId = Convert.ToInt32(Session["UserId"]);
                View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId));
                switch (Convert.ToInt32(Userdetails.RoleId))
                {
                case 1:
                    batches.Add(new Batches {
                        Batch = UtilitiesClass.BatchVisibleToAll, BatchName = UtilitiesClass.BatchVisibleToAll
                    });
                    batches.Add(new Batches {
                        Batch = Convert.ToString(Userdetails.Batch), BatchName = UtilitiesClass.BatchName
                    });
                    break;

                case 2:
                    batches.Add(new Batches {
                        Batch = UtilitiesClass.BatchVisibleToAll, BatchName = UtilitiesClass.BatchVisibleToAll
                    });
                    batches.Add(new Batches {
                        Batch = Convert.ToString(Userdetails.Batch), BatchName = UtilitiesClass.BatchName
                    });
                    break;
                }
                if (Userdetails.RoleId == "4")
                {
                }
                WhiteBoardModel WhiteBoard = new WhiteBoardModel()
                {
                    Viewdetails = batches,
                    RoleId      = Userdetails.RoleId,
                    Batch       = Userdetails.Batch,
                    Stream      = Userdetails.CourseName,
                    Events      = EventCategoryService.GetCategorys()
                };

                if (Type == 1)
                {
                    if ((Userdetails.RoleId == Convert.ToString(1) && Userdetails.Batch == Userdetails.Batch) || (Userdetails.RoleId == Convert.ToString(1) && Convert.ToString(Userdetails.Batch) == UtilitiesClass.BatchVisibleToAll))
                    {
                        ViewBag.Userdata = GenericMethods.GetUserDataserach(UserId, Convert.ToString(Userdetails.Batch), Convert.ToInt32(Userdetails.Years), Userdetails.CourseCategoryName, Type);
                    }
                }
                else if (Type == 2)
                {
                    if ((Userdetails.RoleId == Convert.ToString(1) && Userdetails.Batch == Userdetails.Batch) || (Userdetails.RoleId == Convert.ToString(1) && Convert.ToString(Userdetails.Batch) == UtilitiesClass.BatchVisibleToAll))
                    {
                        ViewBag.Userdata = GenericMethods.GetUserDataserach(UserId, Convert.ToString(Userdetails.Batch), Convert.ToInt32(Userdetails.Years), Userdetails.CourseCategoryName, Type);
                    }
                }
                else
                {
                    if ((Userdetails.RoleId == Convert.ToString(1) && Userdetails.Batch == Userdetails.Batch) || (Userdetails.RoleId == Convert.ToString(1) && Convert.ToString(Userdetails.Batch) == UtilitiesClass.BatchVisibleToAll))
                    {
                        ViewBag.Userdata = GenericMethods.GetUserPostsonId(UserId, Convert.ToString(Userdetails.Batch), Convert.ToInt32(Userdetails.Years), Userdetails.CourseCategoryName, page, defaultPageSize);
                    }
                }

                return(View(WhiteBoard));
            }
            return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" }));
        }