/// <summary> /// 签退 /// </summary> /// <returns></returns> public JsonResult LoginOut(string userNamer) { OperationResult oper = new OperationResult(OperationResultType.Error, "打卡异常"); try { int adminId = _administratorContract.Administrators.Where(x => x.Member.MemberName == userNamer && x.DepartmentId == 7).Select(x => x.Id).FirstOrDefault(); if (adminId == 4147 || adminId == 2119) { Department department = _departmentContract.Departments.Where(x => x.IsDeleted == false && x.IsEnabled == true && !string.IsNullOrEmpty(x.MacAddress) && x.MacAddress == "D4EE074E6AF2").FirstOrDefault(); oper = _attendanceContract.LoginOut(adminId, department); var res = _statContract.StatStoreWhenSignOut(adminId); return(Json(oper, JsonRequestBehavior.AllowGet)); } else { return(Json(oper, JsonRequestBehavior.AllowGet)); } } catch (Exception e) { return(Json(oper, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 签退 /// </summary> /// <returns></returns> public JsonResult LoginOut(string AdminId, string MacAddress) { OperationResult oper = new OperationResult(OperationResultType.Error, "请重新登陆"); int adminId = 0; string strAdminId = AdminId; if (string.IsNullOrEmpty(strAdminId)) { return(Json(oper)); } adminId = int.Parse(strAdminId); if (ExistUnreadMsg(adminId)) { oper.Message = "请先阅读通知"; return(Json(oper)); } Administrator admin = _administratorContract.View(adminId); var checkmac = admin?.JobPosition.CheckMac != false; if (checkmac) { string strMac = MacAddress; oper = this.CheckMac(strMac); if (oper.ResultType != OperationResultType.Success) { return(Json(oper, JsonRequestBehavior.AllowGet)); } } Department department = oper.Data as Department; oper = _attendanceContract.LoginOut(adminId, department, !checkmac); var res = _statContract.StatStoreWhenSignOut(adminId); if (res.ResultType != OperationResultType.Success) { _Logger.Error(res.Message); } return(Json(oper, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 签退 /// </summary> /// <returns></returns> public JsonResult LoginOut() { OperationResult oper = new OperationResult(OperationResultType.Error, "用户未登录,无法签退"); int adminId = AuthorityHelper.OperatorId ?? 0; string strMac = Request["Mac"]; Administrator admin = _administratorContract.View(adminId); var checkmac = admin?.JobPosition.CheckMac != false; if (checkmac) { oper = this.CheckMac(strMac); if (oper.ResultType != OperationResultType.Success) { return(Json(oper, JsonRequestBehavior.AllowGet)); } } Department department = oper.Data as Department; oper = _attendanceContract.LoginOut(adminId, department); return(Json(oper, JsonRequestBehavior.AllowGet)); }