using compabetov2.database; using compabetov2.database.modelos; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace compabetov2 { public partial class envios : Form { private LoginModel loginPrincipal; public envios(LoginModel loginPrincipal) { InitializeComponent(); llenarPanel(); this.loginPrincipal = loginPrincipal; } private void llenarPanel() { panelEnvio.Controls.Clear(); List envios = service.conseguirEnvio(); panelEnvio.BackColor = Color.Aqua; foreach(Envio envio in envios) { TableLayoutPanel carta = new TableLayoutPanel(); carta.ColumnCount = 1; carta.RowCount = 2; carta.RowStyles.Add(new RowStyle(SizeType.Percent, 80F)); carta.RowStyles.Add(new RowStyle(SizeType.Percent, 20F)); carta.Width = 700; carta.Height = 150; carta.BackColor = Color.Gray; FlowLayoutPanel infoPanel = new FlowLayoutPanel(); infoPanel.FlowDirection = FlowDirection.TopDown; infoPanel.Dock = DockStyle.Fill; Label lbFecha = new Label(); lbFecha.Text = $"Fecha: {envio.fecha}"; Label lbDireaccion = new Label(); lbDireaccion.Text = $"Direccion: {envio.direccion}"; panelEnvio.Controls.Add(carta); } } private void button1_Click(object sender, EventArgs e) { // Cerrar el formulario de ventas this.Close(); // Verificar si ya hay una instancia del formulario principal MenuPrincipal menuprincipalForm = Application.OpenForms.OfType().FirstOrDefault(); if (menuprincipalForm == null) { // Si no hay una instancia, crear una nueva menuprincipalForm = new MenuPrincipal(loginPrincipal); // Establecer el formulario principal como el formulario MDI padre menuprincipalForm.MdiParent = this.MdiParent; // Mostrar el formulario principal menuprincipalForm.Show(); } else { // Si ya hay una instancia, simplemente llevarlo al frente menuprincipalForm.BringToFront(); } } private void horafecha_Tick(object sender, EventArgs e) { lblhora.Text = DateTime.Now.ToString("h:mm:ss"); lblfecha.Text = DateTime.Now.ToLongDateString(); } private void label10_Click(object sender, EventArgs e) { } private void envios_Load(object sender, EventArgs e) { } private void label4_Click(object sender, EventArgs e) { } private void panelEnvio_Paint(object sender, PaintEventArgs e) { } } }