271 lines
7.1 KiB
C#
271 lines
7.1 KiB
C#
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Collections;
|
||
|
using System.Text;
|
||
|
using System.Windows.Forms;
|
||
|
using Ease.CoreV35;
|
||
|
namespace Ease.UICreator
|
||
|
{
|
||
|
#region Class
|
||
|
public class MasterFormlvw
|
||
|
{
|
||
|
#region variables
|
||
|
private string _caption;
|
||
|
private string _propertyName;
|
||
|
private int _height;
|
||
|
private int _width;
|
||
|
private string _format;
|
||
|
private object _sourceCollection;
|
||
|
private string _sourceRelationProperty;
|
||
|
private HorizontalAlignment _columnAlignment = HorizontalAlignment.Left;
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region constructor
|
||
|
public MasterFormlvw()
|
||
|
{
|
||
|
_caption = "";
|
||
|
_propertyName = "";
|
||
|
_height = 100;
|
||
|
_width = 100;
|
||
|
_format = "";
|
||
|
_sourceCollection = null;
|
||
|
_sourceRelationProperty = "";
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region Properties
|
||
|
|
||
|
#region Caption
|
||
|
public string Caption
|
||
|
{
|
||
|
get { return _caption; }
|
||
|
set { _caption = value; }
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region Source
|
||
|
public string PropertyName
|
||
|
{
|
||
|
get { return _propertyName; }
|
||
|
set { _propertyName = value; }
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region Source Object Property
|
||
|
public string sourceRelationProperty
|
||
|
{
|
||
|
get { return _sourceRelationProperty; }
|
||
|
set { _sourceRelationProperty = value; }
|
||
|
}
|
||
|
#endregion
|
||
|
#region Height
|
||
|
public int Height
|
||
|
{
|
||
|
get { return _height; }
|
||
|
set { _height = value; }
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region Width
|
||
|
public int Width
|
||
|
{
|
||
|
get { return _width; }
|
||
|
set { _width = value; }
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region Format
|
||
|
public string Format
|
||
|
{
|
||
|
get { return _format; }
|
||
|
set { _format = value; }
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region SourceCollection
|
||
|
public object SourceCollection
|
||
|
{
|
||
|
get { return _sourceCollection; }
|
||
|
set { _sourceCollection = value; }
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
/// <summary>
|
||
|
/// Gets or Sets Column Alignment
|
||
|
/// </summary>
|
||
|
public HorizontalAlignment ColumnAlignment
|
||
|
{
|
||
|
get { return _columnAlignment; }
|
||
|
set { _columnAlignment = value; }
|
||
|
}
|
||
|
#endregion
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region Collection
|
||
|
public class MasterFormlvws : CollectionBase
|
||
|
{
|
||
|
#region Methods
|
||
|
|
||
|
#region Indexer
|
||
|
public MasterFormlvw this[int index]
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return ((MasterFormlvw)List[index]);
|
||
|
}
|
||
|
set
|
||
|
{
|
||
|
List[index] = value;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region Indexer
|
||
|
public MasterFormlvw this[string PropertyName]
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
foreach (MasterFormlvw oItem in this)
|
||
|
{
|
||
|
if (oItem.PropertyName == PropertyName)
|
||
|
{
|
||
|
return oItem;
|
||
|
}
|
||
|
}
|
||
|
throw new Exception("Property not exist in the collection");
|
||
|
}
|
||
|
//set
|
||
|
//{
|
||
|
// bool bValid =false ;
|
||
|
// foreach (MasterFormlvw oItem in this)
|
||
|
// {
|
||
|
// if (oItem.PropertyName == PropertyName)
|
||
|
// {
|
||
|
// oItem =value;
|
||
|
// bValid = true;
|
||
|
// }
|
||
|
// }
|
||
|
// if (bValid == false)
|
||
|
// {
|
||
|
// throw new ServiceException("Property not exist in the collection");
|
||
|
// }
|
||
|
//}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region Add
|
||
|
|
||
|
public int Add(MasterFormlvw value)
|
||
|
{
|
||
|
return (List.Add(value));
|
||
|
}
|
||
|
|
||
|
public int Add(string caption, string propertyName)
|
||
|
{
|
||
|
MasterFormlvw item = new MasterFormlvw();
|
||
|
item.Caption = caption;
|
||
|
item.PropertyName = propertyName;
|
||
|
return (List.Add(item));
|
||
|
}
|
||
|
|
||
|
public int Add(string caption, string propertyName, int nHeight, int nWidth)
|
||
|
{
|
||
|
MasterFormlvw item = new MasterFormlvw();
|
||
|
item.Caption = caption;
|
||
|
item.PropertyName = propertyName;
|
||
|
item.Height = nHeight;
|
||
|
item.Width = nWidth;
|
||
|
return (List.Add(item));
|
||
|
}
|
||
|
|
||
|
public int Add(string caption, string propertyName, int nHeight, int nWidth, string sFormat)
|
||
|
{
|
||
|
MasterFormlvw item = new MasterFormlvw();
|
||
|
item.Caption = caption;
|
||
|
item.PropertyName = propertyName;
|
||
|
item.Height = nHeight;
|
||
|
item.Width = nWidth;
|
||
|
item.Format = sFormat;
|
||
|
return (List.Add(item));
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region IndexOf
|
||
|
public int IndexOf(MasterFormlvw value)
|
||
|
{
|
||
|
return (List.IndexOf(value));
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region Insert
|
||
|
public void Insert(int index, MasterFormlvw value)
|
||
|
{
|
||
|
List.Insert(index, value);
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region Remove
|
||
|
public void Remove(MasterFormlvw value)
|
||
|
{
|
||
|
List.Remove(value);
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
public void IsDuplicateCtlName()
|
||
|
{
|
||
|
int nIndex = -1;
|
||
|
foreach (MasterFormlvw item in this)
|
||
|
{
|
||
|
nIndex = nIndex + 1;
|
||
|
for (int i = 0; i < this.Count; i++)
|
||
|
{
|
||
|
if (nIndex != i)
|
||
|
{
|
||
|
if (this[nIndex].PropertyName == this[i].PropertyName)
|
||
|
{
|
||
|
throw new Exception("Duplicate Control Name Exist:" + this[nIndex].PropertyName);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#region Contains
|
||
|
public bool Contains(MasterFormlvw value)
|
||
|
{
|
||
|
// If value is not of type MasterFormlvw, this will return false.
|
||
|
return (List.Contains(value));
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region Migth be needed
|
||
|
//protected override void OnInsert(int index, Object value)
|
||
|
//{
|
||
|
// // Insert additional code to be run only when inserting values.
|
||
|
//}
|
||
|
|
||
|
//protected override void OnRemove(int index, Object value)
|
||
|
//{
|
||
|
// // Insert additional code to be run only when removing values.
|
||
|
//}
|
||
|
|
||
|
//protected override void OnSet(int index, Object oldValue, Object newValue)
|
||
|
//{
|
||
|
// // Insert additional code to be run only when setting values.
|
||
|
//}
|
||
|
|
||
|
//protected override void OnValidate(Object value)
|
||
|
//{
|
||
|
// if (value.GetType() != typeof(MasterFormlvw))
|
||
|
// throw new ArgumentException("value must be of type List view column.", "value");
|
||
|
//}
|
||
|
#endregion
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
#endregion
|
||
|
}
|