208 lines
5.0 KiB
C#
208 lines
5.0 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 GradeSegment
|
|
|
|
[Serializable]
|
|
public class GradeSegment : BasicBaseObject
|
|
{
|
|
#region Cache Store
|
|
|
|
private static Cache _cache = new Cache(typeof(GradeSegment));
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
#region Input validator
|
|
public string[] InputValidator()
|
|
{
|
|
string[] sErrorString = new string[2];
|
|
if (this.Code == "")
|
|
{
|
|
sErrorString[0] = "Code can not be empty";
|
|
sErrorString[1] = "Code";
|
|
return sErrorString;
|
|
}
|
|
if (this.Name == "")
|
|
{
|
|
sErrorString[0] = "Description can not be empty";
|
|
sErrorString[1] = "Description";
|
|
return sErrorString;
|
|
}
|
|
|
|
sErrorString = null;
|
|
return sErrorString;
|
|
}
|
|
#endregion
|
|
|
|
public GradeSegment()
|
|
{
|
|
_code = string.Empty;
|
|
_name = string.Empty;
|
|
_basicPer = 0;
|
|
_status = EnumStatus.Active;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region code : string
|
|
|
|
private string _code;
|
|
public string Code
|
|
{
|
|
get { return _code; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("code", _code, value);
|
|
_code = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region name : string
|
|
|
|
private string _name;
|
|
public string Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("name", _name, value);
|
|
_name = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region name : string
|
|
|
|
private double _basicPer;
|
|
public double BasicPer
|
|
{
|
|
get { return _basicPer; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<double>("BasicPer", _basicPer, value);
|
|
_basicPer = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Service Factory IGradeSegmentService : IGradeSegmentService
|
|
|
|
internal static IGradeSegmentService Service
|
|
{
|
|
get { return Services.Factory.CreateService<IGradeSegmentService>(typeof(IGradeSegmentService)); }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Functions
|
|
|
|
public string GetNextCode()
|
|
{
|
|
return GradeSegment.Service.GetNextCode();
|
|
}
|
|
|
|
public static GradeSegment Get(ID nID)
|
|
{
|
|
GradeSegment oGradeSegment = null;
|
|
#region Cache Header
|
|
oGradeSegment = (GradeSegment)_cache["Get", nID];
|
|
if (oGradeSegment != null)
|
|
return oGradeSegment;
|
|
#endregion
|
|
oGradeSegment = GradeSegment.Service.Get(nID);
|
|
#region Cache Footer
|
|
_cache.Add(oGradeSegment, "Get", nID);
|
|
#endregion
|
|
return oGradeSegment;
|
|
}
|
|
|
|
public static GradeSegment Get(string sCode)
|
|
{
|
|
GradeSegment oGradeSegment = null;
|
|
#region Cache Header
|
|
oGradeSegment = (GradeSegment)_cache["Get", sCode];
|
|
if (oGradeSegment != null)
|
|
return oGradeSegment;
|
|
#endregion
|
|
oGradeSegment = GradeSegment.Service.Get(sCode);
|
|
#region Cache Footer
|
|
_cache.Add(oGradeSegment, "Get", sCode);
|
|
#endregion
|
|
return oGradeSegment;
|
|
}
|
|
|
|
public static ObjectsTemplate<GradeSegment> Get(EnumStatus status)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<GradeSegment> gradeSegments = _cache["Get",status] as ObjectsTemplate<GradeSegment>;
|
|
if (gradeSegments != null)
|
|
return gradeSegments;
|
|
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
gradeSegments = Service.Get(status);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(gradeSegments, "Get",status);
|
|
|
|
#endregion
|
|
|
|
return gradeSegments;
|
|
}
|
|
|
|
public ID Save()
|
|
{
|
|
this.SetAuditTrailProperties();
|
|
return GradeSegment.Service.Save(this);
|
|
}
|
|
public void Delete(ID id)
|
|
{
|
|
GradeSegment.Service.Delete(id);
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region IGradeSegment Service
|
|
|
|
public interface IGradeSegmentService
|
|
{
|
|
GradeSegment Get(ID id);
|
|
ObjectsTemplate<GradeSegment> Get(EnumStatus status);
|
|
ID Save(GradeSegment item);
|
|
void Delete(ID id);
|
|
GradeSegment Get(string sCode);
|
|
string GetNextCode();
|
|
}
|
|
|
|
#endregion
|
|
}
|