diff --git a/Final_OOP.sln b/Final_OOP.sln index b8f8f5f..2dda42c 100644 --- a/Final_OOP.sln +++ b/Final_OOP.sln @@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 VisualStudioVersion = 17.6.33829.357 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Controladora", "Controladora\Controladora.csproj", "{7168B549-F229-4D49-8C53-AF1CEB9BBB6B}" + ProjectSection(ProjectDependencies) = postProject + {6C83A4AB-C70D-4D4E-A879-5E960C4A103A} = {6C83A4AB-C70D-4D4E-A879-5E960C4A103A} + EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Entidades", "Entidades\Entidades.csproj", "{78A331E5-86D4-427E-AA45-5879F9E5E98B}" EndProject @@ -11,9 +14,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Modelo", "Modelo\Modelo.csp EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vista", "Vista\Vista.csproj", "{8C9E8090-5D8F-42AE-9813-C68D384C6863}" ProjectSection(ProjectDependencies) = postProject + {6C83A4AB-C70D-4D4E-A879-5E960C4A103A} = {6C83A4AB-C70D-4D4E-A879-5E960C4A103A} {7168B549-F229-4D49-8C53-AF1CEB9BBB6B} = {7168B549-F229-4D49-8C53-AF1CEB9BBB6B} EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Informes", "Informes\Informes.csproj", "{6C83A4AB-C70D-4D4E-A879-5E960C4A103A}" + ProjectSection(ProjectDependencies) = postProject + {78A331E5-86D4-427E-AA45-5879F9E5E98B} = {78A331E5-86D4-427E-AA45-5879F9E5E98B} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -36,6 +45,10 @@ Global {8C9E8090-5D8F-42AE-9813-C68D384C6863}.Debug|Any CPU.Build.0 = Debug|Any CPU {8C9E8090-5D8F-42AE-9813-C68D384C6863}.Release|Any CPU.ActiveCfg = Release|Any CPU {8C9E8090-5D8F-42AE-9813-C68D384C6863}.Release|Any CPU.Build.0 = Release|Any CPU + {6C83A4AB-C70D-4D4E-A879-5E960C4A103A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6C83A4AB-C70D-4D4E-A879-5E960C4A103A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6C83A4AB-C70D-4D4E-A879-5E960C4A103A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6C83A4AB-C70D-4D4E-A879-5E960C4A103A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Informes/ConfigEmail.cs b/Informes/ConfigEmail.cs new file mode 100644 index 0000000..0b6e860 --- /dev/null +++ b/Informes/ConfigEmail.cs @@ -0,0 +1,10 @@ +namespace Informes +{ + public class ConfigEmail + { + public string EmailAddr { get; set; } + public string EmailPass { get; set; } + public List EmailTarget { get; set; } + + } +} \ No newline at end of file diff --git a/Informes/InformeEmail.cs b/Informes/InformeEmail.cs new file mode 100644 index 0000000..de6952d --- /dev/null +++ b/Informes/InformeEmail.cs @@ -0,0 +1,133 @@ +using System.Diagnostics; +using System.Net.Mail; +using System.Net; +using System.Text.Json; + +using Entidades; +namespace Informes +{ + public class InformeEmail + { + /// + /// Envia Informes por Email + /// + + private static InformeEmail instance = new(); + public static InformeEmail Instance + { + get { return instance; } + } + + public string EnviarEmailFactura(string titulo, List desc) + { + string? ret = null; + string json; + ConfigEmail config; + try + { // leemos el archivo de configuracion para obtener los certificados y mails destino de los informes + json = File.ReadAllText("settings.json"); + config = JsonSerializer.Deserialize(json); + + } + catch (IOException) + { + ret = "No se pudo leer el archivo \"settings.json\""; + throw; + } + + foreach (var i in config.EmailTarget) + { + if (String.IsNullOrWhiteSpace(i)) return "Hay Emails mal cargados"; + + } + + SmtpClient smtp = new SmtpClient(); + smtp.Host = "smtp.gmail.com"; + smtp.Port = 587; + smtp.Credentials = new NetworkCredential(config.EmailAddr, config.EmailPass); + smtp.DeliveryMethod = SmtpDeliveryMethod.Network; + smtp.EnableSsl = true; + + MailMessage mail = new MailMessage(); + mail.Subject = titulo; + mail.IsBodyHtml = true; + mail.Body = GenerarTabla(desc); + mail.Sender = new MailAddress(config.EmailAddr); + foreach (var i in config.EmailTarget) mail.To.Add(i); + mail.From = new MailAddress(config.EmailAddr); + + try + { + #if DEBUG + Console.WriteLine($"From: {config.EmailAddr}, Title: {titulo}"); + #endif + smtp.Send(mail); + mail.Dispose(); + } + catch (Exception) + { + ret = "No se pudo comunicar con el server SMTP"; + throw; + } + + //Decimos que se envio el email correctamente si el valor del retorno sigue siendo nulo en otro caso tendra la descripcion del error. + return (ret == null) ? + "Se envio el Email Correctamente": + ret; + // + } + + private string GenerarTabla(List desc) + { + // Esta seccion es el armado del mail html + string body = + @" + + + + "; + + foreach (var i in desc) + { + body += + @$" + + + + + + "; + } + + body += + @$" + + + + + + +
Producto + Cantidad + Precio CU + Subtotal +
{i.Producto.Nombre}{i.Cantidad}{i.Producto.Precio}{i.Producto.Precio * i.Cantidad}
Total{CalcularTotal(desc)}
+ "; + return body; + } + private double CalcularTotal(List desc) + { + double total = 0; + foreach (var i in desc) + { + total += i.Producto.Precio * i.Cantidad; + } + return total; + } + + } +} diff --git a/Informes/Informes.csproj b/Informes/Informes.csproj new file mode 100644 index 0000000..495dfff --- /dev/null +++ b/Informes/Informes.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/Informes/bin/Debug/net6.0/Entidades.dll b/Informes/bin/Debug/net6.0/Entidades.dll new file mode 100644 index 0000000..b6098d3 Binary files /dev/null and b/Informes/bin/Debug/net6.0/Entidades.dll differ diff --git a/Informes/bin/Debug/net6.0/Entidades.pdb b/Informes/bin/Debug/net6.0/Entidades.pdb new file mode 100644 index 0000000..4056183 Binary files /dev/null and b/Informes/bin/Debug/net6.0/Entidades.pdb differ diff --git a/Informes/bin/Debug/net6.0/Informes.deps.json b/Informes/bin/Debug/net6.0/Informes.deps.json new file mode 100644 index 0000000..0f33dc6 --- /dev/null +++ b/Informes/bin/Debug/net6.0/Informes.deps.json @@ -0,0 +1,36 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v6.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v6.0": { + "Informes/1.0.0": { + "dependencies": { + "Entidades": "1.0.0" + }, + "runtime": { + "Informes.dll": {} + } + }, + "Entidades/1.0.0": { + "runtime": { + "Entidades.dll": {} + } + } + } + }, + "libraries": { + "Informes/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Entidades/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/Informes/bin/Debug/net6.0/Informes.dll b/Informes/bin/Debug/net6.0/Informes.dll new file mode 100644 index 0000000..0c591ec Binary files /dev/null and b/Informes/bin/Debug/net6.0/Informes.dll differ diff --git a/Informes/bin/Debug/net6.0/Informes.pdb b/Informes/bin/Debug/net6.0/Informes.pdb new file mode 100644 index 0000000..ecc9609 Binary files /dev/null and b/Informes/bin/Debug/net6.0/Informes.pdb differ diff --git a/Informes/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs b/Informes/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs new file mode 100644 index 0000000..ed92695 --- /dev/null +++ b/Informes/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] diff --git a/Informes/obj/Debug/net6.0/Informes.AssemblyInfo.cs b/Informes/obj/Debug/net6.0/Informes.AssemblyInfo.cs new file mode 100644 index 0000000..9adc184 --- /dev/null +++ b/Informes/obj/Debug/net6.0/Informes.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("Informes")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("Informes")] +[assembly: System.Reflection.AssemblyTitleAttribute("Informes")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/Informes/obj/Debug/net6.0/Informes.AssemblyInfoInputs.cache b/Informes/obj/Debug/net6.0/Informes.AssemblyInfoInputs.cache new file mode 100644 index 0000000..f8aafb3 --- /dev/null +++ b/Informes/obj/Debug/net6.0/Informes.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +55f9793ce92bee586e65f5b38a3a7676261de34c diff --git a/Informes/obj/Debug/net6.0/Informes.GeneratedMSBuildEditorConfig.editorconfig b/Informes/obj/Debug/net6.0/Informes.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..7e852a8 --- /dev/null +++ b/Informes/obj/Debug/net6.0/Informes.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,11 @@ +is_global = true +build_property.TargetFramework = net6.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = Informes +build_property.ProjectDir = C:\Users\fedpo\Downloads\final actual\final actual\Informes\ diff --git a/Informes/obj/Debug/net6.0/Informes.GlobalUsings.g.cs b/Informes/obj/Debug/net6.0/Informes.GlobalUsings.g.cs new file mode 100644 index 0000000..8578f3d --- /dev/null +++ b/Informes/obj/Debug/net6.0/Informes.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/Informes/obj/Debug/net6.0/Informes.assets.cache b/Informes/obj/Debug/net6.0/Informes.assets.cache new file mode 100644 index 0000000..0509b86 Binary files /dev/null and b/Informes/obj/Debug/net6.0/Informes.assets.cache differ diff --git a/Informes/obj/Debug/net6.0/Informes.csproj.AssemblyReference.cache b/Informes/obj/Debug/net6.0/Informes.csproj.AssemblyReference.cache new file mode 100644 index 0000000..8d68f48 Binary files /dev/null and b/Informes/obj/Debug/net6.0/Informes.csproj.AssemblyReference.cache differ diff --git a/Informes/obj/Debug/net6.0/Informes.csproj.BuildWithSkipAnalyzers b/Informes/obj/Debug/net6.0/Informes.csproj.BuildWithSkipAnalyzers new file mode 100644 index 0000000..e69de29 diff --git a/Informes/obj/Debug/net6.0/Informes.csproj.CopyComplete b/Informes/obj/Debug/net6.0/Informes.csproj.CopyComplete new file mode 100644 index 0000000..e69de29 diff --git a/Informes/obj/Debug/net6.0/Informes.csproj.CoreCompileInputs.cache b/Informes/obj/Debug/net6.0/Informes.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..cedc465 --- /dev/null +++ b/Informes/obj/Debug/net6.0/Informes.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +59ca0345c28b4ca3e61ae3f6ff36103ebf42ff8f diff --git a/Informes/obj/Debug/net6.0/Informes.csproj.FileListAbsolute.txt b/Informes/obj/Debug/net6.0/Informes.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..cc2d8fc --- /dev/null +++ b/Informes/obj/Debug/net6.0/Informes.csproj.FileListAbsolute.txt @@ -0,0 +1,15 @@ +C:\Users\fedpo\Downloads\final actual\final actual\Informes\bin\Debug\net6.0\Informes.deps.json +C:\Users\fedpo\Downloads\final actual\final actual\Informes\bin\Debug\net6.0\Informes.dll +C:\Users\fedpo\Downloads\final actual\final actual\Informes\bin\Debug\net6.0\Informes.pdb +C:\Users\fedpo\Downloads\final actual\final actual\Informes\bin\Debug\net6.0\Entidades.dll +C:\Users\fedpo\Downloads\final actual\final actual\Informes\bin\Debug\net6.0\Entidades.pdb +C:\Users\fedpo\Downloads\final actual\final actual\Informes\obj\Debug\net6.0\Informes.csproj.AssemblyReference.cache +C:\Users\fedpo\Downloads\final actual\final actual\Informes\obj\Debug\net6.0\Informes.GeneratedMSBuildEditorConfig.editorconfig +C:\Users\fedpo\Downloads\final actual\final actual\Informes\obj\Debug\net6.0\Informes.AssemblyInfoInputs.cache +C:\Users\fedpo\Downloads\final actual\final actual\Informes\obj\Debug\net6.0\Informes.AssemblyInfo.cs +C:\Users\fedpo\Downloads\final actual\final actual\Informes\obj\Debug\net6.0\Informes.csproj.CoreCompileInputs.cache +C:\Users\fedpo\Downloads\final actual\final actual\Informes\obj\Debug\net6.0\Informes.csproj.CopyComplete +C:\Users\fedpo\Downloads\final actual\final actual\Informes\obj\Debug\net6.0\Informes.dll +C:\Users\fedpo\Downloads\final actual\final actual\Informes\obj\Debug\net6.0\refint\Informes.dll +C:\Users\fedpo\Downloads\final actual\final actual\Informes\obj\Debug\net6.0\Informes.pdb +C:\Users\fedpo\Downloads\final actual\final actual\Informes\obj\Debug\net6.0\ref\Informes.dll diff --git a/Informes/obj/Debug/net6.0/Informes.dll b/Informes/obj/Debug/net6.0/Informes.dll new file mode 100644 index 0000000..0c591ec Binary files /dev/null and b/Informes/obj/Debug/net6.0/Informes.dll differ diff --git a/Informes/obj/Debug/net6.0/Informes.pdb b/Informes/obj/Debug/net6.0/Informes.pdb new file mode 100644 index 0000000..ecc9609 Binary files /dev/null and b/Informes/obj/Debug/net6.0/Informes.pdb differ diff --git a/Informes/obj/Debug/net6.0/ref/Informes.dll b/Informes/obj/Debug/net6.0/ref/Informes.dll new file mode 100644 index 0000000..c627a33 Binary files /dev/null and b/Informes/obj/Debug/net6.0/ref/Informes.dll differ diff --git a/Informes/obj/Debug/net6.0/refint/Informes.dll b/Informes/obj/Debug/net6.0/refint/Informes.dll new file mode 100644 index 0000000..c627a33 Binary files /dev/null and b/Informes/obj/Debug/net6.0/refint/Informes.dll differ diff --git a/Vista/FrmInforme.Designer.cs b/Vista/FrmInforme.Designer.cs index 4fb8912..89a9a77 100644 --- a/Vista/FrmInforme.Designer.cs +++ b/Vista/FrmInforme.Designer.cs @@ -28,19 +28,145 @@ /// private void InitializeComponent() { + label1 = new Label(); + label2 = new Label(); + label3 = new Label(); + dgvEmailTarget = new DataGridView(); + txtEmailAddr = new TextBox(); + txtEmailPass = new TextBox(); + txtEmailTargetAdd = new TextBox(); + btnAñadir = new Button(); + btnGuardar = new Button(); + btnEliminar = new Button(); + ((System.ComponentModel.ISupportInitialize)dgvEmailTarget).BeginInit(); SuspendLayout(); // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(12, 22); + label1.Name = "label1"; + label1.Size = new Size(65, 15); + label1.TabIndex = 0; + label1.Text = "Email Addr"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(12, 48); + label2.Name = "label2"; + label2.Size = new Size(62, 15); + label2.TabIndex = 1; + label2.Text = "Email Pass"; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(12, 76); + label3.Name = "label3"; + label3.Size = new Size(71, 15); + label3.TabIndex = 2; + label3.Text = "Email Target"; + // + // dgvEmailTarget + // + dgvEmailTarget.AllowUserToAddRows = false; + dgvEmailTarget.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dgvEmailTarget.EditMode = DataGridViewEditMode.EditProgrammatically; + dgvEmailTarget.EnableHeadersVisualStyles = false; + dgvEmailTarget.Location = new Point(89, 76); + dgvEmailTarget.Name = "dgvEmailTarget"; + dgvEmailTarget.RowTemplate.Height = 25; + dgvEmailTarget.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dgvEmailTarget.Size = new Size(240, 150); + dgvEmailTarget.TabIndex = 3; + // + // txtEmailAddr + // + txtEmailAddr.Location = new Point(89, 18); + txtEmailAddr.Name = "txtEmailAddr"; + txtEmailAddr.Size = new Size(202, 23); + txtEmailAddr.TabIndex = 4; + // + // txtEmailPass + // + txtEmailPass.Location = new Point(89, 47); + txtEmailPass.Name = "txtEmailPass"; + txtEmailPass.PasswordChar = '*'; + txtEmailPass.Size = new Size(202, 23); + txtEmailPass.TabIndex = 5; + // + // txtEmailTargetAdd + // + txtEmailTargetAdd.Location = new Point(335, 76); + txtEmailTargetAdd.Name = "txtEmailTargetAdd"; + txtEmailTargetAdd.Size = new Size(197, 23); + txtEmailTargetAdd.TabIndex = 6; + // + // btnAñadir + // + btnAñadir.Location = new Point(335, 105); + btnAñadir.Name = "btnAñadir"; + btnAñadir.Size = new Size(75, 23); + btnAñadir.TabIndex = 7; + btnAñadir.Text = "Añadir"; + btnAñadir.UseVisualStyleBackColor = true; + btnAñadir.Click += btnAñadir_Click; + // + // btnGuardar + // + btnGuardar.Location = new Point(89, 232); + btnGuardar.Name = "btnGuardar"; + btnGuardar.Size = new Size(75, 23); + btnGuardar.TabIndex = 8; + btnGuardar.Text = "Guardar"; + btnGuardar.UseVisualStyleBackColor = true; + btnGuardar.Click += btnGuardar_Click; + // + // btnEliminar + // + btnEliminar.Location = new Point(335, 134); + btnEliminar.Name = "btnEliminar"; + btnEliminar.Size = new Size(75, 23); + btnEliminar.TabIndex = 9; + btnEliminar.Text = "Eliminar"; + btnEliminar.UseVisualStyleBackColor = true; + btnEliminar.Click += btnEliminar_Click; + // // FrmInforme // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(800, 450); + Controls.Add(btnEliminar); + Controls.Add(btnGuardar); + Controls.Add(btnAñadir); + Controls.Add(txtEmailTargetAdd); + Controls.Add(txtEmailPass); + Controls.Add(txtEmailAddr); + Controls.Add(dgvEmailTarget); + Controls.Add(label3); + Controls.Add(label2); + Controls.Add(label1); Name = "FrmInforme"; Text = "Informes"; WindowState = FormWindowState.Maximized; + ((System.ComponentModel.ISupportInitialize)dgvEmailTarget).EndInit(); ResumeLayout(false); + PerformLayout(); } #endregion + + private Label label1; + private Label label2; + private Label label3; + private DataGridView dgvEmailTarget; + private TextBox txtEmailAddr; + private TextBox txtEmailPass; + private TextBox txtEmailTargetAdd; + private Button btnAñadir; + private Button btnGuardar; + private Button btnEliminar; } } \ No newline at end of file diff --git a/Vista/FrmInforme.cs b/Vista/FrmInforme.cs index 073954c..916d1a3 100644 --- a/Vista/FrmInforme.cs +++ b/Vista/FrmInforme.cs @@ -1,10 +1,12 @@ -using System; +using Informes; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; +using System.Text.Json; using System.Threading.Tasks; using System.Windows.Forms; @@ -12,9 +14,90 @@ namespace Vista { public partial class FrmInforme : Form { + const string configpath = "settings.json"; public FrmInforme() { InitializeComponent(); + + if (!File.Exists(configpath)) + { + string json = JsonSerializer.Serialize(new ConfigEmail { EmailAddr = "", EmailPass = "", EmailTarget = new List() }, new JsonSerializerOptions { WriteIndented = true }); + File.WriteAllText(configpath, json); + } + + string jsonString = File.ReadAllText(configpath); + ConfigEmail config = JsonSerializer.Deserialize(jsonString); + CargaDatos(config); + } + + private void CargaDatos(ConfigEmail ce) + { + txtEmailAddr.Text = ce.EmailAddr; + txtEmailPass.Text = ce.EmailPass; + + dgvEmailTarget.DataSource = null; + dgvEmailTarget.Columns.Add("EmailTarget", "EmailTarget"); + + // Agregar los datos al DataGridView + foreach (var str in ce.EmailTarget) + { + dgvEmailTarget.Rows.Add(str); + } + } + private void btnGuardar_Click(object sender, EventArgs e) + { + List emailTarget = new List(); + + foreach (DataGridViewRow row in dgvEmailTarget.Rows) + { + if (row.Cells["EmailTarget"].Value != null) + { + emailTarget.Add(row.Cells["EmailTarget"].Value.ToString()); + } + } + + ConfigEmail config = new ConfigEmail + { + EmailAddr = txtEmailAddr.Text, + EmailPass = txtEmailPass.Text, + EmailTarget = emailTarget + }; + + string json = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true }); + File.WriteAllText(configpath, json); + } + + private void btnAñadir_Click(object sender, EventArgs e) + { + List emailTarget = new List(); + emailTarget.Add(txtEmailTargetAdd.Text); + foreach (DataGridViewRow row in dgvEmailTarget.Rows) + { + if (row.Cells["EmailTarget"].Value != null) + { + emailTarget.Add(row.Cells["EmailTarget"].Value.ToString()); + } + } + + // Agregar los datos al DataGridView + dgvEmailTarget.Rows.Add(txtEmailTargetAdd.Text); + } + + private void btnEliminar_Click(object sender, EventArgs e) + { + try + { + if (dgvEmailTarget.SelectedRows.Count > 0) + { + // Elimina la fila seleccionada + dgvEmailTarget.Rows.RemoveAt(dgvEmailTarget.SelectedRows[0].Index); + } + else + { + MessageBox.Show("Por favor, selecciona una fila para eliminar EmailTarget."); + } + } + catch (Exception) { throw; } } } } diff --git a/Vista/FrmInforme.resx b/Vista/FrmInforme.resx index af32865..a395bff 100644 --- a/Vista/FrmInforme.resx +++ b/Vista/FrmInforme.resx @@ -18,7 +18,7 @@ System.Resources.ResXResourceReader, System.Windows.Forms, ... System.Resources.ResXResourceWriter, System.Windows.Forms, ... this is my long stringthis is a comment - Blue + Blue [base64 mime encoded serialized .NET Framework object] diff --git a/Vista/Vista.csproj b/Vista/Vista.csproj index 16631e9..ce9f3f3 100644 --- a/Vista/Vista.csproj +++ b/Vista/Vista.csproj @@ -17,6 +17,7 @@ + \ No newline at end of file diff --git a/Vista/obj/Vista.csproj.nuget.dgspec.json b/Vista/obj/Vista.csproj.nuget.dgspec.json index 91564cd..355a4fe 100644 --- a/Vista/obj/Vista.csproj.nuget.dgspec.json +++ b/Vista/obj/Vista.csproj.nuget.dgspec.json @@ -123,6 +123,66 @@ } } }, + "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Informes\\Informes.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Informes\\Informes.csproj", + "projectName": "Informes", + "projectPath": "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Informes\\Informes.csproj", + "packagesPath": "C:\\Users\\fedpo\\.nuget\\packages\\", + "outputPath": "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Informes\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\fedpo\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net6.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {}, + "https://fedesrv.ddns.net/git/api/packages/fede/nuget/index.json": {} + }, + "frameworks": { + "net6.0": { + "targetAlias": "net6.0", + "projectReferences": { + "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Entidades\\Entidades.csproj": { + "projectPath": "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Entidades\\Entidades.csproj" + } + } + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net6.0": { + "targetAlias": "net6.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.306\\RuntimeIdentifierGraph.json" + } + } + }, "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Modelo\\Modelo.csproj": { "version": "1.0.0", "restore": { @@ -213,6 +273,9 @@ }, "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Entidades\\Entidades.csproj": { "projectPath": "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Entidades\\Entidades.csproj" + }, + "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Informes\\Informes.csproj": { + "projectPath": "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Informes\\Informes.csproj" } } } diff --git a/Vista/obj/project.assets.json b/Vista/obj/project.assets.json index 11f0129..136abf4 100644 --- a/Vista/obj/project.assets.json +++ b/Vista/obj/project.assets.json @@ -26,6 +26,19 @@ "bin/placeholder/Entidades.dll": {} } }, + "Informes/1.0.0": { + "type": "project", + "framework": ".NETCoreApp,Version=v6.0", + "dependencies": { + "Entidades": "1.0.0" + }, + "compile": { + "bin/placeholder/Informes.dll": {} + }, + "runtime": { + "bin/placeholder/Informes.dll": {} + } + }, "Modelo/1.0.0": { "type": "project", "framework": ".NETCoreApp,Version=v6.0", @@ -52,6 +65,11 @@ "path": "../Entidades/Entidades.csproj", "msbuildProject": "../Entidades/Entidades.csproj" }, + "Informes/1.0.0": { + "type": "project", + "path": "../Informes/Informes.csproj", + "msbuildProject": "../Informes/Informes.csproj" + }, "Modelo/1.0.0": { "type": "project", "path": "../Modelo/Modelo.csproj", @@ -61,7 +79,8 @@ "projectFileDependencyGroups": { "net6.0-windows7.0": [ "Controladora >= 1.0.0", - "Entidades >= 1.0.0" + "Entidades >= 1.0.0", + "Informes >= 1.0.0" ] }, "packageFolders": { @@ -97,6 +116,9 @@ }, "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Entidades\\Entidades.csproj": { "projectPath": "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Entidades\\Entidades.csproj" + }, + "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Informes\\Informes.csproj": { + "projectPath": "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Informes\\Informes.csproj" } } } diff --git a/Vista/obj/project.nuget.cache b/Vista/obj/project.nuget.cache index b16fd37..2114e12 100644 --- a/Vista/obj/project.nuget.cache +++ b/Vista/obj/project.nuget.cache @@ -1,6 +1,6 @@ { "version": 2, - "dgSpecHash": "WPBgDz5Ag7uyUpIln8eBMvu2+XqGSiWG0TNaL6A9IRZAEDYpI2SXVE367iYE3zDP7SrxjO4nhM2wKkdjx8Psbw==", + "dgSpecHash": "HaKkXKrDu+gimYBODDKQ5E1ZL1m4YoG9CrkcmpZyBjOtEmifQPEVkmmKOyOtFgPNaLHFACDybW6TDfmls/Ua8g==", "success": true, "projectFilePath": "C:\\Users\\fedpo\\Downloads\\final actual\\final actual\\Vista\\Vista.csproj", "expectedPackageFiles": [],