public UserGroupRolesPlaceHolder GetRoles(Guid goupid)
        {
            MakeplaceHolder(goupid);
          UserGroupRolesPlaceHolder place = new UserGroupRolesPlaceHolder(); /* 
            List<UserGroupRolesView> list = _userGroupRolesRepository.GetByGroup(goupid)
                .Select(p => new UserGroupRolesView
                                 {
                                     Id = p.Id,
                                     RoleId = (int) p.UserRole,
                                     Checked=p.CanAccess,
                                     RoleName=p.UserRole.ToString()
                                 })
                                 .ToList();*/
            var roles = _userGroupRolesRepository.GetByGroup(goupid);
            UserGroup group = _userGroupRepository.GetById(goupid);
            List<UserGroupRolesView> rolelList = new List<UserGroupRolesView>();
            foreach (var val in RolesHelper.GetRoles())
            {
                

                Guid id = Guid.NewGuid();
                bool canAcess = false;
                if (roles.Any(a => a.UserGroup.Id == group.Id && a.UserRole == val.Id))
                {
                    UserGroupRoles xrole = roles.First(a => a.UserGroup.Id == group.Id && a.UserRole == val.Id);
                    id = xrole.Id;
                    canAcess = xrole.CanAccess;
                }
                UserGroupRolesView r = new UserGroupRolesView()
                {
                   
                     Id = id,
                                     RoleId = val.Id,
                                     Checked=canAcess,
                                     RoleName=val.ToString()
                    
                };
                rolelList.Add(r);
            }
          
            place.GroupId = goupid;
            place.Rows = rolelList;
            place.GroupName = group.Name;
            return place;
        }
        public UserGroupRolesPlaceHolder GetAgriUserRoles(Guid goupid)
        {
            MakeAgriPlaceHolder(goupid);
            UserGroupRolesPlaceHolder place = new UserGroupRolesPlaceHolder();  
            var roles = _userGroupRolesRepository.GetByAgriGroup(goupid);
            UserGroup group = _userGroupRepository.GetById(goupid);
            List<UserGroupRolesView> rolelList = new List<UserGroupRolesView>();
            foreach (AgriUserRole val in Enum.GetValues(typeof(AgriUserRole)))
            {


                Guid id = Guid.NewGuid();
                bool canAcess = false;
                if (roles.Any(a => a.UserGroup.Id == group.Id && a.UserRole == val))
                {
                    AgriUserGroupRoles xrole = roles.First(a => a.UserGroup.Id == group.Id && a.UserRole == val);
                    id = xrole.Id;
                    canAcess = xrole.CanAccess;
                }
                UserGroupRolesView r = new UserGroupRolesView()
                {

                    Id = id,
                    RoleId = (int)val,
                    Checked = canAcess,
                    RoleName = val.ToString()

                };
                rolelList.Add(r);
            }

            place.GroupId = goupid;
            place.Rows = rolelList;
            place.GroupName = group.Name;
            return place;
        }