private void Button_Click_2(object sender, RoutedEventArgs e) { if (cbpro.SelectedIndex > -1 && cbser.SelectedIndex > -1 && cbasis.SelectedIndex > -1) { ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); int id = int.Parse(cbser.Text); Servicio p = db.Servicio.SingleOrDefault(x => x.ServicioId == id); if (p != null) { tempServicio = p; } AgregarAlGrid.Add(new Servicio() { ServicioId = tempServicio.ServicioId, NombreServicio = tempServicio.NombreServicio, Precio = tempServicio.Precio, ProveedorProveedorId = tempServicio.ProveedorProveedorId, }); actualizaGrid(); tempServicio = null; } else { MessageBox.Show("Tiene que seleccionar un elemento en cada campo", "precaucion", MessageBoxButton.OK, MessageBoxImage.Hand); } }
private void Button_Click_4(object sender, RoutedEventArgs e) { ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); var reg = from s in db.Servicio select s; dbgrid.ItemsSource = reg.ToList(); }
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 Window_Loaded_1(object sender, RoutedEventArgs e) { ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); cbpro.ItemsSource = db.Proveedor.ToList(); cbpro.DisplayMemberPath = "NombreProveedor"; cbpro.SelectedValuePath = "ProveedorId"; cbasis.ItemsSource = db.Asistente.ToList(); cbasis.DisplayMemberPath = "AsistenteId"; cbasis.SelectedValuePath = "AsistenteId"; cbser.ItemsSource = db.Servicio.ToList(); cbser.DisplayMemberPath = "ServicioId"; cbser.SelectedValuePath = "ServicioId"; }
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"); } }
private void Window_Loaded_1(object sender, RoutedEventArgs e) { ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); CbProveedores.ItemsSource = db.Proveedor.ToList(); CbProveedores.DisplayMemberPath = "NombreProveedor"; CbProveedores.SelectedValuePath = "ProveedorId"; }
private void Button_Click_6(object sender, RoutedEventArgs e) { if (Regex.IsMatch(txtid.Text, @"^\d+$")) { ProyectoFinal.BD.ProyectoFinal db = new BD.ProyectoFinal(); int id = int.Parse(txtid.Text); var reg = from s in db.Servicio where s.ServicioId == id select new { s.NombreServicio, s.Precio }; dbgrid.ItemsSource = reg.ToList(); } else { MessageBox.Show("Solo Numeros #id"); } }