Exferia_Actualizacion_BD

master
Gerardo 2023-08-02 12:06:08 +02:00
parent c2dfd558c4
commit 80047d9596
14 changed files with 1613 additions and 0 deletions

View File

@ -0,0 +1,195 @@
using Exferia_Aplicacion.General;
using Exferia_EntityFramework;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Exferia_Actualizacion_BD._1_Datos
{
public class PRV_Actualizaciones_Datos
{
public PRV_Actualizaciones Obtener_UltimaActualizacion()
{
Exferia_Entities obj_Exferia_Entities = null;
PRV_Actualizaciones mdl_PRV_Actualizaciones = null;
try
{
//Conexion
obj_Exferia_Entities = new Exferia_Entities();
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
string str_SQL = " SELECT top 1 " +
nameof(PRV_Actualizaciones.id) + " , " +
nameof(PRV_Actualizaciones.versionETF_Numero_Texto) + " , " +
nameof(PRV_Actualizaciones.versionEFT_Numero_Numerica) + " , " +
nameof(PRV_Actualizaciones.fechaEjecucion) +
" FROM " + nameof(PRV_Actualizaciones) +
" ORDER BY " + nameof(PRV_Actualizaciones.versionEFT_Numero_Numerica) + " DESC ";
//Rellenar el Modelo
mdl_PRV_Actualizaciones = obj_Exferia_Entities.Database.SqlQuery<PRV_Actualizaciones>(str_SQL, new object[]{ }).FirstOrDefault();
}
catch (Control_Errores)
{
throw;
}
catch (Exception ex)
{
throw new Control_Errores("", ex, nameof(PRV_Actualizaciones_Datos) + "/" + nameof(Obtener_UltimaActualizacion), true);
}
finally
{
obj_Exferia_Entities.Database.Connection.Close();
obj_Exferia_Entities.Dispose();
}
return mdl_PRV_Actualizaciones;
}
public void Ejecutar_Script(string _str_Script)
{
Exferia_Entities dbcontext = null;
try
{
dbcontext = new Exferia_Entities();
dbcontext.Database.ExecuteSqlCommand(_str_Script);
}
catch (Exception ex)
{
throw new Control_Errores(_str_Script, ex, nameof(PRV_Actualizaciones_Datos) + "/" + nameof(Ejecutar_Script), true);
}
finally
{
dbcontext.Database.Connection.Close();
dbcontext.Dispose();
}
}
public void Ejecutar_Script_Procedimientos(string _str_Script)
{
SqlCommand obj_SqlCommand;
SqlConnectionStringBuilder obj_SqlConnectionStringBuilder = new SqlConnectionStringBuilder();
obj_SqlConnectionStringBuilder.DataSource = Variables.G_STR_CONEXION_SERVIDOR;
obj_SqlConnectionStringBuilder.InitialCatalog = Variables.G_STR_CONEXION_BASEDATOS;
if (Variables.G_STR_CONEXION_USUARIO.Trim().Equals("") || Variables.G_STR_CONEXION_CLAVE.Trim().Equals(""))
{ obj_SqlConnectionStringBuilder.IntegratedSecurity = true; }
else
{
obj_SqlConnectionStringBuilder.Password = Variables.G_STR_CONEXION_CLAVE;
obj_SqlConnectionStringBuilder.UserID = Variables.G_STR_CONEXION_USUARIO;
}
SqlConnection obj_SqlConnection = null;
try
{
obj_SqlConnection = new SqlConnection(obj_SqlConnectionStringBuilder.ConnectionString);
obj_SqlConnection.Open();
string[] arr_Scripts = _str_Script.Split(new string[] { "SIGUIENTELINEAPARAEJECUCION" }, StringSplitOptions.None);
foreach (string str_Script_Final in arr_Scripts)
{
obj_SqlCommand = new SqlCommand(str_Script_Final, obj_SqlConnection);
obj_SqlCommand.ExecuteNonQuery();
}
obj_SqlConnection.Close();
}
catch (Exception ex)
{
throw new Control_Errores(_str_Script, ex, nameof(PRV_Actualizaciones_Datos) + "/" + nameof(Ejecutar_Script_Procedimientos), true);
}
finally
{
if (obj_SqlConnection != null)
{
if (obj_SqlConnection.State == ConnectionState.Open)
{
obj_SqlConnection.Close();
}
obj_SqlConnection.Dispose();
}
}
}
public void Insertar(PRV_Actualizaciones _mdl_PRV_Actualizaciones)
{
Exferia_Entities obj_Exferia_Entities = null;
try
{
obj_Exferia_Entities = new Exferia_Entities();
obj_Exferia_Entities.Configuration.LazyLoadingEnabled = false;
// Grabar Datos
string str_SQL_Existe = " SELECT " +
nameof(PRV_Actualizaciones.id) +
" FROM " + nameof(PRV_Actualizaciones) +
//WHERE
" WHERE " + nameof(PRV_Actualizaciones) + "." + nameof(PRV_Actualizaciones.versionEFT_Numero_Numerica) + "=@versionEFT_Numero_Numerica";
//Parametros
object[] arr_Parametros_Existe = new object[]
{
new SqlParameter("@versionEFT_Numero_Numerica", _mdl_PRV_Actualizaciones.versionEFT_Numero_Numerica)
};
long? lng_id = obj_Exferia_Entities.Database.SqlQuery<long>(str_SQL_Existe, arr_Parametros_Existe).FirstOrDefault();
//Insertar
if (lng_id == null || lng_id.Value==0)
{
#region INSERT
string str_SQL_Insert = " INSERT INTO " + nameof(PRV_Actualizaciones) +
" (" +
nameof(PRV_Actualizaciones.versionETF_Numero_Texto) + "," +
nameof(PRV_Actualizaciones.versionEFT_Numero_Numerica) + "," +
nameof(PRV_Actualizaciones.fechaEjecucion) +
" ) " +
" VALUES " +
" ( " +
"@versionETF_Numero_Texto," +
"@versionEFT_Numero_Numerica," +
"@fechaEjecucion" +
" ) ";
//Parametros
object[] arr_Parametros_Insert = new object[]
{
new SqlParameter("@versionETF_Numero_Texto", _mdl_PRV_Actualizaciones.versionETF_Numero_Texto),
new SqlParameter("@versionEFT_Numero_Numerica", _mdl_PRV_Actualizaciones.versionEFT_Numero_Numerica),
new SqlParameter("@fechaEjecucion", _mdl_PRV_Actualizaciones.fechaEjecucion),
};
#endregion
obj_Exferia_Entities.Database.ExecuteSqlCommand(str_SQL_Insert, arr_Parametros_Insert);
}
}
catch (Exception ex)
{
throw new Control_Errores(_mdl_PRV_Actualizaciones.versionETF_Numero_Texto, ex, nameof(PRV_Actualizaciones_Datos) + "/" + nameof(Insertar), true);
}
finally
{
obj_Exferia_Entities.Database.Connection.Close();
obj_Exferia_Entities.Dispose();
}
}
}
}

