public ActionResult Users()
        {
            DataAccessMgr    daMgr    = Global.GetDataAccessMgr(this.HttpContext);
            B1SampleEntities entities = new B1SampleEntities();
            var query = from a in entities.UserMasters
                        select new { a.UserCode, a.UserId, a.FirstName };
            DbCommand dbCmd = daMgr.BuildSelectDbCommand(query, null);

            return(PartialView("_Users", daMgr.ExecuteCollection <UserMaster>(dbCmd, null)));
        }
        public ActionResult UserEditForm(int userCode)
        {
            B1SampleEntities entities = new B1SampleEntities();
            DataAccessMgr    daMgr    = Global.GetDataAccessMgr(this.HttpContext);

            var query = from a in entities.UserMasters
                        where a.UserCode == userCode
                        select new { a.UserCode, a.UserId, a.FirstName };
            DbCommand dbCmd = daMgr.BuildSelectDbCommand(query, null);

            return(PartialView(Constants._Page_UserEdit, daMgr.ExecuteCollection <UserMaster>(dbCmd, null).First()));
        }
        public ActionResult EditProfile()
        {
            UserSession userSessionMgr = (UserSession)Session[SessionManagement.Constants.UserSessionMgr];

            if (userSessionMgr == null) // we were not signed on yet
            {
                return(RedirectToAction(Constants.SignOn, Constants.Account, Constants.Admin));
            }
            if (userSessionMgr.IsAccessAllowed(Constants.UIControlCode_AdminEditProfile_Code))
            {
                DataAccessMgr daMgr = Global.GetDataAccessMgr(this.HttpContext);
                DbCommand     dbCmd = UserMaster.GetUserMasterCmd(daMgr);
                dbCmd.Parameters[daMgr.BuildParamName(DataManagement.Constants.UserId)].Value = this.HttpContext.User.Identity.Name;
                EditProfileModel profileData = daMgr.ExecuteCollection <EditProfileModel>(dbCmd, null).First();
                return(View(Constants._Page_EditProfile, profileData));
            }
            ViewBag.Status = "Insufficient privileges for the action." + Request.Url;
            string referUrl = Request.QueryString[Constants.UrlReferrer];

            System.Web.Routing.RouteValueDictionary dictionary = new System.Web.Routing.RouteValueDictionary();
            dictionary.Add(Constants.UrlReferrer, referUrl);
            return(RedirectToAction(Constants.AccessDenied, Constants.Home, dictionary));
        }