310 lines
13 KiB
C#
310 lines
13 KiB
C#
//using HRM.UI.Components;
|
|
//using HRM.BO;
|
|
//using System;
|
|
//using System.Collections.Generic;
|
|
//using System.Linq;
|
|
//using System.Net;
|
|
//using System.Net.Http;
|
|
//using Ease.Core.Model;
|
|
//using Microsoft.AspNetCore.Mvc;
|
|
//using Microsoft.AspNetCore.Authorization;
|
|
//using HRM.UI.MODELS;
|
|
|
|
//namespace HRMobileAPI.Controllers
|
|
//{
|
|
// [ApiController]
|
|
// [Route("api/Mobile/OT")]
|
|
// [Authorize]
|
|
// public class OTController : ControllerBase
|
|
// {
|
|
// [HttpPost]
|
|
// [Route("ValidateSaveOTPreApprove")]
|
|
// public ActionResult ValidateSaveOTPreApprove(OTPreApprovalTModel tModel)
|
|
// {
|
|
// ServiceInitializer.Initialize(tModel.EmployeeID);
|
|
// //OTPreApproval otPreApproval = OTPreApproval.RefreshObject(ID.FromInteger(tModel.EmployeeID), tModel.Reason, tModel.PreApproveDate, tModel.OTHours, tModel.WFStatus, tModel.FromTime, tModel.ToTime);
|
|
// //otPreApproval.Validate();
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK);
|
|
// }
|
|
|
|
// [HttpPost]
|
|
// [Route("SaveOTPreApprove")]
|
|
// public HttpResponseMessage SaveOTPreApprove(OTPreApprovalTModel tModel)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// ServiceInitializer.Initialize(tModel.EmployeeID);
|
|
// //OTPreApproval otPreApproval = OTPreApproval.RefreshObject(ID.FromInteger(tModel.EmployeeID), tModel.Reason, tModel.PreApproveDate, tModel.OTHours, tModel.WFStatus, tModel.FromTime, tModel.ToTime);
|
|
// // otPreApproval.Validate();
|
|
// //otPreApproval.Save();
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK);
|
|
// });
|
|
// }
|
|
|
|
// [HttpPost]
|
|
// [Route("UpdateOTPreApprove")]
|
|
// public HttpResponseMessage UpdateOTPreApprove(OTPreApprovalTModel tModel)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// ServiceInitializer.Initialize(tModel.EmployeeID);
|
|
// //OTPreApproval oOTPreApproval = OTPreApproval.Get(ID.FromInteger(tModel.PKID));
|
|
// // oOTPreApproval.LineManagerUpdate(ID.FromInteger(tModel.LMID), tModel.WFStatus, tModel.LMOTHours);
|
|
// //oOTPreApproval.Save();
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK);
|
|
// });
|
|
// }
|
|
|
|
// [Route("GetOTPreApproval")]
|
|
// public HttpResponseMessage GetOTPreApproval(int EmpID, DateTime PreAproveDate)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// List<OTPreApprovalTModel> obj = null;
|
|
// ServiceInitializer.Initialize(EmpID);
|
|
// // Business Changed: Multiple OT Can be submitted aginst a single Pre approval -- Faisal
|
|
// //List<OTPreApproval> oTPreAproval = OTPreApproval.GetOTPreapprovals(ID.FromInteger(EmpID), PreAproveDate.Date);
|
|
// //List<OTPreApproval> oTPreAproval = OTPreApproval.GetOTUnsubmittedPreapprovals(ID.FromInteger(EmpID), PreAproveDate.Date);
|
|
// //if (oTPreAproval != null)
|
|
// //{
|
|
// // obj = oTPreAproval.ConvertToTModels();
|
|
// //}
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK, obj);
|
|
// });
|
|
// }
|
|
|
|
// [Route("GetPendingOTPreApprovalsByLMID/{id}")]
|
|
// public HttpResponseMessage GetPendingOTPreApprovalsByLMID(int id)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// List<OTPreApprovalTModel> objs = null;
|
|
// Employee oEmp = Employee.Get(ID.FromInteger(id));
|
|
|
|
// if (oEmp != null)
|
|
// {
|
|
// ServiceInitializer.Initialize(oEmp);
|
|
// //objs = OTPreApproval.GetByLMID(id, EnumWFAttnStatus.EmpSubmitted)
|
|
// // .ConvertToTModels();
|
|
|
|
// }
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK, objs);
|
|
// });
|
|
|
|
// }
|
|
|
|
// [Route("GetApprovedOTPreApprovalsByLMID/{id}")]
|
|
// public HttpResponseMessage GetApprovedOTPreApprovalsByLMID(int id)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// List<OTPreApprovalTModel> objs = null;
|
|
// Employee oEmp = Employee.Get(ID.FromInteger(id));
|
|
|
|
// if (oEmp != null)
|
|
// {
|
|
// ServiceInitializer.Initialize(oEmp);
|
|
// //objs = OTPreApproval.GetByLMID(id, EnumWFAttnStatus.LMApproved)
|
|
// // .ConvertToTModels();
|
|
|
|
// }
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK, objs);
|
|
// });
|
|
|
|
// }
|
|
|
|
// [HttpGet]
|
|
// [Route("GetOTAttendanceStatus")]
|
|
// public HttpResponseMessage GetOTAttendanceStatus(int id, DateTime OTDate)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// ServiceInitializer.Initialize(id);
|
|
// var daProcess = DailyAttnProcess.Get(id, OTDate);
|
|
// //return this.Request.CreateResponse(HttpStatusCode.OK, daProcess != null ? daProcess.OTAttendanceStatus : "No Attendance data found");
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK, "No Attendance data found");
|
|
// });
|
|
|
|
// }
|
|
|
|
|
|
|
|
// [HttpPost]
|
|
// [Route("ValidateSaveOT")]
|
|
// public HttpResponseMessage ValidateSaveOT(OTSubmitTModel tModel)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// ServiceInitializer.Initialize(tModel.EmployeeID);
|
|
// //OTSubmit oModel = OTSubmit.RefreshObject(ID.FromInteger(tModel.EmployeeID), tModel.Remarks, tModel.OTSubmitDate, tModel.OTHours, EnumWFAttnStatus.EmpSubmitted, ID.FromInteger(tModel.OTPreApprovalID), tModel.FromTime, tModel.ToTime);
|
|
// //oModel.Validate();
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK);
|
|
// });
|
|
// }
|
|
|
|
// [HttpPost]
|
|
// [Route("SaveOT")]
|
|
// public HttpResponseMessage SaveOT(OTSubmitTModel tModel)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// ServiceInitializer.Initialize(tModel.EmployeeID);
|
|
// //OTSubmit oModel = OTSubmit.RefreshObject(ID.FromInteger(tModel.EmployeeID), tModel.Remarks, tModel.OTSubmitDate, tModel.OTHours, EnumWFAttnStatus.EmpSubmitted,ID.FromInteger(tModel.OTPreApprovalID),tModel.FromTime,tModel.ToTime);
|
|
// //oModel.Validate();
|
|
// //oModel.Save();
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK);
|
|
// });
|
|
// }
|
|
|
|
// [HttpPost]
|
|
// [Route("ValidateUpdateOT")]
|
|
// public HttpResponseMessage ValidateUpdateOT(OTSubmitTModel tModel)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// ServiceInitializer.Initialize(tModel.EmployeeID);
|
|
// //OTSubmit oModel = OTSubmit.Get(ID.FromInteger(tModel.PKID));
|
|
// //if ((tModel.WFStatus == EnumWFAttnStatus.LMApproved) || // IF LM Approved
|
|
// // (tModel.WFStatus == EnumWFAttnStatus.Rejected && oModel.WFStatus == EnumWFAttnStatus.EmpSubmitted)) // OR Rejected and previous Status EMPSubmitted
|
|
// //{
|
|
// // if (tModel.WFStatus == EnumWFAttnStatus.LMApproved && tModel.LMOTHour <= 0)
|
|
// // {
|
|
// // throw new CustomException(EnumExceptionType.Validation, "Cannot Approve OT Hours less than or equal to 0 (zero)");
|
|
// // }
|
|
// //}
|
|
// //else if (tModel.WFStatus == EnumWFAttnStatus.DHApproved || // IF DH Approved
|
|
// // (tModel.WFStatus == EnumWFAttnStatus.Rejected && oModel.WFStatus == EnumWFAttnStatus.LMApproved)) // OR Rejected and previous Status LM Approved
|
|
// //{
|
|
// // if (tModel.WFStatus == EnumWFAttnStatus.DHApproved && tModel.DHOTHour <= 0)
|
|
// // {
|
|
// // throw new CustomException(EnumExceptionType.Validation, "Cannot Approve OT Hours less than or equal to 0 (zero)");
|
|
// // }
|
|
// //}
|
|
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK);
|
|
// });
|
|
// }
|
|
|
|
// [HttpPost]
|
|
// [Route("UpdateOT")]
|
|
// public HttpResponseMessage UpdateOT(OTSubmitTModel tModel)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// ServiceInitializer.Initialize(tModel.EmployeeID);
|
|
// // OTSubmit oModel = OTSubmit.Get(ID.FromInteger(tModel.PKID));
|
|
// //if ((tModel.WFStatus == EnumWFAttnStatus.LMApproved) || // IF LM Approved
|
|
// // (tModel.WFStatus == EnumWFAttnStatus.Rejected && oModel.WFStatus == EnumWFAttnStatus.EmpSubmitted)) // OR Rejected and previous Status EMPSubmitted
|
|
// //{
|
|
// // DateTime salaryMonth = SystemInformation.GetSystemMonth(SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|
|
|
// // oModel.LineManagerUpdate(ID.FromInteger(tModel.LMID), tModel.WFStatus, tModel.LMOTHour, tModel.LMRemarks,salaryMonth);
|
|
// //}
|
|
// //else if (tModel.WFStatus == EnumWFAttnStatus.DHApproved || // IF DH Approved
|
|
// // (tModel.WFStatus == EnumWFAttnStatus.Rejected && oModel.WFStatus == EnumWFAttnStatus.LMApproved)) // OR Rejected and previous Status LM Approved
|
|
// //{
|
|
// // oModel.DepartmentHeadUpdate(ID.FromInteger(tModel.DHID), tModel.WFStatus, tModel.DHOTHour, tModel.DHRemarks, SystemInformation.GetSystemMonth(SystemInformation.CurrentSysInfo.PayrollTypeID.Integer));
|
|
// //}
|
|
|
|
// //oModel.Save();
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK);
|
|
// });
|
|
// }
|
|
|
|
// [Route("GetOT/{id}")]
|
|
// public HttpResponseMessage GetOT(int id)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// OTSubmitTModel obj = null;
|
|
// //OTSubmit oModel = OTSubmit.Get(ID.FromInteger(id));
|
|
|
|
// //if (oModel != null)
|
|
// //{
|
|
// // Employee oEmp = Employee.Get(oModel.EmployeeID);
|
|
// // ServiceInitializer.Initialize(oEmp);
|
|
// // obj = oModel.ConvertToTModel(oEmp);
|
|
// //}
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK, obj);
|
|
// });
|
|
|
|
// }
|
|
|
|
// [Route("GetPendingOTsByLMID/{id}")]
|
|
// public HttpResponseMessage GetPendingOTsByLMID(int id)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// List<OTSubmitTModel> objs = null;
|
|
// Employee oEmp = Employee.Get(ID.FromInteger(id));
|
|
// if (oEmp != null)
|
|
// {
|
|
// ServiceInitializer.Initialize(oEmp);
|
|
// //objs = OTSubmit.GetByLMID(id, EnumWFAttnStatus.EmpSubmitted)
|
|
// // .ConvertToTModels();
|
|
// }
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK, objs);
|
|
// });
|
|
// }
|
|
|
|
// [Route("GetApprovedOTsByLMID/{id}")]
|
|
// public HttpResponseMessage GetApprovedOTsByLMID(int id)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// List<OTSubmitTModel> objs = null;
|
|
// Employee oEmp = Employee.Get(ID.FromInteger(id));
|
|
|
|
// if (oEmp != null)
|
|
// {
|
|
// ServiceInitializer.Initialize(oEmp);
|
|
// //objs = OTSubmit.GetByLMID(id, EnumWFAttnStatus.LMApproved)
|
|
// // .ConvertToTModels();
|
|
|
|
// }
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK, objs);
|
|
// });
|
|
|
|
// }
|
|
|
|
// [Route("GetPendingOTsByDHID/{id}")]
|
|
// public HttpResponseMessage GetPendingOTsByDHID(int id)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// List<OTSubmitTModel> objs = null;
|
|
// Employee oEmp = Employee.Get(ID.FromInteger(id));
|
|
|
|
// if (oEmp != null)
|
|
// {
|
|
// ServiceInitializer.Initialize(oEmp);
|
|
// //objs = OTSubmit.GetByDHID(id, EnumWFAttnStatus.LMApproved)
|
|
// // .ConvertToTModels();
|
|
|
|
// }
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK, objs);
|
|
// });
|
|
|
|
// }
|
|
|
|
// [Route("GetApprovedOTsByDHID/{id}")]
|
|
// public HttpResponseMessage GetApprovedOTsByDHID(int id)
|
|
// {
|
|
// return CreateHttpResponse(this.Request, () =>
|
|
// {
|
|
// List<OTSubmitTModel> objs = null;
|
|
// Employee oEmp = Employee.Get(ID.FromInteger(id));
|
|
|
|
// if (oEmp != null)
|
|
// {
|
|
// ServiceInitializer.Initialize(oEmp);
|
|
// //objs = OTSubmit.GetByDHID(id, EnumWFAttnStatus.DHApproved)
|
|
// // .ConvertToTModels();
|
|
// }
|
|
// return this.Request.CreateResponse(HttpStatusCode.OK, objs);
|
|
// });
|
|
// }
|
|
|
|
// }
|
|
//}
|