예제 #1
0
        private static bool GuardarDetalle(RentasDetalles Detalle)
        {
            bool     paso = false;
            Contexto db   = new Contexto();

            try
            {
                if (db.Rentadetalle.Add(Detalle) != null)
                {
                    db.SaveChanges();
                    paso = true;
                }
            }
            catch (Exception)
            { throw; }
            finally
            { db.Dispose(); }
            return(paso);
        }
예제 #2
0
        protected void DetalleGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int id = Convert.ToInt32(DetalleGridView.DataKeys[e.RowIndex].Values[0]);

            if (id == 0)
            {
                detalles.RemoveRange(id, id);
                DetalleGridView.DataSource = detalles;
                DetalleGridView.DataBind();
            }
            else
            {
                RentasDetalles d = repositorioDetalle.Buscar(id);
                repositorioDetalle.Eliminar(d.DetalleId);
            }

            DetalleGridView.EditIndex  = -1;
            ViewState["Renta"]         = detalles;
            DetalleGridView.DataSource = detalles;
            DetalleGridView.DataBind();
        }
예제 #3
0
        public bool GuardarDetalle(RentasDetalles detalle)
        {
            bool paso = false;

            _contexto = new DAL.Contexto();
            try
            {
                if (_contexto.Rentadetalle.Add(detalle) != null)
                {
                    _contexto.SaveChanges();

                    paso = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                _contexto.Dispose();
            }
            return(paso);
        }