private static Role GetRoleFromReader(IDataReader dataReader) { Role role = new Role(); role.RoleID = DBHelper.GetGuid(dataReader, "RoleID"); role.Name = DBHelper.GetString(dataReader, "Name"); return role; }
public static void UpdateRole(Role role) { string sqlQuery = "UPDATE ROLE SET Name=@Name WHERE RoleID='" + role.RoleID + "'"; DbCommand dbCommand = DBHelper.GetDBCommand(sqlQuery); DBHelper.AddInParameter(dbCommand, "Name", DbType.String, role.Name); DBHelper.ExecuteNonQuery(dbCommand); }
public static Role InsertRole(Role role) { string sqlQuery = "INSERT INTO ROLE(RoleID,Name) VALUES(@RoleID,@Name)"; if (role.RoleID == Guid.Empty) role.RoleID = Guid.NewGuid(); else return null; DbCommand dbCommand = DBHelper.GetDBCommand(sqlQuery); DBHelper.AddInParameter(dbCommand, "RoleID", DbType.Guid, role.RoleID); DBHelper.AddInParameter(dbCommand, "Name", DbType.String, role.Name); return role; }
public static void UpdateRole(Role role) { RoleDB.UpdateRole(role); }
public static Role InsertRole(Role role) { return RoleDB.InsertRole(role); }