Esempio n. 1
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));
                }
            }
        }
        internal static void ShowFrom(string actionId, ISearchExpression se, bool asDetailDialog)
        {
            IDisplayManagerContainer seeForm    = null;
            ArchiveDetailForm        detailForm = null;
            ISearchManager           sm         = null;

            if (!asDetailDialog)
            {
                seeForm = (ServiceProvider.GetService <IApplication>() as IWinFormApplication).ExecuteAction(actionId) as IDisplayManagerContainer;
                if (seeForm == null)
                {
                    throw new InvalidOperationException("未能创建目标窗体!");
                }

                sm = seeForm.DisplayManager.SearchManager;
            }
            else
            {
                //detailForm = Feng.Utils.ReflectionHelper.CreateInstanceFromType(Feng.Utils.ReflectionHelper.GetTypeFromName(info.ToDetailForm)) as ArchiveDetailForm;
                //if (detailForm == null)
                //{
                //    MessageForm.ShowError("未能创建目标窗体!");
                //    return;
                //}
                //detailForm.UpdateContent();
                //findWindow = detailForm.DisplayManager.SearchManager;
            }

            if (sm == null)
            {
                throw new InvalidOperationException("未能找到目标窗体的查找窗口!");
            }

            //List<ISearchExpression> findList = new List<ISearchExpression>();
            //ISearchExpression findCondition = GetAndFindCondition(selected, 0, toColumns);
            //for (int i = 1; i < selected[0].Count; ++i)
            //{
            //    findCondition = new LogicalExpression(findCondition, GetAndFindCondition(selected, i, toColumns), LogicalOperator.Or);
            //}
            //findList.Add(findCondition);
            sm.LoadData(se, null);

            if (asDetailDialog)
            {
                if (detailForm.ControlManager.DisplayManager.Count == 0)
                {
                    ServiceProvider.GetService <IMessageBox>().ShowWarning("未能找到相应记录!");
                    return;
                }

                detailForm.ControlManager.DisplayManager.Position = 0;

                detailForm.ShowDialog();

                detailForm.Dispose();
            }
        }
Esempio 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);
        }
Esempio n. 5
0
        private void ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                ToolStripMenuItem item = sender as ToolStripMenuItem;
                CustomSearchInfo  info = item.Tag as CustomSearchInfo;

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

                if (ToolStripItemClicked != null)
                {
                    ToolStripItemClicked(sender, e);
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(ex);
            }
        }
Esempio n. 6
0
 /// <summary>
 /// 无条件查询
 /// </summary>
 /// <param name="sm"></param>
 public static void LoadData(this ISearchManager sm)
 {
     sm.LoadData(null, null);
 }