using Ease.Core.Model; using System; using System.Collections.Generic; using System.Data; namespace HRM.BO { public class Recognition : BasicBaseObject//, IworkflowInterface { #region Constructor public Recognition() { _nominateBy = (0); _nominateDate = DateTime.MinValue; _justification = string.Empty; _isCash = false; _salaryMonth = DateTime.MinValue; _eWfStatus = EnumwfStatus.Received; _eRequestType = EnumRequestType.Recognition; } #endregion #region Public Properties #region NominateBy : ID private int _nominateBy; public int NominateBy { get { return _nominateBy; } set { _nominateBy = value; } } #endregion public Employee Employee { get; set; } //private Employee _employee; //public Employee Employee //{ // get // { // if (_employee == null && _nominateBy != null) // { // //_employee = new Employee(); // _employee = Employee.Get(_nominateBy); // } // return _employee; // } // set // { // _employee = value; // } //} #region NominateDate : Datetime private DateTime _nominateDate; public DateTime NominateDate { get { return _nominateDate; } set { _nominateDate = value; } } #endregion #region Justification : string private string _justification; public string Justification { get { return _justification; } set { _justification = value; } } #endregion #region IsCash : bool private bool _isCash; public bool IsCash { get { return _isCash; } set { _isCash = value; } } #endregion #region SalaryMonth : DateTime private DateTime _salaryMonth; public DateTime SalaryMonth { get { return _salaryMonth; } set { _salaryMonth = value; } } #endregion #region WfStatus : enumwfStatus private EnumwfStatus _eWfStatus; public EnumwfStatus WfStatus { get { return _eWfStatus; } set { _eWfStatus = value; } } #endregion #region RequestType: EnumRequestType private EnumRequestType _eRequestType; public EnumRequestType RequestType { get { return _eRequestType; } set { _eRequestType = value; } } #endregion public List RecognitionDetails { get; set; } //#region RecognitionDetail //private List _recognitionDetails; //public List RecognitionDetails //{ // get // { // if (this.int != null && _recognitionDetails == null) // { // _recognitionDetails = Recognition.Service.GetRecognitionDetails(this.ID); // } // return _recognitionDetails; // } // set { _recognitionDetails = value; } //} //#endregion //#region Service Factory //internal static IRecognitionService Service //{ // get { return Services.Factory.CreateService(typeof(IRecognitionService)); } //} //#endregion #endregion //#region IworkflowInterface Members ////this property is used for work flow //public int GetStatusbyWf(enumwfStatus wfstatus) //{ // return (int)this.WfStatus; //} //public string WFDesciption() //{ // return this.ObjectDescription; //} //public string ObjectDescription //{ // get // { // string empName = string.Empty; // string tableBody = string.Empty; // string str = string.Empty; // int count = 1; // List recognitionDetails = this.RecognitionDetails; // List employee = Employee.Get(); // int gradeID = employee.Where(e => e.ID.Integer == this.NominateBy.Integer).Select(e => e.GradeID).FirstOrDefault().Integer; // recognitionDetails.ForEach(r => empName = empName + (employee.Where(e => e.ID.Integer == r.EmployeeID.Integer).Select(e => e.Name).FirstOrDefault()) + ", "); // recognitionDetails.ForEach(r => tableBody = tableBody + "" + "" + count++ + "" + "" + employee.Where(e => e.ID.Integer == r.EmployeeID.Integer).Select(e => e.Name).FirstOrDefault() + "" + "" + r.Amount.ToString("#,###") + "" + ""); // string tableNominatedEmp = "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // tableBody + // "" + // "" + // "" + // "" + // "
SINominated EmployeeAmount
Grand Total" + recognitionDetails.Sum(r => r.Amount).ToString("#,###") + "


"; // if (this.WfStatus == enumwfStatus.Passed && gradeID != 15 || gradeID != 18 || gradeID != 19 || gradeID != 20 || gradeID != 23) // str = " " + this.Employee.Name + " has nominated the following persons for YES Tier 1 recognition.

" + tableNominatedEmp; // else // str = " " + "Your YES Tier 1 recognition for the following persons has been approved.

" + tableNominatedEmp; // return str; // } //} ////this property is used for work flow //public int SetupID //{ // get // { // return (3); // } //} ////this property is used for work flow //public int ObjectID //{ // get { return this.ID; } //} //public List GetDetails() //{ // List opJobsDetail = new List(); // opJobsDetail.Add(new PendingJobDetail() { Type = "Applier:", Value = this.Employee.Name }); // opJobsDetail.Add(new PendingJobDetail() { Type = "Salary Month:", Value = this.SalaryMonth.ToString("MMM yyyy") }); // opJobsDetail.Add(new PendingJobDetail() { Type = "Justification:", Value = this.Justification }); // opJobsDetail.Add(new PendingJobDetail() { Type = "Cash :", Value = this.IsCash ? "Yes" : "No" }); // opJobsDetail.Add(new PendingJobDetail() { Type = "Nomination Date :", Value = this.NominateDate.ToString("dd MMM yyyy") }); // // add more items as per need // return opJobsDetail; //} //#endregion //#region Public Methods //public static Recognition Get(int iD) //{ // return Recognition.Service.Get(iD); //} //public static List Get() //{ // return Recognition.Service.Get(); //} //public int Save() //{ // this.SetAuditTrailProperties(); // return Recognition.Service.Save(this); //} //public void Delete(int iD) //{ // Recognition.Service.Delete(iD); //} //public static List GetRecognitionDetails(int recognitionID) //{ // return Recognition.Service.GetRecognitionDetails(recognitionID); //} //public static List GetHRRequetByWFStatus(enumwfStatus enumwfStatus, DateTime fromDate, DateTime toDate, bool p) //{ // return Recognition.Service.GetRecognitionDetails(enumwfStatus, fromDate, toDate, p); //} //public static void UpdatePaidDate(List request, List Uncheckedrequest) //{ // Recognition.Service.UpdatePaidDate(request, Uncheckedrequest); //} //#endregion } public class RecognitionDetail : BasicBaseObject { #region Constructor public RecognitionDetail() { _recognitionID = (0); _employeeID = (0); _amount = 0.0; _salaryMonth = DateTime.MinValue; _paidDate = DateTime.MinValue; } #endregion #region Properties #region RecognitionID : ID private int _recognitionID; public int RecognitionID { get { return _recognitionID; } set { _recognitionID = value; } } #endregion #region EmployeeID : ID private int _employeeID; public int EmployeeID { get { return _employeeID; } set { _employeeID = value; } } #endregion #region Amount : double private double _amount; public double Amount { get { return _amount; } set { _amount = value; } } #endregion #region SalaryMonth : DateTime private DateTime _salaryMonth; public DateTime SalaryMonth { get { return _salaryMonth; } set { _salaryMonth = value; } } #endregion #region PaidDate : DateTime private DateTime _paidDate; public DateTime PaidDate { get { return _paidDate; } set { _paidDate = value; } } #endregion #endregion public DateTime RequestDate { get; set; } } public interface IRecognitionService { Recognition Get(int iD); List Get(); int Save(Recognition recognition); void Delete(int iD); List GetRecognitionDetails(int recognitionID); List GetRecognitionDetails(EnumwfStatus enumwfStatus, DateTime fromDate, DateTime toDate, bool p); void UpdatePaidDate(List request, List Uncheckedrequest); } }