コード例 #1
0
        void sc_AvailableChanged(object sender, EventArgs e)
        {
            ISearchControl sc = sender as ISearchControl;
            Control        c  = sender as Control;

            if (sc.Available)
            {
                if (!m_flpNormal.Controls.Contains(c))
                {
                    m_flpHidden.Controls.Remove(c);
                    m_flpNormal.Controls.Add(c);

                    if (m_controlIndex.ContainsKey(c))
                    {
                        m_flpNormal.Controls.SetChildIndex(c, m_controlIndex[c]);
                    }
                }
            }
            else
            {
                int n = m_flpNormal.Controls.IndexOf(c);
                if (n != -1)
                {
                    m_controlIndex[c] = n;
                    m_flpNormal.Controls.Remove(c);
                    m_flpHidden.Controls.Add(c);

                    m_flpHidden.Controls.SetChildIndex(c, n);
                }
            }
        }
コード例 #2
0
 public void SetSearchControl(ISearchControl searchControl)
 {
     if (srchControl == searchControl)
         return;
     ResetFilter();
     srchControl = searchControl;
 }
コード例 #3
0
        /// <summary>
        /// ��ӡ�
        /// ����Enter KeyPress�¼���
        /// </summary>
        /// <param name="item"></param>
        public override void Add(ISearchControl item)
        {
            base.Add(item);

            IWindowControl outerControl = item as IWindowControl;
            if (outerControl != null)
            {
                outerControl.Control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(InputBox_KeyPress);
            }
            else
            {
                IWindowControlBetween lfcb = item as IWindowControlBetween;
                if (lfcb != null)
                {
                    System.Windows.Forms.Control control = lfcb.Control1 as System.Windows.Forms.Control;
                    if (control != null)
                    {
                        control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(InputBox_KeyPress);
                    }
                    control = lfcb.Control2 as System.Windows.Forms.Control;
                    if (control != null)
                    {
                        control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(InputBox_KeyPress);
                    }
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// 根据<see cref="GridColumnInfo"/>数据自动创建搜索控件
        /// </summary>
        /// <param name="gridName"></param>
        /// <param name="flowLayoutPanelNormal"></param>
        /// <param name="flowLayoutPanelHidden"></param>
        public void LoadSearchControls(string gridName, System.Windows.Forms.FlowLayoutPanel flowLayoutPanelNormal, System.Windows.Forms.FlowLayoutPanel flowLayoutPanelHidden)
        {
            m_flpNormal = flowLayoutPanelNormal;
            m_flpHidden = flowLayoutPanelHidden;
            m_gridName  = gridName;

            if (!string.IsNullOrEmpty(gridName))
            {
                IList <GridColumnInfo> infos = ADInfoBll.Instance.GetGridColumnInfos(gridName);
                foreach (GridColumnInfo info in infos)
                {
                    if (string.IsNullOrEmpty(info.SearchControlType))
                    {
                        continue;
                    }

                    ISearchControl sc = ControlFactory.GetSearchControl(info, m_sm);
                    m_sm.SearchControls.Add(sc);
                    sc.AvailableChanged += new EventHandler(sc_AvailableChanged);

                    Control c = sc as Control;
                    if (c != null)
                    {
                        flowLayoutPanelNormal.Controls.Add(c);
                    }
                    else
                    {
                        throw new ArgumentException("In SearchControlConainer only Windows.Control is permitted!");
                    }
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// 添加。
        /// 处理Enter KeyPress事件,
        /// </summary>
        /// <param name="item"></param>
        public override void Add(ISearchControl item)
        {
            base.Add(item);

            IWindowControl outerControl = item as IWindowControl;

            if (outerControl != null)
            {
                outerControl.Control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(InputBox_KeyPress);
            }
            else
            {
                IWindowControlBetween lfcb = item as IWindowControlBetween;
                if (lfcb != null)
                {
                    System.Windows.Forms.Control control = lfcb.Control1 as System.Windows.Forms.Control;
                    if (control != null)
                    {
                        control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(InputBox_KeyPress);
                    }
                    control = lfcb.Control2 as System.Windows.Forms.Control;
                    if (control != null)
                    {
                        control.KeyPress += new System.Windows.Forms.KeyPressEventHandler(InputBox_KeyPress);
                    }
                }
            }
        }
コード例 #6
0
 protected override void OnKeyDown(KeyEventArgs e)
 {
     base.OnKeyDown(e);
     if (e.Key == Key.Enter)
     {
         ISearchControl.QuickSearch(this.searchtbx.Text);
     }
 }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int entityTypeValue = 0;

        Int32.TryParse(Request.QueryString["EntityType"], out entityTypeValue);
        if (Enum.IsDefined(typeof(EntityType), entityTypeValue))
        {
            _selectedEntityType = (EntityType)entityTypeValue;
            _entityTypeDefined  = true;
        }

        if (_entityTypeDefined)
        {
            // load list control for given entity.
            Control controlToAdd = Page.LoadControl("~/Controls/List" + GeneralUtils.EntityTypeToEntityName(_selectedEntityType) + "Instances.ascx");
            _lister = controlToAdd as IListControl;
            if (_lister != null)
            {
                phListControls.Controls.Add(controlToAdd);
            }
            phListArea.Visible = false;

            // load search control
            controlToAdd = Page.LoadControl("~/Controls/Search" + GeneralUtils.EntityTypeToEntityName(_selectedEntityType) + ".ascx");
            _searcher    = controlToAdd as ISearchControl;
            if (_searcher != null)
            {
                _searcher.AllowSingleEntitySearches = false;
                _searcher.AllowMultiEntitySearches  = true;
                _searcher.SearchClicked            += new EventHandler(searcher_SearchClicked);
                phSearchControls.Controls.Add(controlToAdd);
                phSearchArea.Visible = true;
            }

            bool?showSearchArea = (bool?)ViewState["showSearchArea"];
            if (showSearchArea.HasValue)
            {
                // stored in viewstate, show the correct area.
                phSearchArea.Visible = showSearchArea.Value;
                phListArea.Visible   = !showSearchArea.Value;
            }
        }

        if (!Page.IsPostBack)
        {
            if (_entityTypeDefined)
            {
                this.Title        += _selectedEntityType.ToString() + " instances";
                lblEntityName.Text = GeneralUtils.EntityTypeToEntityName(_selectedEntityType);
            }

            // check for user info
            if (SessionHelper.GetUserID() == string.Empty)
            {
                Response.Redirect("Login.aspx");
            }
        }
    }
 public void SetSearchControl(ISearchControl searchControl)
 {
     if (srchControl == searchControl)
     {
         return;
     }
     srchControl = searchControl;
     ApplyFindFilter(null);
 }
 public void SetSearchControl(ISearchControl searchControl)
 {
     if (srchControl == searchControl)
     {
         return;
     }
     ResetFilter();
     srchControl = searchControl;
 }
コード例 #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int entityTypeValue = 0;

        Int32.TryParse(Request.QueryString["EntityType"], out entityTypeValue);
        if (Enum.IsDefined(typeof(EntityType), entityTypeValue))
        {
            _selectedEntityType = (EntityType)entityTypeValue;
            _entityTypeDefined  = true;
        }

        if (_entityTypeDefined)
        {
            // load edit control for given entity.
            Control      controlToAdd = Page.LoadControl("~/Controls/Edit" + GeneralUtils.EntityTypeToEntityName(_selectedEntityType) + ".ascx");
            IEditControl editor       = controlToAdd as IEditControl;
            if (editor != null)
            {
                editor.EditMode = FormViewMode.ReadOnly;
                phControls.Controls.Add(controlToAdd);
                controlToAdd = Page.LoadControl("~/Controls/Search" + GeneralUtils.EntityTypeToEntityName(_selectedEntityType) + ".ascx");
                ISearchControl searcher = controlToAdd as ISearchControl;
                if (searcher != null)
                {
                    if (Request.QueryString.Count > 1)
                    {
                        // get the filter based on the query string's PK fields. Use the search control for this, as it contains the logic for this.
                        PredicateExpression filter = searcher.CreateFilter(Request.QueryString);
                        editor.FilterToUse = filter;
                        controlToAdd       = Page.LoadControl("~/Controls/ViewRelatedTo" + GeneralUtils.EntityTypeToEntityName(_selectedEntityType) + ".ascx");
                        IViewRelatedControl relatedViewer = controlToAdd as IViewRelatedControl;
                        if (relatedViewer != null)
                        {
                            relatedViewer.FilterToUse = filter;
                            phRelatedEntities.Controls.Add(controlToAdd);
                        }
                    }
                }
            }
        }

        if (!Page.IsPostBack)
        {
            if (_entityTypeDefined)
            {
                this.Title        += _selectedEntityType.ToString() + " instance";
                lblEntityName.Text = GeneralUtils.EntityTypeToEntityName(_selectedEntityType);
            }

            // check for user info
            if (SessionHelper.GetUserID() == string.Empty)
            {
                Response.Redirect("Login.aspx");
            }
        }
    }
コード例 #11
0
 public SearchPage()
 {
     InitializeComponent();
     (ISearchControl).UpdateEvent        += SearchControl_UpdateEvent;
     ISearchControl.SearchPattern         = SearchMode.Object;
     ISearchControl.IsSearchButtonEnabled = true;
     ISearchControl.OnSearchStarted      += SearchControl_OnSearchStarted;
     ISearchControl.UseExtendedSearchTextbox(this.searchtbx);
     this.Loaded += SearchPage_Loaded;
 }
コード例 #12
0
        public void InvalidateControl( )
        {
            if (EditControl == null)
            {
                #region init
                String strType = DataStructureProvider.GetCodingType(this.TableName, this.DataMember.Split(':')[0]);
                if (strType == "String" || strType == "Nullable<String>")
                {
                    EditControl = (ISearchControl)ABCBusinessEntities.ABCDynamicInvoker.CreateInstanceObject(typeof(ABCTextSearch));
                }
                else if (strType == "bool" || strType == "Nullable<bool>")
                {
                    EditControl = (ISearchControl)ABCBusinessEntities.ABCDynamicInvoker.CreateInstanceObject(typeof(ABCBoolSearch));
                }
                else if (strType == "DateTime" || strType == "Nullable<DateTime>")
                {
                    EditControl = (ISearchControl)ABCBusinessEntities.ABCDynamicInvoker.CreateInstanceObject(typeof(ABCDateTimeSearch));
                }
                else if (strType == "int" || strType == "Nullable<int>" || strType == "Guid" || strType == "Nullable<Guid>" || strType == "double" || strType == "Nullable<double>" || strType == "decimal" || strType == "Nullable<decimal>")
                {
                    if (DataStructureProvider.IsForeignKey(this.TableName, this.DataMember.Split(':')[0]) ||
                        DataStructureProvider.IsPrimaryKey(this.TableName, this.DataMember.Split(':')[0]))
                    {
                        EditControl = (ISearchControl)ABCBusinessEntities.ABCDynamicInvoker.CreateInstanceObject(typeof(ABCGridLookUpEditSearch));
                    }
                    else
                    {
                        EditControl = (ISearchControl)ABCBusinessEntities.ABCDynamicInvoker.CreateInstanceObject(typeof(ABCNumbSearch));
                    }
                }

                if (EditControl != null)
                {
                    EditControl.GetType().GetProperty("DataMember").SetValue(EditControl, this.DataMember, null);
                    EditControl.GetType().GetProperty("TableName").SetValue(EditControl, this.TableName, null);
                    if (EditControl is ABCGridLookUpEdit)
                    {
                        ((ABCGridLookUpEdit)EditControl).Initialize(OwnerView);
                    }
                }

                #endregion
            }

            if (EditControl != null)
            {
                EditControl.GetType().GetProperty("DataMember").SetValue(EditControl, this.DataMember, null);
                EditControl.GetType().GetProperty("TableName").SetValue(EditControl, this.TableName, null);
                EditControl.SetFormatInfo();
                this.layoutControl1.Controls.Add((this.EditControl as Control));
                this.LayoutItem.Control = (this.EditControl as Control);
            }

            UpdateLabelText();
        }
コード例 #13
0
 public RPackageManagerVisualComponent(IRPackageManager packageManager, IVisualComponentContainer<IRPackageManagerVisualComponent> container, ISearchControlProvider searchControlProvider, IRSettings settings, ICoreShell coreShell) {
     _viewModel = new RPackageManagerViewModel(packageManager, settings, coreShell);
     Container = container;
     Controller = null;
     var control = new PackageManagerControl {
         DataContext = _viewModel,
     };
     Control = control;
     var searchControlSettings = new SearchControlSettings {
         SearchCategory = SearchCategory,
         MinWidth = (uint)control.SearchControlHost.MinWidth,
         MaxWidth = uint.MaxValue
     };
     _searchControl = searchControlProvider.Create(control.SearchControlHost, _viewModel, searchControlSettings);
 }
コード例 #14
0
        public RPackageManagerVisualComponent(IRPackageManager packageManager, IVisualComponentContainer <IRPackageManagerVisualComponent> container, ISearchControlProvider searchControlProvider, IRSettings settings, ICoreShell coreShell)
        {
            _viewModel = new RPackageManagerViewModel(packageManager, settings, coreShell);
            Container  = container;
            var control = new PackageManagerControl {
                DataContext = _viewModel,
            };

            Control = control;
            var searchControlSettings = new SearchControlSettings {
                SearchCategory = SearchCategory,
                MinWidth       = (uint)control.SearchControlHost.MinWidth,
                MaxWidth       = uint.MaxValue
            };

            _searchControl = searchControlProvider.Create(control.SearchControlHost, _viewModel, searchControlSettings);
        }
コード例 #15
0
        /// <summary>
        /// 保存查找控件信息
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="profile"></param>
        /// <returns></returns>
        public bool LoadLayout(AMS.Profile.IProfile profile)
        {
            string sectionName = "SearchControlContainer." + "." + m_sm.Name + ".Layout";

            string s = profile.GetValue(sectionName, "SearchControls", "");

            if (string.IsNullOrEmpty(s))
            {
                return(false);
            }
            string[] columns = s.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string columnName in columns)
            {
                string[] ss = columnName.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                if (ss.Length != 3)
                {
                    continue;
                }

                ISearchControl sc = m_sm.SearchControls[ss[0]];
                if (sc == null)
                {
                    continue;
                }

                GridColumnInfo info = sc.Tag as GridColumnInfo;
                if (info == null || (!string.IsNullOrEmpty(info.SearchControlType) &&
                                     Authority.AuthorizeByRule(info.SearchControlVisible)))
                {
                    sc.Available = Convert.ToBoolean(ss[1]);
                }
                else
                {
                    m_sm.SearchControls[ss[0]].Available = false;
                }

                sc.Index = Convert.ToInt32(ss[2]);
            }
            return(true);
        }
コード例 #16
0
        public RPackageManagerVisualComponent(IRPackageManager packageManager, IVisualComponentContainer <IRPackageManagerVisualComponent> container, ISearchControlProvider searchControlProvider, IServiceContainer services)
        {
            Container = container;
            var control = new PackageManagerControl(services);

            Control = control;

            var infoBarProvider = services.GetService <IInfoBarProvider>();
            var infoBar         = infoBarProvider.Create(control.InfoBarControlHost);

            _viewModel = new RPackageManagerViewModel(packageManager, infoBar, services);

            var searchControlSettings = new SearchControlSettings {
                SearchCategory = SearchCategory,
                MinWidth       = (uint)control.SearchControlHost.MinWidth,
                MaxWidth       = uint.MaxValue
            };

            _searchControl = searchControlProvider.Create(control.SearchControlHost, _viewModel, searchControlSettings);

            control.DataContext = _viewModel;
        }
コード例 #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int entityTypeValue = 0;

        Int32.TryParse(Request.QueryString["EntityType"], out entityTypeValue);
        if (Enum.IsDefined(typeof(EntityType), entityTypeValue))
        {
            _selectedEntityType = (EntityType)entityTypeValue;
            _entityTypeDefined  = true;
        }

        if (_entityTypeDefined)
        {
            // load edit control for given entity.
            Control controlToAdd = Page.LoadControl("~/Controls/Edit" + GeneralUtils.EntityTypeToEntityName(_selectedEntityType) + ".ascx");
            _editor = controlToAdd as IEditControl;
            if (_editor != null)
            {
                _editor.EditMode = FormViewMode.Edit;
                phEditControls.Controls.Add(controlToAdd);
            }
            phEditArea.Visible = false;

            // load search control
            controlToAdd = Page.LoadControl("~/Controls/Search" + GeneralUtils.EntityTypeToEntityName(_selectedEntityType) + ".ascx");
            _searcher    = controlToAdd as ISearchControl;
            if (_searcher != null)
            {
                if (Request.QueryString.Count == 1)
                {
                    // just entitytype specified.
                    _searcher.AllowSingleEntitySearches = true;
                    _searcher.AllowMultiEntitySearches  = false;
                    _searcher.SearchClicked            += new EventHandler(searcher_SearchClicked);
                    phSearchControls.Controls.Add(controlToAdd);
                    phSearchArea.Visible = true;
                }
                else
                {
                    // get the filter based on the query string's PK fields. Use the search control for this, as it contains the logic for this.
                    if (_editor != null)
                    {
                        _editor.FilterToUse  = _searcher.CreateFilter(Request.QueryString);
                        phSearchArea.Visible = false;
                        phEditArea.Visible   = true;
                    }
                }
            }
        }

        if (!Page.IsPostBack)
        {
            if (_entityTypeDefined)
            {
                this.Title        += _selectedEntityType.ToString() + " instance";
                lblEntityName.Text = GeneralUtils.EntityTypeToEntityName(_selectedEntityType);
            }

            // check for user info
            if (SessionHelper.GetUserID() == string.Empty)
            {
                Response.Redirect("Login.aspx");
            }
        }
    }
コード例 #18
0
 public SearchScrollbar(ISearchControl searchControl)
 {
     _searchControl = searchControl;
 }