public JsonResult ApproveForOperator(long UserId, long verificationId, Dictionary <int, int> demandLevelInfoList) { var res = new ResponseResult <RoleStateViewModel>(); long auditUserId = UserId; var dics = demandLevelInfoList.Where(d => d.Value != 0).ToDictionary(m => m.Key, m => m.Value); if (dics.Count == 0) { res.Message = "请至少选择一个已评星的技能"; var model = new RoleStateViewModel(); model.verificationId = verificationId; model.roleId = RoleType.MachineryOperator; res.IsSuccess = false; res.Entity = model; return(new JsonResultEx(res)); } var machineryOperatorVerificationInfo = this.machineryOperatorVerificationRepository.GetByKey(verificationId); if (machineryOperatorVerificationInfo == null) { res.Message = "记录不存在!"; var model = new RoleStateViewModel(); model.verificationId = verificationId; model.roleId = RoleType.MachineryOperator; res.IsSuccess = false; res.Entity = model; return(new JsonResultEx(res)); } var roles = this.adminUserRepository.GetRoles(machineryOperatorVerificationInfo.UserId); if (roles != null) { int[] roleArray = roles.Select(r => r.RoleID).ToArray(); if (Array.IndexOf(roleArray, (int)RoleType.MachineryOperator) > -1) { res.Message = "已经拥有农机手角色!"; var model = new RoleStateViewModel(); model.verificationId = verificationId; model.roleId = RoleType.MachineryOperator; res.IsSuccess = false; res.Entity = model; return(new JsonResultEx(res)); } } var result = this.roleVerificationRepository.ApproveOperatorVerification(verificationId, auditUserId, dics); if (result == true) { res.Message = "同意了【" + RoleType.MachineryOperator.GetDescription() + "】角色的认证!"; res.IsSuccess = true; } return(new JsonResultEx(res)); }
public JsonResult ApproveForBusiness(Int64 auditUserId, long verificationId, Dictionary <int, int> demandLevelInfoList) { var res = new ResponseResult <RoleStateViewModel>(); var dics = demandLevelInfoList.Where(d => d.Value != 0).ToDictionary(m => m.Key, m => m.Value); if (dics.Count == 0) { res.Message = "请至少选择一个已评星的技能"; var model = new RoleStateViewModel(); model.verificationId = verificationId; model.roleId = RoleType.Business; res.IsSuccess = false; res.Entity = model; return(new JsonResultEx(res)); } var businessVerificationInfo = this.businessVerificationRepository.GetByKey(verificationId); if (businessVerificationInfo == null) { res.Message = "记录不存在!"; var model = new RoleStateViewModel(); model.verificationId = verificationId; model.roleId = RoleType.Business; res.IsSuccess = false; res.Entity = model; return(new JsonResultEx(res)); } var roles = this.adminUserRepository.GetRoles(businessVerificationInfo.UserId); if (roles != null) { int[] roleArray = roles.Select(r => r.RoleID).ToArray(); if (Array.IndexOf(roleArray, (int)RoleType.Business) > -1) { //TempData["Error"] = "已经拥有产业商角色!"; //return RedirectToAction("Detail", new { verificationId, roleId = RoleType.Business }); res.Message = "已经拥有产业商角色!"; var model = new RoleStateViewModel(); model.verificationId = verificationId; model.roleId = RoleType.Business; res.IsSuccess = false; res.Entity = model; return(new JsonResultEx(res)); } } var result = this.roleVerificationRepository.ApproveBusinessVerification(verificationId, auditUserId, demandLevelInfoList); if (result == true) { //TempData["Message"] = "同意了【" + RoleType.Business.GetDescription() + "】角色的认证!"; res.Message = "同意了【" + RoleType.Business.GetDescription() + "】角色的认证!"; res.IsSuccess = true; } return(new JsonResultEx(res)); }
public JsonResult ApproveForFarmer(long UserId, long verificationId, byte star) { var res = new ResponseResult <RoleStateViewModel>(); long auditUserId = UserId; var farmerVerificationInfo = this.farmerVerificationRepository.GetByKey(verificationId); if (farmerVerificationInfo == null) { res.Message = "记录不存在!"; //return RedirectToAction("Detail", new { verificationId, roleId = RoleType.Farmer }); var model = new RoleStateViewModel(); model.verificationId = verificationId; model.roleId = RoleType.Farmer; res.IsSuccess = false; res.Entity = model; return(new JsonResultEx(res)); } var roles = this.adminUserRepository.GetRoles(farmerVerificationInfo.UserId); if (roles != null) { int[] roleArray = roles.Select(r => r.RoleID).ToArray(); if (Array.IndexOf(roleArray, (int)RoleType.Farmer) > -1) { //TempData["Error"] = "已经拥有大农户角色!"; res.Message = "已经拥有大农户角色!"; var model = new RoleStateViewModel(); model.verificationId = verificationId; model.roleId = RoleType.Farmer; res.IsSuccess = false; res.Entity = model; return(new JsonResultEx(res)); } } var result = this.roleVerificationRepository.ApproveFarmerVerification(verificationId, auditUserId, star); if (result == true) { res.Message = "同意了【" + RoleType.Farmer.GetDescription() + "】角色的认证!"; res.IsSuccess = true; } return(new JsonResultEx(res)); }