View File

@ -0,0 +1,126 @@
namespace Exferia_Actualizacion_BD._3_Vistas
{
partial class PE_Proceso_Actualizacion
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.progressBar_Descarga = new System.Windows.Forms.ProgressBar();
this.lbl_Fichero_Descargado = new System.Windows.Forms.Label();
this.pct_Logo_ProcesoDescarga = new System.Windows.Forms.PictureBox();
this.lbl_Total_Descargado = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pct_Logo_ProcesoDescarga)).BeginInit();
this.SuspendLayout();
//
// progressBar_Descarga
//
this.progressBar_Descarga.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.progressBar_Descarga.Location = new System.Drawing.Point(105, 45);
this.progressBar_Descarga.Name = "progressBar_Descarga";
this.progressBar_Descarga.Size = new System.Drawing.Size(486, 22);
this.progressBar_Descarga.Step = 1;
this.progressBar_Descarga.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.progressBar_Descarga.TabIndex = 0;
this.progressBar_Descarga.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ProcesoDescarga_MouseDown);
this.progressBar_Descarga.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ProcesoDescarga_MouseMove);
this.progressBar_Descarga.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ProcesoDescarga_MouseUp);
//
// lbl_Fichero_Descargado
//
this.lbl_Fichero_Descargado.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lbl_Fichero_Descargado.BackColor = System.Drawing.Color.Transparent;
this.lbl_Fichero_Descargado.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbl_Fichero_Descargado.ForeColor = System.Drawing.Color.Black;
this.lbl_Fichero_Descargado.Location = new System.Drawing.Point(102, 21);
this.lbl_Fichero_Descargado.Name = "lbl_Fichero_Descargado";
this.lbl_Fichero_Descargado.Size = new System.Drawing.Size(489, 23);
this.lbl_Fichero_Descargado.TabIndex = 1;
this.lbl_Fichero_Descargado.Tag = "";
this.lbl_Fichero_Descargado.Text = "Comprobando versión de base de datos ...";
this.lbl_Fichero_Descargado.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pct_Logo_ProcesoDescarga
//
this.pct_Logo_ProcesoDescarga.BackColor = System.Drawing.Color.Transparent;
this.pct_Logo_ProcesoDescarga.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.pct_Logo_ProcesoDescarga.Image = global::Exferia_Actualizacion_BD.Properties.Resources.Logo3D;
this.pct_Logo_ProcesoDescarga.Location = new System.Drawing.Point(8, 7);
this.pct_Logo_ProcesoDescarga.Name = "pct_Logo_ProcesoDescarga";
this.pct_Logo_ProcesoDescarga.Size = new System.Drawing.Size(86, 86);
this.pct_Logo_ProcesoDescarga.TabIndex = 2;
this.pct_Logo_ProcesoDescarga.TabStop = false;
this.pct_Logo_ProcesoDescarga.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ProcesoDescarga_MouseDown);
this.pct_Logo_ProcesoDescarga.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ProcesoDescarga_MouseMove);
this.pct_Logo_ProcesoDescarga.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ProcesoDescarga_MouseUp);
//
// lbl_Total_Descargado
//
this.lbl_Total_Descargado.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.lbl_Total_Descargado.BackColor = System.Drawing.Color.Transparent;
this.lbl_Total_Descargado.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbl_Total_Descargado.ForeColor = System.Drawing.Color.Black;
this.lbl_Total_Descargado.Location = new System.Drawing.Point(308, 70);
this.lbl_Total_Descargado.Name = "lbl_Total_Descargado";
this.lbl_Total_Descargado.Size = new System.Drawing.Size(281, 21);
this.lbl_Total_Descargado.TabIndex = 25;
this.lbl_Total_Descargado.Text = "0 de 0";
this.lbl_Total_Descargado.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// PE_Proceso_Actualizacion
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.ClientSize = new System.Drawing.Size(601, 97);
this.Controls.Add(this.lbl_Total_Descargado);
this.Controls.Add(this.progressBar_Descarga);
this.Controls.Add(this.lbl_Fichero_Descargado);
this.Controls.Add(this.pct_Logo_ProcesoDescarga);
this.DoubleBuffered = true;
this.Name = "PE_Proceso_Actualizacion";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "P_Proceso_Actualizacion";
this.Controls.SetChildIndex(this.pct_Logo_ProcesoDescarga, 0);
this.Controls.SetChildIndex(this.lbl_Fichero_Descargado, 0);
this.Controls.SetChildIndex(this.progressBar_Descarga, 0);
this.Controls.SetChildIndex(this.lbl_Total_Descargado, 0);
((System.ComponentModel.ISupportInitialize)(this.pct_Logo_ProcesoDescarga)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ProgressBar progressBar_Descarga;
private System.Windows.Forms.Label lbl_Fichero_Descargado;
private System.Windows.Forms.PictureBox pct_Logo_ProcesoDescarga;
private System.Windows.Forms.Label lbl_Total_Descargado;
}
}

