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
        void CustomSearchItem_Click(object sender, SmartItemClickEventArgs e)
        {
            Xceed.SmartUI.SmartItem item = sender as Xceed.SmartUI.SmartItem;
            CustomSearchInfo        info = item.Tag as CustomSearchInfo;

            m_sm.FirstResult = 0;
            m_sm.LoadData(SearchExpression.Parse(info.SearchExpression), null);
        }
Exemplo n.º 3
0
        void TaskPane_Click(object sender, Xceed.SmartUI.SmartItemClickEventArgs e)
        {
            Xceed.SmartUI.SmartItem item = sender as Xceed.SmartUI.SmartItem;
            TaskInfo info = item.Tag as TaskInfo;

            IArchiveMasterForm   seeForm  = ServiceProvider.GetService <IApplication>().ExecuteAction(info.Action.Name) as IArchiveMasterForm;
            ArchiveOperationForm operForm = seeForm as ArchiveOperationForm;

            if (seeForm == null)
            {
                MessageForm.ShowError("未能创建目标窗体!");
                return;
            }
            switch (info.TaskType)
            {
            case TaskType.Add:
                operForm.DoAdd();
                break;

            case TaskType.Edit:
                ISearchManager smSrc;
                if (m_sms.ContainsKey(info.Name))
                {
                    smSrc = m_sms[info.Name];
                }
                else
                {
                    smSrc = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(info.SearchManagerClassName, info.SearchManagerClassParams);
                }

                ISearchManager smDest = seeForm.DisplayManager.SearchManager;
                if (smSrc.GetType() == smDest.GetType())
                {
                    smDest.LoadData(SearchExpression.Parse(EntityHelper.ReplaceExpression(info.SearchExpression)), null);
                }
                else
                {
                    smSrc.EnablePage = false;
                    object dataSource = smSrc.GetData(SearchExpression.Parse(EntityHelper.ReplaceExpression(info.SearchExpression)), null);

                    IDisplayManager dm = seeForm.DisplayManager;
                    dm.SetDataBinding(dataSource, string.Empty);
                    dm.SearchManager.OnDataLoaded(new DataLoadedEventArgs(dataSource, 0));
                }
                break;

            default:
                throw new NotSupportedException("Invalide TaskType");
            }
        }
        void TaskPaneAlert_Click(object sender, Xceed.SmartUI.SmartItemClickEventArgs e)
        {
            Xceed.SmartUI.SmartItem item = sender as Xceed.SmartUI.SmartItem;
            AlertInfo info = item.Tag as AlertInfo;

            IArchiveMasterForm seeForm = ServiceProvider.GetService <IApplication>().ExecuteAction(info.Action.Name) as IArchiveMasterForm;

            if (seeForm == null)
            {
                MessageForm.ShowError("未能创建目标窗体!");
                return;
            }

            ISearchManager sm = seeForm.DisplayManager.SearchManager;

            sm.LoadData(SearchExpression.Parse(info.SearchExpression), null);

            FixIt(info);
        }
        void GridGotoFormTaskPane_Click(object sender, Xceed.SmartUI.SmartItemClickEventArgs e)
        {
            Xceed.SmartUI.SmartItem item = sender as Xceed.SmartUI.SmartItem;
            GridRelatedInfo         info = item.Tag as GridRelatedInfo;

            switch (info.RelatedType)
            {
            case GridRelatedType.ByRows:
            {
                if (item.ParentItem.Text == "按选定行")
                {
                    ShowFormFromGrid(m_parentForm, info, false);
                }
                else
                {
                    ShowFormFromGrid(m_parentForm, info, true);
                }
            }
            break;

            case GridRelatedType.BySearchExpression:
            {
                SearchHistoryInfo his = m_dm.SearchManager.GetHistory(0);

                if (string.IsNullOrEmpty(his.Expression))
                {
                    MessageForm.ShowInfo("还未有搜索条件!");
                    return;
                }
                string                      newSearchExpression = info.SearchExpression;
                ISearchExpression           oldSe = SearchExpression.Parse(his.Expression);
                Dictionary <string, object> dict  = GetSearchExpreesionValues(oldSe);

                ISearchExpression newSe = SearchExpression.Parse(newSearchExpression);

                newSe = ReplaceSearchExpreesionValues(newSe, dict);

                ShowFrom(info.Action.Name, newSe, false);
            }
            break;

            case GridRelatedType.ByDataControl:
            {
                Dictionary <string, object> dict = m_dm.Copy();
                string exp = EntityHelper.ReplaceEntity(info.SearchExpression, new EntityHelper.GetReplaceValue(delegate(string paramName)
                    {
                        return(dict[paramName]);
                    }));
                ShowFrom(info.Action.Name, SearchExpression.Parse(exp), false);
            }
            break;

            case GridRelatedType.ByNone:
            {
                ShowFrom(info.Action.Name, null, false);
            }
            break;

            default:
                throw new NotSupportedException("Invalid GridRelatedInfo's RelatedType of " + info.Name);
            }
        }