337 lines
9.3 KiB
C#
337 lines
9.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Ease.CoreV35;
|
|
using Ease.CoreV35.Model;
|
|
using Ease.CoreV35.Caching;
|
|
using System.Data.Linq.Mapping;
|
|
|
|
namespace Payroll.BO
|
|
{
|
|
#region ControlManager
|
|
|
|
[Serializable]
|
|
public class ControlManager
|
|
{
|
|
#region Constructor
|
|
|
|
private int[] _SelectedIDS = null;
|
|
private string _SelectedValues = string.Empty;
|
|
private string _SelectedCode = string.Empty;
|
|
private string _SelectedDescription = string.Empty;
|
|
private ObjectsTemplate<ObjectTemplate> _SelectedObjects = null;
|
|
private object _SelectedItems = null;
|
|
private string _Parameters = string.Empty;
|
|
private string _Caption = string.Empty;
|
|
private bool _IsMultipleSelection = false;
|
|
private EnumCustomBasicControlType _ControlType = EnumCustomBasicControlType.ListView;
|
|
private string _ChildPropertyName = string.Empty;
|
|
private string _PickerCaption = string.Empty;
|
|
private Payroll.BO.SearchManager.SearchParameter _SearchParam = null;
|
|
private EnumCustomBasicControl _basicObjectOf;
|
|
|
|
public ControlManager()
|
|
{
|
|
_SelectedCode = "Code,Name";
|
|
_Parameters = "Code,Name";
|
|
}
|
|
|
|
public ControlManager(string paremeters, string caption, bool isMultipleSelection,
|
|
EnumCustomBasicControlType controlType, string childPropertyName,
|
|
string pickerCaption, EnumCustomBasicControl basicObject)
|
|
{
|
|
_Caption = caption;
|
|
_Parameters = paremeters;
|
|
_IsMultipleSelection = isMultipleSelection;
|
|
_ControlType = controlType;
|
|
_ChildPropertyName = childPropertyName;
|
|
_PickerCaption = pickerCaption;
|
|
_basicObjectOf = basicObject;
|
|
}
|
|
|
|
public ControlManager(ObjectsTemplate<ObjectTemplate> Source, string paremeters, string caption, bool isMultipleSelection,
|
|
EnumCustomBasicControlType controlType, string childPropertyName,
|
|
string pickerCaption, EnumCustomBasicControl basicObject )
|
|
{
|
|
_SelectedObjects = Source;
|
|
_Caption = caption;
|
|
_Parameters = paremeters;
|
|
_IsMultipleSelection = isMultipleSelection;
|
|
_ControlType = controlType;
|
|
_ChildPropertyName = childPropertyName;
|
|
_PickerCaption = pickerCaption;
|
|
_basicObjectOf = basicObject;
|
|
}
|
|
|
|
|
|
#region SelectedIDs
|
|
public int[] SelectedIDs
|
|
{
|
|
get
|
|
{
|
|
return _SelectedIDS;
|
|
}
|
|
set
|
|
{
|
|
_SelectedIDS = value;
|
|
}
|
|
}
|
|
|
|
public string GetIDs()
|
|
{
|
|
string ids = string.Empty;
|
|
if (_SelectedIDS != null && _SelectedIDS.Length > 0)
|
|
{
|
|
for (int i = 0; i < _SelectedIDS.Length; i++)
|
|
{
|
|
ids += _SelectedIDS[i].ToString() + ",";
|
|
}
|
|
if (ids.Length > 0)
|
|
{
|
|
ids = ids.Substring(0, ids.Length - 1);
|
|
}
|
|
}
|
|
return ids;
|
|
}
|
|
#endregion
|
|
|
|
#region SelectedValues
|
|
public string SelectedValues
|
|
{
|
|
get
|
|
{
|
|
return _SelectedValues;
|
|
}
|
|
set
|
|
{
|
|
_SelectedValues = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region SelectedCode
|
|
public string SelectedCode
|
|
{
|
|
get
|
|
{
|
|
return _SelectedCode;
|
|
}
|
|
set
|
|
{
|
|
_SelectedCode = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region SelectedDescription
|
|
public string SelectedDescription
|
|
{
|
|
get
|
|
{
|
|
return _SelectedDescription;
|
|
}
|
|
set
|
|
{
|
|
_SelectedDescription = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region ObjectsTemplate<ObjectTemplate>
|
|
public ObjectsTemplate<ObjectTemplate> SelectedObjects
|
|
{
|
|
get
|
|
{
|
|
if (_SelectedObjects == null)
|
|
{
|
|
_SelectedObjects = new ObjectsTemplate<ObjectTemplate>();
|
|
}
|
|
return _SelectedObjects;
|
|
}
|
|
set
|
|
{
|
|
_SelectedObjects = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region Object
|
|
public object SelectedItems
|
|
{
|
|
get
|
|
{
|
|
return _SelectedItems;
|
|
}
|
|
set
|
|
{
|
|
_SelectedItems = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Caption
|
|
public string Caption
|
|
{
|
|
get
|
|
{
|
|
return _Caption;
|
|
}
|
|
set
|
|
{
|
|
_Caption = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Caption
|
|
public Payroll.BO.SearchManager.SearchParameter SearchParam
|
|
{
|
|
get
|
|
{
|
|
if (_SelectedIDS == null || _SelectedIDS.Length <=0)
|
|
return null;
|
|
else
|
|
{
|
|
_SearchParam = new Payroll.BO.SearchManager.SearchParameter();
|
|
_SearchParam.DataType = EnumSearchObjDataType.Number;
|
|
_SearchParam.ParameterValue = this.GetIDs();
|
|
_SearchParam.Paramter = this.GetSearchParameter();
|
|
if (_SelectedIDS.Length == 1)
|
|
_SearchParam.SqlOperator = EnumSQLOperator.EqualTo;
|
|
else if (_SelectedIDS.Length > 1)
|
|
_SearchParam.SqlOperator = EnumSQLOperator.In;
|
|
|
|
}
|
|
return _SearchParam;
|
|
}
|
|
set
|
|
{
|
|
_SearchParam = value;
|
|
}
|
|
}
|
|
|
|
// searchParam.Paramter = EnumSearchParameter.GradeID;
|
|
private EnumSearchParameter GetSearchParameter()
|
|
{
|
|
EnumSearchParameter sparameter = EnumSearchParameter.GradeID;
|
|
//return sparameter;
|
|
switch (_basicObjectOf)
|
|
{
|
|
case EnumCustomBasicControl.Grade:
|
|
sparameter = EnumSearchParameter.GradeID;
|
|
break;
|
|
case EnumCustomBasicControl.Category:
|
|
sparameter = EnumSearchParameter.CategoryID;
|
|
break;
|
|
case EnumCustomBasicControl.Department:
|
|
sparameter = EnumSearchParameter.DepartmentID;
|
|
break;
|
|
case EnumCustomBasicControl.Location:
|
|
sparameter = EnumSearchParameter.LocationID;
|
|
break;
|
|
case EnumCustomBasicControl.Designation:
|
|
sparameter = EnumSearchParameter.DesignationID;
|
|
break;
|
|
case EnumCustomBasicControl.GradeSagment:
|
|
sparameter = EnumSearchParameter.GradeSegmentID;
|
|
break;
|
|
case EnumCustomBasicControl.CostCenter:
|
|
sparameter = EnumSearchParameter.CostCenterID;
|
|
break;
|
|
case EnumCustomBasicControl.Religion:
|
|
sparameter = EnumSearchParameter.ReligionID;
|
|
break;
|
|
case EnumCustomBasicControl.Skills:
|
|
sparameter = EnumSearchParameter.SkillID;
|
|
break;
|
|
case EnumCustomBasicControl.ProdBonusSetup:
|
|
sparameter = EnumSearchParameter.ProductionBonusSetupID;
|
|
break;
|
|
default:
|
|
throw new ServiceException("Search parameter value not defined");
|
|
break;
|
|
}
|
|
return sparameter;
|
|
}
|
|
#endregion
|
|
|
|
#region Parameters
|
|
public string Parameters
|
|
{
|
|
get
|
|
{
|
|
return _Parameters;
|
|
}
|
|
set
|
|
{
|
|
_Parameters = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IsMultipleSelection
|
|
public bool IsMultipleSelection
|
|
{
|
|
get
|
|
{
|
|
return _IsMultipleSelection;
|
|
}
|
|
set
|
|
{
|
|
_IsMultipleSelection = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region ControlType
|
|
public EnumCustomBasicControlType ControlType
|
|
{
|
|
get
|
|
{
|
|
return _ControlType;
|
|
}
|
|
set
|
|
{
|
|
_ControlType = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region ChildPropertyName
|
|
public string ChildPropertyName
|
|
{
|
|
get
|
|
{
|
|
return _ChildPropertyName;
|
|
}
|
|
set
|
|
{
|
|
_ChildPropertyName = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region PickerCaption
|
|
public string PickerCaption
|
|
{
|
|
get
|
|
{
|
|
return _PickerCaption;
|
|
}
|
|
set
|
|
{
|
|
_PickerCaption = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
}
|