public ContentResult SaveRole(string jsonString) { AjaxResult res = new AjaxResult(); try { WF_Role role = jsonString.ToObject <WF_Role>(); WF_Role entity = rolebll.getByID(role.ID); if (entity != null) { role.UpdateTime = DateTime.Now; role.UpdateUserCode = getCurrent().UserCode; role.CreateTime = entity.CreateTime; role.CreateUserCode = entity.CreateUserCode; rolebll.update(role); } else { role.UpdateTime = DateTime.Now; role.UpdateUserCode = getCurrent().UserCode; role.CreateTime = DateTime.Now; role.CreateUserCode = getCurrent().UserCode; rolebll.save(role); } res.code = ResultCode.OK; } catch (Exception ex) { res.code = ResultCode.ERROR; res.message = "保存失败"; } return(Content(res.ToJson())); }
public bool update(WF_Role entity) { using (IDbConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["wfdb"].ToString())) { conn.Open(); return(conn.Update <WF_Role>(entity)); } }
public bool save(WF_Role entity) { using (IDbConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["wfdb"].ToString())) { conn.Open(); conn.Insert <WF_Role>(entity); return(true); } }
public bool del(int id) { using (IDbConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["wfdb"].ToString())) { conn.Open(); WF_Role Role = conn.Get <WF_Role>(id); Role.IsDelete = 1; return(conn.Update <WF_Role>(Role)); } }
public ContentResult UpdateRoleState(int id, int state) { AjaxResult res = new AjaxResult(); try { WF_Role entity = rolebll.getByID(id); if (entity != null) { entity.State = state; rolebll.update(entity); } res.code = ResultCode.OK; res.message = "更新状态成功"; } catch (Exception ex) { res.code = ResultCode.ERROR; res.message = "更新状态失败"; } return(Content(res.ToJson())); }
public ContentResult getRoleByID(int id) { AjaxResult res = new AjaxResult(); try { WF_Role role = rolebll.getByID(id); if (role == null) { role = new WF_Role(); role.ID = id; role.State = 1; } res.code = ResultCode.OK; res.data = role; } catch (Exception ex) { res.code = ResultCode.ERROR; res.message = "获取流程角色信息失败"; } return(Content(res.ToJson())); }
public bool update(WF_Role entity) { return(dao.update(entity)); }
public bool save(WF_Role entity) { return(dao.save(entity)); }