Example #1
0
 public Form2(Rezervari rez)
 {
     rezNou = rez;
     InitializeComponent();
     foreach (var r in rezNou.ListaHoteluri)
     {
         MessageBox.Show(r.ToString());
     }
 }
Example #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (tbNume.Text == "")
     {
         errorProvider1.SetError(tbNume, "Nu ati introdus numel!");
     }
     else if (tbNr.Text == "")
     {
         errorProvider1.SetError(tbNr, "Nu ati introdus numarul de camere!");
     }
     else if (tbPreturi.Text == "")
     {
         errorProvider1.SetError(tbPreturi, "Nu ati introdus preturile camerelor!");
     }
     else
     {
         try
         {
             int      nrCamere = Convert.ToInt32(tbNr.Text);
             string   nume     = tbNume.Text;
             string[] strVect  = tbPreturi.Text.Split(',');
             float[]  valVect  = new float[strVect.Length];
             for (int i = 0; i < valVect.Length; i++)
             {
                 valVect[i] = (float)Convert.ToDouble(strVect[i]);
             }
             Hotel h = new Hotel(nrCamere, nume, valVect);
             rezervari = rezervari + h;
             MessageBox.Show("S-a adaugat un Hotel!");
         }catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         finally
         {
             tbNume.Clear();
             tbNr.Clear();
             tbPreturi.Clear();
         }
     }
 }