public IHttpActionResult GetMyTimeSheet([FromUri] ReqMyTimeSheet req) { DateTime date; if (req.currentTimeStamp <= 0) { date = DateTime.Now; } else { date = DateTimeUtils.CreateDateTime(req.currentTimeStamp); } req.currentTimeStamp = new DateTime(date.Year, date.Month, date.Day).ToTimeStamp(); var currentInfo = this.GetUserModelFromCurrentClaimsIdentity(); ResMyTimeSheet res = new ResMyTimeSheet(); var timeSheetRepoModel = this._timeSheetRepo.GetTimeSheetDetail(currentInfo.mail, req.currentTimeStamp, false); if (timeSheetRepoModel == null) { //当前时间的TimeSheet不存在则创建 if (!this._timeSheetRepo.CreateTimeSheet(currentInfo.mail, req.currentTimeStamp)) { Enforce.Throw(new LogicErrorException("")); } timeSheetRepoModel = this._timeSheetRepo.GetTimeSheetDetail(currentInfo.mail, req.currentTimeStamp, false); } res.setResponse(ResStatusCode.OK, timeSheetRepoModel, 1); return(Ok(res)); }
public bool CreateTimeSheet(string currentUserMail, long currentTimeStamp) { var currentUserInfo = this._userRepository.GetUser(currentUserMail); if (currentUserInfo == null || currentUserInfo.info == null) { Enforce.Throw(new LogicErrorException("当前用户信息不存在")); } TimeSheetInfoModel info = new TimeSheetInfoModel(); info.userID = currentUserInfo.info.userID; info.userMail = currentUserInfo.info.mail; info.userName = currentUserInfo.info.userName; info.timeSheetTimeStamp = currentTimeStamp; info.timeSheetDate = DateTimeUtils.CreateDateTime(currentTimeStamp); info.status = (int)TimeSheetStatus.UnFillOut; info.createUserMail = currentUserMail; info.createTime = DateTime.Now; return(this._timeSheetBll.Add(Mapper.Map <TimeSheetInfoModel, T_TIME_SHEET>(info))); }
public IHttpActionResult ListTask([FromUri] ReqMyTask req) { var userRepoModel = this.GetUserModelFromCurrentClaimsIdentity(); var response = new ResListTask(); DateTime date; if (req.currentTimeStamp <= 0) { date = DateTime.Now; } else { date = DateTimeUtils.CreateDateTime(req.currentTimeStamp); } DateTime startTime = new DateTime(date.Year, date.Month, date.Day); DateTime endTime = startTime.AddDays(1); var backInfoList = this._taskRepository.getMyCompleteTaskList(userRepoModel.mail, startTime, endTime); response.setResponse(ResStatusCode.OK, backInfoList, backInfoList.Count); return(Ok(response)); }