Пример #1
0
        public static bool InsertarFechaPagos(Fecha_Pagos p)
        {
            SqlConnection conn     = new SqlConnection(dbConnectionString);
            bool          correcto = true;

            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                    SqlCommand cmd = new SqlCommand("exec pa_InsertarFecha_Pagos " +
                                                    "@Cedula_Cliente, " +
                                                    "@ID_INSTALACION, " +
                                                    "@FECHA_PAGO," +
                                                    "@PLAZO_VENCIDO" +
                                                    "@OBSERVACIONES", conn);
                    cmd.Parameters.AddWithValue("@Cedula_Cliente", p.CedulaCliente);
                    cmd.Parameters.AddWithValue("@ID_INSTALACION", p.IdInstalacion);
                    cmd.Parameters.AddWithValue("@FECHA_PAGO", p.FechaPago);
                    cmd.Parameters.AddWithValue("@PLAZO_VENCIDO", p.PlazoVencido);
                    cmd.Parameters.AddWithValue("@OBSERVACIONES", p.Observaciones);
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception)
            {
                correcto = false;
            }
            finally
            {
                conn.Close();
            }
            return(correcto);
        }
Пример #2
0
        public static Fecha_Pagos VerFechaPagoCedula(string cedula)
        {
            SqlConnection conn        = new SqlConnection(dbConnectionString);
            Fecha_Pagos   fecha_Pagos = null;

            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                    SqlDataReader dr;
                    SqlCommand    cmd = new SqlCommand("exec pa_MostrarFechaPagoCedula " +
                                                       "@Cedula_Cliente", conn);
                    cmd.Parameters.AddWithValue("@Cedula_Cliente", cedula);
                    dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        fecha_Pagos = new Fecha_Pagos
                        {
                            IdPago        = dr.GetInt32(0),
                            CedulaCliente = dr.GetString(1),
                            IdInstalacion = dr.GetInt32(2),
                            FechaPago     = dr.GetDateTime(3),
                            PlazoVencido  = dr.GetBoolean(4),
                            Observaciones = dr.GetString(5)
                        };
                    }
                    dr.Close();
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                conn.Close();
            }
            return(fecha_Pagos);
        }