Exemple #1
0
        private void BtnUpdateClient_Click(object sender, EventArgs e)
        {
            int clientID = -1;

            if (ckbUpdateClient.Checked)
            {
                if (cmbClientList.SelectedIndex == 0)
                {
                    return;
                }
                clientID = cmbClientList.SelectedIndex;
                Client clientU = new Client()
                {
                    client_name        = txbClientName.Text,
                    client_sname       = txbClientSName.Text,
                    client_phone       = txbClientPhone.Text,
                    client_description = txbClientDescription.Text
                };
                bool updateResult = updateClient.UpdateObject(clientU, clientID);
                if (!updateResult)
                {
                    MessageBox.Show("Błąd aktualizacji");
                }
                GridBuilder.FillTheGrid(getVReservation.GetVReservations(), dgvVReservation);
                ComboBoxSetData.SetDataToCmbClient(cmbClientList);
            }
        }
Exemple #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            GridBuilder.FillTheGrid(getVReservation.GetVReservations(), dgvVReservation);
            SetEnabledClientControl(false);
            SetEnabledServiceControl(false);
            ComboBoxSetData.SetDataToCmbClient(cmbClientList);

            ComboBoxSetData.SetDataToCmbServices(cmbListServices);
            FillClientControls(null, true);
            ComboBoxSetData.SetDataToCmbEmployee(tscmbEmployee.ComboBox);
            // dtpDateFind.Value = DateTime.Now;
        }
Exemple #3
0
        public void insertNewReservation()
        {
            int servicesID = -1;
            int clientID   = -1;

            if (ckbNewClient.Checked)
            {
                clientID = insertObjectToDB.GetClientIdAndInsertToDB(txbClientName.Text, txbClientSName.Text, txbClientPhone.Text, txbClientDescription.Text);
            }
            else
            {
                if (cmbClientList.SelectedIndex == 0)
                {
                    MessageBox.Show("Wybierz klienta");
                    return;
                }
                clientID = cmbClientList.SelectedIndex;
            }
            if (ckbNewServices.Checked)
            {
                servicesID = insertObjectToDB.GetServicesIdAndInsertDB(txbNewServices.Text);
            }
            else
            {
                if (cmbListServices.SelectedIndex == 0)
                {
                    MessageBox.Show("Wybierz usługę");
                    return;
                }
                servicesID = cmbListServices.SelectedIndex;
            }
            if (tscmbEmployee.ComboBox.SelectedIndex == 0)
            {
                MessageBox.Show("Wybierz pracownika");
                return;
            }
            if (!insertObjectToDB.GetReservationIdAndInsertToDB(dtpReservationDate.Value, Convert.ToInt32(nudHour.Value), Convert.ToInt32(nudMinute.Value),
                                                                clientID, servicesID, tscmbEmployee.SelectedIndex))
            {
                MessageBox.Show("Nie można dodać reserwacji w tym terminie. Jest on zajęty");
                return;
            }
            GridBuilder.FillTheGrid(getVReservation.GetVReservations(), dgvVReservation);
            ComboBoxSetData.SetDataToCmbClient(cmbClientList);
            ComboBoxSetData.SetDataToCmbServices(cmbListServices);
            FillClientControls(null, true);
        }