public VMPunchtime convert(tPunchtime p) { VMPunchtime vmp = new VMPunchtime(); vmp.id = p.fId; vmp.title = p.fstatus; vmp.description = p.fstatus + " 打卡時間為:" + p.fDatetime.ToString("yyyy-MM-dd HH:mm:ss"); vmp.start = p.fDatetime.ToString("yyyy-MM-dd"); vmp.displayOrder = p.fId; //bg color if (p.fstatus == "遲到") { vmp.color = "#ff9800"; } else if (p.fstatus == "未打卡") { vmp.color = "#d92534"; } else if (p.fstatus == "已補打卡") { vmp.color = "#00bcd4"; } else { vmp.color = "#2196f3"; //上班、下班 } return(vmp); }
public ActionResult Editpass(int id, int agree) { //資料庫更新 tSignoff signoff = db.tSignoffs.Where(m => m.fId == id).FirstOrDefault(); signoff.fIsAgreed = agree; //通過 不通過 signoff.fPassdate = DateTime.Now; //通過日期 //list更新 var target = list.Where(m => m.id == id).FirstOrDefault(); target.isagreed = agree; target.passdate = DateTime.Now.ToString("yyyy-MM-dd hh:mm"); //通過審核 if (agree == 1) { if (target.catelog == "請假申請") { //儲存假別紀錄 int empId = signoff.tLeave.fEmployeeId; string sortName = signoff.tLeave.fSort; double useTime = signoff.tLeave.fTimeCount; (new CLeaveHelper()).Leavecount(empId, sortName, useTime); createNotifies(empId, "審核通過", "申請" + sortName + "已通過審核"); } if (target.catelog == "補打卡申請") { //儲存假別紀錄 int empId = signoff.tApplypunch.fEmployeeId; //修改打卡紀錄 int punchtimeId = signoff.tApplypunch.fPunchTimeId; string status = "已補打卡"; tPunchtime punchtime = db.tPunchtimes .Where(m => m.fId == punchtimeId) .FirstOrDefault(); punchtime.fstatus = status; createNotifies(empId, "審核通過", "申請補打卡" + punchtime.fDatetime + "已通過審核"); } if (target.catelog == "加班申請") { //儲存假別紀錄 int empId = signoff.tOvertime.fEmployeeId; string sortName = signoff.tOvertime.fSort; createNotifies(empId, "審核通過", "申請" + sortName + "已通過審核"); } } db.SaveChanges(); return(Json("success", JsonRequestBehavior.AllowGet)); }