public ActionResult RoleRightstwo(FormCollection formCollection)
        {
            RolesRightModel.RoleName = formCollection["RoleName"];
            RolesRightModel.RoleID   = formCollection["RoleID"];
            String parentLevel  = formCollection["parentLevel"];
            String parentLevel1 = formCollection["parentLevel1"];
            String parentLevel2 = formCollection["parentLevel2"];
            String parentLevel3 = formCollection["parentLevel3"];
            String parentLevel4 = formCollection["parentLevel4"];

            if (formCollection["parentLevel"] != null)
            {
                String[] ParentModuleID = parentLevel.Split(',');
                right.ParentLevel0ID = ParentModuleID;
            }


            if (formCollection["parentLevel1"] != null)
            {
                String[] ModuleID = parentLevel1.Split(',');
                right.ParentLevel1ID = ModuleID;
            }

            if (formCollection["parentLevel2"] != null)
            {
                String[] ChildModuleID = parentLevel2.Split(',');
                right.ParentLevel2ID = ChildModuleID;
            }
            if (formCollection["parentLevel3"] != null)
            {
                String[] SubChildModuleID = parentLevel3.Split(',');
                right.ParentLevel3ID = SubChildModuleID;
            }
            if (formCollection["parentLevel4"] != null)
            {
                String[] RightID = parentLevel4.Split(',');
                right.ParentLevel4ID = RightID;
            }
            if (formCollection["beforAfterchk"] != null)
            {
                String[] RightID = formCollection["beforAfterchk"].Split(',');
                right.beforAfterchk = RightID;
            }
            right.OLDRightID = null;
            if (RolesRights.addRolesRight(RolesRightModel, right) == true)
            {
                RolesRightModel.GetRoleAndRights = RolesRights.GetRoleAndRights();
                RolesRightModel.GetRoles         = RolesRights.GetAllRols();
                return(RoleRightstwo(Convert.ToInt32(RolesRightModel.RoleID)));
            }
            else
            {
                RolesRightModel.GetRoleAndRights = RolesRights.GetRoleAndRights();
                RolesRightModel.GetRoles         = RolesRights.GetAllRols();
                return(RoleRightstwo(Convert.ToInt32(RolesRightModel.RoleID)));
            }
        }
Exemple #2
0
        public ActionResult RoleRightstwo(FormCollection formCollection)
        {
            RolesRightModel.RoleName = formCollection["RoleName"];
            RolesRightModel.RoleID   = formCollection["RoleID"];
            String parentLevel  = formCollection["parentLevel"];
            String parentLevel1 = formCollection["parentLevel1"];
            String parentLevel2 = formCollection["parentLevel2"];
            String parentLevel3 = formCollection["parentLevel3"];
            String parentLevel4 = formCollection["parentLevel4"];

            if (formCollection["parentLevel"] != null)
            {
                String[] ParentModuleID = parentLevel.Split(',');
                right.ParentLevel0ID = ParentModuleID;
            }


            if (formCollection["parentLevel1"] != null)
            {
                String[] ModuleID = parentLevel1.Split(',');
                right.ParentLevel1ID = ModuleID;
            }

            if (formCollection["parentLevel2"] != null)
            {
                String[] ChildModuleID = parentLevel2.Split(',');
                right.ParentLevel2ID = ChildModuleID;
            }
            if (formCollection["parentLevel3"] != null)
            {
                String[] SubChildModuleID = parentLevel3.Split(',');
                right.ParentLevel3ID = SubChildModuleID;
            }
            if (formCollection["parentLevel4"] != null)
            {
                String[] RightID = parentLevel4.Split(',');
                right.ParentLevel4ID = RightID;
            }

            right.OLDRightID = null;
            if (RolesRights.addRolesRight(RolesRightModel, right) == true)
            {
                return(RedirectToAction("AddRolesRight", "RolesRight"));
            }
            else
            {
                RolesRightModel.GetRoleAndRights = RolesRights.GetRoleAndRights();
                return(View(RolesRightModel));
            }

            return(View());
        }
Exemple #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));
        }
Exemple #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));
        }
        public ActionResult UserRights(FormCollection formCollection)
        {
            //int columncount = Request.Form.Count;
            //int[] rowscount = new int[columncount];
            //for (int a = 0; a < columncount; a++)
            //{
            //     rowscount[a] = Request.Form[a].Split(',').Length;

            //}



            Rights right = new Rights();

            rolesRightModel.RoleName = formCollection["RoleName"];
            rolesRightModel.RoleID   = formCollection["RoleID"];
            usersRight.UserID        = Convert.ToInt32(formCollection["UserID"]);
            BLUsersRight.GetUserRightPassword(usersRight.UserID);
            EditUserRight(usersRight.UserID.ToString());
            usersRight.HospitalID = Convert.ToInt32(formCollection["HospitalName"]);
            usersRight.LocationID = Convert.ToInt32(formCollection["LocationName"]);



            //String parentLevel = formCollection["parentLevel"];
            String parentLevel  = formCollection["parentLevel4Parent"];
            String parentLevel1 = formCollection["parentLevel1"];
            String parentLevel2 = formCollection["parentLevel2"];
            String parentLevel3 = formCollection["parentLevel3"];
            String parentLevel4 = formCollection["parentLevel4"];
            int    length       = 0;
            int    Number       = 0;

            if (right.OLDRightID == null)
            {
                length = 0;
            }
            else
            {
                length = right.OLDRightID.Length;
            }

            if (formCollection["parentLevel4Parent"] != null)
            {
                String[] ParentModuleID = parentLevel.Split(',');
                right.ParentLevel0ID = ParentModuleID;
            }
            if (formCollection["parentLevel1"] != null)
            {
                String[] ModuleID = parentLevel1.Split(',');
                right.ParentLevel1ID = ModuleID;
            }
            if (formCollection["parentLevel2"] != null)
            {
                String[] ChildModuleID = parentLevel2.Split(',');
                right.ParentLevel2ID = ChildModuleID;
            }
            if (formCollection["parentLevel3"] != null)
            {
                String[] SubChildModuleID = parentLevel3.Split(',');
                right.ParentLevel3ID = SubChildModuleID;
            }
            if (formCollection["parentLevel4"] != null)
            {
                String[] RightID = parentLevel4.Split(',');
                right.ParentLevel4ID = RightID;
            }
            //   right.ParentLevel0ID = ParentModuleID;
            //right.ParentLevel1ID = ModuleID;
            //right.ParentLevel2ID = ChildModuleID;
            // right.ParentLevel3ID = SubChildModuleID;
            // right.ParentLevel4ID = RightID;


            for (int m = 0; m < right.ParentLevel4ID.Length; m++)
            {
                // right.ParentLevel1ID = right.ParentLevel4ID.Except(right.OLDRightID).ToArray();

                string[] parentwithIDs = right.ParentLevel4ID[m].Split('+');
                usersRight.Mode = "Add";
                BLUsersRight.add(usersRight, parentwithIDs, Number);
            }

            //if (RolesRights.addRolesRight(rolesRightModel, right) == true)
            //{
            //    return RedirectToAction("AddRolesRight", "RolesRight");
            //}

            //if (BLUsersRight.adduserRight(usersRight) == true)
            //{

            //else
            //{
            rolesRightModel.GetRoleAndRights = RolesRights.GetRoleAndRights();
            return(View(rolesRightModel));
            //}
        }