CEL_Payroll/Payroll.BO/Budget/BudgetNewJoiner.cs

473 lines
12 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.CoreV35.Caching;
using Ease.CoreV35.Model;
namespace Payroll.BO
{
#region class BudgetNewJoiner
[Serializable]
public class BudgetNewJoiner : ObjectTemplate
{
#region Cache Store
private static Cache _cache = new Cache(typeof(BudgetNewJoiner));
#endregion
#region Constructor
public BudgetNewJoiner()
{
_basicSalary = 0;
_budgetID = null;
_departmentID = null;
_categoryID = null;
_gradeID = null;
_incrementPercentage = 0;
_locationID = null;
_nextIncrementalMonth = 0;
_noofEmployee = 0;
_fromDate = DateTime.MinValue;
_grossSalary = 0;
#region Child Variables
_oBudgetNewJoinerCrGs = null;
#endregion
}
#endregion
#region Properties
#region Parent Properties
#region BasicSalary : double
private double _basicSalary;
public double BasicSalary
{
get { return _basicSalary; }
set { _basicSalary = value; }
}
#endregion
#region GrossSalary : double
private double _grossSalary;
public double GrossSalary
{
get { return _grossSalary; }
set { _grossSalary = value; }
}
#endregion
#region BudgetID : ID
private ID _budgetID;
public ID BudgetID
{
get { return _budgetID; }
set { _budgetID = value; }
}
#endregion
#region DepartmentID : ID
private ID _departmentID;
public ID DepartmentID
{
get { return _departmentID; }
set { _departmentID = value; }
}
#endregion
#region GradeID : ID
private ID _gradeID;
public ID GradeID
{
get { return _gradeID; }
set { _gradeID = value; }
}
#endregion
#region CategoryID : ID
private ID _categoryID;
public ID CategoryID
{
get { return _categoryID; }
set { _categoryID = value; }
}
#endregion
#region IncrementPercentage : double
private double _incrementPercentage;
public double IncrementPercentage
{
get { return _incrementPercentage; }
set { _incrementPercentage = value; }
}
#endregion
#region LocationID : ID
private ID _locationID;
public ID LocationID
{
get { return _locationID; }
set { _locationID = value; }
}
#endregion
#region NextIncrementalMonth : int
private int _nextIncrementalMonth;
public int NextIncrementalMonth
{
get { return _nextIncrementalMonth; }
set { _nextIncrementalMonth = value; }
}
#endregion
#region NoofEmployee : int
private int _noofEmployee;
public int NoofEmployee
{
get { return _noofEmployee; }
set { _noofEmployee = value; }
}
#endregion
#region grade : Grade
private Grade _grade;
public Grade Grade
{
get
{
if (_gradeID != null && !_gradeID.IsUnassigned)
{
if (_gradeID.Integer > 0 && _grade == null)
{
_grade = new Grade();
_grade = Grade.Get(_gradeID);
}
}
return this._grade;
}
set
{
_grade = value;
}
}
#endregion
#region department : Department
private Department _department;
public Department Department
{
get
{
if (_departmentID != null && !_departmentID.IsUnassigned)
{
if (_departmentID.Integer > 0 && _department == null)
{
_department = new Department();
_department = Department.Get(_departmentID);
}
}
return this._department;
}
set
{
_department = value;
}
}
#endregion
#region location : Location
private Location _location;
public Location Location
{
get
{
if (_locationID != null && !_locationID.IsUnassigned)
{
if (_locationID.Integer > 0 && _location == null)
{
_location = new Location();
_location = Location.Get(_locationID);
}
}
return this._location;
}
set
{
_location = value;
}
}
#endregion
#region location : Location
private Category _category;
public Category Category
{
get
{
if (_categoryID != null && !_categoryID.IsUnassigned)
{
if (_categoryID.Integer > 0 && _category == null)
{
_category = new Category();
_category = Category.Get(_categoryID);
}
}
return this._category;
}
set
{
_category = value;
}
}
#endregion
#region FromDate : DateTime
private DateTime _fromDate;
public DateTime FromDate
{
get { return _fromDate; }
set { _fromDate = value; }
}
#endregion
#endregion
#region Child Properties
#region BudgetNewJoinerCrG Property
private ObjectsTemplate<BudgetNewJoinerCrG> _oBudgetNewJoinerCrGs;
public ObjectsTemplate<BudgetNewJoinerCrG> OBudgetNewJoinerCrGs
{
get
{
if (_oBudgetNewJoinerCrGs == null)
{
_oBudgetNewJoinerCrGs = new ObjectsTemplate<BudgetNewJoinerCrG>();
if (!this.ID.IsUnassigned)
_oBudgetNewJoinerCrGs = BudgetNewJoiner.Service.GetBudgetNewJoinerCrGs(base.ID);
}
return _oBudgetNewJoinerCrGs;
}
set { _oBudgetNewJoinerCrGs = value; }
}
#endregion
#endregion
#region Service Factory IBudgetNewJoinerService : IBudgetNewJoinerService
internal static IBudgetNewJoinerService Service
{
get { return Services.Factory.CreateService<IBudgetNewJoinerService>(typeof(IBudgetNewJoinerService)); }
}
#endregion
#endregion
public Employee CreateEmployee(int joinerCount)
{
Employee oEmp = new Employee();
oEmp.Name = joinerCount.ToString();
oEmp.GradeID = this.GradeID;
oEmp.DepartmentID = this.DepartmentID;
oEmp.DepartmentID = this.DepartmentID;
oEmp.CategoryID = this.CategoryID;
oEmp.JoiningDate = _fromDate;
oEmp.BasicSalary = this.BasicSalary;
oEmp.GrossSalary = this.GrossSalary;
return oEmp;
}
#region Function(s)
#region Get
public static BudgetNewJoiner Get(ID nID)
{
BudgetNewJoiner oBudgetNewJoiner = null;
#region Cache Header
oBudgetNewJoiner = (BudgetNewJoiner)_cache["Get", nID];
if (oBudgetNewJoiner != null)
return oBudgetNewJoiner;
#endregion
try
{
oBudgetNewJoiner = Service.Get(nID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(oBudgetNewJoiner, "Get", nID);
#endregion
return oBudgetNewJoiner;
}
public static ObjectsTemplate<BudgetNewJoiner> Get()
{
#region Cache Header
ObjectsTemplate<BudgetNewJoiner> oBudgetNewJoiners = _cache["Get"] as ObjectsTemplate<BudgetNewJoiner>;
if (oBudgetNewJoiners != null)
return oBudgetNewJoiners;
#endregion
try
{
oBudgetNewJoiners = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(oBudgetNewJoiners, "Get");
#endregion
return oBudgetNewJoiners;
}
public static ObjectsTemplate<BudgetNewJoiner> Get(int nBudID)
{
#region Cache Header
ObjectsTemplate<BudgetNewJoiner> oBudgetNewJoiners = _cache["Get"] as ObjectsTemplate<BudgetNewJoiner>;
if (oBudgetNewJoiners != null)
return oBudgetNewJoiners;
#endregion
try
{
oBudgetNewJoiners = Service.Get(nBudID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(oBudgetNewJoiners, "Get");
#endregion
return oBudgetNewJoiners;
}
#endregion
#region Save
public ID Save()
{
//SetAuditTrailProperties();
return Service.Save(this);
}
#endregion
#region Delete
public void Delete(ID id)
{
Service.Delete(id);
}
#endregion
#endregion
}
#endregion
#region Child Object(s)
[Serializable]
public class BudgetNewJoinerCrG : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(BudgetNewJoinerCrG));
#endregion
#region Constructor
public BudgetNewJoinerCrG()
{
_cCID = null;
_budgetNewJoinerID = null;
_percentage = 0;
}
#endregion
#region Properties
#region BudgetNewJoinerID : ID
private ID _budgetNewJoinerID;
public ID BudgetNewJoinerID
{
get { return _budgetNewJoinerID; }
set { _budgetNewJoinerID = value; }
}
#endregion
#region CCID : ID
private ID _cCID;
public ID CCID
{
get { return _cCID; }
set { _cCID = value; }
}
#endregion
#region Percentage : double
private double _percentage;
public double Percentage
{
get { return _percentage; }
set { _percentage = value; }
}
#endregion
#region Costcenter : CC
private Costcenter _CC;
public Costcenter CC
{
get
{
if (_cCID.IsUnassigned == false && _cCID.Integer > 0 && _CC == null)
{
_CC = new Costcenter();
_CC = Costcenter.Get(_cCID);
}
return this._CC;
}
set
{
_CC = value;
}
}
#endregion
#endregion
}
#endregion
#region IBudgetNewJoinerService
public interface IBudgetNewJoinerService
{
BudgetNewJoiner Get(ID nID);
ObjectsTemplate<BudgetNewJoiner> Get();
ObjectsTemplate<BudgetNewJoiner> Get(int nBudID);
ID Save(BudgetNewJoiner item);
void Delete(ID nID);
ObjectsTemplate<BudgetNewJoinerCrG> GetBudgetNewJoinerCrGs(ID baseID);
}
#endregion
}