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 _Childs; //public List 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 GetChilds(ID parentID) //{ // #region Cache Header // List locations = _cache["GetChilds", parentID] as List; // 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 PickerChilds //{ // get // { // List pChilds = new List(); // 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(typeof(ILocationService)); } //} //#endregion #endregion } #endregion #region ILocation Service public interface ILocationService { Location Get(int id); List GetLocations(); List Get(); List GetParents(EnumStatus status, int payrollTypeID); List Get(EnumStatus status, int payrollTypeID); List GetByTier(int tier); int Save(Location item); void Delete(int id); List GetChield(int parentID); Location Get(string sCode); List Get(EnumStatus sts); List GetForJV(DateTime dJVMonth, int payrollTypeID); string GetNextCode(int tier, string parentcode); string GetNextCode(int tier, int parentID); string GetNextCode(int nteir); List GetAllLocation(int payrollTypeID, EnumStatus status, string code, string name); List 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 GetLowerTierLocations(int LocationID); } #endregion }