Пример #1
0
        private bool searhUsersDB()
        {
            string queryFetch = "select id_user, fname, lname, email, passwd from users where id_user = "******";";

            string fName = "", lName = "", email = "";

            List <string>[] dataList = new List <string> [3];

            dataList = bd.Select(queryFetch, "id_user", "fName", "lName", "email");

            if (dataList[0].Count <= 0)
            {
                MessageBox.Show("Fallo al recuperar datos del usuario.", "No se pudieron recuerar los datos.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            else
            {
                fName = (string)dataList[1].ToArray().GetValue(0);
                lName = (string)dataList[2].ToArray().GetValue(0);
                email = (string)dataList[3].ToArray().GetValue(0);

                txtEmail.Text = email;
                txtFName.Text = fName;
                txtLName.Text = lName;

                return(true);
            }
        }
Пример #2
0
        private void addParkingsToList()
        {
            string query = "select id_parking, name, address, size from parkings;";

            List <string>[] parkingList = new List <string> [3];

            parkingList = bd.Select(query, "id_parking", "name", "address", "size");
            int parkingQuantity = parkingList[0].Count;

            if (parkingQuantity <= 0)
            {
                MessageBox.Show("Contacte al administrador para solucionar el problema.", "No hay estacionamientos agregados.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                for (int i = 0; i < parkingQuantity; i++)
                {
                    int          j       = 1;
                    ListViewItem parking = new ListViewItem((string)parkingList[j].ToArray().GetValue(i));  // El primero en la lista horizontal
                    j++;                                                                                    // Se debe aumentar uno para que el siguiente subitem no se repita
                    for (; j < 4; j++)
                    {
                        parking.SubItems.Add((string)parkingList[j].ToArray().GetValue(i));                 // Itera sobre las columnas, y los agrega como subitems del item primero
                    }
                    listViewParkings.Items.Add(parking);                                                    // Se agrega la columna entera a la lista
                }
            }
        }
Пример #3
0
        private void addCarsList()
        {
            string query        = "select plate, brand, model, color from cars where id_user = "******";";
            int    carsQuantity = 0;

            List <string>[] carList = new List <string> [3];

            carList      = bd.Select(query, "plate", "brand", "model", "color");
            carsQuantity = carList[0].Count;
            if (carsQuantity <= 0)
            {
                MessageBox.Show("Agregue un auto para poder mostrarlo.", "No se tienen autos agregados.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                for (int i = 0; i < carsQuantity; i++)
                {
                    int          j   = 0;
                    ListViewItem car = new ListViewItem((string)carList[j].ToArray().GetValue(i));  // El primero en la lista horizontal
                    j++;                                                                            // Se debe aumentar uno para que el siguiente subitem no se repita
                    for (; j < 4; j++)
                    {
                        car.SubItems.Add((string)carList[j].ToArray().GetValue(i));                 // Itera sobre las columnas, y los agrega como subitems del item primero
                    }
                    listViewCars.Items.Add(car);                                                    // Se agrega la columna entera a la lista
                }
            }
        }