private void cmdEditar_Click(object sender, EventArgs e) { if (cmdEditar.Text != "Seleccionar") { if (cmdEditar.Text == "Agregar") { _altaCliente = new AltaCliente(this, cmdEditar.Text[0]); } else { _altaCliente = AltaCliente.Crear(this, cmdEditar.Text[0], dgvClientes.SelectedRows[0].Cells["Id"].Value.ToString()); } _altaCliente.Show(); this.Hide(); } else { if (dgvClientes.SelectedRows.Count > 0) { if (_altaFactura != null) { _altaFactura.CargarCliente(dgvClientes.SelectedRows[0].Cells["Id"].Value.ToString(), dgvClientes.SelectedRows[0].Cells["Nombre"].Value.ToString() + " " + dgvClientes.SelectedRows[0].Cells["Apellido"].Value.ToString()); _altaFactura.Show(); } else { _listarFacturas.CargarCliente(dgvClientes.SelectedRows[0].Cells["Id"].Value.ToString(), dgvClientes.SelectedRows[0].Cells["Nombre"].Value.ToString() + " " + dgvClientes.SelectedRows[0].Cells["Apellido"].Value.ToString()); _listarFacturas.Show(); } this.Close(); } } }
public static AltaCliente Crear(ListarClientes listarClientes, char evento, string idCliente) { var abm = new AltaCliente(listarClientes, evento) { _idCliente = Convert.ToInt32(idCliente) }; abm.CargarCliente(); abm._mailCliente = abm.txtMail.Text; return(abm); }