public CommandResult UpdateRole(EAP_Role role) { CommandResult result = new CommandResult(); /* * string sSql = "UPDATE EAP_Role SET "; * role.Items.ForEach(e => * { * if (e.S == EntityStatus.Modified && !string.IsNullOrEmpty(e.K)) * { * sSql += string.Format("[{0}]='{1}',", e.K, e.V); * } * }); * * sSql = sSql.Trim().TrimEnd(','); * sSql += " WHERE ID='" + role.ID.ToString() + "'"; * * int iRows = DataProvider.ExecuteNonQuery(sSql); */ int iRows = DataProvider.DoUpdate(role, "EAP_Role", "ID", null); result.Result = iRows > 0 ? true : false; result.Message = iRows > 0 ? "更新成功。" : "更新失败。"; return(result); }
public CommandResult UpdateUser(EAP_User user) { CommandResult result = new CommandResult(); List <string> _fns = new List <string>(); _fns.Add("Org_Name"); _fns.Add("ID"); int iRows = DataProvider.DoUpdate(user, "EAP_USER", "ID", _fns); /* * string sSql = "UPDATE EAP_User SET "; * user.Items.ForEach(e => * { * if (e.K != "ID" && e.K != "Org_Name") * { * if (e.S == EntityStatus.Modified && !string.IsNullOrEmpty(e.K)) * { * sSql += string.Format("[{0}]='{1}',", e.K, e.V); * } * } * }); * * sSql = sSql.Trim().TrimEnd(','); * sSql += " WHERE ID='" + user.ID.ToString() + "'"; * * int iRows = DataProvider.ExecuteNonQuery(sSql); */ result.Result = iRows > 0 ? true : false; result.Message = iRows > 0 ? "更新成功。" : "更新失败。"; return(result); }