示例#1
0
        private void btnNewClient_Click(object sender, EventArgs e)
        {
            //instanciamos el formulario nuevoCliente el cual se abrira como un modal
            FrmCustomersNews _newClient = new FrmCustomersNews();

            _newClient.ShowDialog();
            _newClient.update = false;
            ShowCustomer();
        }
示例#2
0
        private void tableClient_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (tableClient.Rows[e.RowIndex].Cells["delete"].Selected)
                {
                    message = new FrmError("ELIMINAR ESTE CLIENTE?");
                    DialogResult dialogResult = message.ShowDialog();

                    if (dialogResult == DialogResult.OK)
                    {
                        int idClient = Convert.ToInt32(tableClient.Rows[e.RowIndex].Cells[2].Value.ToString());
                        objCustomer.DeleteCustomer(idClient);

                        this.message = new FrmSuccess("REGISTRO ELIMINADO! ");
                        this.message.ShowDialog();

                        ShowCustomer();
                    }
                }
                else if (tableClient.Rows[e.RowIndex].Cells["edit"].Selected)
                {
                    FrmCustomersNews frmCustomerNew = new FrmCustomersNews();
                    //actualizamos nuestra valiable actualizar para poder editar
                    frmCustomerNew.update = true;
                    //pasamos los valores a nuestro formulario nuevoEmpleado
                    frmCustomerNew.txtIdClient.Text              = tableClient.Rows[e.RowIndex].Cells[2].Value.ToString();
                    frmCustomerNew.txtNameClient.Text            = tableClient.Rows[e.RowIndex].Cells[5].Value.ToString();
                    frmCustomerNew.txtLastNameClient.Text        = tableClient.Rows[e.RowIndex].Cells[6].Value.ToString();
                    frmCustomerNew.txtMothersLastNameClient.Text = tableClient.Rows[e.RowIndex].Cells[7].Value.ToString();

                    frmCustomerNew.txtDniClient.Text          = tableClient.Rows[e.RowIndex].Cells[3].Value.ToString();
                    frmCustomerNew.txtPhoneClient.Text        = tableClient.Rows[e.RowIndex].Cells[4].Value.ToString();
                    frmCustomerNew.txtEmailClient.Text        = tableClient.Rows[e.RowIndex].Cells[8].Value.ToString();
                    frmCustomerNew.cmbCivilStatusClient.Text  = tableClient.Rows[e.RowIndex].Cells[9].Value.ToString();
                    frmCustomerNew.cmbGenderClient.Text       = tableClient.Rows[e.RowIndex].Cells[10].Value.ToString();
                    frmCustomerNew.txtAddressClient.Text      = tableClient.Rows[e.RowIndex].Cells[11].Value.ToString();
                    frmCustomerNew.dtDateAdmissionClient.Text = tableClient.Rows[e.RowIndex].Cells[12].Value.ToString();

                    frmCustomerNew.ShowDialog();

                    ShowCustomer();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Valla a ocurrido un error");
            }
        }