private void CargarCliente(int pIdCliente)
        {
            DataTable dtCliente = new DataTable();

            CapaNegocios.Cliente objNegocio = new CapaNegocios.Cliente();
            try
            {
                if (pIdCliente != 0)
                {
                    dtCliente = objNegocio.LeerCliente(pIdCliente);
                    if (dtCliente.Rows.Count > 0)
                    {
                        txtIdCliente.Text = dtCliente.Rows[0]["IdCliente"].ToString();
                        txtCliente.Text   = dtCliente.Rows[0]["Nombre"].ToString();
                        CargarCombo(Convert.ToInt32(txtIdCliente.Text));
                    }
                    else
                    {
                        MessageBox.Show("El Id del cliente no pertenece a ningún registro", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Beispiel #2
0
        private void CargarLista()
        {
            CapaNegocios.Cliente vNeciosCredito = new CapaNegocios.Cliente();
            DataTable            dtCreditos     = new DataTable();
            ListViewItem         vItem;

            try
            {
                dtCreditos = vNeciosCredito.Select();
                ltvCreditos.Items.Clear();
                if (dtCreditos.Rows.Count > 0)
                {
                    foreach (DataRow vRow in dtCreditos.Rows)
                    {
                        vItem = new ListViewItem(vRow["IdCliente"].ToString());
                        vItem.SubItems.Add(vRow["Nombre"].ToString());
                        vItem.SubItems.Add(vRow["Apellido1"].ToString());
                        vItem.SubItems.Add(vRow["Apellido2"].ToString());
                        vItem.SubItems.Add(vRow["IdInstitucion"].ToString());
                        ltvCreditos.Items.Add(vItem);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Beispiel #3
0
        private void Aceptar()
        {
            CapaEntidad.Estructura.Cliente vEntidad;
            CapaNegocios.Cliente           vNegociosCreditos = new CapaNegocios.Cliente();
            try
            {
                if (Validar())
                {
                    vEntidad = new CapaEntidad.Estructura.Cliente()
                    {
                        IdCliente     = Convert.ToInt32(lblId.Text),
                        Nombre        = txtNombre.Text,
                        Apellido1     = txtApellido1.Text,
                        Apellido2     = txtApellido2.Text,
                        IdInstitucion = Convert.ToInt32(cboInstitucion.SelectedValue.ToString())
                    };

                    switch (vModo)
                    {
                    case "A":
                        vNegociosCreditos.Insert(vEntidad);
                        break;

                    case "B":
                        vNegociosCreditos.Delete(vEntidad);
                        break;

                    case "M":
                        vNegociosCreditos.Update(vEntidad);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }