Águilas Nicas | You are my Sunshine

Hackathon Managua UAM

Team Updates

using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Linq;
using System.Web;
using Microsoft.VisualBasic;
using System.Collections;
using System.Data;
using System.Diagnostics;
using System.Data.SqlClient;
using System.Configuration;
namespace WebApplication3
{
// public class Concexion
// {
// }
//}
/// <summary>
/// Clase que maneja la conexion con sql server
/// </summary>
/// <remarks></remarks>
public class Conexion
{
private string conexion = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
/// <summary>
/// Obtener la un SqlConection con la cadena de conexion
/// </summary>
/// <returns></returns>
/// <remarks></remarks>
public SqlConnection conex()
{
string connectionString = conexion;
return new System.Data.SqlClient.SqlConnection(connectionString);
}
/// <summary>
/// Obtener la Cadena de Conexion
/// </summary>
/// <returns></returns>
/// <remarks></remarks>
public string conex_string()
{
return conexion;
}
}
/// <summary>
/// Clase que maneja el llamado a los procedimientos almacenados
/// </summary>
/// <remarks></remarks>
public class StoredProcedure
{
private Conexion obj = new Conexion();
/// <summary>
/// Constructor que solo recibe el nombre del procedimiento e inicializa la colección.
/// </summary>
/// <param name="nNombre">Nombre del procedimiento almacenado</param>
/// <remarks></remarks>
public StoredProcedure(string nNombre)
{
try
{
Nombre = nNombre;
Parametros = new Collection();
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
///
/// </summary>
/// <remarks></remarks>
public StoredProcedure()
{
Nombre = "";
Parametros = new Collection();
}
/// <summary>
/// declaracion de variables para el nombre de procedimiento y los parametros de los procedimientos
/// </summary>
/// <remarks></remarks>
private string mNombreProcedimiento;
private Collection mParametros;
/// <summary>
/// Propiedad de la clase para asignar y obtener el nombre del procedimiento
/// </summary>
/// <value></value>
/// <returns></returns>
/// <remarks></remarks>
public string Nombre
{
get { return mNombreProcedimiento; }
set { mNombreProcedimiento = value; }
}
/// <summary>
/// Propiedad para obtener y asignar los parametros de los procediemientos almacenados
/// </summary>
/// <value></value>
/// <returns></returns>
/// <remarks></remarks>
public Collection Parametros
{
get { return mParametros; }
set { mParametros = value; }
}
/// <summary>
/// Agrega los parametros del procedimiento y su respectivo valor.
/// </summary>
/// <param name="pVariable"></param>
/// <param name="pValor"></param>
/// <remarks></remarks>
public void AgregarParametro(string pVariable, object pValor)
{
try
{
StoredProcedureParameter iParametro = new StoredProcedureParameter((pVariable[0].ToString().Trim() == "@" ? pVariable : "@" + pVariable), pValor);
this.Parametros.Add(iParametro);
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// Ejecutar Vista
/// </summary>
/// <param name="nombre">Modificacion del nombre a ejecutar, default el nombre inicializado en la instancia</param>
/// <returns></returns>
/// <remarks></remarks>
public DataSet EjecutarVista2(string nombre = "")
{
try
{
string _nombre = (string.IsNullOrEmpty(nombre.Trim()) ? this.Nombre : nombre);
Conexion Conn = new Conexion();
string sql = "SELECT * FROM " + _nombre;
SqlCommand sqlCmd = new SqlCommand(this.Nombre, obj.conex());
sqlCmd.CommandType = CommandType.Text;
sqlCmd.CommandText = sql;
sqlCmd.Connection = obj.conex();
SqlDataAdapter sda = new SqlDataAdapter(sqlCmd);
DataSet ds = new DataSet();
sda.Fill(ds);
obj.conex().Close();
return ds;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// Ejecutar Vista
/// </summary>
/// <param name="nombre">Modificacion del nombre a ejecutar, default el nombre inicializado en la instancia</param>
/// <returns></returns>
/// <remarks></remarks>
public DataTable EjecutarVista(string nombre)
{
try
{
Conexion Conn = new Conexion();
string sql = "SELECT * FROM " + nombre;
SqlCommand sqlCmd = new SqlCommand(this.Nombre, obj.conex());
sqlCmd.CommandType = CommandType.Text;
sqlCmd.CommandText = sql;
sqlCmd.Connection = obj.conex();
SqlDataAdapter sda = new SqlDataAdapter(sqlCmd);
DataTable ds = new DataTable();
sda.Fill(ds);
obj.conex().Close();
return ds;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// Ejecutar una funcion SQL
/// </summary>
/// <param name="nombre"></param>
/// <returns></returns>
/// <remarks></remarks>
public DataTable EjecutarFuncion(string nombre)
{
try
{
Conexion Conn = new Conexion();
string sql = "SELECT " + nombre.Trim();
SqlCommand sqlCmd = new SqlCommand(this.Nombre, obj.conex());
sqlCmd.CommandType = CommandType.Text;
sqlCmd.CommandText = sql;
sqlCmd.Connection = obj.conex();
SqlDataAdapter sda = new SqlDataAdapter(sqlCmd);
DataTable ds = new DataTable();
sda.Fill(ds);
obj.conex().Close();
return ds;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// Ejecuta el procedimiento almacenado.
/// </summary>
/// <param name="nombre">Modificacion del nombre a ejecutar, default el nombre inicializado en la instancia</param>>
/// <returns></returns>
/// <remarks></remarks>
public DataSet EjecutarProcedimiento(string nombre = "")
{
try
{
string _nombre = (string.IsNullOrEmpty(nombre.Trim()) ? this.Nombre : nombre);
Conexion Conn = new Conexion();
//colocacion de la varialbe de conexion
SqlCommand sqlCmd = new SqlCommand(_nombre, obj.conex());
sqlCmd.CommandType = CommandType.StoredProcedure;
sqlCmd.CommandTimeout = 120;
StoredProcedureParameter mParametro = null;
//Agrega las variables al procedimiento almacenado
foreach (StoredProcedureParameter mParametro_loopVariable in this.Parametros)
{
mParametro = mParametro_loopVariable;
SqlParameter pParam = new SqlParameter(mParametro.Variable, mParametro.GetTypeProperty);
pParam.Direction = ParameterDirection.Input;
pParam.Value = mParametro.Valor;
sqlCmd.Parameters.Add(pParam);
}
//SqlAdapter utiliza el SqlCommand para llenar el Dataset
SqlDataAdapter sda = new SqlDataAdapter(sqlCmd);
DataSet ds = new DataSet();
sda.Fill(ds);
obj.conex().Close();
return ds;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// Ejecutar un query de texto en SQL
/// </summary>
/// <param name="query">consulta tipo texto</param>
/// <returns></returns>
/// <remarks></remarks>
public DataSet EjecutarQueryString(string query)
{
try
{
Conexion Conn = new Conexion();
//colocacion de la varialbe de conexion
SqlCommand sqlCmd = new SqlCommand(query.Trim(), obj.conex());
var _with1 = sqlCmd;
_with1.CommandType = CommandType.Text;
_with1.CommandTimeout = 120;
//SqlAdapter utiliza el SqlCommand para llenar el Dataset
SqlDataAdapter sda = new SqlDataAdapter(sqlCmd);
DataSet ds = new DataSet();
sda.Fill(ds);
obj.conex().Close();
return ds;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// EjecutarVistaOrdenada
/// </summary>
/// <param name="SqlOrden">Consulta del order by</param>
/// <param name="nombreVista">Modificacion del nombre a ejecutar, default el nombre inicializado en la instancia</param>
/// <returns></returns>
/// <remarks></remarks>
public DataSet EjecutarVistaOrdenada(string nombreVista, string SqlOrden)
{
try
{
Conexion Conn = new Conexion();
string sql = null;
//colocacion de la varialbe de conexion
sql = "SELECT * FROM " + nombreVista + " ORDER BY " + SqlOrden;
SqlCommand sqlCmd = new SqlCommand(this.Nombre, obj.conex());
sqlCmd.CommandType = CommandType.Text;
sqlCmd.CommandText = sql;
sqlCmd.Connection = obj.conex();
SqlDataAdapter sda = new SqlDataAdapter(sqlCmd);
//Se llena el dataset
DataSet ds = new DataSet();
sda.Fill(ds);
obj.conex().Close();
return ds;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// Convercion de Serializacion de DataTable a Json
/// </summary>
/// <param name="dt">DataTable a convertir</param>
/// <returns>String con formato JSON</returns>
/// <remarks></remarks>
public string ConvertDataTableToJSON(DataTable dt)
{
try
{
System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
Dictionary<string, object> row = default(Dictionary<string, object>);
foreach (DataRow dr in dt.Rows)
{
row = new Dictionary<string, object>();
foreach (DataColumn col in dt.Columns)
{
row.Add(col.ColumnName, dr[col]);
}
rows.Add(row);
}
return serializer.Serialize(rows);
}
catch (Exception ex)
{
throw ex;
}
}
}
/// <summary>
/// Clase que maneja las variables y su respectivo valor
/// </summary>
/// <remarks></remarks>
public class StoredProcedureParameter
{
private string mVariable;
private object mValor;
/// <summary>
/// Nombre de la variable, debe ser igual a la declarada en el procedimiento almacenado
/// </summary>
/// <value></value>
/// <returns></returns>
/// <remarks></remarks>
public string Variable
{
get { return mVariable; }
set { mVariable = value; }
}
/// <summary>
/// Valor de la variable, puede ser de cualquier tipo de dato. preferible que coincida con las variables declaradas en GetTypeProperty
/// </summary>
/// <value></value>
/// <returns></returns>
/// <remarks></remarks>
public object Valor
{
get { return mValor; }
set { mValor = value; }
}
/// <summary>
/// Se definen los posibles tipos de datos que se le van a enviar al procedimiento almacenado
/// Esta lista podria aumentar conforme se usen otro tipo de variable.
/// </summary>
/// <value></value>
/// <returns></returns>
/// <remarks></remarks>
public SqlDbType GetTypeProperty
{
get
{
if (mValor.GetType().FullName == "System.String;")
{
return SqlDbType.NVarChar;
}
else if (mValor.GetType().FullName == "System.Int16;")
{
return SqlDbType.Int;
}
else if (mValor.GetType().FullName == "System.Int32;")
{
return SqlDbType.Int;
}
else if (mValor.GetType().FullName == "System.Int64;")
{
return SqlDbType.BigInt;
}
else if (mValor.GetType().FullName == "System.Integer;")
{
return SqlDbType.Int;
}
else if (mValor.GetType().FullName == "System.Decimal;")
{
return SqlDbType.Decimal;
}
else if (mValor.GetType().FullName == "System.Double;")
{
return SqlDbType.Float;
}
else if (mValor.GetType().FullName == "System.DateTime;")
{
return SqlDbType.DateTime;
}
else if (mValor.GetType().FullName == "System.Byte;")
{
return SqlDbType.Image;
}
return SqlDbType.NVarChar;
}
}
/// <summary>
/// Constructor para la inicializacion de la variable.
/// </summary>
/// <param name="pVariable"></param>
/// <param name="pValor"></param>
/// <remarks></remarks>
public StoredProcedureParameter(string pVariable, object pValor)
{
try
{
this.Variable = pVariable;
this.Valor = pValor;
}
catch (Exception ex)
{
throw new Exception("Error en la creacion del Parametro \n " + ex.Message);
}
}
}
}
view raw gistfile1.txt hosted with ❤ by GitHub
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication3._Default" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<script src="Scripts/ie10-viewport-bug-workaround.js"></script>
<link href="Scripts/ie10-viewport-bug-workaround.css" rel="stylesheet" />
<script src="Scripts/ie-emulation-modes-warning.js"></script>
<link href="Scripts/carousel.css" rel="stylesheet" />
<!-- Carousel
================================================== -->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class=""></li>
<li data-target="#myCarousel" data-slide-to="1" class=""></li>
<li data-target="#myCarousel" data-slide-to="2" class="active"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item">
<img class="first-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="First slide">
<img src="Imagenes/18217639_1419538388068967_987194638_n.png" />" />
<div class="container">
<div class="carousel-caption">
<h1> Utiliza energía amigable para el medio ambiente</h1>
<p>.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Unete al mundo solar</a></p>
</div>
</div>
</div>
<div class="item">
<img class="second-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Second slide">
<img src="Imagenes/casafotovoltaico2.jpg" />" />
</div>
defa<div class="item active">
<img class="third-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Third slide">
<img src="Imagenes/esquema_aislada.jpg" />" />
<div class="container">
<div class="carousel-caption">
<h1></h1>
<p></p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Energía Solar </a></p>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div><!-- /.carousel -->
<div class="jumbotron">
<h1>Energía Inteligente</h1>
<p class="lead">Tiene la visión de despertar el aprovechamiento de la energia solar en &quot;Cuando&quot;,&quot;Como&quot; y &quot;Donde&quot; </p>
<p><a href="http://www.asp.net" class="btn btn-primary btn-lg">Informese más &raquo;</a></p>
</div>
<div class="row">
<div class="col-md-4">
<h2>&nbsp;</h2>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
</div>
<div class="col-md-4">
<h2>&nbsp;</h2>
<p>
&nbsp;
</p>
</div>
<div class="col-md-4">
<p>
&nbsp;</p>
</div>
</div>
</asp:Content>
view raw gistfile2.txt hosted with ❤ by GitHub
//------------------------------------------------------------------------------
// <generado automáticamente>
// Este código fue generado por una herramienta.
//
// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
// se vuelve a generar el código.
// </generado automáticamente>
//------------------------------------------------------------------------------
namespace WebApplication3 {
public partial class SiteMaster {
/// <summary>
/// Control MainContent.
/// </summary>
/// <remarks>
/// Campo generado automáticamente.
/// Para modificarlo, mueva la declaración del campo del archivo del diseñador al archivo de código subyacente.
/// </remarks>
protected global::System.Web.UI.WebControls.ContentPlaceHolder MainContent;
/// <summary>
/// Control ASPxPivotGrid1.
/// </summary>
/// <remarks>
/// Campo generado automáticamente.
/// Para modificarlo, mueva la declaración del campo del archivo del diseñador al archivo de código subyacente.
/// </remarks>
protected global::DevExpress.Web.ASPxPivotGrid.ASPxPivotGrid ASPxPivotGrid1;
/// <summary>
/// Control SqlDataSource1.
/// </summary>
/// <remarks>
view raw gistfile3.txt hosted with ❤ by GitHub
//------------------------------------------------------------------------------
// <generado automáticamente>
// Este código fue generado por una herramienta.
//
// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
// se vuelve a generar el código.
// </generado automáticamente>
//------------------------------------------------------------------------------
namespace WebApplication3 {
public partial class AhorroEnergia {
/// <summary>
/// Control ASPxGridView1.
/// </summary>
/// <remarks>
/// Campo generado automáticamente.
/// Para modificarlo, mueva la declaración del campo del archivo del diseñador al archivo de código subyacente.
/// </remarks>
protected global::DevExpress.Web.ASPxGridView ASPxGridView1;
}
}
view raw gistfile4.txt hosted with ❤ by GitHub
using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Security.Principal;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.AspNet.Identity;
namespace WebApplication3
{
public partial class SiteMaster : MasterPage
{
private const string AntiXsrfTokenKey = "__AntiXsrfToken";
private const string AntiXsrfUserNameKey = "__AntiXsrfUserName";
private string _antiXsrfTokenValue;
protected void Page_Init(object sender, EventArgs e)
{
// The code below helps to protect against XSRF attacks
var requestCookie = Request.Cookies[AntiXsrfTokenKey];
Guid requestCookieGuidValue;
if (requestCookie != null && Guid.TryParse(requestCookie.Value, out requestCookieGuidValue))
{
// Use the Anti-XSRF token from the cookie
_antiXsrfTokenValue = requestCookie.Value;
Page.ViewStateUserKey = _antiXsrfTokenValue;
}
else
{
// Generate a new Anti-XSRF token and save to the cookie
_antiXsrfTokenValue = Guid.NewGuid().ToString("N");
Page.ViewStateUserKey = _antiXsrfTokenValue;
var responseCookie = new HttpCookie(AntiXsrfTokenKey)
{
HttpOnly = true,
Value = _antiXsrfTokenValue
};
if (FormsAuthentication.RequireSSL && Request.IsSecureConnection)
{
responseCookie.Secure = true;
}
Response.Cookies.Set(responseCookie);
}
Page.PreLoad += master_Page_PreLoad;
}
protected void master_Page_PreLoad(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Set Anti-XSRF token
ViewState[AntiXsrfTokenKey] = Page.ViewStateUserKey;
ViewState[AntiXsrfUserNameKey] = Context.User.Identity.Name ?? String.Empty;
}
else
{
// Validate the Anti-XSRF token
if ((string)ViewState[AntiXsrfTokenKey] != _antiXsrfTokenValue
|| (string)ViewState[AntiXsrfUserNameKey] != (Context.User.Identity.Name ?? String.Empty))
{
throw new InvalidOperationException("Validation of Anti-XSRF token failed.");
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Unnamed_LoggingOut(object sender, LoginCancelEventArgs e)
{
Context.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
}
}
}
view raw sitemaster hosted with ❤ by GitHub
M
María Isabel Pérez Acevedo

Justification

Today, people from different economic, social and industrial sectors have one common goal: to use more energy at a lower economic and environmental cost. At the same time, the human being is by nature an ambitious and greedy being in terms of energy use, that is, the more energy one has, the more energy one needs and yet one never manages to supply basic energy needs In all parts of the world evenly.

For reasons such as those mentioned above, this project aims to contribute and contribute to society alternative solutions and methods, friendly to our environment. With this research we want to show that change for a better world does not necessarily have to start with big corporations or representatives of governments or high social class, but the real change can start with ordinary citizens with encouragement And desires to leave a better planet to our future generations.

About us

We are students of American College, students of industrial engineering, engineering in system, engineering in renewable energies, which we have presence of idea called "Intelligent Energy".

What makes us special

It makes us special to be a group of young people united as a team for the same purpose, the environment its preservation, the power to produce energy without the need to damage or contaminate it.

What drives us

We are moved by the power, the sustainable development ecosystem, the power to guarantee our present without affecting the future of the generations to come. Based on the 17 objectives of sustainable development presented by the UN, we base our expectations on the people and contribute to our nation Nicaragua the teaching of being able to change our energy culture as people and citizens taking care of resources that others do not have as a privilege.

Functioning

The operation and basic idea of the project is simple, simple and concrete. It is the combination of solar thermal systems for sanitary water heating, solar panel systems for electric power generation, and computer science to increase performance and make intelligent the system.

The idea is to design and build solar thermal systems for water heating by reusing and recycling raw material (considerably reducing costs) and combining this system with that of solar panels. With the use of intelligent devices, you can control external values, take a smarthphone and decide the temperature at which the user wants to take a shower, or program the amount of liters of water or the time you want to bathe, or To redistribute in an automated way the use of the energy in a house to increase the yield of the energetic consumption.

What can change?

The impact of this project and what it intends to change all lies in the correct use of our needs and importance that we can give to the energy produced by the sun as this can potentially reduce the pollution that fossil fuels produce In our ecosystem. That is why this idea arose to control, optimize, educate and teach people the proper use and capabilities of solar energy and photovoltaic panels.

Which platform is going to be used?

The idea is based on virtual platforms such as: ASP.NET and APK. Since most people are very closely connected with these technologies.

What does the idea need to go to a new level?

The most important and ideal that the team consider to carry out this idea are:

• Financial resources.

• Support from organizations.

• Acceptance to change by the people.

What can become a day?

This idea can reduce environmental pollution, increase regional and national electric independence, reduce transmission lines and facilitate the electrification of rural areas in developing countries, ie Benefit of the electric energy produced by the sun to that person who out of 5 does not have it.

D
Denis Daniel Dixon Henriquez
NASA Logo

SpaceApps is a NASA incubator innovation program.