public static string AddNewMobileAcount(MobileAccount mobileAccount, MethodToCalledNumber CallNumberMethod, MethodToCalledNumber MailNumberMethod) { if (mobileAccount.Validate()) { callDelegate.Add(mobileAccount, CallNumberMethod); mailDelegate.Add(mobileAccount, MailNumberMethod); mobileAccount.CallEvent += MobileAccount_callevent; mobileAccount.MailEvent += MobileAccount_mailevent; string number = GenerateNewNumber(); accounts.Add(number, mobileAccount); return(number); } return(""); }
static void Main(string[] args) { MobileAccount mobile1 = new MobileAccount("Artur", "Sitnichenko", "*****@*****.**", new DateTime(1997, 1, 9)); MobileAccount mobile2 = new MobileAccount("Kolya", "Sitnichenko", "*****@*****.**", new DateTime(1997, 1, 9)); MobileAccount mobile3 = new MobileAccount("Masha", "Sitnichenko", "*****@*****.**", new DateTime(1997, 1, 9)); MobileAccount mobile4 = new MobileAccount("Pasha", "Sitnichenko", "*****@*****.**", new DateTime(1997, 1, 9)); // mobile2.Call("099"); mobile2.SendMail("0993422226"); Console.WriteLine(new string('-', 30)); mobile1.AddAccount(new Account { Name = "Dima", PhoneNumber = mobile2.Number }); mobile2.Call("0993422226"); mobile2.Call("0993"); mobile2.Call("0993"); mobile2.Call("0993"); mobile2.Call("0993"); mobile2.SendMail("0993422226"); mobile1.Call(mobile3.Number); mobile1.Call(mobile2.Number); mobile1.Call(mobile4.Number); mobile1.Call(mobile2.Number); mobile2.Call("0993422226"); Console.WriteLine(new string('-', 30)); BestToNumber(); Console.WriteLine(new string('-', 30)); BestFromNumber(); Console.WriteLine(new string('-', 30)); }
public void SendMail(MobileAccount account) { SendMail(account.Number); }
public void Call(MobileAccount account) { Call(account.Number); }