using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Reflection; namespace HRM.BO { #region AdhocClaim [Serializable] public class AdhocClaim : BasicBaseObject { #region Constructor public AdhocClaim() { EmployeeID = 0; EmployeeRemarks = string.Empty; LMRemarks = string.Empty; EmployeeValue = 0; LMValue = 0; BatchID = 0; LineManagerID = 0; ItemID = 0; ClaimDate = DateTime.MinValue; SalaryMonth = DateTime.MinValue; LMApproveDate = DateTime.MinValue; SMApproveDate = DateTime.MinValue; IsLMSubmitted = false; IsLMEdited = false; IsBatchEntry = false; ShiftManagerID = 0; ShiftID = 0; WorkPlanGroupID = 0; SeniorTechnicianID = 0; ApproverID = 0; IsSTSubmitted = false; AdjustmentSalaryMonth = DateTime.MinValue; } #endregion #region Properties public int EmployeeID { get; set; } public DateTime ClaimDate { get; set; } public enumPayrollComponentType ItemType { get; set; } public int ItemID { get; set; } public double EmployeeValue { get; set; } public double LMValue { get; set; } public string EmployeeRemarks { get; set; } public string LMRemarks { get; set; } public DateTime LMApproveDate { get; set; } public DateTime FromTime { get; set; } public DateTime ToTime { get; set; } public DateTime SMApproveDate { get; set; } public DateTime SalaryMonth { get; set; } public DateTime AdjustmentSalaryMonth { get; set; } public int BatchID { get; set; } public bool IsLMSubmitted { get; set; } public bool IsSTSubmitted { get; set; } public bool IsLMEdited { get; set; } public bool IsBatchEntry { get; set; } public int LineManagerID { get; set; } public int ApproverID { get; set; } public EnumClaimWFStatus ClaimWFStatus { get; set; } public EnumClaimValueType ClaimValueType { get; set; } public int ShiftManagerID { get; set; } public int ShiftID { get; set; } public int WorkPlanGroupID { get; set; } public int SeniorTechnicianID { get; set; } public EnumSystemMode SystemMode { get; set; } //#region Service Factory IAdhocClaim : IAdhocClaim //internal static IAdhocClaimService Service //{ // get { return Services.Factory.CreateService(typeof(IAdhocClaimService)); } //} //#endregion #endregion //#region Functions //public static AdhocClaim RefreshObject(ID loginID, ID EmployeeID, DateTime AttendanceDate, ID ShiftManagerID, ID RelayID, ID WorkplanGroupID, string EmployeeRemarks, double EmployeeValue, // EnumClaimValueType ClaimValueType, EnumClaimWFStatus ClaimWFStatus, string SystemMode, // DateTime NextPayProcessDate, enumPayrollComponentType PayrollComponentType, ID AttendanceBenifitTypeID) //{ // try // { // AdhocClaim _oClaim = new AdhocClaim(); // DateTime salaryMonth = AttnMonthlyBenefit.GetAttandaceSalaryMonth(AttendanceDate); // DateTime systemMonth = NextPayProcessDate; // if (systemMonth > salaryMonth) // _oClaim.AdjustmentSalaryMonth = salaryMonth; // _oClaim.EmployeeID = EmployeeID; // _oClaim.ClaimDate = AttendanceDate; // _oClaim.CreatedBy = loginID; // _oClaim.CreatedDate = DateTime.Today; // _oClaim.ShiftManagerID = ShiftManagerID; // _oClaim.ShiftID = RelayID; // _oClaim.WorkPlanGroupID = WorkplanGroupID; // _oClaim.ItemType = PayrollComponentType; // _oClaim.ItemID = AttendanceBenifitTypeID; // _oClaim.EmployeeRemarks = EmployeeRemarks; // _oClaim.EmployeeValue = EmployeeValue; // _oClaim.SalaryMonth = systemMonth; // _oClaim.ClaimValueType = EnumClaimValueType.Manual; // _oClaim.ClaimWFStatus = EnumClaimWFStatus.EmpSubmitted; // if (SystemMode == EnumSystemMode.Kiosk.ToString()) // _oClaim.SystemMode = EnumSystemMode.Kiosk; // else if (SystemMode == EnumSystemMode.Web.ToString()) // _oClaim.SystemMode = EnumSystemMode.Web; // else // _oClaim.SystemMode = EnumSystemMode.Mobile; // long maxBatchID = AdhocClaim.GetMaxBatchID(); // _oClaim.BatchID = Ease.CoreV35.Model.ID.FromLong(maxBatchID); // return _oClaim; // } // catch (Exception ex) // { // string eMessage = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(ex.Message); // throw new CustomException(EnumExceptionType.Error, "An Error Occurred From RefreshObject " + ex.Source + "( " + eMessage + " )"); // } //} //public static DataTable GetEmpOTDataTable(ID employeeID, DateTime fromDate, DateTime toDate, enumPayrollComponentType allowType, int payrollTypeID) //{ // try // { // ObjectsTemplate _overTimeClaims = AdhocClaim.GetByEmployeeID(employeeID, fromDate, toDate); // _overTimeClaims = _overTimeClaims.Where(o => o.ItemType == allowType).ToObjectsTemplate(); // ObjectsTemplate _overTimes = Term.Get(EnumStatus.Active); // ObjectsTemplate _workPlanGroups = WorkPlanGroup.GetAll().Where(o => o.PayrollTypeID.Integer == payrollTypeID).ToObjectsTemplate(); // ObjectsTemplate _employees = Employee.GetAllPayrollTypesLiveEmps(); // ObjectsTemplate _relays = Shift.Get(); // DataRow oRow = null; // DataTable gridDataTable = new DataTable(); // gridDataTable = new DataTable(); // if (_overTimeClaims.Count > 0) // { // gridDataTable.Columns.Add("EmpOverTimeClaimID"); // gridDataTable.Columns.Add("ClaimDate"); // gridDataTable.Columns.Add("FromTime"); // gridDataTable.Columns.Add("ToTime"); // gridDataTable.Columns.Add("Shift"); // gridDataTable.Columns.Add("Relay"); // gridDataTable.Columns.Add("ShiftManager"); // gridDataTable.Columns.Add("OverTimeTypes"); // gridDataTable.Columns.Add("AppliedOTHour"); // gridDataTable.Columns.Add("Remarks"); // gridDataTable.Columns.Add("Status"); // gridDataTable.Columns.Add("ApprovedOTHour"); // gridDataTable.Columns.Add("LMApprovedDate"); // gridDataTable.Columns.Add("IsLineManagerSubmitted"); // foreach (AdhocClaim oItem in _overTimeClaims) // { // Employee shiftManager = _employees.Where(o => o.ID == oItem.ShiftManagerID).FirstOrDefault(); // WorkPlanGroup oWorkPlanGroup = _workPlanGroups.Where(o => o.ID == oItem.WorkPlanGroupID).FirstOrDefault(); // Shift relay = _relays.FirstOrDefault(x => x.ID == oItem.ShiftID); // oRow = gridDataTable.NewRow(); // oRow["EmpOverTimeClaimID"] = oItem.ID; // oRow["ClaimDate"] = oItem.ClaimDate.ToString("dd MMM yyyy"); // oRow["FromTime"] = oItem.FromTime != DateTime.MinValue ? oItem.FromTime.ToString("hh:mm tt") : ""; // oRow["ToTime"] = oItem.ToTime != DateTime.MinValue ? oItem.ToTime.ToString("hh:mm tt") : ""; // oRow["Shift"] = oWorkPlanGroup == null ? "" : oWorkPlanGroup.Name; // oRow["Relay"] = relay == null ? "" : relay.Name; // oRow["ShiftManager"] = shiftManager == null ? "" : shiftManager.Name; // Term overTime = _overTimes.Where(o => o.ID == oItem.ItemID).FirstOrDefault(); // oRow["OverTimeTypes"] = overTime == null ? "" : overTime.Name; // oRow["AppliedOTHour"] = oItem.EmployeeValue; // oRow["Remarks"] = oItem.EmployeeRemarks; // if (oItem.IsSTSubmitted && oItem.ClaimWFStatus == EnumClaimWFStatus.EmpSubmitted) // { // oRow["Status"] = "STSubmitted"; // } // else // { // oRow["Status"] = oItem.ClaimWFStatus.ToString(); // } // if (oItem.LMApproveDate != null && oItem.LMApproveDate != DateTime.MinValue) // oRow["LMApprovedDate"] = oItem.LMApproveDate.ToString("dd MMM yyyy"); // if (oItem.ClaimWFStatus == EnumClaimWFStatus.LMApproved) // oRow["ApprovedOTHour"] = oItem.LMValue; // oRow["IsLineManagerSubmitted"] = oItem.IsLMSubmitted ? "Yes" : "No"; // gridDataTable.Rows.Add(oRow); // } // } // return gridDataTable; // } // catch (Exception ex) // { // throw new Exception(ex.Message, ex); // } //} //public static AdhocClaim RefreshOTObject(ID loginID, ID EmployeeID, DateTime AttendanceDate, ID ShiftManagerID, ID RelayID, ID WorkplanGroupID, string EmployeeRemarks, double EmployeeValue, // EnumClaimValueType ClaimValueType, EnumClaimWFStatus ClaimWFStatus, string SystemMode, // DateTime NextPayProcessDate, enumPayrollComponentType PayrollComponentType, ID AttendanceBenifitTypeID, DateTime FromTime, DateTime ToTime) //{ // try // { // AdhocClaim _oTClaim = new AdhocClaim(); // DateTime salaryMonth = AttnMonthlyBenefit.GetAttandaceSalaryMonth(AttendanceDate); // DateTime systemMonth = NextPayProcessDate; // if (systemMonth > salaryMonth) // _oTClaim.AdjustmentSalaryMonth = salaryMonth; // _oTClaim.EmployeeID = EmployeeID; // _oTClaim.CreatedBy = loginID; // _oTClaim.CreatedDate = DateTime.Today; // _oTClaim.ClaimDate = AttendanceDate; // _oTClaim.ShiftManagerID = ShiftManagerID; // _oTClaim.ShiftID = RelayID; // _oTClaim.WorkPlanGroupID = WorkplanGroupID; // _oTClaim.ItemType = PayrollComponentType; // _oTClaim.ItemID = AttendanceBenifitTypeID; // _oTClaim.EmployeeRemarks = EmployeeRemarks; // _oTClaim.EmployeeValue = EmployeeValue; // _oTClaim.SalaryMonth = systemMonth; // _oTClaim.FromTime = new DateTime(_oTClaim.ClaimDate.Year, _oTClaim.ClaimDate.Month, _oTClaim.ClaimDate.Day, FromTime.Hour, FromTime.Minute, FromTime.Second); // _oTClaim.ToTime = new DateTime(_oTClaim.ClaimDate.Year, _oTClaim.ClaimDate.Month, _oTClaim.ClaimDate.Day, ToTime.Hour, ToTime.Minute, ToTime.Second); // _oTClaim.ClaimValueType = EnumClaimValueType.Manual; // _oTClaim.ClaimWFStatus = EnumClaimWFStatus.EmpSubmitted; // if (SystemMode == EnumSystemMode.Kiosk.ToString()) // _oTClaim.SystemMode = EnumSystemMode.Kiosk; // else if (SystemMode == EnumSystemMode.Web.ToString()) // _oTClaim.SystemMode = EnumSystemMode.Web; // else // _oTClaim.SystemMode = EnumSystemMode.Mobile; // long maxBatchID = AdhocClaim.GetMaxBatchID(); // _oTClaim.BatchID = Ease.CoreV35.Model.ID.FromLong(maxBatchID); // return _oTClaim; // } // catch (Exception ex) // { // string eMessage = new JavaScriptSerializer().Serialize(ex.Message); // throw new CustomException(EnumExceptionType.Error, "An Error Occurred From RefreshObject " + ex.Source + "( " + eMessage + " )"); // } //} //public void ValidateObject(AdHocClaimMessage errmessage) //{ // DateTime cutoffDate = DateTime.Today.AddDays(-90); // ObjectsTemplate _shifts = Shift.Get(); // Shift oShift = _shifts.Where(o => o.IsOverlapingDay && o.ID.ToString() == ShiftID.ToString()).FirstOrDefault(); // DailyAttnProcess daProcess = DailyAttnProcess.Get(EmployeeID.Integer, ClaimDate); // if (daProcess == null) // throw new CustomException(EnumExceptionType.Error, errmessage.YouCanNotApplyAsThereIsNoAttendanceDataFoundForTheClaimDate); // if ((Ease.CoreV35.Model.ID.FromInteger(AttendanceBenefitTypeIDConstant.T_Shift_Allowance) == ItemID && oShift == null)) // throw new CustomException(EnumExceptionType.Error, errmessage.tSAOnlyApplicableForNightShift); // if (EmployeeRemarks == "") // throw new CustomException(EnumExceptionType.Error, errmessage.pleaseWriteRemarks); // if (ClaimDate > DateTime.Today) // throw new CustomException(EnumExceptionType.Error, errmessage.YouCanNotApplyAtFutureDate); // //if (ClaimDate < cutoffDate) // // throw new CustomException(EnumExceptionType.Error, errmessage.YouHaveToApplyWithin90Days); // if (GlobalFunctions.ApplyValidation(ClaimDate)) // throw new CustomException(EnumExceptionType.Error, errmessage.YouCanNotApplyForThePreviousMonthAtThisTimeWhileSalaryProcessIsNotCompletedYet); // DateTime salaryMonth = AttnMonthlyBenefit.GetAttandaceSalaryMonth(ClaimDate); // ObjectsTemplate _attnMonthlyBenefits = AttnMonthlyBenefit.Get(EmployeeID.ToString(), salaryMonth); // AttnMonthlyBenefit attnMBenefit = _attnMonthlyBenefits.Where(o => o.ItemType == ItemType && o.ItemID == ItemID.Integer).FirstOrDefault(); // DateTime applicableMonth = DateTime.MinValue; // AttnMnthBenefitValueMapper objMapper = new AttnMnthBenefitValueMapper(ClaimDate, out applicableMonth); // string propertyName = objMapper[ClaimDate]; // PropertyInfo propertyInfo = typeof(AttnMonthlyBenefit).GetProperties().FirstOrDefault(p => p.Name == propertyName); // double calculatedfValue; // if (propertyInfo == null) // calculatedfValue = 0; // else // { // if (attnMBenefit != null) // calculatedfValue = (double)propertyInfo.GetValue(attnMBenefit, null); // else // calculatedfValue = 0; // } // if (Ease.CoreV35.Model.ID.FromInteger(AttendanceBenefitTypeIDConstant.Conveyance_Allowance) == ItemID && calculatedfValue > 3) // throw new CustomException(EnumExceptionType.Error, errmessage.YouAlreadyGotThreeConveyanceForTheDay); // else if (Ease.CoreV35.Model.ID.FromInteger(AttendanceBenefitTypeIDConstant.Conveyance_Allowance) != ItemID && calculatedfValue > 0) // throw new CustomException(EnumExceptionType.Error, errmessage.YouAlreadyGotForTheDay); // ObjectsTemplate _claimsAll = AdhocClaim.GetByEmployeeID(EmployeeID, ClaimDate, ClaimDate); // //only for conveyance // if (Ease.CoreV35.Model.ID.FromInteger(AttendanceBenefitTypeIDConstant.Conveyance_Allowance) == ItemID) // { // double totalNumber = _claimsAll.Where(o => o.ClaimDate == ClaimDate && o.ItemType == ItemType && o.ItemID == ItemID).Sum(o => o.EmployeeValue); // if (totalNumber >= 3) // throw new CustomException(EnumExceptionType.Error, errmessage.YouAlreadyGotThreeConveyanceForTheDay); // if (calculatedfValue == 1 && ((daProcess.ShiftID == ShiftID) || (daProcess.TempShiftID == ShiftID))) // { // throw new CustomException(EnumExceptionType.Error, errmessage.YouAlreadyGotConveyanceForTheDay); // } // if ((calculatedfValue + EmployeeValue) > 3) // { // throw new CustomException(EnumExceptionType.Error, errmessage.YouAlreadyGotConveyanceForTheDay); // } // } // //only for tshift // if (Ease.CoreV35.Model.ID.FromInteger(AttendanceBenefitTypeIDConstant.Conveyance_Allowance) == ItemID) // { // AdhocClaim claim = _claimsAll.Where(o => o.ShiftID == ShiftID && o.ClaimDate == ClaimDate && o.ItemType == ItemType && o.ItemID == ItemID).FirstOrDefault(); // if (claim != null) // throw new CustomException(EnumExceptionType.Error, errmessage.YouCanNotClaimTwiceInTheSameShiftOfASpecificDate); // } // else //others // { // if (calculatedfValue > 1) // throw new CustomException(EnumExceptionType.Error, errmessage.YouCanNotClaimTwiceInTheSameDate); // AdhocClaim claim = _claimsAll.Where(o => o.ClaimDate == ClaimDate && o.ItemType == ItemType && o.ItemID == ItemID && o.ClaimWFStatus != EnumClaimWFStatus.Rejected).FirstOrDefault(); // if (claim != null && (claim.ClaimWFStatus != EnumClaimWFStatus.Rejected)) // throw new CustomException(EnumExceptionType.Error, errmessage.YouCanNotClaimTwiceInTheSameDate); // if (claim != null && (claim.ClaimWFStatus == EnumClaimWFStatus.EmpSubmitted || claim.ClaimWFStatus == EnumClaimWFStatus.LMApproved)) // throw new CustomException(EnumExceptionType.Error, errmessage.YouCanNotClaimTwiceInTheSameDate); // } //} //public void ValidateOTObject(AdHocClaimMessage errmessage) //{ // bool isOTApplicable = true; // ObjectsTemplate tempShiftEmps = null; // ActingResponsibilitySetup temporaryShiftEmployee = null; // DateTime shiftInTime = DateTime.MinValue; // DateTime shiftOutTime = DateTime.MinValue; // DateTime cutoffDate = DateTime.Today.AddDays(-90); // double totalOTHour = 0; // ID shiftID = null; // DailyAttnProcess daProcess = DailyAttnProcess.Get(EmployeeID.Integer, ClaimDate); // Shift oShift = null; // if (EmployeeRemarks == "") // throw new CustomException(EnumExceptionType.Error, errmessage.pleaseWriteRemarks); // if (EmployeeValue == 0) // throw new CustomException(EnumExceptionType.Error, errmessage.NumberCantBe0); // if (EmployeeValue != 8 && (ItemID == Ease.CoreV35.Model.ID.FromInteger(AttendanceBenefitTypeIDConstant.Festivel_Over_Time) || ItemID == Ease.CoreV35.Model.ID.FromInteger(AttendanceBenefitTypeIDConstant.Dayoff_Over_Time) // || ItemID == Ease.CoreV35.Model.ID.FromInteger(AttendanceBenefitTypeIDConstant.Additional_Overtime))) // throw new CustomException(EnumExceptionType.Error, errmessage.CanNotClaimOvertimeFestivalDayoffOvertime8Hours); // if (EmployeeValue > 8 && ItemID == Ease.CoreV35.Model.ID.FromInteger(AttendanceBenefitTypeIDConstant.Hartal_OverTime)) // throw new CustomException(EnumExceptionType.Error, errmessage.CanNotClaimOvertime8Hours); // if (EmployeeValue > 16 && (ShiftID.Integer != 6 && ShiftID.Integer != 7 && ShiftID.Integer != 8 && ShiftID.Integer != 9)) //For Common shift // throw new CustomException(EnumExceptionType.Error, errmessage.CanNotClaimOvertime16Hours); // //if (ClaimDate < cutoffDate) // // throw new CustomException(EnumExceptionType.Error, errmessage.YouHaveToApplyWithin90Days); // if (ClaimDate > DateTime.Today) // throw new CustomException(EnumExceptionType.Error, errmessage.YouCanNotApplyAtFutureDate); // if (daProcess == null) // throw new CustomException(EnumExceptionType.Error, errmessage.YouCanNotApplyAsThereIsNoAttendanceDataFoundForTheClaimDate); // shiftID = daProcess.TempShiftID != null ? daProcess.TempShiftID : daProcess.ShiftID; // oShift = Shift.Get(shiftID); // if (oShift == null) // throw new CustomException(EnumExceptionType.Error, errmessage.NoShiftFoundAfterAttendanceProcess); // if (ItemType == enumPayrollComponentType.Over_Time) // { // shiftInTime = new DateTime(daProcess.AttnDate.Year, daProcess.AttnDate.Month, daProcess.AttnDate.Day, oShift.InTime.Hour, oShift.InTime.Minute, 0); // shiftOutTime = new DateTime(daProcess.AttnDate.Year, daProcess.AttnDate.Month, daProcess.AttnDate.Day, oShift.OutTime.Hour, oShift.OutTime.Minute, 0); // if (oShift.IsOverlapingDay) // shiftOutTime = shiftOutTime.AddDays(1); // if (daProcess.TempShiftID != null) // { // tempShiftEmps = ActingResponsibilitySetup.GetTemporaryShiftEmployee(daProcess.AttnDate, daProcess.EmployeeID); // temporaryShiftEmployee = tempShiftEmps.Where(o => o.EmployeeID == daProcess.EmployeeID).FirstOrDefault(); // if (temporaryShiftEmployee != null && (temporaryShiftEmployee.WorkPlanGroupID.Integer == 5 || temporaryShiftEmployee.WorkPlanGroupID.Integer == 17 || temporaryShiftEmployee.WorkPlanGroupID.Integer == 18)) // { // isOTApplicable = false; // } // } // if (daProcess.WorkDayType == EnumWorkPlanDayType.WeeklyHoliday || daProcess.WorkDayType == EnumWorkPlanDayType.NationalHoliday) // { // isOTApplicable = false; // } // if (isOTApplicable == true) // { // if (daProcess.InTime != DateTime.MinValue && daProcess.OutTime != DateTime.MinValue) // { // if (FromTime > shiftInTime && FromTime < shiftOutTime) // { // throw new CustomException(EnumExceptionType.Error, errmessage.YouCannotApplyOTOnRegularWorkingTime); // } // //erd.PunchTime >= punchInFromtime && erd.PunchTime <= punchInTotime // if (ToTime > shiftInTime && ToTime < shiftOutTime) // { // throw new CustomException(EnumExceptionType.Error, errmessage.YouCannotApplyOTOnRegularWorkingTime); // } // //if (FromTime.TimeOfDay >= item.FromTime.TimeOfDay && FromTime.TimeOfDay <= item.ToTime.TimeOfDay) // //{ // // throw new CustomException(EnumExceptionType.Validation, "As you already applied overtime in this time period, You cant not apply Over Time."); // //} // //if (ToTime.TimeOfDay >= item.FromTime.TimeOfDay && ToTime.TimeOfDay <= item.ToTime.TimeOfDay) // //{ // // throw new CustomException(EnumExceptionType.Validation, "As you already applied overtime in this time period, You cant not apply Over Time."); // //} // //if (item.FromTime.TimeOfDay >= FromTime.TimeOfDay && item.ToTime.TimeOfDay <= FromTime.TimeOfDay) // //{ // // throw new CustomException(EnumExceptionType.Validation, "As you already applied overtime in this time period, You cant not apply Over Time."); // //} // //if (item.ToTime.TimeOfDay >= FromTime.TimeOfDay && item.ToTime.TimeOfDay <= ToTime.TimeOfDay) // //{ // // throw new CustomException(EnumExceptionType.Validation, "As you already applied overtime in this time period, You cant not apply Over Time."); // //} // } // } // } // if (GlobalFunctions.ApplyValidation(ClaimDate)) // throw new CustomException(EnumExceptionType.Error, errmessage.YouCanNotApplyForThePreviousMonthAtThisTimeWhileSalaryProcessIsNotCompletedYet); // ObjectsTemplate _attnMonthlyBenefits = AttnMonthlyBenefit.Get(EmployeeID.ToString(), AttnMonthlyBenefit.GetAttandaceSalaryMonth(ClaimDate)); // AttnMonthlyBenefit attnMBenefit = _attnMonthlyBenefits.Where(o => o.ItemType == ItemType && o.ItemID == ItemID.Integer).FirstOrDefault(); // DateTime applicableMonth = DateTime.MinValue; // AttnMnthBenefitValueMapper objMapper = new AttnMnthBenefitValueMapper(ClaimDate, out applicableMonth); // string propertyName = objMapper[ClaimDate]; // PropertyInfo propertyInfo = typeof(AttnMonthlyBenefit).GetProperties().FirstOrDefault(p => p.Name == propertyName); // double calculatedfValue; // if (propertyInfo == null) // calculatedfValue = 0; // else // { // if (attnMBenefit != null) // calculatedfValue = (double)propertyInfo.GetValue(attnMBenefit, null); // else // calculatedfValue = 0; // } // if (attnMBenefit != null && calculatedfValue > 0 && (attnMBenefit.ItemID == AttendanceBenefitTypeIDConstant.Dayoff_Over_Time) || (attnMBenefit.ItemID == AttendanceBenefitTypeIDConstant.Festivel_Over_Time) || (attnMBenefit.ItemID == AttendanceBenefitTypeIDConstant.Hartal_OverTime)) // { // throw new CustomException(EnumExceptionType.Error, errmessage.YouCanNotClaimTwiceInTheSameDate); // } // if (attnMBenefit != null && (calculatedfValue + EmployeeValue) > 24 && (attnMBenefit.ItemID == AttendanceBenefitTypeIDConstant.Over_Time)) // { // throw new CustomException(EnumExceptionType.Error, errmessage.CanNotClaimOvertimeAlreadyGot24HourOvertime); // } // ObjectsTemplate _claimsAll = AdhocClaim.GetByEmployeeID(EmployeeID, ClaimDate, ClaimDate); // AdhocClaim claim = _claimsAll.Where(o => o.ShiftID == ShiftID && o.ClaimDate == ClaimDate && o.ItemType == ItemType).FirstOrDefault(); // totalOTHour = _claimsAll.Where(o => o.ClaimDate == ClaimDate && o.ItemType == ItemType).Sum(o => o.EmployeeValue); // if (totalOTHour >= 24) // throw new CustomException(EnumExceptionType.Error, errmessage.CanNotClaimOvertimeAlreadyGot24HourOvertime); // if ((EmployeeValue + totalOTHour) > 24) // throw new CustomException(EnumExceptionType.Error, errmessage.CanNotClaimOvertimeExceed24Hour); // if ((ShiftID.Integer != 6 && ShiftID.Integer != 7 && ShiftID.Integer != 8 && ShiftID.Integer != 9) && claim != null) // throw new CustomException(EnumExceptionType.Error, errmessage.CanNotClaimTwiceWithSameRelay); // claim = _claimsAll.Where(o => o.ClaimDate == ClaimDate && o.ItemType == ItemType && (o.ItemID.Integer == AttendanceBenefitTypeIDConstant.Festivel_Over_Time || o.ItemID.Integer == AttendanceBenefitTypeIDConstant.Dayoff_Over_Time || o.ItemID.Integer == AttendanceBenefitTypeIDConstant.Hartal_OverTime)).FirstOrDefault(); // if (claim != null && (ItemID == Ease.CoreV35.Model.ID.FromInteger(AttendanceBenefitTypeIDConstant.Festivel_Over_Time) || ItemID == Ease.CoreV35.Model.ID.FromInteger(AttendanceBenefitTypeIDConstant.Dayoff_Over_Time) || // ItemID == Ease.CoreV35.Model.ID.FromInteger(AttendanceBenefitTypeIDConstant.Hartal_OverTime))) // throw new CustomException(EnumExceptionType.Error, errmessage.YouCanNotClaimTwiceInTheSameDate); // //LeaveEntry oLeaveEntry = LeaveEntry.GetCompensatoryLeaveByEmployeeID(ClaimDate, EmployeeID); // //if (oLeaveEntry != null && !oLeaveEntry.IsNew && oLeaveEntry.LeaveID.Integer == 6 && ((ItemID.Integer == AttendanceBenefitTypeIDConstant.Festivel_Over_Time || // // ItemID.Integer == AttendanceBenefitTypeIDConstant.Dayoff_Over_Time || ItemID.Integer == AttendanceBenefitTypeIDConstant.Hartal_OverTime))) // // throw new CustomException(EnumExceptionType.Error, errmessage.CanNotClaimOvertime); //} //public static DataTable GetEmpConveyanceApproveDataTable(ObjectsTemplate _conveyanceClaims) //{ // try // { // //DataSet dSetAllData = Employee.GetAllRelevantData(); // //ObjectsTemplate _shifts = Shift.LoaData(dSetAllData.Tables["Shift"]); // //ObjectsTemplate _workPlanGroups = WorkPlanGroup.LoaData(dSetAllData.Tables["WorkPlanGroup"]); // //ObjectsTemplate _employees = Employee.LoaData(dSetAllData.Tables["Employee"]); // //ObjectsTemplate _departments = Department.LoaData(dSetAllData.Tables["Department"]); // //DataRow oRow = null; // DataTable gridDataTable = new DataTable(); // //gridDataTable.Columns.Add("ConveyancePendingClaimID"); // //gridDataTable.Columns.Add("EmpNo"); // //gridDataTable.Columns.Add("Name"); // //gridDataTable.Columns.Add("Department"); // //gridDataTable.Columns.Add("Shift"); // //gridDataTable.Columns.Add("Relay"); // //gridDataTable.Columns.Add("ClaimDate"); // //gridDataTable.Columns.Add("AppliedConveyance"); // //gridDataTable.Columns.Add("EmpRemarks"); // //gridDataTable.Columns.Add("Status"); // //if (_conveyanceClaims != null) // //{ // // foreach (AdhocClaim oItem in _conveyanceClaims) // // { // // Employee oEmployee = _employees.Where(o => o.ID == oItem.EmployeeID).FirstOrDefault(); // // if (oEmployee == null) // // continue; // // Shift oShift = _shifts.Where(o => o.ID == oItem.ShiftID).FirstOrDefault(); // // WorkPlanGroup oWorkPlanGroup = _workPlanGroups.Where(o => o.ID == oItem.WorkPlanGroupID).FirstOrDefault(); // // Department oDepartment = _departments.Where(o => o.ID == oEmployee.DepartmentID).FirstOrDefault(); // // oRow = gridDataTable.NewRow(); // // oRow["ConveyancePendingClaimID"] = oItem.ID; // // oRow["EmpNo"] = oEmployee.EmployeeNo; // // oRow["Name"] = oEmployee.Name; // // oRow["Department"] = oDepartment == null ? "" : oDepartment.Name; // // oRow["Shift"] = oWorkPlanGroup == null ? "" : oWorkPlanGroup.Name; // // oRow["Relay"] = oShift == null ? "" : oShift.Name; // // oRow["ClaimDate"] = oItem.ClaimDate.ToString("dd MMM yyyy"); // // oRow["AppliedConveyance"] = oItem.EmployeeValue; // // oRow["EmpRemarks"] = oItem.EmployeeRemarks; // // oRow["Status"] = oItem.ClaimWFStatus.ToString(); // // gridDataTable.Rows.Add(oRow); // // } // //} // return gridDataTable; // } // catch (Exception ex) // { // throw new Exception(ex.Message, ex); // } //} //public static DataTable GetEmpTSAApproveDataTable(ObjectsTemplate _tsaClaims) //{ // try // { // // DataSet dSetAllData = Employee.GetAllRelevantData(); // //ObjectsTemplate _shifts = Shift.LoaData(dSetAllData.Tables["Shift"]); // //ObjectsTemplate _workPlanGroups = WorkPlanGroup.LoaData(dSetAllData.Tables["WorkPlanGroup"]); // //ObjectsTemplate _employees = Employee.LoaData(dSetAllData.Tables["Employee"]); // //ObjectsTemplate _departments = Department.LoaData(dSetAllData.Tables["Department"]); // //DataRow oRow = null; // DataTable gridDataTable = new DataTable(); // gridDataTable.Columns.Add("TSAClaimID"); // gridDataTable.Columns.Add("EmpNo"); // gridDataTable.Columns.Add("Name"); // gridDataTable.Columns.Add("Department"); // gridDataTable.Columns.Add("Shift"); // gridDataTable.Columns.Add("Relay"); // gridDataTable.Columns.Add("ClaimDate"); // gridDataTable.Columns.Add("AppliedTSA"); // gridDataTable.Columns.Add("Remarks"); // gridDataTable.Columns.Add("Status"); // //if (_tsaClaims != null) // //{ // // foreach (AdhocClaim oItem in _tsaClaims) // // { // // Employee oEmployee = _employees.Where(o => o.ID == oItem.EmployeeID).FirstOrDefault(); // // if (oEmployee == null) // // continue; // // Shift oShift = _shifts.Where(o => o.ID == oItem.ShiftID).FirstOrDefault(); // // WorkPlanGroup oWorkPlanGroup = _workPlanGroups.Where(o => o.ID == oItem.WorkPlanGroupID).FirstOrDefault(); // // Department oDepartment = _departments.Where(o => o.ID == oEmployee.DepartmentID).FirstOrDefault(); // // oRow = gridDataTable.NewRow(); // // oRow["TSAClaimID"] = oItem.ID; // // oRow["EmpNo"] = oEmployee.EmployeeNo; // // oRow["Name"] = oEmployee.Name; // // oRow["Department"] = oDepartment == null ? "" : oDepartment.Name; // // oRow["Shift"] = oWorkPlanGroup == null ? "" : oWorkPlanGroup.Name; // // oRow["Relay"] = oShift == null ? "" : oShift.Name; // // oRow["ClaimDate"] = oItem.ClaimDate.ToString("dd MMM yyyy"); // // oRow["AppliedTSA"] = oItem.EmployeeValue; // // oRow["Remarks"] = oItem.EmployeeRemarks; // // oRow["Status"] = oItem.ClaimWFStatus.ToString(); // // gridDataTable.Rows.Add(oRow); // // } // //} // return gridDataTable; // } // catch (Exception ex) // { // throw new Exception(ex.Message, ex); // } //} //public static DataTable GetEmpDSAApproveDataTable(ObjectsTemplate _dsaClaims) //{ // try // { // //DataSet dSetAllData = Employee.GetAllRelevantData(); // //ObjectsTemplate _shifts = Shift.LoaData(dSetAllData.Tables["Shift"]); // //ObjectsTemplate _workPlanGroups = WorkPlanGroup.LoaData(dSetAllData.Tables["WorkPlanGroup"]); // //ObjectsTemplate _employees = Employee.LoaData(dSetAllData.Tables["Employee"]); // //ObjectsTemplate _departments = Department.LoaData(dSetAllData.Tables["Department"]); // //DataRow oRow = null; // DataTable gridDataTable = new DataTable(); // gridDataTable.Columns.Add("DSAClaimID"); // gridDataTable.Columns.Add("EmpNo"); // gridDataTable.Columns.Add("Name"); // gridDataTable.Columns.Add("Department"); // gridDataTable.Columns.Add("Shift"); // gridDataTable.Columns.Add("Relay"); // gridDataTable.Columns.Add("ClaimDate"); // gridDataTable.Columns.Add("AppliedDSA"); // gridDataTable.Columns.Add("Remarks"); // gridDataTable.Columns.Add("Status"); // //if (_dsaClaims != null) // //{ // // foreach (AdhocClaim oItem in _dsaClaims) // // { // // Employee oEmployee = _employees.Where(o => o.ID == oItem.EmployeeID).FirstOrDefault(); // // if (oEmployee == null) // // continue; // // Shift oShift = _shifts.Where(o => o.ID == oItem.ShiftID).FirstOrDefault(); // // WorkPlanGroup oWorkPlanGroup = _workPlanGroups.Where(o => o.ID == oItem.WorkPlanGroupID).FirstOrDefault(); // // Department oDepartment = _departments.Where(o => o.ID == oEmployee.DepartmentID).FirstOrDefault(); // // oRow = gridDataTable.NewRow(); // // oRow["DSAClaimID"] = oItem.ID; // // oRow["EmpNo"] = oEmployee.EmployeeNo; // // oRow["Name"] = oEmployee.Name; // // oRow["Department"] = oDepartment == null ? "" : oDepartment.Name; // // oRow["Shift"] = oWorkPlanGroup == null ? "" : oWorkPlanGroup.Name; // // oRow["Relay"] = oShift == null ? "" : oShift.Name; // // oRow["ClaimDate"] = oItem.ClaimDate.ToString("dd MMM yyyy"); // // oRow["AppliedDSA"] = oItem.EmployeeValue; // // oRow["Remarks"] = oItem.EmployeeRemarks; // // oRow["Status"] = oItem.ClaimWFStatus.ToString(); // // gridDataTable.Rows.Add(oRow); // // } // //} // return gridDataTable; // } // catch (Exception ex) // { // throw new Exception(ex.Message, ex); // } //} ////public static DataTable GetEmpDSADataTable(ID employeeID, DateTime fromDate, DateTime toDate, enumPayrollComponentType allowType, int benefitID) ////{ //// try //// { //// Employee shiftManager = null; //// Shift oShift = null; //// WorkPlanGroup oWorkPlanGroup = null; //// ObjectsTemplate _dsaClaims = AdhocClaim.GetByEmployeeID(employeeID, fromDate, toDate); //// _dsaClaims = _dsaClaims.Where(o => o.ItemType == allowType && o.ItemID.Integer == benefitID).ToObjectsTemplate(); //// DataSet dSetAllData = null; //// dSetAllData = Employee.GetAllRelevantData(); //// ObjectsTemplate _shifts = Shift.LoaData(dSetAllData.Tables["Shift"]); //// ObjectsTemplate _workPlanGroups = WorkPlanGroup.LoaData(dSetAllData.Tables["WorkPlanGroup"]); //// ObjectsTemplate _employees = Employee.LoaData(dSetAllData.Tables["Employee"]); //// DataRow oRow = null; //// DataTable gridDataTable = new DataTable(); //// gridDataTable = new DataTable(); //// if (_dsaClaims.Count > 0) //// { //// gridDataTable.Columns.Add("DSAClaimID"); //// gridDataTable.Columns.Add("Shift"); //// gridDataTable.Columns.Add("Relay"); //// gridDataTable.Columns.Add("ShiftManager"); //// gridDataTable.Columns.Add("ClaimDate"); //// gridDataTable.Columns.Add("AppliedDSA"); //// gridDataTable.Columns.Add("Remarks"); //// gridDataTable.Columns.Add("Status"); //// gridDataTable.Columns.Add("LMApprovedDate"); //// gridDataTable.Columns.Add("ApprovedDSA"); //// foreach (AdhocClaim oItem in _dsaClaims) //// { //// shiftManager = _employees.Where(o => o.ID == oItem.ShiftManagerID).FirstOrDefault(); //// oShift = _shifts.Where(o => o.ID == oItem.ShiftID).FirstOrDefault(); //// oWorkPlanGroup = _workPlanGroups.Where(o => o.ID == oItem.WorkPlanGroupID).FirstOrDefault(); //// oRow = gridDataTable.NewRow(); //// oRow["DSaClaimID"] = oItem.ID; //// oRow["Shift"] = oWorkPlanGroup == null ? "" : oWorkPlanGroup.Name; //// oRow["Relay"] = oShift == null ? "" : oShift.Name; //// oRow["ShiftManager"] = shiftManager == null ? "" : shiftManager.Name; //// oRow["ClaimDate"] = oItem.ClaimDate.ToString("dd MMM yyyy"); //// oRow["AppliedDSA"] = oItem.EmployeeValue; //// oRow["Remarks"] = oItem.EmployeeRemarks; //// oRow["Status"] = oItem.ClaimWFStatus.ToString(); //// if (oItem.LMApproveDate != null && oItem.LMApproveDate != DateTime.MinValue) //// oRow["LMApprovedDate"] = oItem.LMApproveDate.ToString("dd MMM yyyy"); //// if (oItem.ClaimWFStatus == EnumClaimWFStatus.LMApproved) //// oRow["ApprovedDSA"] = oItem.LMValue; //// gridDataTable.Rows.Add(oRow); //// } //// } //// return gridDataTable; //// } //// catch (Exception ex) //// { //// throw new Exception(ex.Message, ex); //// } ////} ////public static DataTable GetEmpConveyanceDataTable(ID employeeID, DateTime fromDate, DateTime toDate, enumPayrollComponentType allowType, int benefitID) ////{ //// try //// { //// ObjectsTemplate _conveyanceClaims = AdhocClaim.GetByEmployeeID(employeeID, fromDate, toDate); //// _conveyanceClaims = _conveyanceClaims.Where(o => o.ItemType == allowType && o.ItemID.Integer == benefitID).ToObjectsTemplate(); //// DataSet dSetAllData = null; //// dSetAllData = Employee.GetAllRelevantData(); //// ObjectsTemplate _shifts = Shift.LoaData(dSetAllData.Tables["Shift"]); //// ObjectsTemplate _workPlanGroups = WorkPlanGroup.LoaData(dSetAllData.Tables["WorkPlanGroup"]); //// ObjectsTemplate _employees = Employee.LoaData(dSetAllData.Tables["Employee"]); //// DataRow oRow = null; //// DataTable gridDataTable = new DataTable(); //// gridDataTable = new DataTable(); //// if (_conveyanceClaims.Count > 0) //// { //// gridDataTable.Columns.Add("ConveyanceClaimID"); //// gridDataTable.Columns.Add("Shift"); //// gridDataTable.Columns.Add("Relay"); //// gridDataTable.Columns.Add("ShiftManager"); //// gridDataTable.Columns.Add("ClaimDate"); //// gridDataTable.Columns.Add("AppliedConveyance"); //// gridDataTable.Columns.Add("Remarks"); //// gridDataTable.Columns.Add("Status"); //// gridDataTable.Columns.Add("LMApprovedDate"); //// gridDataTable.Columns.Add("ApprovedConveyance"); //// foreach (AdhocClaim oItem in _conveyanceClaims) //// { //// Employee shiftManager = _employees.Where(o => o.ID == oItem.ShiftManagerID).FirstOrDefault(); //// Shift oShift = _shifts.Where(o => o.ID == oItem.ShiftID).FirstOrDefault(); //// WorkPlanGroup oWorkPlanGroup = _workPlanGroups.Where(o => o.ID == oItem.WorkPlanGroupID).FirstOrDefault(); //// oRow = gridDataTable.NewRow(); //// oRow["ConveyanceClaimID"] = oItem.ID; //// oRow["Shift"] = oWorkPlanGroup == null ? "" : oWorkPlanGroup.Name; //// oRow["Relay"] = oShift == null ? "" : oShift.Name; //// oRow["ShiftManager"] = shiftManager == null ? "" : shiftManager.Name; //// oRow["ClaimDate"] = oItem.ClaimDate.ToString("dd MMM yyyy"); //// oRow["AppliedConveyance"] = oItem.EmployeeValue; //// oRow["Remarks"] = oItem.EmployeeRemarks; //// oRow["Status"] = oItem.ClaimWFStatus.ToString(); //// if (oItem.LMApproveDate != null && oItem.LMApproveDate != DateTime.MinValue) //// oRow["LMApprovedDate"] = oItem.LMApproveDate.ToString("dd MMM yyyy"); //// if (oItem.ClaimWFStatus == EnumClaimWFStatus.LMApproved) //// oRow["ApprovedConveyance"] = oItem.LMValue; //// gridDataTable.Rows.Add(oRow); //// } //// } //// return gridDataTable; //// } //// catch (Exception ex) //// { //// throw new Exception(ex.Message, ex); //// } ////} ////public static DataTable GetEmpOddHourConveyanceDataTable(ID employeeID, DateTime fromDate, DateTime toDate, enumPayrollComponentType allowType, int benefitID) ////{ //// try //// { //// ObjectsTemplate _conveyanceClaims = AdhocClaim.GetByEmployeeID(employeeID, fromDate, toDate); //// _conveyanceClaims = _conveyanceClaims.Where(o => o.ItemType == allowType && o.ItemID.Integer == benefitID).ToObjectsTemplate(); //// DataSet dSetAllData = null; //// dSetAllData = Employee.GetAllRelevantData(); //// ObjectsTemplate _shifts = Shift.LoaData(dSetAllData.Tables["Shift"]); //// ObjectsTemplate _workPlanGroups = WorkPlanGroup.LoaData(dSetAllData.Tables["WorkPlanGroup"]); //// ObjectsTemplate _employees = Employee.LoaData(dSetAllData.Tables["Employee"]); //// DataRow oRow = null; //// DataTable gridDataTable = new DataTable(); //// gridDataTable = new DataTable(); //// if (_conveyanceClaims.Count > 0) //// { //// gridDataTable.Columns.Add("ConveyanceClaimID"); //// gridDataTable.Columns.Add("Shift"); //// gridDataTable.Columns.Add("Relay"); //// gridDataTable.Columns.Add("ShiftManager"); //// gridDataTable.Columns.Add("ClaimDate"); //// gridDataTable.Columns.Add("AppliedConveyance"); //// gridDataTable.Columns.Add("Remarks"); //// gridDataTable.Columns.Add("Status"); //// gridDataTable.Columns.Add("LMApprovedDate"); //// gridDataTable.Columns.Add("ApprovedConveyance"); //// foreach (AdhocClaim oItem in _conveyanceClaims) //// { //// Employee shiftManager = _employees.Where(o => o.ID == oItem.ShiftManagerID).FirstOrDefault(); //// Shift oShift = _shifts.Where(o => o.ID == oItem.ShiftID).FirstOrDefault(); //// WorkPlanGroup oWorkPlanGroup = _workPlanGroups.Where(o => o.ID == oItem.WorkPlanGroupID).FirstOrDefault(); //// oRow = gridDataTable.NewRow(); //// oRow["ConveyanceClaimID"] = oItem.ID; //// oRow["Shift"] = oWorkPlanGroup == null ? "" : oWorkPlanGroup.Name; //// oRow["Relay"] = oShift == null ? "" : oShift.Name; //// oRow["ShiftManager"] = shiftManager == null ? "" : shiftManager.Name; //// oRow["ClaimDate"] = oItem.ClaimDate.ToString("dd MMM yyyy"); //// oRow["AppliedConveyance"] = oItem.EmployeeValue; //// oRow["Remarks"] = oItem.EmployeeRemarks; //// oRow["Status"] = oItem.ClaimWFStatus.ToString(); //// if (oItem.LMApproveDate != null && oItem.LMApproveDate != DateTime.MinValue) //// oRow["LMApprovedDate"] = oItem.LMApproveDate.ToString("dd MMM yyyy"); //// if (oItem.ClaimWFStatus == EnumClaimWFStatus.LMApproved) //// oRow["ApprovedConveyance"] = oItem.LMValue; //// gridDataTable.Rows.Add(oRow); //// } //// } //// return gridDataTable; //// } //// catch (Exception ex) //// { //// throw new Exception(ex.Message, ex); //// } ////} ////public static DataTable GetEmpTSADataTable(ID employeeID, DateTime fromDate, DateTime toDate, enumPayrollComponentType allowType, int benefitID) ////{ //// try //// { //// ObjectsTemplate _tsaClaims = AdhocClaim.GetByEmployeeID(employeeID, fromDate, toDate); //// _tsaClaims = _tsaClaims.Where(o => o.ItemType == allowType && o.ItemID.Integer == benefitID).ToObjectsTemplate(); //// DataSet dSetAllData = null; //// dSetAllData = Employee.GetAllRelevantData(); //// ObjectsTemplate _shifts = Shift.LoaData(dSetAllData.Tables["Shift"]); //// ObjectsTemplate _workPlanGroups = WorkPlanGroup.LoaData(dSetAllData.Tables["WorkPlanGroup"]); //// ObjectsTemplate _employees = Employee.LoaData(dSetAllData.Tables["Employee"]); //// DataRow oRow = null; //// DataTable gridDataTable = new DataTable(); //// gridDataTable = new DataTable(); //// if (_tsaClaims.Count > 0) //// { //// gridDataTable.Columns.Add("TSaClaimID"); //// gridDataTable.Columns.Add("Shift"); //// gridDataTable.Columns.Add("Relay"); //// gridDataTable.Columns.Add("ShiftManager"); //// gridDataTable.Columns.Add("ClaimDate"); //// gridDataTable.Columns.Add("AppliedTSA"); //// gridDataTable.Columns.Add("Remarks"); //// gridDataTable.Columns.Add("Status"); //// gridDataTable.Columns.Add("LMApprovedDate"); //// gridDataTable.Columns.Add("ApprovedTSA"); //// foreach (AdhocClaim oItem in _tsaClaims) //// { //// Employee shiftManager = _employees.Where(o => o.ID == oItem.ShiftManagerID).FirstOrDefault(); //// Shift oShift = _shifts.Where(o => o.ID == oItem.ShiftID).FirstOrDefault(); //// WorkPlanGroup oWorkPlanGroup = _workPlanGroups.Where(o => o.ID == oItem.WorkPlanGroupID).FirstOrDefault(); //// oRow = gridDataTable.NewRow(); //// oRow["TSaClaimID"] = oItem.ID; //// oRow["Shift"] = oWorkPlanGroup == null ? "" : oWorkPlanGroup.Name; //// oRow["Relay"] = oShift == null ? "" : oShift.Name; //// oRow["ShiftManager"] = shiftManager == null ? "" : shiftManager.Name; //// oRow["ClaimDate"] = oItem.ClaimDate.ToString("dd MMM yyyy"); //// oRow["AppliedTSA"] = oItem.EmployeeValue; //// oRow["Remarks"] = oItem.EmployeeRemarks; //// oRow["Status"] = oItem.ClaimWFStatus.ToString(); //// if (oItem.LMApproveDate != null && oItem.LMApproveDate != DateTime.MinValue) //// oRow["LMApprovedDate"] = oItem.LMApproveDate.ToString("dd MMM yyyy"); //// if (oItem.ClaimWFStatus == EnumClaimWFStatus.LMApproved) //// oRow["ApprovedTSA"] = oItem.LMValue; //// gridDataTable.Rows.Add(oRow); //// } //// } //// return gridDataTable; //// } //// catch (Exception ex) //// { //// throw new Exception(ex.Message, ex); //// } ////} ////public static DataTable GetEmpOTDataTable(ID employeeID, DateTime fromDate, DateTime toDate, enumPayrollComponentType allowType, int payrollTypeID) ////{ //// try //// { //// ObjectsTemplate _overTimeClaims = AdhocClaim.GetByEmployeeID(employeeID, fromDate, toDate); //// _overTimeClaims = _overTimeClaims.Where(o => o.ItemType == allowType).ToObjectsTemplate(); //// ObjectsTemplate _overTimes = Term.Get(EnumStatus.Active); //// ObjectsTemplate _workPlanGroups = WorkPlanGroup.GetAll().Where(o => o.PayrollTypeID.Integer == payrollTypeID).ToObjectsTemplate(); //// ObjectsTemplate _employees = Employee.GetAllPayrollTypesLiveEmps(); //// DataRow oRow = null; //// DataTable gridDataTable = new DataTable(); //// gridDataTable = new DataTable(); //// if (_overTimeClaims.Count > 0) //// { //// gridDataTable.Columns.Add("EmpOverTimeClaimID"); //// gridDataTable.Columns.Add("ClaimDate"); //// gridDataTable.Columns.Add("FromTime"); //// gridDataTable.Columns.Add("ToTime"); //// gridDataTable.Columns.Add("Shift"); //// gridDataTable.Columns.Add("ShiftManager"); //// gridDataTable.Columns.Add("OverTimeTypes"); //// gridDataTable.Columns.Add("AppliedOTHour"); //// gridDataTable.Columns.Add("Remarks"); //// gridDataTable.Columns.Add("Status"); //// gridDataTable.Columns.Add("ApprovedOTHour"); //// gridDataTable.Columns.Add("LMApprovedDate"); //// gridDataTable.Columns.Add("IsLineManagerSubmitted"); //// foreach (AdhocClaim oItem in _overTimeClaims) //// { //// Employee shiftManager = _employees.Where(o => o.ID == oItem.ShiftManagerID).FirstOrDefault(); //// WorkPlanGroup oWorkPlanGroup = _workPlanGroups.Where(o => o.ID == oItem.WorkPlanGroupID).FirstOrDefault(); //// oRow = gridDataTable.NewRow(); //// oRow["EmpOverTimeClaimID"] = oItem.ID; //// oRow["ClaimDate"] = oItem.ClaimDate.ToString("dd MMM yyyy"); //// oRow["FromTime"] = oItem.FromTime != DateTime.MinValue ? oItem.FromTime.ToString("hh:mm tt") : ""; //// oRow["ToTime"] = oItem.ToTime != DateTime.MinValue ? oItem.ToTime.ToString("hh:mm tt") : ""; //// oRow["Shift"] = oWorkPlanGroup == null ? "" : oWorkPlanGroup.Name; //// oRow["ShiftManager"] = shiftManager == null ? "" : shiftManager.Name; //// Term overTime = _overTimes.Where(o => o.ID == oItem.ItemID).FirstOrDefault(); //// oRow["OverTimeTypes"] = overTime == null ? "" : overTime.Name; //// oRow["AppliedOTHour"] = oItem.EmployeeValue; //// oRow["Remarks"] = oItem.EmployeeRemarks; //// oRow["Status"] = oItem.ClaimWFStatus.ToString(); //// if (oItem.LMApproveDate != null && oItem.LMApproveDate != DateTime.MinValue) //// oRow["LMApprovedDate"] = oItem.LMApproveDate.ToString("dd MMM yyyy"); //// if (oItem.ClaimWFStatus == EnumClaimWFStatus.LMApproved) //// oRow["ApprovedOTHour"] = oItem.LMValue; //// oRow["IsLineManagerSubmitted"] = oItem.IsLMSubmitted ? "Yes" : "No"; //// gridDataTable.Rows.Add(oRow); //// } //// } //// return gridDataTable; //// } //// catch (Exception ex) //// { //// throw new Exception(ex.Message, ex); //// } ////} ////public static int GetAdhocClaimDataByWFStatusCount(DateTime fromdate, DateTime toDate, EnumWFAttnStatus status) ////{ //// try //// { //// return Service.GetAdhocClaimDataByWFStatusCount(fromdate, toDate, status); //// } //// catch (ServiceException e) //// { //// throw new Exception(e.Message, e); //// } ////} //public static AdhocClaim Get(ID nID) //{ // AdhocClaim oAdhocClaim = null; // #region Cache Header // oAdhocClaim = (AdhocClaim)_cache["Get", nID]; // if (oAdhocClaim != null) // return oAdhocClaim; // #endregion // oAdhocClaim = AdhocClaim.Service.Get(nID); // #region Cache Footer // _cache.Add(oAdhocClaim, "Get", nID); // #endregion // return oAdhocClaim; //} //public static long GetMaxBatchID() //{ // long maxBatchID = 0; // maxBatchID = AdhocClaim.Service.GetMaxBatchID(); // return maxBatchID; //} //public static int GetAdhocClaimDataByWFStatusCount(DateTime fromdate, DateTime toDate, EnumWFAttnStatus status) //{ // try // { // return Service.GetAdhocClaimDataByWFStatusCount(fromdate, toDate, status); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } //} //public static ObjectsTemplate Get() //{ // #region Cache Header // ObjectsTemplate AdhocClaims = _cache["Get"] as ObjectsTemplate; // if (AdhocClaims != null) // return AdhocClaims; // #endregion // try // { // AdhocClaims = Service.Get(); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(AdhocClaims, "Get"); // #endregion // return AdhocClaims; //} //public static ObjectsTemplate GetByEmployeeID(ID employeeID) //{ // #region Cache Header // ObjectsTemplate AdhocClaims = _cache["GetByEmployeeID"] as ObjectsTemplate; // if (AdhocClaims != null) // return AdhocClaims; // #endregion // try // { // AdhocClaims = Service.GetByEmployeeID(employeeID); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(AdhocClaims, "GetByEmployeeID"); // #endregion // return AdhocClaims; //} //public static ObjectsTemplate GetByEmployeeID(string employeeIDs, EnumClaimWFStatus wfStatus) //{ // #region Cache Header // ObjectsTemplate AdhocClaims = _cache["GetByEmployeeID"] as ObjectsTemplate; // if (AdhocClaims != null) // return AdhocClaims; // #endregion // try // { // AdhocClaims = Service.GetByEmployeeID(employeeIDs, wfStatus); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(AdhocClaims, "GetByEmployeeID"); // #endregion // return AdhocClaims; //} //public static ObjectsTemplate GetByShiftManagerID(ID shiftManagerID) //{ // #region Cache Header // ObjectsTemplate AdhocClaims = _cache["GetByShiftManagerID"] as ObjectsTemplate; // if (AdhocClaims != null) // return AdhocClaims; // #endregion // try // { // AdhocClaims = Service.GetByShiftManagerID(shiftManagerID); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(AdhocClaims, "GetByShiftManagerID"); // #endregion // return AdhocClaims; //} //public static ObjectsTemplate GetByApproverID(ID approverID, DateTime fromDate, DateTime toDate) //{ // #region Cache Header // ObjectsTemplate AdhocClaims = _cache["GetByEmployeeID"] as ObjectsTemplate; // if (AdhocClaims != null) // return AdhocClaims; // #endregion // try // { // AdhocClaims = Service.GetByApproverID(approverID, fromDate, toDate); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(AdhocClaims, "GetByEmployeeID"); // #endregion // return AdhocClaims; //} //public static ObjectsTemplate GetByShiftManagerID(ID shiftManagerID, DateTime fromDate, DateTime toDate) //{ // #region Cache Header // ObjectsTemplate AdhocClaims = _cache["GetByEmployeeID"] as ObjectsTemplate; // if (AdhocClaims != null) // return AdhocClaims; // #endregion // try // { // AdhocClaims = Service.GetByShiftManagerID(shiftManagerID, fromDate, toDate); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(AdhocClaims, "GetByEmployeeID"); // #endregion // return AdhocClaims; //} //public static ObjectsTemplate GetBySeniorTechnicianID(ID seniorTechnicianID, DateTime fromDate, DateTime toDate) //{ // #region Cache Header // ObjectsTemplate AdhocClaims = _cache["GetByEmployeeID"] as ObjectsTemplate; // if (AdhocClaims != null) // return AdhocClaims; // #endregion // try // { // AdhocClaims = Service.GetBySeniorTechnicianID(seniorTechnicianID, fromDate, toDate); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(AdhocClaims, "GetByEmployeeID"); // #endregion // return AdhocClaims; //} //public static ObjectsTemplate GetByShiftManagerID(ID shiftManagerID, EnumClaimWFStatus wfStatus) //{ // #region Cache Header // ObjectsTemplate AdhocClaims = _cache["GetByEmployeeID"] as ObjectsTemplate; // if (AdhocClaims != null) // return AdhocClaims; // #endregion // try // { // AdhocClaims = Service.GetByShiftManagerID(shiftManagerID, wfStatus); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(AdhocClaims, "GetByEmployeeID"); // #endregion // return AdhocClaims; //} //public static ObjectsTemplate GetByApprover(ID shiftID, ID deparetmentID, EnumClaimWFStatus wfStatus) //{ // #region Cache Header // ObjectsTemplate AdhocClaims = _cache["GetByEmployeeID"] as ObjectsTemplate; // if (AdhocClaims != null) // return AdhocClaims; // #endregion // try // { // AdhocClaims = Service.GetByApprover(shiftID, deparetmentID, wfStatus); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(AdhocClaims, "GetByEmployeeID"); // #endregion // return AdhocClaims; //} //public static ObjectsTemplate GetByEmployeeID(ID employeeID, DateTime fromDate, DateTime toDate) //{ // #region Cache Header // ObjectsTemplate AdhocClaims = _cache["GetByEmployeeID"] as ObjectsTemplate; // if (AdhocClaims != null) // return AdhocClaims; // #endregion // try // { // AdhocClaims = Service.GetByEmployeeID(employeeID, fromDate, toDate); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(AdhocClaims, "GetByEmployeeID"); // #endregion // return AdhocClaims; //} //public static ObjectsTemplate Get(DateTime deploymentDate) //{ // #region Cache Header // ObjectsTemplate AdhocClaims = _cache["Get", deploymentDate] as ObjectsTemplate; // if (AdhocClaims != null) // return AdhocClaims; // #endregion // try // { // AdhocClaims = Service.Get(deploymentDate); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(AdhocClaims, "Get", deploymentDate); // #endregion // return AdhocClaims; //} //public ID Save() //{ // this.SetAuditTrailProperties(); // return AdhocClaim.Service.Save(this); //} //public static void Save(ObjectsTemplate adhocClaims) //{ // foreach (AdhocClaim item in adhocClaims) // { // item.SetAuditTrailProperties(); // } // AdhocClaim.Service.Save(adhocClaims); //} //public static void Save(ObjectsTemplate adhocClaims, ObjectsTemplate attnMBenefits, ObjectsTemplate attnBenefitAuditTrails) //{ // foreach (AdhocClaim item in adhocClaims) // { // item.SetAuditTrailProperties(); // } // AdhocClaim.Service.Save(adhocClaims, attnMBenefits, attnBenefitAuditTrails); //} //public void Delete(ID id) //{ // AdhocClaim.Service.Delete(id); //} //#endregion } #endregion //#region IAdhocClaimService Service //public interface IAdhocClaimService //{ // int GetAdhocClaimDataByWFStatusCount(DateTime fromdate, DateTime toDate, EnumWFAttnStatus status); // ObjectsTemplate GetByApproverID(ID approverID, DateTime fromDate, DateTime toDate); // ObjectsTemplate GetByEmployeeID(string employeeIDs, EnumClaimWFStatus wfStatus); // ObjectsTemplate GetBySeniorTechnicianID(ID seniorTechnicianID, DateTime fromDate, DateTime toDate); // ObjectsTemplate GetByApprover(ID shiftID, ID deparetmentID, EnumClaimWFStatus wfStatus); // ObjectsTemplate GetByShiftManagerID(ID shiftManagerID, EnumClaimWFStatus wfStatus); // ObjectsTemplate GetByShiftManagerID(ID shiftManagerID, DateTime fromDate, DateTime toDate); // ObjectsTemplate GetByShiftManagerID(ID shiftManagerID); // ObjectsTemplate GetByEmployeeID(ID employeeID, DateTime fromDate, DateTime toDate); // long GetMaxBatchID(); // ObjectsTemplate GetByEmployeeID(ID employeeID); // ObjectsTemplate Get(DateTime deploymentDate); // AdhocClaim Get(ID id); // ObjectsTemplate Get(); // ID Save(AdhocClaim item); // void Save(ObjectsTemplate adhocClaims); // void Save(ObjectsTemplate adhocClaims, ObjectsTemplate attnMBenefits, ObjectsTemplate attnBenefitAuditTrails); // void Delete(ID id); //} //#endregion }