View File

@ -0,0 +1,119 @@
using Exferia_Aplicacion.General;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Exferia_Actualizacion_BD._3_Vistas
{
public partial class PE_Proceso_Actualizacion : P_Personalizada
{
#region Propiedades Publicas
public int PE_Proceso_Actualizacion_Progreso
{
get
{
return progressBar_Descarga.Value;
}
set
{
try
{
if (g_int_Total>0)
{
progressBar_Descarga.Value = (value * 100) / g_int_Total;
}
else
{
progressBar_Descarga.Value = 0;
}
}
catch (Exception)
{ }
}
}
private int g_int_Total = 0;
public int PE_Proceso_Total
{
get
{
return g_int_Total;
}
set
{
g_int_Total = value;
}
}
public string PE_Proceso_Actualizacion_Titulo
{
get
{
return lbl_Fichero_Descargado.Text;
}
set
{
lbl_Fichero_Descargado.Text = value;
}
}
public int PE_Proceso_Actualizacion_InformacionProgreso
{
set
{
lbl_Total_Descargado.Text = value + " de " + g_int_Total;
}
}
#endregion
public PE_Proceso_Actualizacion()
{
InitializeComponent();
}
#region Mover pantalla con raton
private Boolean g_bol_Seleccionada;
private int g_int_X, g_int_Y;
private void ProcesoDescarga_MouseDown(object sender, MouseEventArgs e)
{
g_bol_Seleccionada = true;
g_int_X = e.X;
g_int_Y = e.Y;
}
private void ProcesoDescarga_MouseMove(object sender, MouseEventArgs e)
{
if (g_bol_Seleccionada)
{
this.SetDesktopLocation(Cursor.Position.X - g_int_X, Cursor.Position.Y - g_int_Y);
}
}
private void ProcesoDescarga_MouseUp(object sender, MouseEventArgs e)
{
g_bol_Seleccionada = false;
}
#endregion
public void Cambiar_Imagen(Image _img_Imagen)
{
try
{
pct_Logo_ProcesoDescarga.Image = Imagenes.G_IMG_MONTANDOBASEDATOS;
}
catch (Exception)
{}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,109 @@
namespace Exferia_Actualizacion_BD._3_Vistas
{
partial class P_Personalizada
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pnl_BordeDerecho = new System.Windows.Forms.Panel();
this.pnl_BordeIzquierdo = new System.Windows.Forms.Panel();
this.pnl_BordeInferior = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// pnl_BordeDerecho
//
this.pnl_BordeDerecho.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnl_BordeDerecho.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(149)))), ((int)(((byte)(208)))), ((int)(((byte)(227)))));
this.pnl_BordeDerecho.Location = new System.Drawing.Point(793, 2);
this.pnl_BordeDerecho.Name = "pnl_BordeDerecho";
this.pnl_BordeDerecho.Size = new System.Drawing.Size(2, 664);
this.pnl_BordeDerecho.TabIndex = 21;
//
// pnl_BordeIzquierdo
//
this.pnl_BordeIzquierdo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.pnl_BordeIzquierdo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(149)))), ((int)(((byte)(208)))), ((int)(((byte)(227)))));
this.pnl_BordeIzquierdo.Location = new System.Drawing.Point(1, 2);
this.pnl_BordeIzquierdo.Name = "pnl_BordeIzquierdo";
this.pnl_BordeIzquierdo.Size = new System.Drawing.Size(2, 664);
this.pnl_BordeIzquierdo.TabIndex = 22;
//
// pnl_BordeInferior
//
this.pnl_BordeInferior.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnl_BordeInferior.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(149)))), ((int)(((byte)(208)))), ((int)(((byte)(227)))));
this.pnl_BordeInferior.Location = new System.Drawing.Point(1, 666);
this.pnl_BordeInferior.Name = "pnl_BordeInferior";
this.pnl_BordeInferior.Size = new System.Drawing.Size(795, 2);
this.pnl_BordeInferior.TabIndex = 23;
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(149)))), ((int)(((byte)(208)))), ((int)(((byte)(227)))));
this.panel1.Location = new System.Drawing.Point(1, 2);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(794, 2);
this.panel1.TabIndex = 24;
//
// P_Personalizada
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(797, 670);
this.Controls.Add(this.panel1);
this.Controls.Add(this.pnl_BordeInferior);
this.Controls.Add(this.pnl_BordeIzquierdo);
this.Controls.Add(this.pnl_BordeDerecho);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "P_Personalizada";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "P_Personalizada";
this.TopMost = true;
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.P_Personalizada_MouseDown);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.P_Personalizada_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.P_Personalizada_MouseUp);
this.Resize += new System.EventHandler(this.P_Personalizada_Resize);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel pnl_BordeDerecho;
private System.Windows.Forms.Panel pnl_BordeIzquierdo;
private System.Windows.Forms.Panel pnl_BordeInferior;
private System.Windows.Forms.Panel panel1;
}
}

