Exemplo n.º 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);
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 3
0
        private void BtnAddEmployee_Click(object sender, EventArgs e)
        {
            int employeID = -1;

            if (tscmbEmployee.ComboBox.SelectedIndex == 0)
            {
                employeID = insertObjectToDB.GetEmployeeIdAndInsertToDB(tstxbEmployeeName.TextBox.Text);
                ComboBoxSetData.SetDataToCmbEmployee(tscmbEmployee.ComboBox);
            }
            else
            {
                MessageBox.Show("Nie można dodać nowego pracownika");
            }
        }
Exemplo n.º 4
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);
        }