Example #1
0
        private void EditClient(object sender, EventArgs e)
        {
            Podatnik edited = new Podatnik();
            int      podID  = Convert.ToInt32(ShowClients.selectedRow.Cells["Id"].Value.ToString());

            using (InzynierkaDBEntities db = new InzynierkaDBEntities())
            {
                edited =
                    db.Podatnik.Where(x => x.podatnik_id == podID).First();
            }

            AddClient f = new AddClient(edited);

            if (f.ShowDialog() == DialogResult.OK)
            {
                int    id          = edited.podatnik_id;
                string updateQuery =
                    "UPDATE Podatnik SET " +
                    "urzad_id = " + f.nowyPodatnik.urzad_id + ", " +
                    "nazwa = '" + f.nowyPodatnik.nazwa + "', " +
                    "symbol = '" + f.nowyPodatnik.symbol + "', " +
                    "nip = '" + f.nowyPodatnik.nip + "', " +
                    "wojewodztwo = '" + f.nowyPodatnik.wojewodztwo + "', " +
                    "miasto = '" + f.nowyPodatnik.miasto + "', " +
                    "ulica = '" + f.nowyPodatnik.ulica + "', " +
                    "kod_pocztowy = '" + f.nowyPodatnik.kod_pocztowy + "', " +
                    "telefon = '" + f.nowyPodatnik.telefon + "', " +
                    "email = '" + f.nowyPodatnik.email + "' " +
                    "WHERE podatnik_id = " + id + ";";
                SQL.DoQuery(updateQuery);
            }
        }
