예제 #1
0
        /// <summary>
        /// براساس کلمه کلیدی تعداد نتایج جستجورا برمیگرداند
        /// </summary>
        /// <param name="searchKey"></param>
        /// <param name="field"></param>
        /// <returns></returns>
        public virtual int GetRecordCountBySearch(string searchKey, ManagerSearchFields field)
        {
            try
            {
                int             managerCount = 0;
                IList <decimal> ids          = accessPort.GetAccessibleManagers();
                switch (field)
                {
                case ManagerSearchFields.PersonCode:
                    managerCount = managerRep.GetSearchCountByPersonCode(searchKey, ids.ToArray());
                    break;

                case ManagerSearchFields.PersonName:
                    managerCount = managerRep.GetSearchCountByPersonName(searchKey, ids.ToArray());
                    break;

                case ManagerSearchFields.OrganizationUnitName:
                    managerCount = managerRep.GetSearchCountByOrganName(searchKey, ids.ToArray());
                    break;

                case ManagerSearchFields.NotSpecified:
                    managerCount = managerRep.GetSearchCountByQuickSearch(searchKey, ids.ToArray());
                    break;
                }
                return(managerCount);
            }
            catch (Exception ex)
            {
                LogException(ex, "BManager", "GetRecordCountBySearch");
                throw ex;
            }
        }
예제 #2
0
        /// <summary>
        ///نتایج جستجو را صفحه به صفحه برمیگرداند
        /// </summary>
        public IList <Manager> SearchByPage(string searchKey, ManagerSearchFields field, int pageIndex, int pageSize)
        {
            try
            {
                IList <decimal> ids      = accessPort.GetAccessibleManagers();
                IList <Manager> managers = new List <Manager>();
                switch (field)
                {
                case ManagerSearchFields.PersonCode:
                    managers = managerRep.GetSearchByPersonCode(searchKey, pageSize, pageIndex, ids.ToArray());
                    break;

                case ManagerSearchFields.PersonName:
                    managers = managerRep.GetSearchByPersonName(searchKey, pageSize, pageIndex, ids.ToArray());
                    break;

                case ManagerSearchFields.OrganizationUnitName:
                    managers = managerRep.GetSearchByOrganName(searchKey, pageSize, pageIndex, ids.ToArray());
                    break;

                case ManagerSearchFields.NotSpecified:
                    managers = managerRep.GetSearchByQucikSearch(searchKey, pageSize, pageIndex, ids.ToArray());
                    break;
                }
                return(managers);
            }
            catch (Exception ex)
            {
                LogException(ex, "BManager", "SearchByPage");
                throw ex;
            }
        }
예제 #3
0
        private void Fill_GridManagers_Managers(LoadState Ls, int PageIndex, decimal AccessGroupID, ManagerSearchFields SearchField, string SearchTerm)
        {
            string[]        retMessage   = new string[4];
            int             PageSize     = this.GridManagers_Managers.PageSize;
            IList <Manager> ManagersList = null;

            try
            {
                this.InitializeCulture();

                switch (Ls)
                {
                case LoadState.Normal:
                    ManagersList = this.ManagerBusiness.GetAllByPage(PageIndex, PageSize);
                    break;

                case LoadState.Filter:
                    ManagersList = this.ManagerBusiness.SearchByAccessGroup(AccessGroupID, PageIndex, PageSize);
                    break;

                case LoadState.Search:
                    ManagersList = this.ManagerBusiness.SearchByPage(SearchTerm, SearchField, PageIndex, PageSize);
                    break;

                default:
                    break;
                }
                this.GridManagers_Managers.DataSource = ManagersList;
                this.GridManagers_Managers.DataBind();
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                this.ErrorHiddenField_Managers_Managers.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                this.ErrorHiddenField_Managers_Managers.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                this.ErrorHiddenField_Managers_Managers.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
        }
예제 #4
0
        private void SetManagersPageCount_Managers(LoadState Ls, decimal AccessGroupID, ManagerSearchFields SearchField, string SearchTerm)
        {
            string[] retMessage = new string[4];
            try
            {
                int ManagersCount = 0;
                switch (Ls)
                {
                case LoadState.Normal:
                    ManagersCount = this.ManagerBusiness.GetRecordCount();
                    break;

                case LoadState.Filter:
                    ManagersCount = this.ManagerBusiness.GetRecordCountByAccessGroupFilter(AccessGroupID);
                    break;

                case LoadState.Search:
                    ManagersCount = this.ManagerBusiness.GetRecordCountBySearch(SearchTerm, SearchField);
                    break;
                }
                this.hfManagersPageCount_Managers.Value = Utility.GetPageCount(ManagersCount, this.GridManagers_Managers.PageSize).ToString();
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                this.ErrorHiddenField_Managers_Managers.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                this.ErrorHiddenField_Managers_Managers.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                this.ErrorHiddenField_Managers_Managers.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
        }