/// <summary> /// 签到 /// </summary> /// <returns></returns> public JsonResult LoginIn(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 || adminId == 2114 || adminId == 3122) { Department department = _departmentContract.Departments.Where(x => x.IsDeleted == false && x.IsEnabled == true && !string.IsNullOrEmpty(x.MacAddress) && x.MacAddress == "D4EE074E6AF2").FirstOrDefault(); oper = _attendanceContract.LoginIn(adminId, department); Administrator admin = _administratorContract.View(adminId); admin.UpdatedTime = DateTime.Now; admin.LoginTime = DateTime.Now; _administratorContract.Update(admin); return(Json(oper, JsonRequestBehavior.AllowGet)); } else { return(Json(oper, JsonRequestBehavior.AllowGet)); } } catch (Exception e) { return(Json(new OperationResult(OperationResultType.Error, "没有权限"), JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 签到 /// </summary> /// <returns></returns> public JsonResult LoginIn(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)); } var examRecords = _examRecordContract.Entities.Count(r => r.AdminId == adminId && !r.IsDeleted && r.IsEnabled && r.EntryTrainStatus == 0); if (examRecords > 0) { oper.Message = "您的入职培训试题未完成,无法签到"; return(Json(oper)); } if (_workOrderDealtWithContract.Entities.Count(d => d.HandlerID == adminId && d.Status == 0) > 0) { oper.Message = "您有未处理的配单信息"; return(Json(oper)); } var dic = _attendanceContract.DoubleScoreReminderBySign(adminId); if (dic["DeductionDoubleScore"]) { oper.Message = "扣除双倍积分"; oper.Other = -2; 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.LoginIn(adminId, department, !checkmac); if (dic["IsReminder"]) { oper.Other = -1; } else { oper.Other = 0; } admin.UpdatedTime = DateTime.Now; admin.LoginTime = DateTime.Now; _administratorContract.Update(admin); var res = _statContract.SetStoreOpenWhenFirstSignIn(adminId); if (res.ResultType != OperationResultType.Success) { _Logger.Error(res.Message); } if (oper.ResultType == OperationResultType.Success) { _administratorContract.SendAdminBirthdayNoti(adminId); } return(Json(oper, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 签到 /// </summary> /// <returns></returns> public JsonResult LoginIn() { OperationResult oper = new OperationResult(OperationResultType.Error, "请重新登陆"); int adminId = AuthorityHelper.OperatorId ?? 0; Administrator admin = _administratorContract.View(adminId); var examRecords = _examRecordContract.Entities.Count(r => r.AdminId == adminId && !r.IsDeleted && r.IsEnabled && r.EntryTrainStatus == 0); if (examRecords > 0) { oper.Message = "您的入职培训试题未完成,无法签到"; return(Json(oper, JsonRequestBehavior.AllowGet)); } if (_workOrderDealtWithContract.Entities.Count(d => d.HandlerID == adminId && d.Status == 0) > 0) { oper.Message = "您有未处理的配单信息"; return(Json(oper, JsonRequestBehavior.AllowGet)); } var dic = _attendanceContract.DoubleScoreReminderBySign(adminId); if (dic["DeductionDoubleScore"]) { oper.Message = "上个月有未处理的补卡,处理后方可正常签到"; oper.Other = -2; return(Json(oper, JsonRequestBehavior.AllowGet)); } string strMac = Request["Mac"]; 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.LoginIn(adminId, department); if (dic["IsReminder"]) { oper.Other = -1; oper.Message = "补卡未处理的从下个月进行补卡会扣双倍积分"; } else { oper.Other = 0; } admin.UpdatedTime = DateTime.Now; admin.LoginTime = DateTime.Now; _administratorContract.Update(admin); var res = _statContract.SetStoreOpenWhenFirstSignIn(adminId); if (oper.ResultType == OperationResultType.Success) { _administratorContract.SendAdminBirthdayNoti(adminId); } return(Json(oper, JsonRequestBehavior.AllowGet)); }