Example #2
0
        /// <summary>
        /// The DgvClients_CellContentClick method
        /// Delete and Modify a customer by id.
        /// </summary>
        private void DgvClients_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string id = dgvClients.Rows[e.RowIndex].Cells["Código"].FormattedValue.ToString();

            if (dgvClients.Columns[e.ColumnIndex].Name == "Edit")
            {
                dgvClients.CurrentRow.Selected = true;

                AddClient route = new AddClient(id);
                route.ShowDialog();

                loadCustomerView();
            }

            if (dgvClients.Columns[e.ColumnIndex].Name == "Delete")
            {
                dgvClients.CurrentRow.Selected = true;

                DialogResult dialogResult = MessageBox.Show("Está a punto de eliminar a " + dgvClients.Rows[e.RowIndex].Cells["Nombre"].FormattedValue.ToString() + ".\n" +
                                                            "¿Está seguro de que quiere continuar?", "¿Eliminar Cliente?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (dialogResult == DialogResult.Yes)
                {
                    if (clientBLL.deleteClientBLL(id))
                    {
                        loadCustomerView();
                        MessageBox.Show("Eliminado con éxito", "Éxito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Ha ocurrido un problema, no se ha podido eliminar el cliente\nNo se puede eliminar un cliente asignado a una orden", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Example #3
0
        /// <summary>
        /// The Button1_Click method
        /// Open a window to add a client.
        /// </summary>
        private void Button1_Click(object sender, EventArgs e)
        {
            AddClient route = new AddClient();

            route.ShowDialog();
            cbClient.Items.Clear();
            clientBLL.fillClientComboBox(cbClient);
        }
Example #4
0
 private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e)
 {
     using (var form = new AddClient())
     {
         form.ShowDialog();
         RefreshData();
     }
 }
Example #5
0
        private void msi_addUser_Click(object sender, EventArgs e)
        {
            AddClient client = new AddClient();

            if (client.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                client.Close();
            }
            GrabClients();
        }
Example #6
0
        private void AddClient(object sender, EventArgs e)
        {
            AddClient f = new AddClient();

            if (f.ShowDialog() == DialogResult.OK)
            {
                using (InzynierkaDBEntities db = new InzynierkaDBEntities())
                {
                    db.Podatnik.Add(f.nowyPodatnik);
                    db.SaveChanges();
                }
            }
        }
Example #7
0
        private void barButtonItem3_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (!(clientBindingSource.Current is Client currentClient) || tabPane1.SelectedPageIndex != 0)
            {
                XtraMessageBox.Show("Сначала выберете клиента", "Предупреждение", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                return;
            }

            using (var form = new AddClient(currentClient))
            {
                form.ShowDialog();
                RefreshData();
            }
        }
Example #8
0
        private void bunifuButton2_Click(object sender, EventArgs e)
        {
            AddClient m = new AddClient();

            m.ShowDialog();
            try
            {
                m.btnAdd.Text = "Add New";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            RefreshClientDGV();
        }
Example #9
0
        private void AddClientBtn_Click(object sender, RoutedEventArgs e)
        {
            InitDataSource(ref clientItems, Mapper.ClientsToClientViewModels, clientController.Get);

            AddClient addClient = new AddClient(libraryItems);

            if (addClient.ShowDialog().Value)
            {
                string           name    = addClient.Name.Text;
                string           surname = addClient.Surname.Text;
                LibraryViewModel model   = addClient.SelectedItem;

                if (model != null)
                {
                    Library library = libraryController.GetById(model.Id);
                    Client  client  = new Client(name, surname, library);
                    clientController.Add(client);
                    clientItems.Add(Mapper.ClientToClientViewModel(client));
                    return;
                }
            }
        }
Example #10
0
        private void bunifuButton1_Click(object sender, EventArgs e)
        {
            AddClient m = new AddClient();

            try
            {
                m.txtCompany.Text   = dgvUser.CurrentRow.Cells[1].Value.ToString();
                m.txtFirstName.Text = dgvUser.CurrentRow.Cells[2].Value.ToString();
                m.txtLastName.Text  = dgvUser.CurrentRow.Cells[3].Value.ToString();
                m.txtPhone.Text     = dgvUser.CurrentRow.Cells[4].Value.ToString();
                m.txtAdress.Text    = dgvUser.CurrentRow.Cells[6].Value.ToString();
                m.txtEmail.Text     = dgvUser.CurrentRow.Cells[5].Value.ToString();
                m.lblId.Text        = dgvUser.CurrentRow.Cells[0].Value.ToString();
                m.btnAdd.Text       = "Update";
                m.ShowDialog();
                RefreshClientDGV();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #11
0
        private void EditClientBtn_Click(object sender, RoutedEventArgs e)
        {
            ClientViewModel clientVM = dataGrid.SelectedItem as ClientViewModel;

            AddClient editClient = new AddClient(libraryItems, clientVM.Name, clientVM.SurName, libraryItems.First(i => i.Id == clientVM.LibraryId));

            if (editClient.ShowDialog().Value)
            {
                string           name    = editClient.Name.Text;
                string           surname = editClient.Surname.Text;
                LibraryViewModel model   = editClient.SelectedItem;

                if (clientVM != null && name != null && model != null)
                {
                    Client  clien   = clientController.GetById(clientVM.Id);
                    Library library = libraryController.GetById(model.Id);
                    clien.Name         = clientVM.Name = name;
                    clientVM.LibraryId = library.Id;
                    clien.Library      = library;
                    clien.Surname      = clientVM.SurName = surname;
                    clientController.Edit(clien);
                }
            }
        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            AddClient a = new AddClient();

            a.ShowDialog();
        }
        private void panel2_Click(object sender, EventArgs e)
        {
            AddClient ac = new AddClient();

            ac.ShowDialog();
        }
        private void metroButton6_Click(object sender, EventArgs e)
        {
            AddClient a = new AddClient();

            a.ShowDialog();
        }
        private void clientToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            AddClient a = new AddClient();

            a.ShowDialog();
        }
Example #16
0
        /// <summary>
        /// метод открывает Окно добавления нового клиента
        /// </summary>
        public void OpenNewClient()
        {
            AddClient acl = new AddClient();

            acl.ShowDialog();
        }