public JsonResult Edit(string id, Models.LableModel model) { var user = OperatorProvider.Provider.Current(); model.LabelId = model.LabelId.PadLeft(6, '0'); if (lablemanagebll.GetIsBind(model.LabelId)) { return(Json(new AjaxResult { type = ResultType.error, message = "标签已经绑定!" })); } if (!string.IsNullOrEmpty(model.UserId) && lablemanagebll.GetUserLable(model.UserId) != null) { return(Json(new AjaxResult { type = ResultType.error, message = model.Name + "已经绑定!" })); } var entity = new LablemanageEntity() { ID = Guid.NewGuid().ToString(), DeptId = model.DeptId, DeptCode = model.DeptCode, DeptName = model.DeptName, BindTime = model.BindTime, CreateDate = DateTime.Now, CreateUserDeptCode = user.DeptCode, CreateUserId = user.UserId, ModifyDate = DateTime.Now, ModifyUserId = user.DeptId, CreateUserOrgCode = user.OrganizeCode, IdCardOrDriver = model.IdCardOrDriver, IsBind = 1, LableId = model.LabelId, LableTypeName = model.LableTypeName, LableTypeId = model.LableTypeId, Name = model.Name, OperUserId = user.UserName, Phone = model.Phone, Power = "100%", Type = 0, State = "离线", UserId = model.UserId }; lablemanagebll.SaveForm(id, entity); if (string.IsNullOrEmpty(id)) { //将标签信息同步到后台计算服务中 RabbitMQHelper rh = RabbitMQHelper.CreateInstance(); SendData sd = new SendData(); sd.DataName = "LableEntity"; sd.EntityString = JsonConvert.SerializeObject(entity); rh.SendMessage(JsonConvert.SerializeObject(sd)); } return(Json(new AjaxResult { type = ResultType.success, message = "保存成功!" })); }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, LablemanageEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
public ActionResult SaveForm(string keyValue, LablemanageEntity entity) { lablemanagebll.SaveForm(keyValue, entity); return(Success("操作成功。")); }