CEL_Payroll/Ease.UICreator/SingleFormComboBox.cs

131 lines
3.1 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Text;
using Ease.CoreV35.Model;
using Ease.CoreV35.Caching;
namespace Ease.UICreator
{
#region enum
public enum enmComboType
{
CBTDropDownList = 1,
CBTDropDown = 2
}
public enum enmCboPopulatedFrom
{
Enum = 1,
Collection = 2
}
#endregion
#region class
public class SingleFormComboBox
{
#region variables
private ObjectsTemplate<ObjectTemplate> _comboSource;
private bool _hasDefaultItem;
private string _defaultItemName;
private string _dataPropertyName;
private string _DataSourcePropertyName;
private string _displayName;
private enmComboType _comboType;
private enmCboPopulatedFrom _populatedFrom;
#endregion
#region constructor
public SingleFormComboBox()
{
//_comboSource = new object();
_hasDefaultItem = false;
_defaultItemName = "";
_dataPropertyName = "";
_DataSourcePropertyName = "";
_displayName = "";
_comboType = enmComboType.CBTDropDownList;
_populatedFrom = enmCboPopulatedFrom.Enum;
}
#endregion
public void AddComboSource<T>(List<T> source) where T : ObjectTemplate
{
_comboSource = new ObjectsTemplate<ObjectTemplate>();
foreach (var item in source)
_comboSource.Add(item);
}
#region properties
#region ComboSource
public ObjectsTemplate<ObjectTemplate> ComboSource
{
get { return _comboSource; }
set { _comboSource = value; }
}
#endregion
#region Combo Populated From
public enmCboPopulatedFrom PopulatedFrom
{
get { return _populatedFrom; }
set { _populatedFrom = value; }
}
#endregion
#region Source
public string DefaultItemName
{
get { return _defaultItemName; }
set { _defaultItemName = value; }
}
#endregion
#region HasDefaultItem
public bool HasDefaultItem
{
get { return _hasDefaultItem; }
set { _hasDefaultItem = value; }
}
#endregion
#region DataPropertyName
public string DataPropertyName
{
get { return _dataPropertyName; }
set { _dataPropertyName = value; }
}
#endregion
#region Data Source PropertyName
public string DataSourcePropertyName
{
get { return _DataSourcePropertyName; }
set { _DataSourcePropertyName = value; }
}
#endregion
#region ComboType
public enmComboType ComboType
{
get { return _comboType; }
set { _comboType = value; }
}
#endregion
#region DisplayName
public string DisplayName
{
get { return _displayName; }
set { _displayName = value; }
}
#endregion
#endregion
}
#endregion
}