Exemple #1
0
        private void comboBoxCustomer_SelectedIndexChanged(object sender,
                                                           System.EventArgs e)
        {
            CustomerDao customerDao = listCustomer[comboBoxCustomer.SelectedIndex];

            textBoxPhoneNumber.Text = customerDao.PhoneNumber;
            textBoxAddress.Text     = customerDao.Address;
        }
Exemple #2
0
        private void loadData()
        {
            mDbConnection = new MySqlConnection("server=localhost;Database=db_laundry;username=root;password=;");
            mDbConnection.Open();

            string          selectQueryType = "SELECT * FROM type";
            MySqlCommand    commandType     = new MySqlCommand(selectQueryType, mDbConnection);
            MySqlDataReader readerType      = commandType.ExecuteReader();

            while (readerType.Read())
            {
                TypeDao item = new TypeDao
                {
                    ID    = readerType.GetInt32("_id"),
                    Name  = readerType.GetString("name"),
                    Price = readerType.GetInt32("price"),
                    Unit  = readerType.GetString("unit")
                };

                listType.Add(item);
                comboBoxType.Items.Add(item.Name);
            }
            mDbConnection.Close();

            mDbConnection.Open();
            string          selectQueryPackage = "SELECT * FROM package";
            MySqlCommand    commandPackage     = new MySqlCommand(selectQueryPackage, mDbConnection);
            MySqlDataReader readerPackage      = commandPackage.ExecuteReader();

            while (readerPackage.Read())
            {
                PackageDao item = new PackageDao
                {
                    ID       = readerPackage.GetInt32("_id"),
                    Name     = readerPackage.GetString("name"),
                    Estimate = readerPackage.GetInt32("estimate")
                };

                listPackage.Add(item);
                comboBoxPackage.Items.Add(item.Name);
            }
            mDbConnection.Close();

            mDbConnection.Open();
            string          selectQueryPelanggan = "SELECT * FROM customer";
            MySqlCommand    commandCustomer      = new MySqlCommand(selectQueryPelanggan, mDbConnection);
            MySqlDataReader readerCustomer       = commandCustomer.ExecuteReader();

            while (readerCustomer.Read())
            {
                CustomerDao item = new CustomerDao
                {
                    ID          = readerCustomer.GetInt32("_id"),
                    Name        = readerCustomer.GetString("name"),
                    PhoneNumber = readerCustomer.GetString("phone_number"),
                    Address     = readerCustomer.GetString("address")
                };

                listCustomer.Add(item);
                comboBoxCustomer.Items.Add(item.Name);
            }
            mDbConnection.Close();

            StatusDao itemStatusProses = new StatusDao();

            itemStatusProses.ID   = 0;
            itemStatusProses.Name = "Proses";

            listStatus.Add(itemStatusProses);

            StatusDao itemStatusFinish = new StatusDao();

            itemStatusFinish.ID   = 1;
            itemStatusFinish.Name = "Selesai";
            listStatus.Add(itemStatusFinish);

            for (int i = 0; i < listStatus.Count; i++)
            {
                StatusDao statusDao = listStatus[i];
                comboBoxStatus.Items.Add(statusDao.Name);
            }
        }