예제 #1
0
 public ContBancar(string numarCont, double suma, TipCont tipCont)
 {
     if (suma < 0)
     {
         throw new Exception("Suma introdusa nu poate fi negativa!");
     }
     this._numarCont = numarCont;
     this._suma      = suma;
     this._tipCont   = tipCont;
 }
예제 #2
0
 private void AddToList(string numarCont, double suma, TipCont tipCont)
 {
     if (_listaConturi.Count < 5)
     {
         var cont = _listaConturi.Where(t => t.NumarCont == numarCont).FirstOrDefault();
         if (cont != null)
         {
             throw new Exception("Contul " + numarCont + " exista deja -> nu se mai poate adauga");
         }
         if (tipCont == TipCont.EURO)
         {
             _listaConturi.Add(new ContEuro(numarCont, suma, tipCont));
         }
         else
         {
             _listaConturi.Add(new ContRON(numarCont, suma, tipCont));
         }
     }
     else
     {
         throw new Exception("Clientul are deja 5 conturi");
     }
 }
예제 #3
0
 public ContRON(string numarCont, double suma, TipCont tipCont) : base(numarCont, suma, tipCont)
 {
 }
예제 #4
0
 public void AdaugaClient(string CNP, string nume, string adresa, string numarCont, double suma, TipCont tipCont)
 {
     try
     {
         Client client = _listaClienti.Where(t => t.CNP == CNP).FirstOrDefault();
         if (client == null)
         {
             _listaClienti.Add(new Client(CNP, nume, adresa, numarCont, suma, tipCont));
         }
         else
         {
             client.AdaugaContBancar(numarCont, suma, tipCont);
         }
     }
     catch (Exception exp)
     {
         Console.WriteLine(exp.Message);
     }
 }
예제 #5
0
 public Banca(long codBanca, string CNP, string nume, string adresa, string numarCont, double suma, TipCont tipCont)
 {
     try
     {
         this._codBanca = codBanca;
         _listaClienti.Add(new Client(CNP, nume, adresa, numarCont, suma, tipCont));
     }
     catch (Exception exp)
     {
         Console.WriteLine(exp.Message);
     }
 }
예제 #6
0
 public void AdaugaContBancar(string numarCont, double suma, TipCont tipCont)
 {
     AddToList(numarCont, suma, tipCont);
 }
예제 #7
0
 public Client(string CNP, string nume, string adresa, string numarCont, double suma, TipCont tipCont)
 {
     if (!CNPOK(CNP))
     {
         throw new Exception("CNPul ' " + CNP + " ' nu e valid");
     }
     this._CNP    = CNP;
     this._nume   = nume;
     this._adresa = adresa;
     AddToList(numarCont, suma, tipCont);
 }