private void filtrarMaterias() { try { DBM.CLS.QUERY Query = new DBM.CLS.QUERY(); DataTable dtMateria = new DataTable(); DataRow dr; dtMateria = Query.GetRecords("estado"); for (int i = 0; i < dtMateria.Rows.Count; i++) { dr = dtMateria.Rows[i]; DBM.CLS.Metodos.myButton MyButton = new DBM.CLS.Metodos.myButton(); MyButton.Width = 200; MyButton.Height = 80; MyButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular); MyButton.BackColor = Color.FromName(dr["color"].ToString()); //MyButton.ForeColor = Color.White; MyButton.campo1 = dr["idEstado"].ToString(); MyButton.campo2 = dr["estado"].ToString(); MyButton.Text = dr["estado"].ToString(); MyButton.Click_ConIndice += myButton_Click; MyPanel.Controls.Add(MyButton); } } catch { } }
void creaBotonEntrar(int pedidoID, String total, int lastIdDetalle, int estado) { DBM.CLS.Metodos.myButton boton = new DBM.CLS.Metodos.myButton(); boton.indice = pedidoID; boton.Name = pedidoID.ToString();//TRAE EL ID DEL SALON QUE SIRVE COMO FILTRO boton.campo1 = pedidoID.ToString(); boton.campo2 = total; boton.campo3 = lastIdDetalle.ToString(); boton.Tag = estado.ToString(); //Guardamos el estado en el tag por si desea modificarse, por el momento no se usa boton.Text = "Orden # " + pedidoID.ToString(); boton.AutoSize = false; boton.AllowDrop = true; boton.Width = Properties.Settings.Default.sizeButtonPedido.Width; boton.Height = Properties.Settings.Default.sizeButtonPedido.Height; boton.BackColor = System.Drawing.SystemColors.ControlLightLight; boton.FlatStyle = FlatStyle.Flat; boton.FlatAppearance.BorderSize = 1; boton.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); MyToolTip.SetToolTip(boton, "\nPedido: " + boton.campo1 + "\nTotal: " + boton.campo2 + "\nLastIdDetalle: " + boton.campo3); boton.Click_ConIndice += Boton_Click_ConIndice;// para el evento click de cada boton creado if (filtrarPedidoconCategoriasDisponibles(int.Parse(boton.campo1)) <= 0) { boton.Visible = false; } if (estado == 0) { flowPanelPendiente.Controls.Add(boton);// añadimos los botones al contenedor } else if (estado == 1) { flowPanelProceso.Controls.Add(boton);// añadimos los botones al contenedor } else if (estado == 2) { flowPanelFinalizado.Controls.Add(boton);// añadimos los botones al contenedor } }
private void ValidaCambiosEnPedido() { DBM.CLS.QUERY QueryTable = new DBM.CLS.QUERY(); DataRow drOrder; DataRow drOrderDetalle; DBM.CLS.Metodos.myButton boton = new DBM.CLS.Metodos.myButton(); foreach (DBM.CLS.Metodos.myButton item in flowPanelProceso.Controls) { drOrder = QueryTable.GetUniqueRecord("Pedido", "idPedido", item.Name); if (drOrder != null) { DataTable DT = new DataTable(); DT = QueryTable.GetRecordsFilters("pedido_detalle", "idPedido", drOrder["idPedido"].ToString()); int totalReg = DT.Rows.Count; try { if (item.campo2 != drOrder["total"].ToString() || int.Parse(item.campo3) < int.Parse(DT.Rows[totalReg - 1]["idDetalle"].ToString())) { item.BackColor = Color.Orange; if (!item.Enabled) { item.Enabled = true; item.Text.Replace("Cancelada", ""); } if (!item.Text.Contains("Hay cambios")) { item.Text = item.Text + " Hay cambios"; } if (LastOrderIdClicked == item.indice) { /* * frmDetalle.OrderID = item.indice; * frmDetalle.UltimoIDDetalle = Convert.ToInt32(item.campo3); * frmDetalle.cambiosDetectados = true; * frmDetalle.lblObservaciones.Text = "Último idDetalle:" + frmDetalle.UltimoIDDetalle; * frmDetalle.filtrarPedido(item.indice); * //Prueba al 18-08-2019 para que no actualice el formulario de pedido_detalle * item.campo2 = drOrder["total"].ToString(); * item.campo3 = DT.Rows[totalReg - 1]["idDetalle"].ToString(); */ } } } catch { } } } foreach (DBM.CLS.Metodos.myButton item in flowPanelFinalizado.Controls.OfType <Button>()) { drOrder = QueryTable.GetUniqueRecord("Pedido", "idPedido", item.Name); DataTable DT = new DataTable(); DT = QueryTable.GetRecordsFilters("pedido_detalle", "idPedido", drOrder["idPedido"].ToString()); int totalReg = DT.Rows.Count; try { if (item.campo2 != drOrder["total"].ToString() || int.Parse(item.campo3) < int.Parse(DT.Rows[totalReg - 1]["idDetalle"].ToString())) { item.BackColor = Color.Orange; if (!item.Text.Contains("Hay cambios")) { item.Text = item.Text + " Hay cambios"; } } } catch { } } }