Exemplo n.º 1
0
        void HistoryPaneItem_Click(object sender, SmartItemClickEventArgs e)
        {
            Xceed.SmartUI.SmartItem item = sender as Xceed.SmartUI.SmartItem;
            SearchHistoryInfo       his  = item.Tag as SearchHistoryInfo;

            m_sm.FirstResult = 0;
            m_sm.LoadData(SearchExpression.Parse(his.Expression), SearchOrder.Parse(his.Order));
        }
Exemplo n.º 2
0
        public bool LoadLayout(AMS.Profile.IProfile profile)
        {
            int r = profile.GetValue("SearchManager." + m_sm.Name, "MaxResult", -1);

            if (r != -1)
            {
                m_sm.MaxResult = r;
            }

            string history = profile.GetValue("SearchManager." + m_sm.Name, "History", string.Empty);

            if (!string.IsNullOrEmpty(history))
            {
                string[] ss = history.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = ss.Length - 1; i >= 0; --i)
                {
                    string s = ss[i];
                    if (string.IsNullOrEmpty(s))
                    {
                        continue;
                    }
                    string[] sss = s.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    if (sss.Length == 0)
                    {
                        continue;
                    }
                    ISearchExpression se = null;
                    try
                    {
                        se = SearchExpression.Parse(sss[0]);
                    }
                    catch (Exception)
                    {
                    }

                    if (se == null)
                    {
                        continue;
                    }
                    IList <ISearchOrder> so = null;
                    if (sss.Length > 1)
                    {
                        so = SearchOrder.Parse(sss[1]);
                    }
                    SearchHistoryInfo his = m_sm.SetHistory(se, so);
                    his.IsCurrentSession = false;
                }
            }

            bool ret = this.searchControlContainer1.LoadLayout(profile);

            return(ret);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 搜索动作执行后
        /// </summary>
        //public event CancelEventHandler SearchExecuting;
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (tabControl1.SelectedIndex == 0)
            {
                if (!m_isLoading)
                {
                    //CancelEventArgs arg = new CancelEventArgs();
                    //if (SearchExecuting != null)
                    //{
                    //    SearchExecuting(sender, arg);
                    //}

                    //if (!arg.Cancel)
                    {
                        m_sm.FirstResult = 0;
                        m_sm.LoadDataAccordSearchControls();
                    }
                }
                else
                {
                    //m_sm.StopLoadData();

                    //StopLoadData();
                    // Nothing
                }
            }
            else if (tabControl1.SelectedIndex == 3)
            {
                m_sm.FirstResult = 0;
                if (ckbUseHql.Checked)
                {
                    if (!string.IsNullOrEmpty(txtSearchExpression.Text))
                    {
                        m_sm.LoadData(new Feng.Search.QueryExpression(txtSearchExpression.Text), SearchOrder.Parse(txtSearchOrder.Text));
                    }
                    else
                    {
                        m_sm.LoadData(null, null);
                    }
                }
                else
                {
                    m_sm.LoadData(SearchExpression.Parse(txtSearchExpression.Text), SearchOrder.Parse(txtSearchOrder.Text));
                }
            }
        }
Exemplo n.º 4
0
        ///// <summary>
        ///// Constructor
        ///// </summary>
        ///// <param name="cmParent"></param>
        //public SearchManagerProxyDetailInMaster(IControlManager cmParent)
        //    : base(cmParent)
        //{
        //}

        /// <summary>
        ///
        /// </summary>
        /// <param name="searchExpression"></param>
        /// <param name="searchOrders"></param>
        /// <param name="parentItem"></param>
        /// <returns></returns>
        public override System.Collections.IEnumerable GetData(ISearchExpression searchExpression, IList <ISearchOrder> searchOrders, object parentItem)
        {
            if (parentItem == null)
            {
                return(null);
            }
            string exp = EntityHelper.ReplaceEntity(m_searchExpression, parentItem);

            searchExpression = SearchExpression.And(SearchExpression.Parse(exp), searchExpression);

            if (!string.IsNullOrEmpty(m_searchOrder))
            {
                return(m_innerSearchManager.GetData(searchExpression, SearchOrder.Parse(m_searchOrder)));
            }
            else
            {
                return(m_innerSearchManager.GetData(searchExpression, null));
            }
        }
Exemplo n.º 5
0
        public static Tuple <ISearchExpression, IList <ISearchOrder> > GetSearchManagerParameters(ISearchManager sm, System.Collections.Specialized.NameValueCollection nvc)
        {
            sm.FirstResult = 0;
            sm.MaxResult   = SearchManagerDefaultValue.MaxResult;

            ISearchExpression    exp    = null;
            IList <ISearchOrder> orders = null;

            if (!string.IsNullOrEmpty(nvc["exp"]))
            {
                exp = SearchExpression.Parse(System.Web.HttpUtility.UrlDecode(nvc["exp"]));
            }
            else if (!string.IsNullOrEmpty(nvc["filter"]))
            {
                exp = SearchExpression.Parse(System.Web.HttpUtility.UrlDecode(nvc["filter"]));
            }
            if (!string.IsNullOrEmpty(nvc["order"]))
            {
                orders = SearchOrder.Parse(System.Web.HttpUtility.UrlDecode(nvc["order"]));
            }
            else if (!string.IsNullOrEmpty(nvc["orderby"]))
            {
                orders = SearchOrder.Parse(System.Web.HttpUtility.UrlDecode(nvc["orderby"]));
            }
            if (!string.IsNullOrEmpty(nvc["first"]))
            {
                sm.FirstResult = Feng.Utils.ConvertHelper.ToInt(nvc["first"]).Value;
            }
            else if (!string.IsNullOrEmpty(nvc["skip"]))
            {
                sm.FirstResult = Feng.Utils.ConvertHelper.ToInt(nvc["skip"]).Value;
            }
            if (!string.IsNullOrEmpty(nvc["count"]))
            {
                sm.MaxResult = Feng.Utils.ConvertHelper.ToInt(nvc["count"]).Value;
            }
            else if (!string.IsNullOrEmpty(nvc["top"]))
            {
                sm.MaxResult = Feng.Utils.ConvertHelper.ToInt(nvc["top"]).Value;
            }
            return(new Tuple <ISearchExpression, IList <ISearchOrder> >(exp, orders));
        }