EchoTex_Payroll/HRM.BO/Basic/Location.cs

166 lines
4.8 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using System;
using System.Collections.Generic;
using System.Data;
namespace HRM.BO
{
#region Location
public class Location : BasicBaseObject
{
#region Constructor
public Location()
{
Code = string.Empty;
Name = string.Empty;
NameInBangla = string.Empty;
ParentsID = string.Empty;
Tier = 1;
Parent = null;
//_Childs = null;
Status = EnumStatus.Active;
this.LatLongSetDate = null;
this.LatLongSetBy = null;
this.LatLongApproveStatus = null;
this.Latitude = 0;
this.Longitude = 0;
}
#endregion
public string Code { get; set; }
public string Name { get; set; }
public string NameInBangla { get; set; }
public int? ParentID { get; set; }
public string ParentsID { get; set; }
public int Tier { get; set; }
public Location Parent { get; set; }
public int PayrollTypeID { get; set; }
public bool AttendancePoint { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
public int? LatLongSetBy { get; set; }
public DateTime? LatLongSetDate { get; set; }
public bool? LatLongApproveStatus { get; set; }
#region Properties
//#region Chield : Department
//private List<Location> _Childs;
//public List<Location> Childs
//{
// get
// {
// if (_Childs == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
// {
// _Childs = Location.GetChilds(this.ID);
// }
// return _Childs;
// }
// set
// {
// _Childs = value;
// }
//}
//public static List<Location> GetChilds(ID parentID)
//{
// #region Cache Header
// List<Location> locations = _cache["GetChilds", parentID] as List<Location>;
// if (locations != null)
// return locations;
// #endregion
// try
// {
// locations = Service.GetChield(parentID);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(locations, "GetChilds", parentID);
// #endregion
// return locations;
//}
//public List<ObjectTemplate> PickerChilds
//{
// get
// {
// List<ObjectTemplate> pChilds = new List<ObjectTemplate>();
// if (_Childs == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
// {
// _Childs = Location.GetChilds(this.ID);
// if (_Childs != null)
// {
// foreach (Location dpt in _Childs)
// {
// pChilds.Add(dpt);
// }
// }
// }
// return pChilds;
// }
//}
//#endregion
//#region Service Factory ILocationService : ILocationService
//internal static ILocationService Service
//{
// get { return Services.Factory.CreateService<ILocationService>(typeof(ILocationService)); }
//}
//#endregion
#endregion
}
#endregion
#region ILocation Service
public interface ILocationService
{
Location Get(int id);
List<Location> GetLocations();
List<Location> Get();
List<Location> GetParents(EnumStatus status, int payrollTypeID);
List<Location> Get(EnumStatus status, int payrollTypeID);
List<Location> GetByTier(int tier);
int Save(Location item);
void Delete(int id);
List<Location> GetChield(int parentID);
Location Get(string sCode);
List<Location> Get(EnumStatus sts);
List<Location> GetForJV(DateTime dJVMonth, int payrollTypeID);
string GetNextCode(int tier, string parentcode);
string GetNextCode(int tier, int parentID);
string GetNextCode(int nteir);
List<Location> GetAllLocation(int payrollTypeID, EnumStatus status, string code, string name);
List<Location> GetAllLocation(string code, string name);
Location GetByEmployeeID(int employeeID);
DataSet GetLocationFromCoord(double Lat, double Long);
DataTable GetLocationAllTier(int locationID);
bool SaveLocation(int locationID, double latitude, double longitude, int userid, bool latLongApprvStatus);
List<Location> GetLowerTierLocations(int LocationID);
}
#endregion
}