public async Task <IActionResult> CreatePunchin([FromBody] TimeAndAttendanceParam param) { DataService ds = new DataService(this._baseUrl); TimeAndAttendancePunchInView view = await ds.PostAsync <TimeAndAttendanceParam, TimeAndAttendancePunchInView>("api/TimeAndAttendance/TAPunchin", param); return(Ok(view)); }
public async Task <IActionResult> CreatePunchin([FromBody] TimeAndAttendanceParam param) { TimeAndAttendanceModule taMod = new TimeAndAttendanceModule(); TimeAndAttendancePunchIn taPunchin = null; TimeAndAttendanceTimeView currentTime = await taMod.TimeAndAttendance.Query().GetUTCAdjustedTime(); DateTime asOfDate = currentTime.PunchDate; taPunchin = await taMod.TimeAndAttendance.Query().BuildPunchin(param.EmployeeId, param.Account, asOfDate); taMod.TimeAndAttendance.AddPunchIn(taPunchin).Apply(); TimeAndAttendancePunchInView view = null; view = await taMod.TimeAndAttendance.Query().GetPunchOpenView(param.EmployeeId); return(Ok(view)); }
public async Task <IActionResult> UpdatePunch([FromBody] TimeAndAttendanceParam param) { TimeAndAttendanceModule taMod = new TimeAndAttendanceModule(); TimeAndAttendancePunchIn taPunchin = null; TimeAndAttendanceTimeView currentTime = await taMod.TimeAndAttendance.Query().GetUTCAdjustedTime(); DateTime asOfDate = currentTime.PunchDate; taPunchin = await taMod.TimeAndAttendance.Query().GetPunchOpen(param.EmployeeId); taMod.TimeAndAttendance.UpdatePunchIn(taPunchin, param.MealDeduction).Apply(); TimeAndAttendancePunchInView view = null; //view = await taMod.TimeAndAttendance.Query().GetPunchOpenView(param.employeeId); view = await taMod.TimeAndAttendance.Query().GetViewById(taPunchin.TimePunchinId); return(Ok(view)); }
public async Task <IActionResult> ManualPunchOut(TimeAndAttendanceParam param) { TimeAndAttendanceModule taMod = new TimeAndAttendanceModule(); TimeAndAttendancePunchIn taPunchin = null; TimeAndAttendancePunchInView view = null; //long employeeId=1; //string account = "1200.215"; //int mealDeduction = 30; //int manual_elapsedHours = 12; //int manual_elapsedMinutes = 30; TimeAndAttendancePunchIn openTA = await taMod.TimeAndAttendance.Query().IsPunchOpen(param.EmployeeId, param.AsOfDate); if (openTA != null) { taMod.TimeAndAttendance.UpdatePunchIn(openTA, param.MealDeduction, param.Manual_ElapsedHours, param.Manual_ElapsedMinutes).Apply(); taPunchin = await taMod.TimeAndAttendance.Query().GetEntityById(openTA.TimePunchinId); view = await taMod.TimeAndAttendance.Query().MapToView(taPunchin); } else { taPunchin = await taMod.TimeAndAttendance.Query().BuildPunchin(param.EmployeeId, param.Account, param.AsOfDate); taMod.TimeAndAttendance.AddPunchIn(taPunchin).Apply(); taPunchin = await taMod.TimeAndAttendance.Query().GetPunchOpen(param.EmployeeId); taMod.TimeAndAttendance.UpdatePunchIn(taPunchin, param.MealDeduction, param.Manual_ElapsedHours, param.Manual_ElapsedMinutes).Apply(); taPunchin = await taMod.TimeAndAttendance.Query().GetEntityById(taPunchin.TimePunchinId); view = await taMod.TimeAndAttendance.Query().MapToView(taPunchin); } return(Ok(view)); //Assert.NotNull(taPunchin.PunchinDate); }