private void OrganizationConfig_Load(object sender, EventArgs e) { f = this.FindForm(); ClassifySearch _Search = new ClassifySearch(this.m_Application); _Search.Filters.Add(new ParentIdFilter(0)); _Search.Filters.Add(new ClassifyTypeFilter(typeof(Organization))); foreach (Organization _Organization in _Search.Search()) { this.m_Organization = _Organization; this.txtName.Text = this.m_Organization.Name; break; } foreach (ClassifyType _ClassifyType in this.m_Application.ClassifyTypes) { if (Function.IsInheritableBaseType(_ClassifyType.Type, typeof(AC.Base.Organization))) { this.cmbClassifyType.Items.Add(_ClassifyType); if (this.m_Organization != null && this.m_Organization.ClassifyType.Equals(_ClassifyType)) { this.cmbClassifyType.SelectedItem = _ClassifyType; } } } if (this.cmbClassifyType.SelectedIndex == -1 && this.cmbClassifyType.Items.Count > 0) { this.cmbClassifyType.SelectedIndex = 0; } }
/// <summary> /// 检查全局插件能否使用。 /// </summary> /// <param name="application"></param> /// <returns></returns> public bool Check(FormApplicationClass application) { ClassifySearch _Search = new ClassifySearch(application); _Search.Filters.Add(new ParentIdFilter(0)); _Search.Filters.Add(new ClassifyTypeFilter(typeof(CommonCustomClassify))); return(_Search.Search().Count > 0); }
/// <summary> /// 设置控件视图的配置参数。 /// </summary> /// <param name="config"></param> public void SetViewConfig(System.Xml.XmlNode config) { ClassifySearch _Search = new ClassifySearch(this.m_Application); _Search.Filters.Add(new IdFilter(Function.ToInt(config.InnerText))); _Search.Filters.Add(new ClassifyTypeFilter(typeof(CommonCustomClassify))); foreach (CommonCustomClassify _Classify in _Search.Search()) { this.Classify = _Classify; break; } }
private void LoadChildren() { if (this.m_Parent.Source != null && this.m_Parent.Source.Count > 1) { foreach (Classify classifyParent in this.m_Parent.Source) { classifyParent.Children.m_Children = new ClassifyCollection(true); } //批量读取子分类 ClassifySearch ds = new ClassifySearch(this.m_Parent.Application); ds.Filters.Add(new ParentIdFilter(this.m_Parent.Source.GetIdForArray())); ds.OrderInfos.Add(false, new OrdinalNumberOrder()); ds.OrderInfos.Add(false, new IdOrder()); foreach (Classify classifyChildren in ds.Search(1, false, false, false)) { foreach (Classify classifyParent in this.m_Parent.Source) { if (classifyChildren.m_ParentId == classifyParent.ClassifyId) { classifyParent.m_Children.Add(classifyChildren); break; } } } foreach (Classify classifyParent in this.m_Parent.Source) { classifyParent.Children.m_Count = classifyParent.Children.m_Children.Count; } } else { ClassifySearch ds = new ClassifySearch(this.m_Parent.Application); ds.Filters.Add(new ParentIdFilter(this.m_Parent.ClassifyId)); ds.OrderInfos = new Searchs.SearchOrderInfoCollection <IClassifyOrder>(); ds.OrderInfos.Add(false, new OrdinalNumberOrder()); ds.OrderInfos.Add(false, new IdOrder()); this.m_Children = ds.Search(); this.m_Count = ds.RecordsetCount; foreach (Classify classify in this.m_Children) { classify.SetParent(this.m_Parent); } } }
/// <summary> /// 设置应用程序框架。 /// </summary> /// <param name="application"></param> public void SetApplication(FormApplicationClass application) { this.m_Application = application; ClassifySearch _Search = new ClassifySearch(this.m_Application); _Search.Filters.Add(new ParentIdFilter(0)); _Search.Filters.Add(new ClassifyTypeFilter(typeof(Department))); this.Add(_Search.Search(), this.tvClassify.Nodes); if (this.tvClassify.Nodes.Count > 0) { this.tvClassify.ExpandAll(); } }
/// <summary> /// 设置应用程序框架。 /// </summary> /// <param name="application">应用程序框架。</param> public void SetApplication(FormApplicationClass application) { this.m_Application = application; ClassifySearch _Search = new ClassifySearch(this.m_Application); _Search.Filters.Add(new ParentIdFilter(0)); _Search.Filters.Add(new ClassifyTypeFilter(typeof(CommonCustomClassify))); foreach (CommonCustomClassify _Classify in _Search.Search()) { this.tabClassify.TabPages.Add(new CommonCustomClassifyManageTabPage(_Classify)); } this.tabClassify_SelectedIndexChanged(null, null); }
/// <summary> /// 设置应用程序框架。 /// </summary> /// <param name="application">应用程序框架。</param> public void SetApplication(Forms.FormApplicationClass application) { this.m_Application = (WindowsFormApplicationClass)application; ClassifySearch _Search = new ClassifySearch(this.m_Application); _Search.Filters.Add(new ParentIdFilter(0)); _Search.Filters.Add(new ClassifyTypeFilter(typeof(CommonCustomClassify))); ClassifyCollection _Classifys = _Search.Search(); if (_Classifys.Count > 0) { if (_Classifys.Count == 1) { CommonCustomClassify _Classify = _Classifys[0] as CommonCustomClassify; this.Text = _Classify.Name; this.Tag = _Classify; this.Image = _Classify.GetIcon16(); this.Click += new EventHandler(CommonCustomClassifyMenuPlugin_Click); } else { if (base.OwnerItem is ToolStripMenuItem) { ToolStripMenuItem owner = base.OwnerItem as ToolStripMenuItem; for (int intIndex = 0; intIndex < _Classifys.Count; intIndex++) { CommonCustomClassify _Classify = _Classifys[intIndex] as CommonCustomClassify; if (intIndex == 0) { this.Text = _Classify.Name; this.Tag = _Classify; this.Image = _Classify.GetIcon16(); this.Click += new EventHandler(CommonCustomClassifyMenuPlugin_Click); } else { ToolStripMenuItem tsmi = new ToolStripMenuItem(); tsmi.Text = _Classify.Name; tsmi.Tag = _Classify; tsmi.Image = _Classify.GetIcon16(); tsmi.Click += new EventHandler(CommonCustomClassifyMenuPlugin_Click); owner.DropDownItems.Add(tsmi); } } } else { for (int intIndex = 0; intIndex < _Classifys.Count; intIndex++) { CommonCustomClassify _Classify = _Classifys[intIndex] as CommonCustomClassify; ToolStripMenuItem tsmi = new ToolStripMenuItem(); tsmi.Text = _Classify.Name; tsmi.Tag = _Classify; tsmi.Image = _Classify.GetIcon16(); tsmi.Click += new EventHandler(CommonCustomClassifyMenuPlugin_Click); this.DropDownItems.Add(tsmi); } } } } }