CEL_Payroll/Payroll.BO/Budget/AppraisalPoint.cs
2024-09-17 14:30:13 +06:00

137 lines
3.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.CoreV35.Model;
namespace Payroll.BO
{
[Serializable]
public class AppraisalPoint : BasicBaseObject
{
#region delegate
public delegate void ItemChanged();
#endregion
#region Constructor
public AppraisalPoint()
{
_code = "";
_name = "";
}
#endregion
#region Properties
#region Input Validator
public string[] InputValidator()
{
string[] sErrorString = new string[2];
if (this.Name == "")
{
sErrorString[0] = "Name can not be empty";
sErrorString[1] = "Name";
return sErrorString;
}
if (this.Code == "")
{
sErrorString[0] = "Code can not be empty";
sErrorString[1] = "Code";
return sErrorString;
}
if (this.ID.IsUnassigned && !AppraisalPoint.CheckCode(this.Code))
{
sErrorString[0] = "Code can not be same \n Plz select some different code";
sErrorString[1] = "Code";
return sErrorString;
}
sErrorString = null;
return sErrorString;
}
#endregion
#region Code
private string _code;
public string Code
{
get { return _code; }
set { _code = value; }
}
#endregion
#region Name
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
#endregion
#region Service Factory IAppraisalPointService : IAppraisalPointService
internal static IAppraisalPointService Service
{
get { return Services.Factory.CreateService<IAppraisalPointService>(typeof(IAppraisalPointService)); }
}
#endregion
#endregion
#region Functions
#region Get
public static ObjectsTemplate<AppraisalPoint> Get(EnumStatus status)
{
return AppraisalPoint.Service.Get(status);
}
#endregion
#region Delete
public static void Delete(ID id)
{
AppraisalPoint.Service.Delete(id);
}
#endregion
#region CheckCode
public static bool CheckCode(string code)
{
return AppraisalPoint.Service.CheckCode(code);
}
#endregion
#region Save
public ID Save()
{
this.SetAuditTrailProperties();
return AppraisalPoint.Service.Save(this);
}
#endregion
#endregion
}
#region IAppraisalPointService
public interface IAppraisalPointService
{
ObjectsTemplate<AppraisalPoint> Get(EnumStatus status);
ID Save(AppraisalPoint item);
void Delete(ID id);
bool CheckCode(string code);
}
#endregion
}