Ejemplo n.º 1
0
 private void CargaCuentaxPagar()
 {
     preBan             = AdmPreBan.CargaPrestamoBancario(Convert.ToInt32(preBan.CodPrestamoBancario));
     txtCodPreBan.Text  = preBan.CodPrestamoBancario.ToString();
     txtBanco.Text      = preBan.DescBanco;
     txtPrestamo.Text   = String.Format("{0:#,##0.00}", preBan.Montoprestamo);
     txtInteres.Text    = String.Format("{0:#,##0.00}", preBan.Montointeres);
     txtTotal.Text      = String.Format("{0:#,##0.00}", preBan.Montodevolver);
     txtMoneda.Text     = preBan.DescMoneda;
     txtTipoCambio.Text = String.Format("{0:#,##0.000}", preBan.TipoCambio);
     dtpFecha.Value     = Convert.ToDateTime(preBan.Fechaaprobacion);
     //MessageBox.Show(preBan.CantCuotas + "" + Procede);
     if (Procede == 2)
     {
         txtNDEC.Text = preBan.CantCuotas.ToString();
     }
 }
Ejemplo n.º 2
0
        public Boolean insert(clsPrestamoBancario preBan)
        {
            try
            {
                return(Mpreban.Insert(preBan));
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Duplicate entry"))
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: N°- de Documento Repetido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                else
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                return(false);
            }
        }
Ejemplo n.º 3
0
        public clsPrestamoBancario CargaPrestamoBancario(Int32 CodPreBan)
        {
            clsPrestamoBancario prestamo = null;

            try
            {
                con.conectarBD();
                cmd = new MySqlCommand("MuestraPrestamoBancario", con.conector);
                cmd.Parameters.AddWithValue("codpreban", CodPreBan);
                cmd.CommandType = CommandType.StoredProcedure;
                dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        prestamo = new clsPrestamoBancario();
                        prestamo.CodPrestamoBancario = dr.GetInt32(0);
                        prestamo.CodBanco            = dr.GetInt32(1);
                        prestamo.DescBanco           = dr.GetString(2);
                        prestamo.CodMoneda           = dr.GetInt32(3);
                        prestamo.DescMoneda          = dr.GetString(4);
                        prestamo.TipoCambio          = dr.GetDecimal(5);
                        prestamo.Montoprestamo       = dr.GetDecimal(6);
                        prestamo.Montointeres        = dr.GetDecimal(7);
                        prestamo.Montodevolver       = dr.GetDecimal(8);
                        prestamo.Pendiente           = dr.GetDecimal(9);
                        prestamo.Fechaaprobacion     = dr.GetDateTime(10);
                        prestamo.Descripcion         = dr.GetString(12);
                        prestamo.Cancelado           = dr.GetInt32(14);
                        prestamo.CantCuotas          = dr.GetInt32(17);
                    }
                }
                return(prestamo);
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Ejemplo n.º 4
0
        public Boolean Insert(clsPrestamoBancario preBan)
        {
            try
            {
                con.conectarBD();

                cmd             = new MySqlCommand("GuardaPrestamoBancario", con.conector);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlParameter oParam;
                oParam           = cmd.Parameters.AddWithValue("codban", Convert.ToInt32(preBan.CodBanco));
                oParam           = cmd.Parameters.AddWithValue("codmon", Convert.ToInt32(preBan.CodMoneda));
                oParam           = cmd.Parameters.AddWithValue("tipcam", preBan.TipoCambio);
                oParam           = cmd.Parameters.AddWithValue("monpre", preBan.Montoprestamo);
                oParam           = cmd.Parameters.AddWithValue("monint", preBan.Montointeres);
                oParam           = cmd.Parameters.AddWithValue("mondev", preBan.Montodevolver);
                oParam           = cmd.Parameters.AddWithValue("fecapr", preBan.Fechaaprobacion);
                oParam           = cmd.Parameters.AddWithValue("fecven", preBan.Fechavencimiento);
                oParam           = cmd.Parameters.AddWithValue("descr", preBan.Descripcion);
                oParam           = cmd.Parameters.AddWithValue("newid", 0);
                oParam.Direction = ParameterDirection.Output;
                int x = cmd.ExecuteNonQuery();

                preBan.CodPrestamoBancario = Convert.ToInt32(cmd.Parameters["newid"].Value);

                if (x != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (MySqlException ex)
            {
                throw ex;
            }
            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }