Ejemplo n.º 1
0
        void ClickCargarOrden(object sender, EventArgs e)
        {
            try
            {
                listaTareas  = new List <OrdenDetalleViewModel>();
                listaPrendas = new List <OrdenPrendaViewModel>();

                BorrarPanelDetalleOrdenes();
                BorrarPanelPagos();
                Panel btn = sender as Panel;
                var   id  = int.Parse(btn.Name);

                var Colores = true;

                rowCount = 0;


                var orden = db.Ordenes.Find(id);

                label8.Text  = orden.EmpleadoRealizo;
                label9.Text  = orden.EmpleadoActualizo;
                label11.Text = orden.EmpleadoCompleto;



                foreach (var prenda in orden.Prendas)

                {
                    var panelViewPrenda = new OrdenPrendaViewModel(string.Empty);



                    panelViewPrenda.panelPrenda.Name = prenda.DetalleOrdenPrendaId.ToString();

                    panelViewPrenda.lblPrenda.Text = prenda.Prenda.TipoRopa.ToString() + "X" + prenda.Cantidad;



                    panelViewPrenda.panelPrenda.Controls.Add(panelViewPrenda.lblPrenda);
                    listaPrendas.Add(panelViewPrenda);
                    rowCount += 1;
                    tblDetalleOrdenesClientes.RowCount = rowCount;
                    this.tblDetalleOrdenesClientes.Controls.Add(listaPrendas.Last().panelPrenda, 0, rowCount);

                    foreach (var tarea in prenda.DetalleTareas)
                    {
                        var panelViewTarea = new OrdenDetalleViewModel(string.Empty, string.Empty, 0);



                        panelViewTarea.panelTarea.MouseEnter += new EventHandler(MouseoverDos);
                        panelViewTarea.panelTarea.MouseLeave += new EventHandler(MouseleaveDos);
                        panelViewTarea.panelTarea.Size        = new Size(1020, 30);
                        panelViewTarea.panelTarea.Name        = tarea.DetalleOrdenesId.ToString();
                        panelViewTarea.DetalleOrdenesId       = tarea.DetalleOrdenesId;
                        if (Colores == true)
                        {
                            panelViewTarea.panelTarea.BackColor = Color.White;
                            Colores = false;
                        }
                        else
                        {
                            panelViewTarea.panelTarea.BackColor = Color.WhiteSmoke;
                            Colores = true;
                        }

                        panelViewTarea.lblId.Text = tarea.Prenda.OrdenId.ToString();

                        panelViewTarea.lblId.Location = new Point(0, 0);
                        panelViewTarea.lblId.Size     = new Size(65, 20);
                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblId);

                        panelViewTarea.lblTarea.Text = tarea.Detalle.Tarea.NombreTareas.ToString();

                        panelViewTarea.lblTarea.Location = new Point(90, 0);
                        panelViewTarea.lblTarea.Size     = new Size(135, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblTarea);

                        panelViewTarea.lblDetalleTarea.Text = tarea.Detalle.DetalleTareas.ToString();

                        panelViewTarea.lblDetalleTarea.Location = new Point(230, 0);
                        panelViewTarea.lblDetalleTarea.Size     = new Size(135, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblDetalleTarea);

                        panelViewTarea.lblPrecio.Text = tarea.Detalle.Precio.ToString();

                        panelViewTarea.lblPrecio.Location = new Point(400, 0);
                        panelViewTarea.lblPrecio.Size     = new Size(65, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblPrecio);

                        panelViewTarea.txtTotalPrecio.Text = (tarea.Descuento).ToString();

                        panelViewTarea.txtTotalPrecio.Location = new Point(480, 0);
                        panelViewTarea.txtTotalPrecio.Size     = new Size(65, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.txtTotalPrecio);

                        panelViewTarea.lblSubTotal.Text = (tarea.Subtotal).ToString();

                        panelViewTarea.lblSubTotal.Location = new Point(560, 0);
                        panelViewTarea.lblSubTotal.Size     = new Size(65, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblSubTotal);


                        panelViewTarea.lblDescuento.Text = ("").ToString();

                        panelViewTarea.lblDescuento.Location = new Point(640, 0);
                        panelViewTarea.lblDescuento.Size     = new Size(135, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblDescuento);

                        if (tarea.AfiliadoId > 0)
                        {
                            var nombre = db.Afiliados.Find(tarea.AfiliadoId);
                            panelViewTarea.lblAfiliado.Text = (nombre.Nombre);
                        }
                        else
                        {
                            panelViewTarea.lblAfiliado.Text = "";
                        }



                        panelViewTarea.lblAfiliado.Location = new Point(800, 0);
                        panelViewTarea.lblAfiliado.Size     = new Size(105, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblAfiliado);

                        panelViewTarea.lblEmpleado.Text = (tarea.EmpleadoActualizo).ToString();

                        panelViewTarea.lblEmpleado.Location = new Point(935, 0);
                        panelViewTarea.lblEmpleado.Size     = new Size(90, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblEmpleado);

                        listaTareas.Add(panelViewTarea);
                        rowCount += 1;
                        tblDetalleOrdenesClientes.RowCount = rowCount;
                        this.tblDetalleOrdenesClientes.Controls.Add(listaTareas.Last().panelTarea, 0, rowCount);
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 2
0
        void ClickCargarOrden(object sender, EventArgs e)
        {
            try
            {
                listaTareas  = new List <OrdenDetalleViewModel>();
                listaPrendas = new List <OrdenPrendaViewModel>();

                BorrarPanelDetalleOrdenes();

                Panel btn     = sender as Panel;
                var   id      = int.Parse(btn.Name);
                var   Colores = true;

                rowCount = 0;


                var orden = db.Ordenes.Find(id);

                label19.Text = orden.EmpleadoRealizo;
                label15.Text = orden.EmpleadoActualizo;
                label14.Text = orden.EmpleadoCompleto;



                foreach (var prenda in orden.Prendas)

                {
                    var panelViewPrenda = new OrdenPrendaViewModel(string.Empty);



                    panelViewPrenda.panelPrenda.Click += new EventHandler(ClickCargarOrden);
                    panelViewPrenda.panelPrenda.Name   = prenda.DetalleOrdenPrendaId.ToString();

                    panelViewPrenda.lblPrenda.Text = prenda.Prenda.TipoRopa.ToString() + "X" + prenda.Cantidad;



                    panelViewPrenda.panelPrenda.Controls.Add(panelViewPrenda.lblPrenda);
                    listaPrendas.Add(panelViewPrenda);
                    rowCount += 1;
                    tblDetalleOrdenesClientes.RowCount = rowCount;
                    this.tblDetalleOrdenesClientes.Controls.Add(listaPrendas.Last().panelPrenda, 0, rowCount);

                    foreach (var tarea in prenda.DetalleTareas)
                    {
                        var panelViewTarea = new OrdenDetalleViewModel(string.Empty, string.Empty, 0);



                        panelViewTarea.panelTarea.Click      += new EventHandler(ClickCargarOrden);
                        panelViewTarea.panelTarea.MouseEnter += new EventHandler(MouseoverDos);
                        panelViewTarea.panelTarea.MouseLeave += new EventHandler(MouseleaveDos);
                        panelViewTarea.panelTarea.Name        = tarea.DetalleOrdenesId.ToString();
                        panelViewTarea.DetalleOrdenesId       = tarea.DetalleOrdenesId;
                        if (Colores == true)
                        {
                            panelViewTarea.panelTarea.BackColor = Color.White;
                            Colores = false;
                        }
                        else
                        {
                            panelViewTarea.panelTarea.BackColor = Color.WhiteSmoke;
                            Colores = true;
                        }



                        panelViewTarea.lblTarea.Text = tarea.Detalle.Tarea.NombreTareas.ToString();
                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblTarea);

                        panelViewTarea.lblDetalleTarea.Text = tarea.Detalle.DetalleTareas.ToString();
                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblDetalleTarea);

                        panelViewTarea.txtPrecio.Text = tarea.Detalle.Precio.ToString();
                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.txtPrecio);

                        panelViewTarea.txtTotalPrecio.Text = (prenda.Cantidad * tarea.Detalle.Precio).ToString();
                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.txtTotalPrecio);

                        if (tarea.Estado == true)
                        {
                            panelViewTarea.btnEstado.BackColor = Color.OliveDrab;
                            panelViewTarea.btnEstado.ForeColor = Color.OliveDrab;
                            panelViewTarea.btnEstado.Text      = tarea.DetalleOrdenesId.ToString();
                            panelViewTarea.btnEstado.Click    += new EventHandler(ClickCambiarEstadoTarea);
                            panelViewTarea.panelTarea.Controls.Add(panelViewTarea.btnEstado);
                        }
                        else
                        {
                            panelViewTarea.btnEstado.Text   = tarea.DetalleOrdenesId.ToString();
                            panelViewTarea.btnEstado.Click += new EventHandler(ClickCambiarEstadoTarea);
                            panelViewTarea.panelTarea.Controls.Add(panelViewTarea.btnEstado);
                        }


                        listaTareas.Add(panelViewTarea);
                        rowCount += 1;
                        tblDetalleOrdenesClientes.RowCount = rowCount;
                        this.tblDetalleOrdenesClientes.Controls.Add(listaTareas.Last().panelTarea, 0, rowCount);
                    }
                }

                dgvPagos.DataSource = db.Pagos.Where(q => q.OrdenId == orden.OrdenId).Select(t => new { t.Fecha, t.Monto, t.MediosPago.FormaPago, t.EmpleadoRealizo, t.Puntos }).ToList();
            }
            catch (Exception)
            {
            }
        }