public ActionResult UpdateEmp(EMPLOYEE_MODEL model) { JsonSMsg rMsg = new JsonSMsg(); string accessToken = HmjClientServiceApi.Create().GetAccessToken(); DeptInfo dept = new DeptInfo(); dept.ID = model.EmpGroupId; string errMsg = null; int rows = EmployeeService.SaveEmployee(accessToken, model, dept, ref errMsg); if (rows > 0) { rMsg.Status = 1; } else { if (string.IsNullOrEmpty(errMsg)) { errMsg = "保存失败。"; } rMsg.Message = errMsg; } return(Json(rMsg)); }
public ActionResult SaveEmployee(EMPLOYEE_MODEL model, FormCollection form) { JsonSMsg rMsg = new JsonSMsg(); string accessToken = HmjClientServiceApi.Create().GetAccessToken(); if (model.ID == 0) { WeiPage wp = new WeiPage(); string mpToken = wp.Token(AppConfig.FWHOriginalID); int ewmId = SystemService.GetEwmId() + 1; model.EwmId = ewmId; QRCodeResponse qrCodeResponse = WXMPClientServiceApi.Create().CreateQRCode(mpToken, ewmId); if (qrCodeResponse != null && qrCodeResponse.ErrorCode == 0) { model.EwmUrl = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + qrCodeResponse.Ticket; } else { rMsg.Message = "获取服务号access_token失败,请重试。"; return(Json(rMsg)); } } DeptInfo dept = new DeptInfo(); dept.ID = model.EmpGroupId; string errMsg = null; int rows = EmployeeService.SaveEmployee(accessToken, model, dept, ref errMsg); if (rows > 0) { rMsg.Status = 1; } else { if (string.IsNullOrEmpty(errMsg)) { errMsg = "保存失败。"; } rMsg.Message = errMsg; } return(Json(rMsg)); }