Ejemplo n.º 1
0
        /// <summary>
        /// 根据上一次查询条件重新读入数据
        /// 第一条记录设置不变
        /// </summary>
        public virtual void ReloadData()
        {
            //// 还没查找过,不能刷新
            //if (m_needFindConddition && !m_findConditionLoaded)
            //    return;

            //if (m_needSearchExpression)
            //{
            SearchHistoryInfo his = GetHistory(0);

            // his.Expression = string.Empty 代表查询条件为空,当时已经查询过
            if (his != null && his.IsCurrentSession && his.Expression != null)
            {
                LoadData(SearchExpression.Parse(his.Expression), SearchOrder.Parse(his.Order));
            }
            // 不过无查询条件,不刷新
            //else
            //{
            //    LoadData();
            //}
            //}
            //else
            //{
            //    LoadData(new List<ISearchExpression>(), null, this.FirstResult);
            //    return true;
            //}
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dm"></param>
        /// <param name="actionName"></param>
        public static string GetNavigatorAddress(string actionName, IDisplayManager dm = null)
        {
            SearchHistoryInfo his = null;

            if (dm != null)
            {
                his = dm.SearchManager.GetHistory(0);
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(string.Format("{0}/action/{1}/?", SystemConfiguration.ApplicationName, actionName));
            if (his != null && his.IsCurrentSession)
            {
                if (!string.IsNullOrEmpty(his.Expression))
                {
                    sb.Append(string.Format("exp={0}&", his.Expression));
                }
                if (!string.IsNullOrEmpty(his.Order))
                {
                    sb.Append(string.Format("order={0}&", his.Order));
                }
                if (dm.SearchManager.FirstResult != 0)
                {
                    sb.Append(string.Format("first={0}&", dm.SearchManager.FirstResult));
                }
                sb.Append(string.Format("count={0}&", dm.SearchManager.MaxResult));
            }

            return(s_addressHeader + Encrypt(sb.ToString()));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// SetHistory
        /// </summary>
        /// <param name="searchExpression"></param>
        /// <param name="searchOrders"></param>
        /// <param name="isCurrent"></param>
        private SearchHistoryInfo SetHistory(ISearchExpression searchExpression, IList <ISearchOrder> searchOrders, bool isCurrent)
        {
            string nowExpression = SearchExpression.ToString(searchExpression);

            int existIdx = -1;

            // 发现有重复的也一样添加,因为翻页用到历史里的最近一条(只和最近一条比较)
            for (int i = 0; i < 1; ++i)
            {
                if (m_searchHistoryInfos[i] != null &&
                    m_searchHistoryInfos[i].Expression == nowExpression)
                {
                    existIdx = i;
                    break;
                }
            }

            if (existIdx == -1)
            {
                //historySearchExpressions[historyNow] = SearchExpression.ToString(searchExpressions);
                //historySearchOrders[historyNow] = SearchOrder.ToString(searchOrders);
                //historyNow = (historyNow + 1) % historyCnt;
                for (int i = historyCnt - 1; i > 0; --i)
                {
                    m_searchHistoryInfos[i] = m_searchHistoryInfos[i - 1];
                }
                m_searchHistoryInfos[0] = new SearchHistoryInfo(SearchExpression.ToString(searchExpression),
                                                                SearchOrder.ToString(searchOrders), isCurrent);

                return(m_searchHistoryInfos[0]);
            }
            else
            {
                m_searchHistoryInfos[existIdx].IsCurrentSession = isCurrent;
                return(m_searchHistoryInfos[existIdx]);
            }
        }