Ejemplo n.º 1
0
        public JsonResult AddUpdatePageUser(LP_PageUser_Property objpageuser)
        {
            try
            {
                int userid = Convert.ToInt16(Session["UID"].ToString());
                List <LP_PageUser_Property> pageserlist = new List <LP_PageUser_Property>();

                //DBClass.db.Database.ExecuteSqlCommand("Delete from PageUsers where UserID={0}", timeline.UserID);
                //DBClass.db.SaveChanges();
                for (int i = 0; i < objpageuser.PageList.Count; i++)
                {
                    LP_PageUser_Property objpguser = new LP_PageUser_Property();
                    objpguser.UserID      = objpageuser.UserID;
                    objpguser.PageID      = objpageuser.PageList[i].ID;
                    objpguser.CreatedDate = DateTime.Now;
                    objpguser.status      = true;
                    objpguser.CreatedBy   = userid;
                    pageserlist.Add(objpguser);
                }
                objpageuser.DetailData = Helper.ToDataTable <LP_PageUser_Property>(pageserlist);
                objUserBll             = new User_BLL();
                bool flag = objUserBll.UpdatePageUser(objpageuser);


                return(Json(new { success = flag, statuscode = 200, url = "/Account/PageUser" }, JsonRequestBehavior.AllowGet));
            }

            catch (Exception ex)
            {
                return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 2
0
        public ActionResult PageUser()
        {
            string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
            string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            string pagename       = @"/" + controllerName + @"/" + actionName;
            var    page           = (List <LP_Pages_Property>)Session["PageList"];

            if (Session["LoggedIn"] != null && Helper.CheckPageAccess(pagename, page) && Session["ISADMIN"] != null && Convert.ToBoolean(Session["ISADMIN"].ToString()) == true)
            // if (Session["LOGGEDIN"] != null)

            {
                LP_PageUser_Property objpage = new LP_PageUser_Property();
                objUserBll       = new User_BLL();
                objpage.PageList = Helper.ConvertDataTable <LP_Pages_Property>(objUserBll.GetAllPages());



                User_Property objUserProperty = new User_Property();
                objUserProperty.branchIdx = 1;//user logged in session branchIdx
                User_BLL objUser = new User_BLL(objUserProperty);
                var      Data    = JsonConvert.SerializeObject(objUser.ViewAll());

                objpage.UserList = Helper.ConvertDataTable <User_Property>(objUser.ViewAll());
                ViewBag.Pagelist = objpage.PageList;
                return(View(objpage));
            }
            else
            {
                if (Session["LoggedIn"] == null)
                {
                    return(RedirectToAction("Login", "Account"));
                }
                else
                {
                    return(RedirectToAction("NotAuthorized", "Account"));
                }
            }
        }