private void getHostes()
 {
     try
     {
         hostes = HosteRepository.getHostes();
         fillHostesCombobox();
     }
     catch (Exception ex) {
         hostes = new List <Hoste>();
     }
 }
Exemplo n.º 2
0
        // END HOSTE

        public AfegirHosteController()
        {
            ah.DNIPassaportInput.TextChanged += CheckIfDNIValid;
            ah.nomCompletInput.TextChanged   += CheckIfNomValid;

            ah.telefonInput.TextChanged      += telefonInputChanged;
            ah.nacionalitatInput.TextChanged += nacionalitatInputChanged;
            ah.adrecaInput.TextChanged       += adrecaInputChanged;
            ah.codiPostalInput.TextChanged   += codiPostalInputChanged;
            ah.poblacioInput.TextChanged     += poblacioInputChanged;

            ah.afegirClientB.Click += afegirHosteClick;

            hostes = HosteRepository.getHostes();

            ah.Show();
        }
Exemplo n.º 3
0
        private void fillHostesGrid()
        {
            try
            {
                hl.hostesGrid.ColumnCount = 7;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            hl.hostesGrid.Columns[0].Name             = "Nom complet";
            hl.hostesGrid.Columns[0].DataPropertyName = "nom";
            hl.hostesGrid.Columns[0].Width            = 200;

            hl.hostesGrid.Columns[1].Name             = "DNI / Passaport";
            hl.hostesGrid.Columns[1].DataPropertyName = "DNIPasaport";
            hl.hostesGrid.Columns[1].Width            = 150;

            hl.hostesGrid.Columns[2].Name             = "Telèfon";
            hl.hostesGrid.Columns[2].DataPropertyName = "Telefon";

            hl.hostesGrid.Columns[3].Name             = "Població";
            hl.hostesGrid.Columns[3].DataPropertyName = "Poblacio";

            hl.hostesGrid.Columns[4].Name             = "Codi Postal";
            hl.hostesGrid.Columns[4].DataPropertyName = "Codipostal";

            hl.hostesGrid.Columns[5].Name             = "Adreça";
            hl.hostesGrid.Columns[5].DataPropertyName = "Adreca";

            hl.hostesGrid.Columns[6].Name             = "idClient";
            hl.hostesGrid.Columns[6].DataPropertyName = "idClient";
            hl.hostesGrid.Columns[6].Visible          = false;

            hl.hostesGrid.AutoGenerateColumns = false;

            hl.hostesGrid.DataSource = HosteRepository.getHostes();
        }
 private void afegirHosteClick(object sender, EventArgs e)
 {
     HosteRepository.InsertHoste(hoste);
     ah.Close();
 }