public bool AddSegundas(string cliente, string Tela, string Conf, string Lav, string proc, string avios, string falt, string total) { using (PLMContext db = new PLMContext()) { var Segundas = new Segundas(); Segundas.Cliente = cliente; Segundas.avios = avios + "%"; Segundas.Tela = Tela + "%"; Segundas.Conf = Conf + "%"; Segundas.Lavado = Lav + "%"; Segundas.proc = proc + "%"; Segundas.faltantes = falt + "%"; Segundas.total = total + "%"; try { db.Segundas.Add(Segundas); db.SaveChanges(); return(true); } catch (Exception ex) { Dialogs.Show(ex.Message, DialogsType.Error); return(false); } } }
private void tbCliente_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F3) { cotizacion1.cliente = false; Busqueda.Busqueda frmBusqueda = new Busqueda.Busqueda(41); frmBusqueda.ShowDialog(); if (frmBusqueda.dato != "") { //CLIENTE CONTROL USER cotizacion1.cliente = true; cotizacion2.cliente = true; cotizacion3.cliente = true; cotizacion4.cliente = true; cotizacion5.cliente = true; Segundas segundas = new Segundas(); tbCliente.Text = frmBusqueda.dato; tbTienda.Text = frmBusqueda.dato1; nacionalidad = frmBusqueda.dato2; segundas = cotizacion.GetSegundas(tbCliente.Text); //NACIONALIDAD CONTROL USER cotizacion1.nacionalidad = nacionalidad.Trim(); cotizacion2.nacionalidad = nacionalidad.Trim(); cotizacion3.nacionalidad = nacionalidad.Trim(); cotizacion4.nacionalidad = nacionalidad.Trim(); cotizacion5.nacionalidad = nacionalidad.Trim(); if (segundas != null) { tbTela.Text = segundas.Tela; tbConf.Text = segundas.Conf; tbLav.Text = segundas.Lavado; tbPres.Text = segundas.proc; tbAvios.Text = segundas.avios; tbFalt.Text = segundas.faltantes; tbTotal.Text = segundas.total; //PORCENTAJE cotizacion1.porcentaje_tela = Convert.ToDecimal(segundas.Tela.Replace("%", "")) / 100; cotizacion2.porcentaje_tela = Convert.ToDecimal(segundas.Tela.Replace("%", "")) / 100; cotizacion3.porcentaje_tela = Convert.ToDecimal(segundas.Tela.Replace("%", "")) / 100; cotizacion4.porcentaje_tela = Convert.ToDecimal(segundas.Tela.Replace("%", "")) / 100; cotizacion5.porcentaje_tela = Convert.ToDecimal(segundas.Tela.Replace("%", "")) / 100; cotizacion6.faltantes = Convert.ToDecimal(segundas.faltantes.Replace("%", "")) / 100; } else { Dialogs.Show("Cliente no existente en el catálogo", DialogsType.Warning); tbTela.Text = "0"; tbConf.Text = "0"; tbLav.Text = "0"; tbPres.Text = "0"; tbAvios.Text = "0"; tbFalt.Text = "0"; tbTotal.Text = "0"; cotizacion1.porcentaje_tela = 0; cotizacion2.porcentaje_tela = 0; cotizacion3.porcentaje_tela = 0; cotizacion4.porcentaje_tela = 0; cotizacion5.porcentaje_tela = 0; } } else { tbCliente.Text = ""; tbTienda.Text = ""; tbTela.Text = ""; tbConf.Text = ""; tbLav.Text = ""; tbPres.Text = ""; tbAvios.Text = ""; tbFalt.Text = ""; tbTotal.Text = ""; //CLIENTE CONTROL USER cotizacion1.cliente = false; cotizacion2.cliente = false; cotizacion3.cliente = false; cotizacion4.cliente = false; cotizacion5.cliente = false; } } }
public Segundas GetSegundas(string cliente) { Segundas segundas = db.Segundas.Where(x => x.Cliente == cliente).FirstOrDefault(); return(segundas); }