View File

@ -0,0 +1,149 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Exferia_Actualizacion_BD._3_Vistas
{
public partial class P_Personalizada : Form
{
#region Librerias Externas
[DllImport("dwmapi.dll")]
public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset);
[DllImport("dwmapi.dll")]
public static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);
[DllImport("dwmapi.dll")]
public static extern int DwmIsCompositionEnabled(ref int pfEnabled);
#endregion
private bool g_bol_Seleccionada;
private int g_int_X, g_int_Y;
public P_Personalizada()
{
InitializeComponent();
}
private void P_Personalizada_MouseDown(object sender, MouseEventArgs e)
{
g_bol_Seleccionada = true;
g_int_X = e.X;
g_int_Y = e.Y;
}
private void P_Personalizada_MouseMove(object sender, MouseEventArgs e)
{
if (g_bol_Seleccionada)
{
SetDesktopLocation(Cursor.Position.X - g_int_X, Cursor.Position.Y - g_int_Y);
}
}
private void P_Personalizada_Resize(object sender, EventArgs e)
{
pnl_BordeIzquierdo.Size = new Size(2, Height - 3);
pnl_BordeDerecho.Location = new Point(Width - 3, pnl_BordeDerecho.Location.Y);
pnl_BordeDerecho.Size = new Size(2, Height - 3);
pnl_BordeInferior.Location = new Point(pnl_BordeInferior.Location.X, Height - 3);
pnl_BordeInferior.Size = new Size(Width - 4, 2);
}
private void P_Personalizada_MouseUp(object sender, MouseEventArgs e)
{
g_bol_Seleccionada = false;
}
#region Crear Sombra de la pantalla
protected override void WndProc(ref Message m)
{
//Sombra de la pantalla ..................................................
if (m.Msg == WM_NCPAINT)// box shadow
{
if (g_bol_HabilitarSombra)
{
var v = 2;
DwmSetWindowAttribute(Handle, 2, ref v, 4);
MARGINS margins = new MARGINS()
{
bottomHeight = 1,
leftWidth = 1,
rightWidth = 1,
topHeight = 1
};
DwmExtendFrameIntoClientArea(Handle, ref margins);
}
}
base.WndProc(ref m);
}
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
private static extern IntPtr CreateRoundRectRgn
(
int nLeftRect, // x-coordinate of upper-left corner
int nTopRect, // y-coordinate of upper-left corner
int nRightRect, // x-coordinate of lower-right corner
int nBottomRect, // y-coordinate of lower-right corner
int nWidthEllipse, // height of ellipse
int nHeightEllipse // width of ellipse
);
private bool g_bol_HabilitarSombra; // variables for box shadow
private const int CS_DROPSHADOW = 0x00020000;
private const int WM_NCPAINT = 0x0085;
private const int WM_ACTIVATEAPP = 0x001C;
public struct MARGINS // struct for box shadow
{
public int leftWidth;
public int rightWidth;
public int topHeight;
public int bottomHeight;
}
private const int WM_NCHITTEST = 0x84; // variables for dragging the form
private const int HTCLIENT = 0x1;
private const int HTCAPTION = 0x2;
protected override CreateParams CreateParams
{
get
{
g_bol_HabilitarSombra = CheckAeroEnabled();
CreateParams cp = base.CreateParams;
if (!g_bol_HabilitarSombra)
cp.ClassStyle |= CS_DROPSHADOW;
return cp;
}
}
private bool CheckAeroEnabled()
{
if (Environment.OSVersion.Version.Major >= 6)
{
int enabled = 0;
DwmIsCompositionEnabled(ref enabled);
return (enabled == 1) ? true : false;
}
return false;
}
#endregion
}
}

View File

