Capa de Datos.
1. Conexin.
public class Conexion
{
private MySqlConnection conMYSQL { get; set; }
private string obtenerConexionMYSQL()
{
return ConfigurationManager.ConnectionStrings["conexionMYSQL"].ConnectionString;
}
public void ConectarMYSQL()
{
try
{
conMYSQL = new MySqlConnection(obtenerConexionMYSQL());
this.conMYSQL.Open();
}
catch (Exception)
{
conMYSQL = null;
}
}
public MySqlConnection getConexionMYSQL()
{
return conMYSQL;
}
public void cerrarConexion()
{
this.conMYSQL.Close();
}
2. DatoConexion.
MessageBox.Show("" + e);
throw e;
}
case 2:
return null;
default:
return null;
Capa entidades.
3. Historico
4. Investigador
public class Investigador
{
public int CodigoInvestigador { get; set; }
public int CodigoMestra { get; set; }
public string NombreInvestigador { get; set; }
}
5. Maestra
public class Maestra
{
public int CodigoMestra { get; set; }
public String NombreInvestigador { get; set; }
}
6. ProyectoCabecera
public class ProyectoCabecera
{
public int CodigoProyecto { get; set; }
public int CodigoMestra { get; set; }
public int CodigoInvestigador { get; set; }
public string NombreProyecto { get; set; }
public string AreaAplicacion { get; set; }
public string FechaPresentacion { get; set; }
}
7. ProyectoDetalle
public class ProyectoDetalle
{
public int CodigoProyectoDetalle { get; set; }
public int CodigoProyecto { get; set; }
public int PuntajeProyecto { get; set; }
public int Calificado { get; set; }
}
8. Requisitos
public class Requisitos
{
public String Area { get; set; }
public String Requisito_uno { get; set; }
public String Requisito_dos { get; set; }
public String Requisito_tres { get; set; }
public String Requisito_cuatro { get; set; }
Capa Interface
1. HistorialProyectosCalificados.xaml
public partial class HistorialProyectosCalificados : Window
{
DataView mifoltro = new DataView();
DataSet resultados = new DataSet();
public HistorialProyectosCalificados()
{
InitializeComponent();
}
public static string obtenerString()
{
return
ConfigurationManager.ConnectionStrings["conexionMYSQL"].ConnectionString;
}
public void leer_datos(string query, ref DataSet dstprincipal, string tabla)
{
try
{
string cadena = obtenerString();
MySqlConnection cn = new MySqlConnection(cadena);
MySqlCommand cmd = new MySqlCommand(query, cn);
cn.Open();
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
da.Fill(dstprincipal, tabla);
da.Dispose();
cn.Close();
}
catch (Exception e)
{
}
System.Windows.MessageBox.Show("fallo" + e);
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
resultados = new DataSet();
this.leer_datos("SELECT *FROM todoproyectos Where Calificado=1", ref
resultados, "todoproyectos");
this.mifoltro = ((DataTable)resultados.Tables["todoproyectos"]).DefaultView;
this.historial.ItemsSource = mifoltro;
}
string codigo;
string calificacion;
string nombre;
private void historial_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
try
{
codigo =
((DataRowView)historial.SelectedItem).Row["CodigoProyectoDetalle"].ToString();
calificacion =
((DataRowView)historial.SelectedItem).Row["Calificado"].ToString();
nombre =
((DataRowView)historial.SelectedItem).Row["NombreProyecto"].ToString();
string area =
((DataRowView)historial.SelectedItem).Row["AreaAplicacion"].ToString();
if (calificacion=="1")
{
MessageBox.Show("Este proyecto ya esta calificado.. escoja los que tengan
como calificacion 0");
}
else
{
}
}
catch (Exception)
{
throw;
2. HistorialProyectosNoCalificados.xaml
public partial class HistorialProyectosNoCalificados : Window
{
DataView mifoltro = new DataView();
DataSet resultados = new DataSet();
public HistorialProyectosNoCalificados()
{
InitializeComponent();
}
public static string obtenerString()
{
return
ConfigurationManager.ConnectionStrings["conexionMYSQL"].ConnectionString;
}
public void leer_datos(string query, ref DataSet dstprincipal, string tabla)
{
try
{
string cadena = obtenerString();
MySqlConnection cn = new MySqlConnection(cadena);
MySqlCommand cmd = new MySqlCommand(query, cn);
cn.Open();
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
da.Fill(dstprincipal, tabla);
da.Dispose();
cn.Close();
}
catch (Exception e)
{
}
System.Windows.MessageBox.Show("fallo" + e);
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
resultados = new DataSet();
this.leer_datos("SELECT *FROM todoproyectos Where Calificado=0", ref
resultados, "todoproyectos");
this.mifoltro = ((DataTable)resultados.Tables["todoproyectos"]).DefaultView;
this.historial.ItemsSource = mifoltro;
}
string codigo;
string calificacion;
string nombre;
private void historial_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
try
{
codigo =
((DataRowView)historial.SelectedItem).Row["CodigoProyectoDetalle"].ToString();
calificacion =
((DataRowView)historial.SelectedItem).Row["Calificado"].ToString();
nombre =
((DataRowView)historial.SelectedItem).Row["NombreProyecto"].ToString();
string area =
((DataRowView)historial.SelectedItem).Row["AreaAplicacion"].ToString();
if (calificacion=="1")
{
MessageBox.Show("Este proyecto ya esta calificado.. escoja los que tengan
como calificacion 0");
}
else
{
}
}
catch (Exception)
{
throw;
3. IngresoDocumento.xaml
public partial class IngresoDocumento : Window
{
Maestra maestraPrincipal;
List<Investigador> investigadores = new List<Investigador>();
public IngresoDocumento(Maestra maestra)
{
InitializeComponent();
investigadores = ReynaAzul.Seleccionar<Investigador>(1, 'S',
"procinvestigador");
maestraPrincipal = maestra;
nombremaetra.Text = maestra.NombreInvestigador;
codigomaestra.Text = maestra.CodigoMestra.ToString();
area.Items.Add("--------------------------selec--------------------------");
area.Items.Add("Ingenierias");
area.Items.Add("Biomedicas");
area.Items.Add("Sociales");
foreach (var item in investigadores)
{
investigador.Items.Add(item.NombreInvestigador);
}
}
int buscarCodigoInvestigador(string nombre)
{
List<Investigador> investigador = new List<Investigador>();
investigador = ReynaAzul.Seleccionar<Investigador>(1, 'S', "procinvestigador");
foreach (var item in investigador)
{
if (nombre==item.NombreInvestigador)
{
return item.CodigoInvestigador;
}
}
return 0;
}
private void guardar_Click(object sender, RoutedEventArgs e)
{
ProyectoCabecera nuevocabecera = new ProyectoCabecera();
nuevocabecera.CodigoProyecto = 0;
nuevocabecera.CodigoMestra = maestraPrincipal.CodigoMestra;
nuevocabecera.CodigoMestra = maestraPrincipal.CodigoMestra;
// string nombreinves=investigador.SelectedItem.ToString();
string nombreinves=investigador.SelectedItem.ToString();
nuevocabecera.CodigoInvestigador = buscarCodigoInvestigador(nombreinves);
nuevocabecera.NombreProyecto = nombre.Text;
nuevocabecera.AreaAplicacion = area.SelectedItem.ToString();
nuevocabecera.FechaPresentacion = fechainicio.Text;
if (ReynaAzul.Altas(nuevocabecera, 1, 'I', "procproyectocabecera") != 0)
{
MessageBox.Show("ingreso con exito");
}
}
}
4. IngresoInvestigador.xaml
public partial class IngresoInvestigador : Window
{
Maestra maestraPrincipal;
public IngresoInvestigador(Maestra maestra)
{
maestraPrincipal = maestra;
InitializeComponent();
nombremaestra.Text = maestra.NombreInvestigador;
codigomaestra.Text = maestra.CodigoMestra.ToString();
}
private void Ingresar_Datos_Click(object sender, RoutedEventArgs e)
{
Investigador nuevoInvestigador = new Investigador();
nuevoInvestigador.CodigoInvestigador = 0;
nuevoInvestigador.CodigoMestra = maestraPrincipal.CodigoMestra;
nuevoInvestigador.NombreInvestigador = nombre.Text +" "+apellidos.Text;
if (ReynaAzul.Altas(nuevoInvestigador, 1, 'I', "procinvestigador") != 0)
{
MessageBox.Show("ingreso con exito");
}
}
}
5. InterfazInicial.xaml
public partial class InterfazInicial : Window
{
Maestra jues = new Maestra();
List<Investigador> investigadores = new List<Investigador>();
List<Maestra> jueces = new List<Maestra>();
public InterfazInicial()
{
jues.CodigoMestra = 1;
jues.NombreInvestigador = "Julia Mamani";
InitializeComponent();
iniciarsesion.Visibility = Visibility.Hidden;
iniciarSesion.Visibility = Visibility.Hidden;
}
private void INVESTIGADOR(object sender, RoutedEventArgs e)
{
IngresoInvestigador nuevoInvestigador = new IngresoInvestigador(jues);
nuevoInvestigador.ShowDialog();
}
private void MAESTRO(object sender, RoutedEventArgs e)
{
Form1 nuevo = new Form1();
nuevo.ShowDialog();
}
private void INICIAR(object sender, RoutedEventArgs e)
{
jueces = ReynaAzul.Seleccionar<Maestra>(1, 'S', "procmaestra");
MessageBox.Show("Iniciando Sesion...");
iniciarSesion.Visibility = Visibility.Visible;
iniciarsesion.Visibility = Visibility.Visible;
}
private void INGRESAR(object sender, RoutedEventArgs e)
{
IngresoDocumento nuevoDocumento = new IngresoDocumento(jues);
nuevoDocumento.ShowDialog();
}
6. ProyectosAprobados.xaml
public partial class ProyectosAprobados : Window
{
DataView mifoltro = new DataView();
DataSet resultados = new DataSet();
public ProyectosAprobados()
{
InitializeComponent();
}
public static string obtenerString()
{
return
ConfigurationManager.ConnectionStrings["conexionMYSQL"].ConnectionString;
}
public void leer_datos(string query, ref DataSet dstprincipal, string tabla)
{
try
{
string cadena = obtenerString();
MySqlConnection cn = new MySqlConnection(cadena);
MySqlCommand cmd = new MySqlCommand(query, cn);
cn.Open();
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
da.Fill(dstprincipal, tabla);
da.Dispose();
cn.Close();
}
catch (Exception e)
{
}
System.Windows.MessageBox.Show("fallo" + e);
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
resultados = new DataSet();
this.leer_datos("SELECT *FROM ProyectoInnovacion where calificacion >50", ref
resultados, "ProyectoInnovacion");
this.mifoltro = ((DataTable)resultados.Tables["ProyectoInnovacion"]).DefaultView;
this.aprobados.ItemsSource = mifoltro;
}
}