/// <summary> /// 角色管理 详情查询 /// </summary> public object Get(int id) { base_roles info = rolesBLL.GetInfo(id, out errmsg); if (!string.IsNullOrEmpty(errmsg)) { return(new { Rcode = -1, Rmsg = "获取数据失败" }); } return(new { Rcode = 1, Rdata = info }); }
/// <summary> /// 角色管理 添加数据 /// </summary> /// <param name="base_roles">要添加的角色管理对象</param> /// <param name="errmsg">错误信息</param> /// <returns>返回对象</returns> public static bool Add(base_roles info, out string errmsg) { List <DataParameter> pars = new List <DataParameter>(); pars.Add(new DataParameter("rolename", info.rolename)); pars.Add(new DataParameter("roletype", info.roletype)); pars.Add(new DataParameter("description", info.description)); string sqlstr = "insert into base_roles (rolename,roletype,description) values (@rolename,@roletype,@description) "; return(MySqlHelper.ExecuteCommand(sqlstr, out errmsg, pars) > 0); }
/// <summary> /// 角色管理 更新数据 /// </summary> /// <param name="base_roles">要更新的角色管理对象</param> /// <param name="errmsg">错误信息</param> /// <returns>返回对象</returns> public static bool Update(base_roles info, out string errmsg) { List <DataParameter> pars = new List <DataParameter>(); pars.Add(new DataParameter("rolename", info.rolename)); pars.Add(new DataParameter("roletype", info.roletype)); pars.Add(new DataParameter("description", info.description)); string sqlstr = "update base_roles set rolename=@rolename,roletype=@roletype,description=@description where roleid=@roleid "; pars.Add(new DataParameter("roleid", info.roleid)); return(MySqlHelper.ExecuteCommand(sqlstr, out errmsg, pars) > 0); }
/// <summary> /// 角色管理 添加数据 /// </summary> public object Post([FromBody] base_roles info) { bool success = rolesBLL.Add(info, out errmsg); WriteSysLog(0, string.Format("添加角色管理 {0},返回{1} {2}", info.rolename, success, errmsg)); if (!success || !string.IsNullOrEmpty(errmsg)) { return new { Rcode = -1, Rmsg = "添加失败" } } ; return(new { Rcode = 1, Rmsg = "添加成功" }); }
/// <summary> /// 角色管理 更新数据 /// </summary> public object Put(int id, [FromBody] base_roles info) { info.roleid = id; bool success = rolesBLL.Update(info, out errmsg); WriteSysLog(1, string.Format("更新字典管理 id为 {0},返回{1} {2}", id, success, errmsg)); if (!success || !string.IsNullOrEmpty(errmsg)) { return new { Rcode = -1, Rmsg = "更新失败" } } ; return(new { Rcode = 1, Rmsg = "更新成功" }); }
/// <summary> /// 角色管理 更新数据 /// </summary> /// <param name="base_roles">要更新的角色管理对象</param> /// <param name="errmsg">错误信息</param> /// <returns>返回对象</returns> public static bool Update(base_roles info, out string errmsg) { return(rolesDAL.Update(info, out errmsg)); }
/// <summary> /// 角色管理 添加数据 /// </summary> /// <param name="base_roles">要添加的角色管理对象</param> /// <param name="errmsg">错误信息</param> /// <returns>返回对象</returns> public static bool Add(base_roles info, out string errmsg) { return(rolesDAL.Add(info, out errmsg)); }
/// <summary> /// 角色管理 详情查询 /// </summary> public static base_roles GetInfo(int roleid, out string errmsg) { base_roles info = rolesDAL.GetInfo(roleid, out errmsg); return(info); }