public static SalesItem Load(BinaryReader reader) { string salesNum = reader.ReadString(); int itemID = reader.ReadInt32(); string code = reader.ReadString(); double units = reader.ReadDouble(); double pieces = reader.ReadDouble(); string grade = reader.ReadString(); DateTime date; DateTime.TryParse(reader.ReadString(), out date); int master = reader.ReadInt32(); double filled = reader.ReadDouble(); double scheduled = reader.ReadDouble(); var newSales = new SalesItem(code, salesNum, units, pieces, grade, date, itemID) { MasterID = master, ScheduledToFill = scheduled, Fulfilled = filled }; return(newSales); }
/// <summary> /// Used to check if all data members are the same. Does not check unique ID. /// </summary> /// <param name="other"></param> /// <returns></returns> public bool IsEqual(SalesItem other) { return(Date == other.Date && InvoiceNumber == other.InvoiceNumber && Grade == other.Grade && ProductionCode == other.ProductionCode && Math.Abs(Units - other.Units) < 0.0001 && Math.Abs(TotalPieces - other.TotalPieces) < 0.0001); }