/// <summary>
        /// Get Users with their roles from databse.
        /// </summary>
        /// <returns>Type of object list.</returns>
        public List <AssignRoleEntity> UsersWithRolesList()
        {
            List <AssignRoleEntity> objUsersWithRoleList = new List <AssignRoleEntity>();

            try
            {
                using (mFrameworkDbContext objmFrameworkDbContext = new mFrameworkDbContext())
                {
                    objUsersWithRoleList = (from a in objmFrameworkDbContext.roleuserdtl
                                            join b in objmFrameworkDbContext.rolemaster on a.RoleId equals b.RoleId
                                            join c in objmFrameworkDbContext.usermaster on a.UserId equals c.UserId
                                            where c.IsActive == true
                                            select new AssignRoleEntity
                    {
                        RoleUserId = (int)a.RoleUserId,
                        RoleId = (int)a.RoleId,
                        UserId = (int)a.UserId,
                        UserName = c.UserName,
                        RoleName = b.RoleName
                    }).ToList();
                }
            }
            catch
            {
                throw;
            }
            return(objUsersWithRoleList);
        }
        public List <AccessRightsEntity> SearchAssignRoles()
        {
            try
            {
                using (mFrameworkDbContext objmFrameworkDbContext = new mFrameworkDbContext())
                {
                    AccessControlListEntity   objAccessControl = new AccessControlListEntity();
                    List <AccessRightsEntity> AccessRightsList = new List <AccessRightsEntity>();

                    List <ScreenMaster> ScreenMasterList = (from SM in objmFrameworkDbContext.screenmaster
                                                            select SM).ToList();

                    AccessRightsList = (from RM in objmFrameworkDbContext.rolemaster
                                        select new AccessRightsEntity {
                        RoleId = (int)RM.RoleId, RoleName = RM.RoleName,
                    }).ToList();

                    foreach (var itm in AccessRightsList)
                    {
                        List <AccessControlListEntity> objAccessControlList = new List <AccessControlListEntity>();
                        foreach (var screen in ScreenMasterList)
                        {
                            objAccessControl = (from ACL in objmFrameworkDbContext.accesscontrollist
                                                where ACL.RoleId == itm.RoleId &&
                                                ACL.ScreenId == (int)screen.ScreenId
                                                select new AccessControlListEntity
                            {
                                AccesscontrolListId = (int)ACL.AccesscontrolListId,
                                ScreenId = (int)ACL.ScreenId,
                                ScreenName = screen.ScreenName,
                                RoleId = (int)ACL.RoleId,
                                ScreenAccessId = ACL.ScreenAccessId,
                                CanAdd = ACL.CanAdd,
                                CanEdit = ACL.CanEdit,
                                CanDelete = ACL.CanDelete,
                                CanSearch = ACL.CanSearch,
                                CanUpload = ACL.CanUpload
                            }).SingleOrDefault();
                            if (objAccessControl == null)
                            {
                                objAccessControl                     = new AccessControlListEntity();
                                objAccessControl.ScreenId            = (int)screen.ScreenId;
                                objAccessControl.AccesscontrolListId = 0;
                                objAccessControl.ScreenName          = screen.ScreenName;
                            }
                            objAccessControlList.Add(objAccessControl);
                        }
                        itm.AccessControlList = objAccessControlList;
                    }
                    return(AccessRightsList);
                }
            }
            catch
            {
                throw;
            }
        }
        public List <AutoCompleteItem> DepartmentAutoList(string value)
        {
            List <AutoCompleteItem> objRolesList = new List <AutoCompleteItem>();

            try
            {
                using (mFrameworkDbContext objmFrameworkDbContext = new mFrameworkDbContext())
                {
                    objRolesList = (from e in objmFrameworkDbContext.departmentmaster where (value == null ? e.DepartmentName == e.DepartmentName : e.DepartmentName.StartsWith(value))
                                    select new AutoCompleteItem
                    {
                        label = e.DepartmentName,
                        value = (int)e.DepartmentId
                    }).ToList();
                }
            }
            catch
            {
                throw;
            }
            return(objRolesList);
        }
        public List <AutoCompleteItem> UserAutoList(string value)
        {
            List <AutoCompleteItem> objUserList = new List <AutoCompleteItem>();

            try
            {
                using (mFrameworkDbContext objmFrameworkDbContext = new mFrameworkDbContext())
                {
                    objUserList = (from e in objmFrameworkDbContext.usermaster
                                   where (value == null ? e.UserName == e.UserName : e.UserName.StartsWith(value)) &&
                                   e.IsActive == true
                                   select new AutoCompleteItem
                    {
                        label = e.UserName,
                        value = (int)e.UserId
                    }).ToList();
                }
            }
            catch
            {
                throw;
            }
            return(objUserList);
        }
 public GenericRepository()
 {
     this.objmFrameworkDbContext = new mFrameworkDbContext();
     this.dbSet = objmFrameworkDbContext.Set <T>();
 }