Exemplo n.º 1
0
 private bool UpdateDatos(int pId)
 {
     try
     {
         using (var db = new PosDbEntities())
         {
             var buscaObjeto = db.SERVICIOS.FirstOrDefault(c => c.ID == pId);
             if (buscaObjeto == null)
             {
                 return(false);
             }
             buscaObjeto.CODIGO      = Codigo;// Convert.ToDateTime(txtfechanacimiento.Text);
             buscaObjeto.NOMBRE      = Nombre;
             buscaObjeto.DESCRIPCION = Descripcion;
             // buscaObjeto.PRECIO = Convert.ToDecimal( txtPrecio.Text);
             buscaObjeto.NOTAS = Notas;
             // buscaObjeto.COSTO = Convert.ToDecimal(txtCosto.Text);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 2
0
        private bool InsertDatos(int pId)
        {
            //UploadFile(fuImagen);
            // int autor = Convert.ToInt32(Session["userAutor"]);
            //   int userID = Convert.ToInt32(Session["userId"]);

            //  int sucursal = Convert.ToInt32(Session["usrSucursal"]);
            //Creando los datos generales del socio en la tabla personas
            try
            {
                using (var db = new PosDbEntities())
                {
                    var datosObjeto = new SERVICIOS
                    {
                        CODIGO      = Codigo,
                        BARCODE     = BarCode,
                        CATEGORIAID = Categoriaid,
                        NOMBRE      = Nombre,
                        DESCRIPCION = Descripcion,
                        NOTAS       = Notas,
                        AUTORID     = Autorid,
                        SUCURSALID  = Sucursalid
                    };
                    // IMAGEN = fuImagen.FileName
                    //  PRECIO = Convert.ToDecimal(txtPrecio.Text),
                    //
                    //   COSTO = Convert.ToDecimal(txtCosto.Text),
                    // STOCK = Convert.ToInt32(txtStock.Text),
                    db.SERVICIOS.Add(datosObjeto);
                    db.SaveChanges();
                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }