334 lines
11 KiB
C#
334 lines
11 KiB
C#
|
|
|||
|
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<RecognitionDetail> RecognitionDetails { get; set; }
|
|||
|
|
|||
|
//#region RecognitionDetail
|
|||
|
//private List<RecognitionDetail> _recognitionDetails;
|
|||
|
//public List<RecognitionDetail> 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<IRecognitionService>(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<RecognitionDetail> recognitionDetails = this.RecognitionDetails;
|
|||
|
// List<Employee> 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 + "<tr>" + "<td align='left' style='border:0.5px solid;'>" + count++ + "</td>" + "<td align='left' style='border:0.5px solid;'>" + employee.Where(e => e.ID.Integer == r.EmployeeID.Integer).Select(e => e.Name).FirstOrDefault() + "</td>" + "<td align='right' style='border:0.5px solid;'>" + r.Amount.ToString("#,###") + "</td>" + "</tr>");
|
|||
|
|
|||
|
// string tableNominatedEmp = "<table style='border:1px solid; border-collapse: collapse;'>" +
|
|||
|
// "<thead style='background-color: #ffb113;'>" +
|
|||
|
// "<tr>" +
|
|||
|
// "<th style='border:0.5px solid;'>SI</th>" +
|
|||
|
// "<th style='border:0.5px solid;'>Nominated Employee</th>" +
|
|||
|
// "<th style='border:0.5px solid;'>Amount</th>" +
|
|||
|
// "</tr>" +
|
|||
|
// "</thead>" +
|
|||
|
// "<tbody>" +
|
|||
|
// tableBody +
|
|||
|
// "<tr style='background-color: #ffb113;'>" +
|
|||
|
// "<td></td><td>Grand Total</td><td align='right'>" + recognitionDetails.Sum(r => r.Amount).ToString("#,###") + "</td>" +
|
|||
|
// "</tr>" +
|
|||
|
// "</tbody>" +
|
|||
|
// "</table><br/><br/>";
|
|||
|
// 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.<br/><br/>" + tableNominatedEmp;
|
|||
|
// else
|
|||
|
// str = " " + "Your YES Tier 1 recognition for the following persons has been approved.<br/><br/>" + 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<PendingJobDetail> GetDetails()
|
|||
|
//{
|
|||
|
// List<PendingJobDetail> opJobsDetail = new List<PendingJobDetail>();
|
|||
|
|
|||
|
// 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<Recognition> 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<RecognitionDetail> GetRecognitionDetails(int recognitionID)
|
|||
|
//{
|
|||
|
// return Recognition.Service.GetRecognitionDetails(recognitionID);
|
|||
|
//}
|
|||
|
//public static List<RecognitionDetail> GetHRRequetByWFStatus(enumwfStatus enumwfStatus, DateTime fromDate, DateTime toDate, bool p)
|
|||
|
//{
|
|||
|
// return Recognition.Service.GetRecognitionDetails(enumwfStatus, fromDate, toDate, p);
|
|||
|
//}
|
|||
|
|
|||
|
//public static void UpdatePaidDate(List<RecognitionDetail> request, List<RecognitionDetail> 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<Recognition> Get();
|
|||
|
int Save(Recognition recognition);
|
|||
|
void Delete(int iD);
|
|||
|
List<RecognitionDetail> GetRecognitionDetails(int recognitionID);
|
|||
|
|
|||
|
List<RecognitionDetail> GetRecognitionDetails(EnumwfStatus enumwfStatus, DateTime fromDate, DateTime toDate, bool p);
|
|||
|
|
|||
|
void UpdatePaidDate(List<RecognitionDetail> request, List<RecognitionDetail> Uncheckedrequest);
|
|||
|
}
|
|||
|
}
|
|||
|
|