private void Button_Click_2(object sender, RoutedEventArgs e) { if (Regex.IsMatch(txtnombre.Text, @"^[a-zA-Z]+$") && Regex.IsMatch(txtcontra.Text, @"^[a-zA-Z]+$")) { //ProyectoFinal db = new ProyectoFinal(); ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); CuentaProveedor cue = new CuentaProveedor(); cue.Usuario = txtnombre.Text; cue.Contrasena = txtcontra.Text; db.CuentaProveedor.Add(cue); db.SaveChanges(); } else { MessageBox.Show("Solo Letras en #nombre y #contrasena "); } }
private void Button_Click_2(object sender, RoutedEventArgs e) { if (Regex.IsMatch(txtnombre.Text, @"^[a-zA-Z\s]+$") && Regex.IsMatch(txtpre.Text, @"^\d+$") && Regex.IsMatch(CbProveedores.Text, @"^\d+$")) { //ProyectoFinal db = new ProyectoFinal(); ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); Servicio ser = new Servicio(); ser.NombreServicio = txtnombre.Text; ser.Precio = float.Parse(txtpre.Text); ser.ProveedorProveedorId = (int)CbProveedores.SelectedValue; db.Servicio.Add(ser); db.SaveChanges(); } else { MessageBox.Show("Solo Letras en #nombre, numeros en #precio y seleccionar un elemento en #Proveedor"); } }
private void Button_Click_2(object sender, RoutedEventArgs e) { if (Regex.IsMatch(txtnombre.Text, @"^[a-zA-Z\s]+$") && Regex.IsMatch(txtape.Text, @"^[a-zA-Z\s]+$") && Regex.IsMatch(txttel.Text, @"^\d+$")) { //ProyectoFinal db = new ProyectoFinal(); ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); Asistente asi = new Asistente(); asi.Nombre = txtnombre.Text; asi.Apellido = txtape.Text; asi.Telefono = int.Parse(txttel.Text); db.Asistente.Add(asi); db.SaveChanges(); } else { MessageBox.Show("Solo Letras en #nombre y #direccion y solo numeros en #Telefono "); } }
private void Button_Click_2(object sender, RoutedEventArgs e) { if (Regex.IsMatch(txtnombre.Text, @"^[a-zA-Z\s]+$") && Regex.IsMatch(txtdir.Text, @"^[a-zA-Z\s]+$") && Regex.IsMatch(txtgiro.Text, @"^[a-zA-Z\s]+$")) { //ProyectoFinal db = new ProyectoFinal(); ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); Proveedor pro = new Proveedor(); pro.NombreProveedor = txtnombre.Text; pro.Direccion = txtdir.Text; pro.Giro = txtgiro.Text; db.Proveedor.Add(pro); db.SaveChanges(); } else { MessageBox.Show("Solo Letras en #nombre, #direccion y #giro "); } }
private void Button_Click_3(object sender, RoutedEventArgs e) { if (Regex.IsMatch(txtnombre.Text, @"^[a-zA-Z\s]+$") && Regex.IsMatch(txtpre.Text, @"^\d+$") && Regex.IsMatch(txtid.Text, @"^\d+$") && Regex.IsMatch(CbProveedores.Text, @"^\d+$")) { ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); int id = int.Parse(txtid.Text); var ser = db.Servicio.SingleOrDefault(x => x.ServicioId == id);/*from x in db.Empleado where x.id == id select x;*/ if (ser != null) { ser.NombreServicio = txtnombre.Text; ser.Precio = int.Parse(txtpre.Text); db.SaveChanges(); } } else { MessageBox.Show("Solo Letras en #nombre, selecciona algun elemento en #Proveedor y numeros en #precio y #ID"); } }
private void Button_Click_3(object sender, RoutedEventArgs e) { if (Regex.IsMatch(txtnombre.Text, @"^[a-zA-Z\s]+$") && Regex.IsMatch(txtdir.Text, @"^[a-zA-Z\s]+$") && Regex.IsMatch(txtgiro.Text, @"^[a-zA-Z\s]+$")&& Regex.IsMatch(txtid.Text, @"^\d+$")) { ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); int id = int.Parse(txtid.Text); var pro = db.Proveedor.SingleOrDefault(x => x.ProveedorId == id);/*from x in db.Empleado where x.id == id select x;*/ if(pro != null){ pro.NombreProveedor = txtnombre.Text; pro.Direccion = txtdir.Text; pro.Giro = txtgiro.Text; db.SaveChanges(); } } else { MessageBox.Show("Solo Letras en #nombre, #direccion y #giro y numeros en #ID"); } }
private void Button_Click_3(object sender, RoutedEventArgs e) { if (Regex.IsMatch(txtnombre.Text, @"^[a-zA-Z]+$") && Regex.IsMatch(txtcontra.Text, @"^[a-zA-Z]+$") && Regex.IsMatch(txtid.Text, @"^\d+$")) { ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); int id = int.Parse(txtid.Text); var cue = db.CuentaProveedor.SingleOrDefault(x => x.CuentaId == id);/*from x in db.Empleado where x.id == id select x;*/ if (cue != null) { cue.Usuario = txtnombre.Text; cue.Contrasena = txtcontra.Text; db.SaveChanges(); } } else { MessageBox.Show("Solo Letras en #nombre, y #contrasena y numeros en #ID"); } }
private void Button_Click_3(object sender, RoutedEventArgs e) { if (Regex.IsMatch(txtnombre.Text, @"^[a-zA-Z\s]+$") && Regex.IsMatch(txtape.Text, @"^[a-zA-Z\s]+$") && Regex.IsMatch(txttel.Text, @"^\d+$") && Regex.IsMatch(txtid.Text, @"^\d+$")) { ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); int id = int.Parse(txtid.Text); var asi = db.Asistente.SingleOrDefault(x => x.AsistenteId == id);/*from x in db.Empleado where x.id == id select x;*/ if (asi != null) { asi.Nombre = txtnombre.Text; asi.Apellido = txtape.Text; asi.Telefono = int.Parse(txttel.Text); db.SaveChanges(); } } else { MessageBox.Show("Solo Letras en #nombre y #apellido y numeros en #telefono y #ID"); } }
private void Button_Click_3(object sender, RoutedEventArgs e) { ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); Factura fac = new Factura(); fac.ServicioServicioId = (int)cbser.SelectedValue; fac.Fecha = DateTime.Now; fac.AsistenteAsistenteId = (int)cbasis.SelectedValue; fac.ProveedorIdProveedor = (int)cbpro.SelectedValue; //actualizaGrid(); db.Factura.Add(fac); db.SaveChanges(); MessageBox.Show("Se Guardaron los datos"); CleanUp(); }
private void Button_Click_5(object sender, RoutedEventArgs e) { if (Regex.IsMatch(txtid.Text, @"^\d+$")) { ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); int id = int.Parse(txtid.Text); var ser = db.Servicio.SingleOrDefault(x => x.ServicioId == id);/*from x in db.Empleado where x.id == id select x;*/ if (ser != null) { db.Servicio.Remove(ser); db.SaveChanges(); } } else { MessageBox.Show("Solo Numeros #id"); } }