Beispiel #1
0
        /// <summary>
        /// نتایج جستجو
        /// </summary>
        /// <param name="key"></param>
        /// <param name="searchValue"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IList <UserProxy> GetAllByPageBySearch(UserSearchKeys key, string searchValue, int pageIndex, int pageSize)
        {
            try
            {
                IList <User> list       = null;
                IDataAccess  dataAccess = new BUser();
                list = userRepository.GetAllByPageQuickSearch(key, searchValue, BUser.CurrentUser.ID, pageIndex, pageSize);

                /*
                 * decimal[] arr = dataAccess.GetAccessiblePersonByDepartment().ToArray();
                 * switch (key)
                 * {
                 *  case UserSearchKeys.PersonCode:
                 *      list = userRepository.GetAllByPageBarcode(searchValue, pageIndex, pageSize, arr);
                 *      break;
                 *  case UserSearchKeys.Name:
                 *      list = userRepository.GetAllByPageName(searchValue, pageIndex, pageSize, arr);
                 *      break;
                 *  case UserSearchKeys.Username:
                 *      list = userRepository.GetAllByPageUserName(searchValue, pageIndex, pageSize, arr);
                 *      break;
                 *  case UserSearchKeys.RoleName:
                 *      list = userRepository.GetAllByPageRoleName(searchValue, pageIndex, pageSize, arr);
                 *      break;
                 *  case UserSearchKeys.NotSpecified:
                 *      list = userRepository.GetAllByPageQuickSearch(searchValue, pageIndex, pageSize, arr);
                 *      break;
                 *
                 * }*/
                if (list != null)
                {
                    IList <UserProxy> users = new List <UserProxy>();
                    foreach (User user in list)
                    {
                        UserProxy proxy = new UserProxy(user);
                        if (proxy.Active && !Utility.IsEmpty(user.Person.EndEmploymentDate))
                        {
                            proxy.Active = DateTime.Now > user.Person.EndEmploymentDate ? false : true;
                        }
                        users.Add(proxy);
                    }

                    return(users);
                }
                return(null);
            }
            catch (Exception ex)
            {
                LogException(ex, "BManager", "GetAllByPageBySearch");
                throw ex;
            }
        }
Beispiel #2
0
        private void SetUsersPageCount_Users(LoadState Ls, UserSearchKeys SearchKey, string SearchTerm)
        {
            int UsersCount = 0;

            switch (Ls)
            {
            case LoadState.Normal:
                UsersCount = this.UserBusiness.GetAllByPageBySearchCount(SearchKey, string.Empty);
                break;

            case LoadState.Search:
                UsersCount = this.UserBusiness.GetAllByPageBySearchCount(SearchKey, SearchTerm);
                break;
            }
            this.hfUsersCount_Users.Value     = UsersCount.ToString();
            this.hfUsersPageCount_Users.Value = Utility.GetPageCount(UsersCount, this.GridUsers_Users.PageSize).ToString();
        }
Beispiel #3
0
        private void Fill_GridUsers_Users(LoadState Ls, int pageSize, int pageIndex, UserSearchKeys SearchKey, string SearchTerm)
        {
            string[]          retMessage = new string[4];
            IList <UserProxy> UsersList  = null;

            try
            {
                this.InitializeCulture();
                switch (Ls)
                {
                case LoadState.Normal:
                    UsersList = this.UserBusiness.GetAllByPageBySearch(SearchKey, string.Empty, pageIndex, pageSize);
                    break;

                case LoadState.Search:
                    UsersList = this.UserBusiness.GetAllByPageBySearch(SearchKey, SearchTerm, pageIndex, pageSize);
                    break;
                }
                this.GridUsers_Users.DataSource = UsersList;
                this.GridUsers_Users.DataBind();
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                this.ErrorHiddenField_Users.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                this.ErrorHiddenField_Users.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (OutOfExpectedRangeException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ex, retMessage);
                this.ErrorHiddenField_Users.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                this.ErrorHiddenField_Users.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
        }
Beispiel #4
0
        /// <summary>
        /// تعداد نتایج جستجو را برمیگرداند
        /// </summary>
        /// <param name="key"></param>
        /// <param name="searchValue"></param>
        /// <returns></returns>
        public int GetAllByPageBySearchCount(UserSearchKeys key, string searchValue)
        {
            try
            {
                IDataAccess dataAccess = new BUser();
                int         userCount  = 0;
                //decimal [] arr=dataAccess.GetAccessiblePersonByDepartment().ToArray();
                userCount = userRepository.GetNumberOfUsersByQuickSearch(key, searchValue, BUser.CurrentUser.ID);

                /*switch (key)
                 * {
                 *  case UserSearchKeys.PersonCode:
                 *      userCount = userRepository.GetNumberOfUsersByBarcode(searchValue,arr );
                 *      break;
                 *  case UserSearchKeys.Name:
                 *      userCount = userRepository.GetNumberOfUsersByName(searchValue, arr);
                 *      break;
                 *  case UserSearchKeys.Username:
                 *      userCount = userRepository.GetNumberOfUsersByUserName(searchValue, arr);
                 *      break;
                 *  case UserSearchKeys.RoleName:
                 *      userCount = userRepository.GetNumberOfUsersByRoleName(searchValue, arr);
                 *      break;
                 *  case UserSearchKeys.NotSpecified:
                 *      userCount = userRepository.GetNumberOfUsersByQuickSearch(searchValue, BUser.CurrentUser.ID);
                 *      break;
                 *  default:
                 *      return 0;
                 * }*/
                return(userCount);
            }
            catch (Exception ex)
            {
                LogException(ex, "BUser", "GetAllByPageBySearchCount");
                throw ex;
            }
        }