123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using DevComponents.DotNetBar;
- using DevComponents.DotNetBar.Layout;
- namespace WCS_Client.UC
- {
- public partial class FrmLEdit : Office2007Form
- {
- public FrmLEdit()
- {
- InitializeComponent();
- ErrItem.BlinkStyle = ErrorBlinkStyle.BlinkIfDifferentError;
- }
- ErrorProvider ErrItem = new ErrorProvider();
- List<LayoutControlItem> _LCItemList = new List<LayoutControlItem>();
- public void InitFrm(List<LayoutControlItem> LCItemList)
- {
- _LCItemList = LCItemList;
- //LayoutControl添加控件
- if (_LCItemList != null)
- {
- foreach (LayoutControlItem LocItem in _LCItemList)
- {
- this.layoutControl1.Controls.Add(LocItem.Control);
- this.layoutControl1.RootGroup.Items.Add(LocItem);
- }
- }
- }
- public void SetLCItemErr(LayoutControlItem LCItem, string ErrText)
- {
- if (LCItem == null || LCItem.Control == null)
- {
- return;
- }
- if (!string.IsNullOrEmpty(ErrText))
- {
- LCItem.Control.Padding = new System.Windows.Forms.Padding(0, 0, 15, 0);
- LCItem.Control.Margin = new System.Windows.Forms.Padding(0, 0, 15, 0);
- }
- else
- {
- LCItem.Control.Padding = new System.Windows.Forms.Padding(0, 0, 0, 0);
- LCItem.Control.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0);
- }
- ErrItem.SetError(LCItem.Control, ErrText);
- }
- public void ClearLCItemErr()
- {
- ErrItem.Clear();
- }
- public void SetLCItemErr(string LCName, string ErrText)
- {
- LayoutControlItem LCItem = GetLCItem(LCName);
- SetLCItemErr(LCItem, ErrText);
- }
- public List<LayoutControlItem> GetLCItemList()
- {
- return _LCItemList;
- }
- public LayoutControlItem GetLCItem(string LCName)
- {
- return _LCItemList.Find(a => a.Name == LCName);
- }
- public void ClearLCItemValue()
- {
- LCItemUtil.ClearValue_LCItem(_LCItemList);
- }
- public void LCItemIsEnable(string LCName, bool IsEnable)
- {
- LayoutControlItem item = GetLCItem(LCName);
- if (item == null || item.Control == null)
- {
- return;
- }
- item.Control.Enabled = IsEnable;
- }
- public void LCItemIsEnable(bool IsEnable)
- {
- foreach (LayoutControlItem item in _LCItemList)
- {
- if (item == null || item.Control == null)
- {
- continue;
- }
- item.Control.Enabled = IsEnable;
- }
- }
- public DataRow GetData()
- {
- DataTable dt = new DataTable();
- foreach (LayoutControlItem Item in _LCItemList)
- {
- dt.Columns.Add(Item.Name, typeof(object));
- }
- DataRow dr = dt.NewRow();
- foreach (LayoutControlItem Item in _LCItemList)
- {
- dr[Item.Name] = LCItemUtil.GetValue_LCItem(Item);
- }
- return dr;
- }
- public void SetLCItemValue(DataRow dr)
- {
- foreach (LayoutControlItem Item in _LCItemList)
- {
- if (dr.Table.Columns.Contains(Item.Name))
- {
- LCItemUtil.SetValue_LCItem(Item, dr[Item.Name]);
- }
- }
- }
- }
- }
|