private static void PreloadData() { //Create new type of Accounts StatementLine.CreateMessageAccount("0411222333", "M Plan Message", 50, 800); StatementLine.CreateCallAccount("0411222333", "M Plan Call Usage", 500, 800); StatementLine.CreateMessageAccount("0411333444", "XL Plan Message", 100, 2750); StatementLine.CreateCallAccount("0411333444", "XL Plan Call Usage", 2000, 2750); // Testing Adjust bonus free usage before Roll over to new Message Account statement StatementLine.StatementMessageID("0411222333").PhoneAccount.AdjustAccount(new MessageAccountUsage(-2)); StatementLine.StatementMessageID("0411222333").PhoneAccount.RollOver(); StatementLine.StatementMessageID("0411222333").PhoneAccount.AdjustAccount(new MessageAccountUsage(2)); // Testing Adjust bonus free usage before Roll over to new Call Account statement StatementLine.StatementCallID("0411222333").PhoneAccount.AdjustAccount(new CallAccountUsage(-30)); StatementLine.StatementCallID("0411222333").PhoneAccount.RollOver(); StatementLine.StatementCallID("0411222333").PhoneAccount.AdjustAccount(new CallAccountUsage(30)); // Testing Adjust bonus free usage before Roll over to new Message Account statement StatementLine.StatementMessageID("0411333444").PhoneAccount.AdjustAccount(new MessageAccountUsage(-10)); StatementLine.StatementMessageID("0411333444").PhoneAccount.RollOver(); // reject the next statement StatementLine.StatementMessageID("0411333444").PhoneAccount.AdjustAccount(new MessageAccountUsage(200)); StatementLine.StatementMessageID("0411333444").PhoneAccount.AdjustAccount(new MessageAccountUsage(10)); // Testing Adjust bonus free usage before Roll over to new Call Account statement StatementLine.StatementCallID("0411333444").PhoneAccount.AdjustAccount(new CallAccountUsage(1000)); StatementLine.StatementCallID("0411333444").PhoneAccount.RollOver(); // reject the next statement StatementLine.StatementCallID("0411333444").PhoneAccount.AdjustAccount(new CallAccountUsage(2000)); }
Account(StatementLine line) { _Line = line; _ServiceID = line.ServiceID; _Credit = line.PhoneAccount.Credit; _UsedCredit = line.PhoneAccount.UsedCredit; }
protected Account(StatementLine line, double credit) { _ServiceID = line.ServiceID; _Credit = credit; _UsedCredit = 0; _Line = line; }
// Service method return new CallAccount creating status is true - if it is not existing on the List public static bool CreateCallAccount(string id, string description, double defaultUsage, double credit) { if (StatementCallID(id) != null) { return(false); } StatementLine line = new StatementLine(id, description); line._PhoneAccount = new CallAccount(line, defaultUsage, credit); _RecordCallLines.Add(line); return(line != null); }
// Service method return new MessageAccount creating status is true - if it is not existing on the List public static bool CreateMessageAccount(string id, string description, int usage, double credit) { if (StatementMessageID(id) != null) { return(false); } StatementLine line = new StatementLine(id, description); line._PhoneAccount = new MessageAccount(line, usage, credit); _RecordMessageLines.Add(line); return(true); }
// Service method return the match CallAccount id StatementLine record or null object if it is not found public static StatementLine StatementCallID(string id) { StatementLine result = null; foreach (StatementLine l in _RecordCallLines) { if (l.ServiceID == id) { result = l; break; } } return(result); }
Account(StatementLine line, double usage) { _Line = line; _AvaliableUnit = usage; Console.WriteLine("line: " + line); //Why the shit is this null if (line != null){ Console.WriteLine("Account line is not null" + line); _ServiceID = line.ServiceID; _Credit = line.PhoneAccount.Credit; _UsedCredit = line.PhoneAccount.UsedCredit; _UsagePerUnit = 0; _UsedUnit = 0; } }
SMSMessageAccount(StatementLine line, int usage) : base(usage) { }
public MessageAccount(StatementLine line, int usage, double credit) : base(line, credit) { _AvaliableUnits = usage; _UsedUnit = 0; _UsagePerUnit = DEFAULT_COST; }
public MessageAccount(StatementLine line, int usage, double credit) : base(line.ServiceID, line.Description, usage, credit) { }
static void Main(string[] args) { PreloadData(); Console.WriteLine("====================="); Console.WriteLine("Load Account Details"); Console.WriteLine("====================="); foreach (StatementLine line in StatementLine.RecordMessageLines) { Console.WriteLine("- {0}", line); } foreach (StatementLine line in StatementLine.RecordCallLines) { Console.WriteLine("- {0}", line); } Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); // Create new AccountStatement object AccountStatement record = new AccountStatement(); ServiceItem item; // declare new ServiceItem object //Record new testing ServiceItem for different type of Account if (StatementLine.StatementMessageID("0411222333").Record("SMS 047123456", new MessageAccountUsage(5), out item) == true) { record.Add(item); } if (StatementLine.StatementCallID("0411333444").Record("Call 0411222333", null, out item) == true) { record.Add(item); } if (StatementLine.StatementMessageID("0411333444").Record("SMS 0411222333", null, out item) == true) { record.Add(item); } if (StatementLine.StatementCallID("0411222333").Record("Call 0413211893", new CallAccountUsage(49.2), out item) == true) { record.Add(item); } if (StatementLine.StatementCallID("0411222333").Record("Call 0418112734", new CallAccountUsage(5000), out item) == true) { record.Add(item); } if (StatementLine.StatementMessageID("0411333444").Record("SMS 018442564", null, out item) == true) { record.Add(item); } if (StatementLine.StatementCallID("0411333444").Record("Call 018442564", new CallAccountUsage(300), out item) == true) { record.Add(item); } if (StatementLine.StatementCallID("0411333444").Record("Call 017312896", new CallAccountUsage(2000), out item) == true) { record.Add(item); } else { Console.WriteLine("you done f****d up aaron"); } #warning me Console.WriteLine("======="); Console.WriteLine("Recorded Usage"); Console.WriteLine("======="); Console.WriteLine(record.GetText()); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("===================="); Console.WriteLine("Current Account Usage"); Console.WriteLine("===================="); foreach (StatementLine line in StatementLine.RecordMessageLines) { Console.WriteLine("- {0}", line); } foreach (StatementLine line in StatementLine.RecordCallLines) { Console.WriteLine("- {0}", line); } Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); }