CEL_Payroll/Payroll.BO/Discipline Action Management/DAMaster.cs

1051 lines
22 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;
using Ease.CoreV35.Model;
using Ease.CoreV35.Caching;
using System.Data.Linq.Mapping;
using System.Data;
namespace Payroll.BO
{
#region Class DAMAster
[Serializable]
public class DAMaster : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(DAMaster));
#endregion
#region Constructor
public DAMaster()
{
_dAMCode = String.Empty;
_dAMNote = String.Empty;
_dAMFileName = String.Empty;
_dAMDate = DateTime.MinValue;
_dACNote = String.Empty;
_dCDate = DateTime.MinValue;
_dAPRIFileName = String.Empty;
_dPRIDate = DateTime.MinValue;
_dACOMFileName = String.Empty;
_dAEmployees = null;
_dAComplains = null;
_dAEmpExplanations = null;
_dAPunishments = null;
_dAComEmps = null;
_dAPRIEmps = null;
_dACSheetFileName = String.Empty;
_dACSheetNote = String.Empty;
_dCSheetDate = DateTime.MinValue;
}
#endregion
#region Properties
#region DAMCode : string
private string _dAMCode;
public string DAMCode
{
get { return _dAMCode; }
set
{
base.OnPropertyChange<string>("dAMCode", _dAMCode, value);
_dAMCode = value;
}
}
#endregion
#region DAMNote : string
private string _dAMNote;
public string DAMNote
{
get { return _dAMNote; }
set
{
base.OnPropertyChange<string>("dAMNote", _dAMNote, value);
_dAMNote = value;
}
}
#endregion
#region DAMFileName : string
private string _dAMFileName;
public string DAMFileName
{
get { return _dAMFileName; }
set
{
base.OnPropertyChange<string>("dAMFileName", _dAMFileName, value);
_dAMFileName = value;
}
}
#endregion
#region DAMDate : DateTime
private DateTime _dAMDate;
public DateTime DAMDate
{
get { return _dAMDate; }
set
{
base.OnPropertyChange<DateTime>("dAMDate", _dAMDate, value);
_dAMDate = value;
}
}
#endregion
#region DACNote : string
private string _dACNote;
public string DACNote
{
get { return _dACNote; }
set
{
base.OnPropertyChange<string>("dACNote", _dACNote, value);
_dACNote = value;
}
}
#endregion
#region DCDate : DateTime
private DateTime _dCDate;
public DateTime DCDate
{
get { return _dCDate; }
set
{
base.OnPropertyChange<DateTime>("dCDate", _dCDate, value);
_dCDate = value;
}
}
#endregion
#region DAPRIFileName : string
private string _dAPRIFileName;
public string DAPRIFileName
{
get { return _dAPRIFileName; }
set
{
base.OnPropertyChange<string>("dAPRIFileName", _dAPRIFileName, value);
_dAPRIFileName = value;
}
}
#endregion
#region DPRIDate : DateTime
private DateTime _dPRIDate;
public DateTime DPRIDate
{
get { return _dPRIDate; }
set
{
base.OnPropertyChange<DateTime>("dPRIDate", _dPRIDate, value);
_dPRIDate = value;
}
}
#endregion
#region DACOMFileName : string
private string _dACOMFileName;
public string DACOMFileName
{
get { return _dACOMFileName; }
set
{
base.OnPropertyChange<string>("dACOMFileName", _dACOMFileName, value);
_dACOMFileName = value;
}
}
#endregion
#region DCSheetDate : DateTime
private DateTime _dCSheetDate;
public DateTime DCSheetDate
{
get { return _dCSheetDate; }
set
{
base.OnPropertyChange<DateTime>("dCSheetDate", _dCSheetDate, value);
_dCSheetDate = value;
}
}
#endregion
#region DACSheetNote : string
private string _dACSheetNote;
public string DACSheetNote
{
get { return _dACSheetNote; }
set
{
base.OnPropertyChange<string>("dACSheetNote", _dACSheetNote, value);
_dACSheetNote = value;
}
}
#endregion
#region DACSheetFileName : string
private string _dACSheetFileName;
public string DACSheetFileName
{
get { return _dACSheetFileName; }
set
{
base.OnPropertyChange<string>("dACSheetFileName", _dACSheetFileName, value);
_dACSheetFileName = value;
}
}
#endregion
#region Property DAEmployees : DAEmployee
private ObjectsTemplate<DAEmployee> _dAEmployees;
public ObjectsTemplate<DAEmployee> DAEmployees
{
get
{
if (_dAEmployees == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
{
_dAEmployees = Service.GetDAEmployees(this.ID);
}
return _dAEmployees;
}
set
{
_dAEmployees = value;
}
}
#endregion
#region Property DAComplains : DAComplain
private ObjectsTemplate<DAComplain> _dAComplains;
public ObjectsTemplate<DAComplain> DAComplains
{
get
{
if (_dAComplains == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
{
_dAComplains = Service.GetDAComplains(this.ID);
}
return _dAComplains;
}
set
{
_dAComplains = value;
}
}
#endregion
#region Property DAEmpExplanations : DAEmpExplanation
private ObjectsTemplate<DAEmpExplanation> _dAEmpExplanations;
public ObjectsTemplate<DAEmpExplanation> DAEmpExplanations
{
get
{
if (_dAEmpExplanations == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
{
_dAEmpExplanations = Service.GetDAEmpExplanations(this.ID);
}
return _dAEmpExplanations;
}
set
{
_dAEmpExplanations = value;
}
}
#endregion
#region Property DAPunishments : DAPunishments
private ObjectsTemplate<DAPunishment> _dAPunishments;
public ObjectsTemplate<DAPunishment> DAPunishments
{
get
{
if (_dAPunishments == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
{
_dAPunishments = Service.GetDAPunishments(this.ID);
}
return _dAPunishments;
}
set
{
_dAPunishments = value;
}
}
#endregion
#region Property DAComEmps : DAComEmp
private ObjectsTemplate<DAComEmp> _dAComEmps;
public ObjectsTemplate<DAComEmp> DAComEmps
{
get
{
if (_dAComEmps == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
{
_dAComEmps = Service.GetDAComEmps(this.ID);
}
return _dAComEmps;
}
set
{
_dAComEmps = value;
}
}
#endregion
#region Property DAPRIEmps : DAPRIEmps
private ObjectsTemplate<DAPRIEmp> _dAPRIEmps;
public ObjectsTemplate<DAPRIEmp> DAPRIEmps
{
get
{
if (_dAPRIEmps == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
{
_dAPRIEmps = Service.GetDAPRIEmps(this.ID);
}
return _dAPRIEmps;
}
set
{
_dAPRIEmps = value;
}
}
#endregion
#region Service Factory IDAMasterService : IDAMasterService
internal static IDAMasterService Service
{
get { return Services.Factory.CreateService<IDAMasterService>(typeof(IDAMasterService)); }
}
#endregion
#endregion
#region Function
public static DAMaster Get(ID nID)
{
DAMaster daMaster = null;
#region Cache Header
daMaster = (DAMaster)_cache["Get", nID];
if (daMaster != null)
return daMaster;
#endregion
daMaster = Service.Get(nID);
#region Cache Footer
_cache.Add(daMaster, "Get", nID);
#endregion
return daMaster;
}
public static DAMaster Get(string code)
{
DAMaster daMaster = null;
#region Cache Header
daMaster = (DAMaster)_cache["Get", code];
if (daMaster != null)
return daMaster;
#endregion
daMaster = Service.Get(code);
#region Cache Footer
_cache.Add(daMaster, "Get", code);
#endregion
return daMaster;
}
public static ObjectsTemplate<DAMaster> GetDAs(string sql)
{
#region Cache Header
ObjectsTemplate<DAMaster> oDAMasters = _cache["Get"] as ObjectsTemplate<DAMaster>;
if (oDAMasters != null)
return oDAMasters;
#endregion
try
{
oDAMasters = Service.GetDAs(sql);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(oDAMasters, "Get");
#endregion
return oDAMasters;
}
public ID Save()
{
this.SetAuditTrailProperties();
return Service.Save(this);
}
public void Delete(ID id)
{
Service.Delete(id);
}
public int GetDAEmployeeIndexByEmployeeID(ID id)
{
int count = 0;
foreach (DAEmployee emp in this.DAEmployees)
{
if (emp.EmployeeID == id)
{
return count;
}
count++;
}
return -1;
}
#endregion
}
#endregion
#region Child Classes
#region Class DAEmployee
[Serializable]
public class DAEmployee :BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(DAEmployee));
#endregion
#region Constructor
public DAEmployee()
{
_dAID = ID.FromInteger(0);
_employeeID = ID.FromInteger(0);
}
#endregion
#region Properties
#region DAID : ID
private ID _dAID;
public ID DAID
{
get { return _dAID; }
set { _dAID = value; }
}
#endregion
#region EmployeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
#endregion
#endregion
}
#endregion
#region Class DAComplain
[Serializable]
public class DAComplain : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(DAComplain));
#endregion
#region Constructor
public DAComplain()
{
_dAID = ID.FromInteger(0);
_complainID = ID.FromInteger(0);
}
#endregion
#region Properties
#region DAID : ID
private ID _dAID;
public ID DAID
{
get { return _dAID; }
set { _dAID = value; }
}
#endregion
#region ComplainID : ID
private ID _complainID;
public ID ComplainID
{
get { return _complainID; }
set { _complainID = value; }
}
#endregion
#endregion
}
#endregion
#region Class DAChargesheet
[Serializable]
public class DAChargesheet : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(DAChargesheet));
#endregion
#region Constructor
public DAChargesheet()
{
_dAID = ID.FromInteger(0);
_dACSNote = String.Empty;
_dACSFileName = String.Empty;
_dACSDate = DateTime.MinValue;
}
#endregion
#region Properties
#region DAID : ID
private ID _dAID;
public ID DAID
{
get { return _dAID; }
set { _dAID = value; }
}
#endregion
#region DACSNote : string
private string _dACSNote;
public string DACSNote
{
get { return _dACSNote; }
set { _dACSNote = value; }
}
#endregion
#region DACSFileName : string
private string _dACSFileName;
public string DACSFileName
{
get { return _dACSFileName; }
set { _dACSFileName = value; }
}
#endregion
#region DACSDate: Datetime
private DateTime _dACSDate;
public DateTime DACSDate
{
get { return _dACSDate; }
set { _dACSDate = value; }
}
#endregion
#endregion
}
#endregion
#region Class DAEmpExplanation
[Serializable]
public class DAEmpExplanation : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(DAEmpExplanation));
#endregion
#region Constructor
public DAEmpExplanation()
{
_dAID = ID.FromInteger(0);
_employeeID = ID.FromInteger(0);
_dAEXNote = String.Empty;
_fileName = String.Empty;
_dAEXDate = DateTime.MinValue;
_hRNote = String.Empty;
}
#endregion
#region Properties
#region DAID : ID
private ID _dAID;
public ID DAID
{
get { return _dAID; }
set { _dAID = value; }
}
#endregion
#region EMPLOYEEID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
#endregion
#region DAEXNote : string
private string _dAEXNote;
public string DAEXNote
{
get { return _dAEXNote; }
set { _dAEXNote = value; }
}
#endregion
#region DAEXDate: Datetime
private DateTime _dAEXDate;
public DateTime DAEXDate
{
get { return _dAEXDate; }
set { _dAEXDate = value; }
}
#endregion
#region FileName : string
private string _fileName;
public string FileName
{
get { return _fileName; }
set { _fileName = value; }
}
#endregion
#region HRNote : string
private string _hRNote;
public string HRNote
{
get { return _hRNote; }
set { _hRNote = value; }
}
#endregion
#endregion
}
#endregion
#region Class DAPunishment
[Serializable]
public class DAPunishment : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(DAPunishment));
#endregion
#region Constructor
public DAPunishment()
{
_dAID = ID.FromInteger(0);
_employeeID = ID.FromInteger(0);
_dAPNote = String.Empty;
_dAPFromDate = DateTime.MinValue;
_dAPToDate = DateTime.MinValue;
_dAPDate = DateTime.MinValue;
_dAPEmployees = null;
}
#endregion
#region Properties
#region DAID : ID
private ID _dAID;
public ID DAID
{
get { return _dAID; }
set { _dAID = value; }
}
#endregion
#region EmployeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
#endregion
#region DAPNote : string
private string _dAPNote;
public string DAPNote
{
get { return _dAPNote; }
set { _dAPNote = value; }
}
#endregion
#region DAPDate: Datetime
private DateTime _dAPDate;
public DateTime DAPDate
{
get { return _dAPDate; }
set { _dAPDate = value; }
}
#endregion
#region DAPFromDate : DateTime
private DateTime _dAPFromDate;
public DateTime DAPFromDate
{
get { return _dAPFromDate; }
set { _dAPFromDate = value; }
}
#endregion
#region DAPToDate : DateTime
private DateTime _dAPToDate;
public DateTime DAPToDate
{
get { return _dAPToDate; }
set { _dAPToDate = value; }
}
#endregion
#region DAPFileName : string
private string _dDAPFileName;
public string DAPFileName
{
get { return _dDAPFileName; }
set { _dDAPFileName = value; }
}
#endregion
#region Property DAPEmployees : DAPEmployee
private ObjectsTemplate<DAPEmployee> _dAPEmployees;
public ObjectsTemplate<DAPEmployee> DAPEmployees
{
get
{
if (_dAPEmployees == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
{
_dAPEmployees = DAMaster.Service.GetDAPEmployees(this.ID);
}
return _dAPEmployees;
}
set
{
_dAPEmployees = value;
}
}
#endregion
#endregion
}
#endregion
#region Class DAComEmp
[Serializable]
public class DAComEmp : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(DAComEmp));
#endregion
#region Constructor
public DAComEmp()
{
_dAID = ID.FromInteger(0);
_employeeID = ID.FromInteger(0);
}
#endregion
#region Properties
#region DAID : ID
private ID _dAID;
public ID DAID
{
get { return _dAID; }
set { _dAID = value; }
}
#endregion
#region ComplainID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
#endregion
#endregion
}
#endregion
#region Class DAPEmployee
[Serializable]
public class DAPEmployee : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(DAPEmployee));
#endregion
#region Constructor
public DAPEmployee()
{
_pID = ID.FromInteger(0);
_punishmentID = ID.FromInteger(0);
_dAID = ID.FromInteger(0);
_empID = ID.FromInteger(0);
}
#endregion
#region Properties
#region DAID : ID
private ID _dAID;
public ID DAID
{
get { return _dAID; }
set { _dAID = value; }
}
#endregion
#region PID : ID
private ID _pID;
public ID PID
{
get { return _pID; }
set { _pID = value; }
}
#endregion
#region PunishmentID : ID
private ID _punishmentID;
public ID PunishmentID
{
get { return _punishmentID; }
set { _punishmentID = value; }
}
#endregion
#region EmpID : ID
private ID _empID;
public ID EmpID
{
get { return _empID; }
set { _empID = value; }
}
#endregion
#endregion
}
#endregion
#region Class DAPRIEmp
[Serializable]
public class DAPRIEmp : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(DAPRIEmp));
#endregion
#region Constructor
public DAPRIEmp()
{
_dAID = ID.FromInteger(0);
_employeeID = ID.FromInteger(0);
}
#endregion
#region Properties
#region DAID : ID
private ID _dAID;
public ID DAID
{
get { return _dAID; }
set { _dAID = value; }
}
#endregion
#region EmployeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
#endregion
#endregion
}
#endregion
#endregion
#region IEmployee Service
public interface IDAMasterService
{
DAMaster Get(ID id);
ObjectsTemplate<DAMaster> GetDAs(string sql);
ID Save(DAMaster dAMaster);
void Delete(ID id);
ObjectsTemplate<DAEmployee> GetDAEmployees(ID id);
ObjectsTemplate<DAComplain> GetDAComplains(ID id);
ObjectsTemplate<DAEmpExplanation> GetDAEmpExplanations(ID id);
ObjectsTemplate<DAPunishment> GetDAPunishments(ID id);
ObjectsTemplate<DAComEmp> GetDAComEmps(ID id);
ObjectsTemplate<DAPEmployee> GetDAPEmployees(ID id);
ObjectsTemplate<DAPRIEmp> GetDAPRIEmps(ID id);
DAMaster Get(string code);
}
#endregion
}