private void mostrarMeseros() { dtMesero = NTrabajador.MostrarMesero(); nroMesero = dtMesero.Rows.Count; int y = 40; int x = 20; btnMesero = new Button[nroMesero]; for (int i = 0; i < nroMesero; i++) { if (i == 5) { y = 40; x = 190; } else if (i == 10) { y = 40; x = 360; } else if (i == 15) { y = 40; x = 530; } else if (i == 20) { y = 40; x = 700; } else if (i == 25) { y = 40; x = 870; } else if (i == 30) { y = 40; x = 1040; } else if (i == 35) { y = 40; x = 1210; } else if (i == 40) { y = 40; x = 1380; } else if (i == 45) { y = 40; x = 1550; } else if (i == 50) { y = 40; x = 1720; } DataRow row = dtMesero.Rows[i]; btnMesero[i] = new Button(); btnMesero[i].Location = new Point(x, y); btnMesero[i].Name = string.Concat("Mesero", i.ToString()); btnMesero[i].Size = new Size(148, 80); btnMesero[i].TabIndex = i; btnMesero[i].Text = row[1].ToString(); btnMesero[i].BackColor = Color.FromArgb(240, 240, 240); btnMesero[i].Visible = true; btnMesero[i].Tag = i; btnMesero[i].Click += new EventHandler((sender, e) => { if (lblBandera.Text == "0") { if (this.lblBanderaEstado.Text == "0") { frmVenta form = new frmVenta(); form.idMesa = idMesa; form.lblIdMesa.Text = idMesa; form.nroMesa = nroMesa; form.idMesero = row[0].ToString(); form.lblIdTrabajador.Text = row[0].ToString(); form.nombreMesero = row[1].ToString(); form.idSalon = idSalon; form.nombreSalon = nombreSalon; form.lblIdUsuario.Text = row[0].ToString(); form.Show(); this.Dispose(); } else { DataTable dtIdVenta; frmVenta form = new frmVenta(); dtIdVenta = NMesa.mostrarIdVentaMesa(Convert.ToInt32(idMesa)); form.lblIdVenta.Text = dtIdVenta.Rows[0][0].ToString(); form.lblIdUsuario.Text = row[0].ToString(); form.idMesero = row[0].ToString(); form.nombreMesero = row[1].ToString(); form.Show(); this.Dispose(); } } else { if (this.lblBanderaEstado.Text == "0") { frmDelivery form = new frmDelivery(); form.idMesa = idMesa; form.lblIdMesa.Text = idMesa; form.nroMesa = "DELIVERY"; form.idMesero = row[0].ToString(); form.lblIdTrabajador.Text = row[0].ToString(); form.nombreMesero = row[1].ToString(); form.lblIdUsuario.Text = this.lblIdUsuario.Text; form.idSalon = idSalon; form.nombreSalon = "DELIVERY"; // form.lblIdUsuario.Text = this.lblIdUsuario.Text; form.Show(); this.Dispose(); } else { DataTable dtIdVenta; frmDelivery form = new frmDelivery(); dtIdVenta = NMesa.mostrarIdVentaMesa(Convert.ToInt32(idMesa)); form.lblIdVenta.Text = dtIdVenta.Rows[0][0].ToString(); form.lblIdUsuario.Text = row[0].ToString(); form.nombreMesero = row[1].ToString(); form.idMesero = row[0].ToString(); form.Show(); this.Dispose(); } } }); //this.Controls.Add(this.btnSalon[i]); y += 90; gbMeseros.Controls.Add(btnMesero[i]); } }
public void mostrarMesas(string idSalon) { if (idSalon != "") { this.lblNroMesas.Text = "0"; dtMesa = NMesa.Mostrar(Convert.ToInt32(idSalon)); nroMesa = dtMesa.Rows.Count; int y1 = 70; int x1 = 6; btnMesa = new Button[nroMesa]; for (int i = 0; i < nroMesa; i++) { if (i == 7) { y1 = 150; x1 = 6; } else if (i == 14) { y1 = 230; x1 = 3; } else if (i == 21) { y1 = 310; x1 = 3; } else if (i == 28) { y1 = 390; x1 = 3; } else if (i == 35) { y1 = 470; x1 = 3; } else if (i == 42) { y1 = 550; x1 = 3; } else if (i == 49) { y1 = 630; x1 = 3; } else if (i == 56) { y1 = 710; x1 = 3; } else if (i == 63) { y1 = 890; x1 = 3; } else if (i == 70) { y1 = 970; x1 = 3; } else if (i == 77) { y1 = 1050; x1 = 3; } DataRow row = dtMesa.Rows[i]; btnMesa[i] = new Button(); btnMesa[i].Location = new Point(x1, y1); btnMesa[i].Name = string.Concat("btnMesa", i.ToString()); //String mesa = row[0].ToString(); //btnMesa[i].Name = string.Concat("btnMesa",mesa); btnMesa[i].Size = new Size(100, 70); btnMesa[i].Font = new Font("Roboto", 10f, FontStyle.Bold); btnMesa[i].TabIndex = i; btnMesa[i].Text = row[1].ToString(); btnMesa[i].Visible = true; if (dtMesa.Rows[i][3].ToString().Equals("Libre")) { btnMesa[i].BackColor = Color.DarkOliveGreen; } else if (dtMesa.Rows[i][3].ToString().Equals("Ocupada")) { btnMesa[i].BackColor = Color.Red; } else if (dtMesa.Rows[i][3].ToString().Equals("Por Salir")) { btnMesa[i].BackColor = Color.Orange; } btnMesa[i].ForeColor = Color.White; btnMesa[i].Tag = i; lblNroMesas.Text = nroMesa.ToString(); x1 += 103; gbMesas.Controls.Add(btnMesa[i]); btnMesa[i].Click += new EventHandler((sender, e) => { //this.btnMesa[2].BackColor = Color.Red; this.lblIdMesa.Text = String.Concat(row[0].ToString()); this.lblPrueba.Visible = true; this.lblPrueba.Text = String.Concat("Mesa ", row[1].ToString()); if (row[3].ToString().Equals("Ocupada") || row[3].ToString().Equals("Por Salir")) { /* * DataTable dtIdVenta; * frmVenta form = new frmVenta(); * dtIdVenta = NMesa.mostrarIdVentaMesa(Convert.ToInt32(this.lblIdMesa.Text)); * form.lblIdVenta.Text = dtIdVenta.Rows[0][0].ToString(); * form.lblIdUsuario.Text = this.lblIdUsuario.Text; * this.tActualizarEstado.Enabled = false; * form.Show();*/ this.lblBanderaEstado.Text = "1"; //frmMesero form = new frmMesero(); frmVenta form = new frmVenta(); DataTable dtMesero = NTrabajador.MostrarMesero(); DataTable dtIdVenta; dtIdVenta = NMesa.mostrarIdVentaMesa(Convert.ToInt32(lblIdMesa.Text)); form.lblBanderaEstado.Text = "1"; form.lblIdVenta.Text = dtIdVenta.Rows[0][0].ToString(); form.nroMesa = row[1].ToString(); form.idMesa = this.lblIdMesa.Text; form.idSalon = this.lblIdSalon.Text; form.nombreSalon = this.lblNombreSalon.Text; form.nombreMesero = this.lblUsuario.Text; form.lblIdUsuario.Text = this.lblIdUsuario.Text; form.lblIdMesa.Text = this.lblIdMesa.Text; form.idMesero = this.lblIdUsuario.Text; this.tEstado.Enabled = false; form.Show(); } else { this.lblBanderaEstado.Text = "0"; //frmMesero form = new frmMesero(); frmVenta form = new frmVenta(); form.lblBanderaEstado.Text = "0"; form.nroMesa = row[1].ToString(); form.idMesa = this.lblIdMesa.Text; form.lblIdMesa.Text = this.lblIdMesa.Text; form.idSalon = this.lblIdSalon.Text; form.nombreSalon = this.lblNombreSalon.Text; form.nombreMesero = this.lblUsuario.Text; form.lblIdUsuario.Text = this.lblIdUsuario.Text; form.idMesero = this.lblIdUsuario.Text; this.tEstado.Enabled = false; form.Show(); } // form.lbli = }); } } }
private void frmVenta_FormClosed(object sender, FormClosedEventArgs e) { _myFormVenta = null; }
private void frmVenta_FormClosing(object sender, FormClosingEventArgs e) { _instancia = null; }
private void btnVenta_Click(object sender, EventArgs e) { frmVenta venta = new frmVenta(); venta.Show(); }