public JsonResult GetUsers(string prefix)
        {
            BL_RolesRights co = new BL_RolesRights();

            connect();
            List <UserRights> usersRight = new List <UserRights>();

            try
            {
                DataSet    ds  = new DataSet();
                SqlCommand cmd = new SqlCommand("select upper(LoginName) as LoginName,upper(FullName) as FullName,UserID from Users where LoginName like '" + prefix + "%' and RowStatus = 0", con);

                con.Open();
                SqlDataAdapter ad = new SqlDataAdapter();
                ad.SelectCommand = cmd;
                ad.Fill(ds);
                foreach (DataRow rdr in ds.Tables[0].Rows)
                {
                    UserRights user = new UserRights();
                    user.UserID    = Convert.ToInt32(rdr["UserID"]);
                    user.LoginName = rdr["LoginName"].ToString();
                    user.FullName  = rdr["FullName"].ToString();
                    usersRight.Add(user);
                }
                con.Close();
            }
            catch (Exception ex)
            {
                con.Close();
                ex.ToString();
            }
            return(new JsonResult {
                Data = usersRight, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public ActionResult EditRoleRightsLevel2(int RoleID)
        {
            List <RolesRights> SerchAdd  = new List <Models.Keystone.RolesRights>();
            List <RolesRights> objSearch = new List <Models.Keystone.RolesRights>();
            BL_RolesRights     BLobj     = new BL_RolesRights();
            RolesRights        obj       = new RolesRights();

            if (RoleID > 0)
            {
                obj.GetRights = RolesRights.GetRoleAndRightsByRoleID(RoleID);
                obj.RoleID    = obj.GetRights.Tables[0].Rows[0]["RoleID"].ToString();
                obj.RoleName  = obj.GetRights.Tables[0].Rows[0]["RoleName"].ToString();
                foreach (DataRow dr in obj.GetRights.Tables[0].Rows)
                {
                    SerchAdd.Add(new RolesRights
                    {
                        ModuleIDchk = Convert.ToInt32(dr["ModuleIDchk"]),
                        ModuleID    = Convert.ToInt32(dr["ModuleID"]),
                        // ModuleName = dr["ModuleName"].ToString(),
                        RightCode = Convert.ToInt32(dr["RightCode"])
                                    //=obj.GetRights.Tables[0].Rows[0]["ModuleID"].ToString();
                    });
                }
            }
            return(new JsonResult {
                Data = SerchAdd, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Пример #3
0
        public ActionResult RoleRightstwo(int RoleID)
        {
            BL_RolesRights BLobj = new BL_RolesRights();
            RolesRights    obj   = new RolesRights();

            ModelState.Clear();
            obj.GetRoleAndRights = BLobj.GetRoleAndRights();
            obj.GetRoles         = RolesRights.GetAllRols();

            return(View(obj));
        }
        public ActionResult UserRights()
        {
            //HospitalLocation Location = new HospitalLocation();
            //collection
            //return View();
            UserRights location = new UserRights();


            BL_RolesRights BLobj = new BL_RolesRights();
            RolesRights    obj   = new RolesRights();

            ModelState.Clear();
            obj.GetRoleAndRights = BLobj.GetRoleAndRights();
            obj.GetRoles         = BLobj.GetAllRols();

            return(View(obj));
        }
Пример #5
0
        public ActionResult RoleRightsLevel2(int Level1ModuleID)
        {
            List <RolesRights> objSearch = new List <Models.Keystone.RolesRights>();
            BL_RolesRights     BLobj     = new BL_RolesRights();
            RolesRights        obj       = new RolesRights();

            ModelState.Clear();
            obj.GetRoleAndRights = BLobj.GetRoleAndRights();
            DataView dataView3 = new DataView(obj.GetRoleAndRights.Tables[0], " ParentModuleID = " + Level1ModuleID + "", "", DataViewRowState.CurrentRows);

            foreach (DataRow dr in dataView3.ToTable().Rows)
            {
                objSearch.Add(new RolesRights {
                    ModuleID   = Convert.ToInt32(dr["ModuleID"]),
                    ModuleName = dr["ModuleName"].ToString(),
                });
            }
            return(new JsonResult {
                Data = objSearch, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        //
        // GET: /RoleRightstwo/
        public ActionResult RoleRightstwo(int RoleID)
        {
            BL_RolesRights BLobj = new BL_RolesRights();
            RolesRights    obj   = new RolesRights();

            ModelState.Clear();
            obj.GetRoleAndRights = BLobj.GetRoleAndRights();
            obj.GetRoles         = RolesRights.GetAllRols();
            if (RoleID > 0)
            {
                obj.GetRights = RolesRights.GetRoleAndRightsByRoleID(RoleID);
                obj.RoleID    = obj.GetRights.Tables[0].Rows[0]["RoleID"].ToString();
                obj.RoleName  = obj.GetRights.Tables[0].Rows[0]["RoleName"].ToString();
            }
            else
            {
                //  obj.RoleName = "";
                //  obj.RoleID = "0";
            }
            return(View(obj));
        }