@ -0,0 +1,372 @@
using Exferia_Actualizacion_BD._1_Datos;
using Exferia_Actualizacion_BD._3_Vistas;
using Exferia_Actualizacion_BD.General;
using Exferia_Aplicacion.General;
using Exferia_Aplicacion.Modelos_Generales;
using Exferia_EntityFramework;
using Exferia_EntityFramework.Script_Actualizacion;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Transactions;
using System.Windows.Forms;
namespace Exferia_Actualizacion_BD
{
public class Datos_Actualizacion_BD
{
#region Variables privadas
private BackgroundWorker g_obj_TareaAsincrona_EjecutarScripts =null;
private int g_int_Terminado_Correctamente = 0;
private bool g_bol_Termino = false;
private PE_Proceso_Actualizacion g_frm_PE_Proceso_Actualizacion = new PE_Proceso_Actualizacion();
private string g_str_Ruta_Aplicacion = "";
private string g_str_Nombre_ExferiaEntityFramework = "";
#endregion
public int Comprobar_Actualizaciones_BD(string _str_Ruta_Aplicacion,string _str_Nombre_ExferiaEntityFramework)
{
g_int_Terminado_Correctamente = 0;
g_str_Ruta_Aplicacion = _str_Ruta_Aplicacion;
g_str_Nombre_ExferiaEntityFramework = _str_Nombre_ExferiaEntityFramework;
try
{
//Mostrar pantalla de progreso
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Actualizacion_Progreso = 0;
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Total = 0;
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Actualizacion_Titulo = "Comprobando conexión a base de datos ...";
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Actualizacion_InformacionProgreso = 0;
g_frm_PE_Proceso_Actualizacion.Visible = true;
if (g_obj_TareaAsincrona_EjecutarScripts != null)
{
while (g_obj_TareaAsincrona_EjecutarScripts.IsBusy)
Application.DoEvents();
}
else
{
g_obj_TareaAsincrona_EjecutarScripts = new BackgroundWorker();
g_obj_TareaAsincrona_EjecutarScripts.DoWork += new DoWorkEventHandler(TareaAsincrona_EjecutarScripts_DoWork);
g_obj_TareaAsincrona_EjecutarScripts.ProgressChanged += new ProgressChangedEventHandler(TareaAsincrona_EjecutarScripts_ProgressChanged);
g_obj_TareaAsincrona_EjecutarScripts.RunWorkerCompleted += new RunWorkerCompletedEventHandler(TareaAsincrona_EjecutarScripts_Completed);
g_obj_TareaAsincrona_EjecutarScripts.WorkerReportsProgress = true;
}
g_bol_Termino = false;
//Ejecutar TareaAsincrona
g_obj_TareaAsincrona_EjecutarScripts.RunWorkerAsync();
//Te quedas esperando a que termine la tarea asincrona de Ejecutar Script
if (g_obj_TareaAsincrona_EjecutarScripts != null)
{
while (g_bol_Termino == false)
{
Application.DoEvents();
Thread.Sleep(10);
}
}
}
catch (Control_Errores )
{
g_bol_Termino = false;
g_frm_PE_Proceso_Actualizacion.Visible = false;
Mensajes.MostrarMensaje(Mensajes.G_STR_ERROR_ACTUALIZACION_BASEDATOS);
g_int_Terminado_Correctamente = -1;
}
catch (Exception ex)
{
g_bol_Termino = false;
g_frm_PE_Proceso_Actualizacion.Visible = false;
Mensajes.MostrarMensaje(Mensajes.G_STR_ERROR_ACTUALIZACION_BASEDATOS);
Control_Errores.Errores_Log("", ex, nameof(Datos_Actualizacion_BD) + "/" + nameof(Comprobar_Actualizaciones_BD));
g_int_Terminado_Correctamente = -1;
}
return g_int_Terminado_Correctamente;
}
private void TareaAsincrona_EjecutarScripts_DoWork(object sender, DoWorkEventArgs e)
{
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo = new INTERNO_ValorDevuelto_Modelo();
mdl_ValorDevuelto_Modelo.TodoCorrecto = true;
mdl_ValorDevuelto_Modelo.Mensaje = "";
try
{
PRV_Actualizaciones_Datos obj_PRV_Actualizaciones_Datos = new PRV_Actualizaciones_Datos();
//Version del Exferia_EntityFramework instalada en la aplicacion
FileVersionInfo obj_FileVersion_Exferia_EntityFramework = FileVersionInfo.GetVersionInfo(g_str_Ruta_Aplicacion + @"\" + g_str_Nombre_ExferiaEntityFramework);
Version obj_Version_Exferia_EntityFramework = Version.Parse(obj_FileVersion_Exferia_EntityFramework.ProductVersion);
//Parsenado la base de datos (es solo la primera conuslta a base de datos)
((BackgroundWorker)sender).ReportProgress(0, "2");
//Buscar el Base de datos la ultima version actualizada
PRV_Actualizaciones mdl_PRV_Actualizaciones = obj_PRV_Actualizaciones_Datos.Obtener_UltimaActualizacion();
//Buscar fichero de script de actualizaciones ejecutados
List<INTERNO_Versiones_Modelo> lst_Versiones_Ejecutadas = new List<INTERNO_Versiones_Modelo>();
StreamReader obj_StreamReader_FICHERO = null;
try
{
if (File.Exists(g_str_Ruta_Aplicacion + @"\" + Variables.G_STR_NOMBREFICHERO_ACTUALIZACIONESREALIZADAS))
{
//Recorrer todas las lineas , para ver que script se han ejecutado
int int_Contador = 0;
string str_Linea;
obj_StreamReader_FICHERO = new StreamReader(g_str_Ruta_Aplicacion + @"\" + Variables.G_STR_NOMBREFICHERO_ACTUALIZACIONESREALIZADAS);
while ((str_Linea = obj_StreamReader_FICHERO.ReadLine()) != null)
{
if (str_Linea.Trim().Length > 0)
{
string[] arr_Datos = str_Linea.Split('|');
lst_Versiones_Ejecutadas.Add(new INTERNO_Versiones_Modelo("", new Version(arr_Datos[0]), DateTime.ParseExact(arr_Datos[1], "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture)));
}
//Aumentaro Contador
int_Contador++;
}
//Cerrar Fichero
obj_StreamReader_FICHERO.Close();
obj_StreamReader_FICHERO.Dispose();
}
}
catch (Exception ex)
{
if (obj_StreamReader_FICHERO == null)
{
obj_StreamReader_FICHERO.Close();
}
Control_Errores.Errores_Log("", ex, nameof(Datos_Actualizacion_BD) + "/" + nameof(Comprobar_Actualizaciones_BD));
g_int_Terminado_Correctamente = -1;
}
//Si no dio ningun Error Comprobamos si hay que ejecutar scripts
if (g_int_Terminado_Correctamente == 0)
{
bool bol_Ejecutar_Script = false;
//Si no tiene fichero de actualizciones generadas se ejecuta
if (lst_Versiones_Ejecutadas.Count == 0)
{
bol_Ejecutar_Script = true;
}
//Si la Version grabada en BD esta a nula, se genera
else if (mdl_PRV_Actualizaciones == null)
{
bol_Ejecutar_Script = true;
}
//Si la ultima version que tengo ejecutada de scrip, no es la ultima version disponible se Ejecuta
else if (lst_Versiones_Ejecutadas.OrderByDescending(m => m.version).FirstOrDefault().version < new Version(mdl_PRV_Actualizaciones.versionETF_Numero_Texto))
{
bol_Ejecutar_Script = true;
}
//Si la Version que hay es menor que la que esta en Base de datos, aviso de Problema de compatibilidad
else if (obj_Version_Exferia_EntityFramework < new Version(mdl_PRV_Actualizaciones.versionETF_Numero_Texto))
{
g_int_Terminado_Correctamente = 1;
}
//Si la Version que hay es mayor que la que esta en Base de datos,se ejecuta
else if (obj_Version_Exferia_EntityFramework > new Version(mdl_PRV_Actualizaciones.versionETF_Numero_Texto))
{
bol_Ejecutar_Script = true;
}
//Se ejecuta para que genere los scripts
if (bol_Ejecutar_Script)
{
//Leer todos los Scripts de Actualizaciones Superiores a la ultima version que se ejecuto
long lng_VersionUltimo_Script_Ejecutado = 0;
if (lst_Versiones_Ejecutadas.Count > 0)
{
lng_VersionUltimo_Script_Ejecutado = long.Parse(lst_Versiones_Ejecutadas.OrderByDescending(m => m.version).FirstOrDefault().version.ToString().Replace(".", ""));
}
Versiones_EF obj_Versiones_EF = new Versiones_EF();
if (obj_Versiones_EF.G_LST_VERSIONES_EF!=null && obj_Versiones_EF.G_LST_VERSIONES_EF.Count>0)
{
List< INTERNO_Versiones_EF_Modelo > lst_INTERNO_Versiones_EF_Modelo = obj_Versiones_EF.G_LST_VERSIONES_EF.OrderBy(m => m.Version_Numerica).Where(x => x.Version_Numerica > lng_VersionUltimo_Script_Ejecutado).ToList();
if (lst_INTERNO_Versiones_EF_Modelo!=null && lst_INTERNO_Versiones_EF_Modelo.Count > 0)
{
//Actualizar Pantalla de Progreso
((BackgroundWorker)sender).ReportProgress(lst_INTERNO_Versiones_EF_Modelo.Count,"0");
try
{
PRV_Actualizaciones mdl_PRV_Actualizaciones_GRABAR = null;
DateTime dtt_FechaHora_Actual = DateTime.Now;
int int_Contador = 0;
foreach (INTERNO_Versiones_EF_Modelo mdl_INTERNO_Versiones_EF_Modelo in lst_INTERNO_Versiones_EF_Modelo.OrderBy(m=>m.Version_Numerica))
{
//Ejecutar los Script Procedimientpo
if (mdl_INTERNO_Versiones_EF_Modelo.Tipo==1)
{
obj_PRV_Actualizaciones_Datos.Ejecutar_Script_Procedimientos(mdl_INTERNO_Versiones_EF_Modelo.Script);
}
//Ejecutar los Script
else
{
obj_PRV_Actualizaciones_Datos.Ejecutar_Script(mdl_INTERNO_Versiones_EF_Modelo.Script);
}
//Grabar registro en BD
mdl_PRV_Actualizaciones_GRABAR = new PRV_Actualizaciones();
mdl_PRV_Actualizaciones_GRABAR.versionEFT_Numero_Numerica = mdl_INTERNO_Versiones_EF_Modelo.Version_Numerica;
mdl_PRV_Actualizaciones_GRABAR.versionETF_Numero_Texto = mdl_INTERNO_Versiones_EF_Modelo.Version.ToString();
mdl_PRV_Actualizaciones_GRABAR.fechaEjecucion = dtt_FechaHora_Actual;
obj_PRV_Actualizaciones_Datos.Insertar(mdl_PRV_Actualizaciones_GRABAR);
//Actualizar Pantalla de Progreso
int_Contador += 1;
((BackgroundWorker)sender).ReportProgress(int_Contador,"1");
}
string str_TextoFichero = "";
//Grabar en el fichero todos los scripts ejecutados
foreach (INTERNO_Versiones_EF_Modelo mdl_INTERNO_Versiones_EF_Modelo in lst_INTERNO_Versiones_EF_Modelo)
{
str_TextoFichero += mdl_INTERNO_Versiones_EF_Modelo.Version.ToString() + "|" + dtt_FechaHora_Actual.ToString("dd/MM/yyyy HH:mm") + System.Environment.NewLine;
}
File.AppendAllText(g_str_Ruta_Aplicacion + @"\" + Variables.G_STR_NOMBREFICHERO_ACTUALIZACIONESREALIZADAS, str_TextoFichero);
}
catch (Control_Errores)
{
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_ERROR_ACTUALIZACION_BASEDATOS;
}
catch (Exception ex)
{
Control_Errores.Errores_Log("", ex, nameof(Datos_Actualizacion_BD) + "/" + nameof(TareaAsincrona_EjecutarScripts_DoWork));
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_ERROR_ACTUALIZACION_BASEDATOS;
}
}
}
}
}
}
catch (ThreadAbortException ex)
{
Thread.ResetAbort();
Control_Errores.Errores_Log(ex.Message, ex, nameof(Datos_Actualizacion_BD) + "/" + nameof(TareaAsincrona_EjecutarScripts_DoWork));
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_ERROR_ACTUALIZACION_BASEDATOS;
}
catch (Control_Errores)
{
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_ERROR_ACTUALIZACION_BASEDATOS;
}
catch (Exception ex)
{
Control_Errores.Errores_Log(ex.Message, ex, nameof(Datos_Actualizacion_BD) + "/" + nameof(TareaAsincrona_EjecutarScripts_DoWork));
mdl_ValorDevuelto_Modelo.TodoCorrecto = false;
mdl_ValorDevuelto_Modelo.Mensaje = Mensajes.G_STR_ERROR_ACTUALIZACION_BASEDATOS;
}
finally
{
e.Result = mdl_ValorDevuelto_Modelo;
}
}
private void TareaAsincrona_EjecutarScripts_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
try
{
if (e.UserState.ToString().Equals("0"))
{
//Vaciar progress .................................................................................................................
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Actualizacion_Progreso = 0;
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Total = e.ProgressPercentage;
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Actualizacion_Titulo = "Actualizando la base de datos, por favor espere ...";
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Actualizacion_InformacionProgreso = 0;
g_frm_PE_Proceso_Actualizacion.Cambiar_Imagen(Imagenes.G_IMG_ESPERA);
//.................................................................................................................................
}
else if (e.UserState.ToString().Equals("1"))
{
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Actualizacion_Progreso = e.ProgressPercentage;
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Actualizacion_InformacionProgreso = e.ProgressPercentage;
}
else if (e.UserState.ToString().Equals("2"))
{
//Vaciar progress .................................................................................................................
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Actualizacion_Progreso = 0;
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Total = e.ProgressPercentage;
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Actualizacion_Titulo = "Montando la base de datos, esto puede tardar unos segundos, por favor espere ...";
g_frm_PE_Proceso_Actualizacion.PE_Proceso_Actualizacion_InformacionProgreso = 0;
g_frm_PE_Proceso_Actualizacion.Cambiar_Imagen(Imagenes.G_IMG_MONTANDOBASEDATOS);
//.................................................................................................................................
}
}
catch (Exception)
{}
}
private void TareaAsincrona_EjecutarScripts_Completed(object sender, RunWorkerCompletedEventArgs e)
{
g_frm_PE_Proceso_Actualizacion.Visible = false;
g_bol_Termino = true;
try
{
INTERNO_ValorDevuelto_Modelo mdl_ValorDevuelto_Modelo_Resultado = (INTERNO_ValorDevuelto_Modelo)e.Result;
//Mostrar si tuviera algun mensaje
if (mdl_ValorDevuelto_Modelo_Resultado.TodoCorrecto == false)
{
g_int_Terminado_Correctamente = -1;
if (mdl_ValorDevuelto_Modelo_Resultado.Mensaje.Trim().Length > 0)
{
Mensajes.MostrarMensaje(mdl_ValorDevuelto_Modelo_Resultado.Mensaje);
}
}
else
{
if (g_int_Terminado_Correctamente == 1)
{
Mensajes.MostrarMensaje(Mensajes.G_STR_VALIDACION_ACTUALIZACION_BASEDATOS_VERSIONLOCAL_INFERIOR);
}
}
}
catch (Exception)
{ }
}
}
}

View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C3F04196-1B59-4A52-9F76-F658A5B2A7C2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Exferia_Actualizacion_BD</RootNamespace>
<AssemblyName>Exferia_Actualizacion_BD</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ClosedXML">
<HintPath>..\..\DLL\ClosedXML.dll</HintPath>
</Reference>
<Reference Include="EntityFramework">
<HintPath>..\..\DLL\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Exferia_Aplicacion">
<HintPath>..\..\DLL\Exferia_Aplicacion.dll</HintPath>
</Reference>
<Reference Include="Exferia_Controles">
<HintPath>..\..\DLL\Exferia_Controles.dll</HintPath>
</Reference>
<Reference Include="Exferia_EntityFramework">
<HintPath>..\..\DLL\Exferia_EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Exferia_General">
<HintPath>..\..\DLL\Exferia_General.dll</HintPath>
</Reference>
<Reference Include="MonthCalendarControl">
<HintPath>..\..\DLL\MonthCalendarControl.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="1_Datos\PRV_Actualizaciones_Datos.cs" />
<Compile Include="3_Vistas\PE_Proceso_Actualizacion.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="3_Vistas\PE_Proceso_Actualizacion.Designer.cs">
<DependentUpon>PE_Proceso_Actualizacion.cs</DependentUpon>
</Compile>
<Compile Include="3_Vistas\P_Personalizada.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="3_Vistas\P_Personalizada.Designer.cs">
<DependentUpon>P_Personalizada.cs</DependentUpon>
</Compile>
<Compile Include="Datos_Actualizacion_BD.cs" />
<Compile Include="General\Funciones_Actualizacion_BD.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="0_Modelos\" />
<Folder Include="3_Vistas\Controladoras\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="3_Vistas\PE_Proceso_Actualizacion.resx">
<DependentUpon>PE_Proceso_Actualizacion.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Resources\Logo3D.gif" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exferia_Actualizacion_BD", "Exferia_Actualizacion_BD.csproj", "{C3F04196-1B59-4A52-9F76-F658A5B2A7C2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C3F04196-1B59-4A52-9F76-F658A5B2A7C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C3F04196-1B59-4A52-9F76-F658A5B2A7C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3F04196-1B59-4A52-9F76-F658A5B2A7C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3F04196-1B59-4A52-9F76-F658A5B2A7C2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Exferia_Actualizacion_BD.General
{
public class Funciones_Actualizacion_BD
{
public static string FormatBytes(long _lng_bytes, int _int_decimalPlaces, bool _bol_showByteType)
{
double dbl_newBytes = _lng_bytes;
string str_formatString = "{0";
string str_byteType = "B";
// Check if best size in KB
if (dbl_newBytes > 1024 && dbl_newBytes < 1048576)
{
dbl_newBytes /= 1024;
str_byteType = "KB";
}
else if (dbl_newBytes > 1048576 && dbl_newBytes < 1073741824)
{
// Check if best size in MB
dbl_newBytes /= 1048576;
str_byteType = "MB";
}
else
{
// Best size in GB
dbl_newBytes /= 1073741824;
str_byteType = "GB";
}
// Show decimals
if (_int_decimalPlaces > 0)
str_formatString += ":0.";
// Add decimals
for (int i = 0; i < _int_decimalPlaces; i++)
str_formatString += "0";
// Close placeholder
str_formatString += "}";
// Add byte type
if (_bol_showByteType)
str_formatString += str_byteType;
return string.Format(str_formatString, dbl_newBytes);
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// La información general de un ensamblado se controla mediante el siguiente
// conjunto de atributos. Cambie estos valores de atributo para modificar la información
// asociada con un ensamblado.
[assembly: AssemblyTitle("Exferia_Actualizacion_BD")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Exferia_Actualizacion_BD")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles
// para los componentes COM. Si necesita obtener acceso a un tipo de este ensamblado desde
// COM, establezca el atributo ComVisible en true en este tipo.
[assembly: ComVisible(false)]
// El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM.
[assembly: Guid("c3f04196-1b59-4a52-9f76-f658a5b2a7c2")]
// La información de versión de un ensamblado consta de los cuatro valores siguientes:
//
// Versión principal
// Versión secundaria
// Número de compilación
// Revisión
//
// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
// mediante el carácter '*', como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]

View File

@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Este código fue generado por una herramienta.
// Versión de runtime:4.0.30319.42000
//
// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
// se vuelve a generar el código.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Exferia_Actualizacion_BD.Properties {
using System;
/// <summary>
/// Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc.
/// </summary>
// StronglyTypedResourceBuilder generó automáticamente esta clase
// a través de una herramienta como ResGen o Visual Studio.
// Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen
// con la opción /str o recompile su proyecto de VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Devuelve la instancia de ResourceManager almacenada en caché utilizada por esta clase.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Exferia_Actualizacion_BD.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Reemplaza la propiedad CurrentUICulture del subproceso actual para todas las
/// búsquedas de recursos mediante esta clase de recurso fuertemente tipado.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Busca un recurso adaptado de tipo System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Logo3D {
get {
object obj = ResourceManager.GetObject("Logo3D", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Logo3D" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Logo3D.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB