Example #1
0
        //----------------------------------------------------------------------------------------------
        //Modificar Arreglo
        public String ModificarArregloDAL(UTIL_Arreglo utilAr)
        {
            ConnectionBD     stringconn  = new ConnectionBD();
            NpgsqlConnection conn        = new NpgsqlConnection(stringconn.Postgreconnection());
            NpgsqlCommand    postCommand = new NpgsqlCommand("update_arreglo", conn);

            postCommand.CommandType = CommandType.StoredProcedure;

            try
            {
                postCommand.Parameters.Add("_abonado", NpgsqlTypes.NpgsqlDbType.Integer).Value = UTIL.UTIL.ObtenerValor(utilAr.iCedula);
                postCommand.Parameters.Add("_monto", NpgsqlTypes.NpgsqlDbType.Integer).Value   = UTIL.UTIL.ObtenerValor(utilAr.iMonto);
                postCommand.Parameters.Add("_abono", NpgsqlTypes.NpgsqlDbType.Integer).Value   = UTIL.UTIL.ObtenerValor(utilAr.iAbono);
                NpgsqlParameter message = postCommand.Parameters.Add("message", NpgsqlTypes.NpgsqlDbType.Text, 250);
                message.Direction = ParameterDirection.Output;


                conn.Open();
                postCommand.ExecuteNonQuery();
                messageOutput = postCommand.Parameters["message"].Value.ToString();
            }

            catch (Exception ex)
            {
                return(ex.Message);

                throw new Exception(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            return(messageOutput);
        }
Example #2
0
        //----------------------------------------------------------------------------------------------
        //Buscar Arreglo por cedula
        public DataTable BuscarArregloDAL(UTIL_Arreglo utilAr)
        {
            DataSet ds = new DataSet();

            ConnectionBD     stringconn  = new ConnectionBD();
            NpgsqlConnection conn        = new NpgsqlConnection(stringconn.Postgreconnection());
            NpgsqlCommand    postCommand = new NpgsqlCommand("buscar_arreglo", conn);

            postCommand.CommandType = CommandType.StoredProcedure;

            try
            {
                postCommand.Parameters.Add("_cedula", NpgsqlTypes.NpgsqlDbType.Integer).Value = UTIL.UTIL.ObtenerValor(utilAr.iCedula);
                NpgsqlParameter message = postCommand.Parameters.Add("message", NpgsqlTypes.NpgsqlDbType.Text, 250);
                message.Direction = ParameterDirection.Output;


                conn.Open();
                postCommand.ExecuteNonQuery();
                NpgsqlDataAdapter dta = new NpgsqlDataAdapter(postCommand);
                dta.Fill(ds);
                messageOutput = postCommand.Parameters["message"].Value.ToString();
            }

            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            if (ds.Tables.Count > 0)
            {
                return(ds.Tables[0]);
            }

            else
            {
                return(null);
            }
        }