public void Validacion() { try { SqlCommand cmd = con.CreateCommand(); cmd.CommandText = "select Nombre,Contraseña from Usuarios where Nombre ='" + textBox_usuario.Text + "'and Contraseña ='" + textBox_contraseña.Text + "' "; cmd.Connection = con; con.Open(); dr = cmd.ExecuteReader(); if (dr.Read()) { //metodo de varra de progreso pruebabarra(); //--------------- MessageBox.Show("Bienvenido: " + textBox_usuario.Text, "Correcto", MessageBoxButtons.OK, MessageBoxIcon.Information); menu obj = new menu(); //Mostrar Usuario Rejistrado----- obj.label_usuario.Text = textBox_usuario.Text; //obtiene nombre de usuario nombre = dr[0].ToString(); /*if (textBox_usuario.Text!="Vicente"&&textBox_contraseña.Text!="admin"&&textBox_usuario.Text!="Adolfo"&&textBox_contraseña.Text!="12345678") * { * obj.button_administrador.Enabled = false; * } */ //----- obj.Visible = true; Visible = false; } else { // MessageBox.Show("Datos Incorrectos"); MessageBox.Show("Datos Incorrectos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } dr.Close(); con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button_hacer_venta_Click(object sender, EventArgs e) { try { //if (listView_venta.Items.Count <= 0) if (label_TOTAL.Text == "0,00" || label_TOTAL.Text == "0") { MessageBox.Show("No hay nada que vender"); } else { enter_cobrar obj = new enter_cobrar(); obj.label_total_a_pagar.Text = label_TOTAL.Text; //-----prueba //obj.textBox_nombre_cobrear.Text = textBox_nombre.Text; obj.textBox_fecha_cobrar.Text = textBox_hora_actual.Text; obj.textBox_total_cobrar.Text = label_TOTAL.Text; // obj.textBox_total_cobrar.Text = textBox_total.Text; //obj.textBox_codigo_cobrar.Text = textBox_codigo_de_varrras.Text; //Ocultar anterior this.Hide(); obj.ShowDialog(); double L_C; L_C = double.Parse(obj.label_cambio_pago.Text); if (L_C <= 0) { // MessageBox.Show("La Cantidad Especificada No Es Suficiente"); } else { listView_venta.Items.Clear(); label_subtotal.Text = "0,00"; label_iva.Text = "0,00"; label_total2.Text = "0,00"; label_TOTAL.Text = "0,00"; label_num_prod_en_venta.Text = "0"; // textBox_total.Text = "0"; //label_total_abajo.Text = "0.00"; label_total_abajo.Text = obj.label_total_a_pagar.Text; label_pago_con.Text = obj.textBox_pago.Text;// .Text = suma2.ToString(); label_cambio.Text = obj.label_cambio_pago.Text; //--------INS VENTA---------------- menu me = new menu(); // float total = Convert.ToInt32(label_TOTAL.Text); //ins_venta(textBox_nombre.Text,textBox_hora_actual.Text,total); // MessageBox.Show("Gracias por su compra"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }