public static bool Crear(T_GUQ_RESERVA_SALA_OPERACIÓN reserva)
        {
            bool exito = false;

            try
            {
                RicardoPalmaEntities db = new RicardoPalmaEntities();
                db.T_GUQ_RESERVA_SALA_OPERACIÓN.Add(reserva);
                db.SaveChanges();
                exito = true;
            }
            catch (Exception ex)
            {
                exito = false;
                Bitacora.CrearLog("Error al crear la reserva", TipoLog.Error, ex);
            }
            return(exito);
        }
Exemple #2
0
        public static bool Crear(T_GUQ_PRESUPUESTO_PARTIDA presupuestoPartida)
        {
            bool exito = false;

            try
            {
                RicardoPalmaEntities db = new RicardoPalmaEntities();

                db.T_GUQ_PRESUPUESTO_PARTIDA.Add(presupuestoPartida);
                db.SaveChanges();
                exito = true;
            }
            catch (Exception ex)
            {
                exito = false;
                Bitacora.CrearLog("Error al crear el presupuesto", TipoLog.Error, ex);
            }
            return(exito);
        }
Exemple #3
0
        public static bool Crear(T_GUQ_PRESUPUESTO presupuesto, List <T_GUQ_PARTIDA> listaPartidas, List <double> listaMontos)
        {
            bool exito = false;

            try
            {
                RicardoPalmaEntities      db = new RicardoPalmaEntities();
                T_GUQ_PRESUPUESTO_PARTIDA PresupuestoPartida;


                presupuesto.estado = "Generado";
                for (int i = 0; i < listaPartidas.Count(); i++)
                {
                    PresupuestoPartida              = new T_GUQ_PRESUPUESTO_PARTIDA();
                    PresupuestoPartida.idPartida    = listaPartidas[i].idPartida;
                    PresupuestoPartida.montoPartida = listaMontos[i];
                    presupuesto.monto = presupuesto.monto + listaMontos[i];
                    presupuesto.T_GUQ_PRESUPUESTO_PARTIDA.Add(PresupuestoPartida);
                }

                db.Entry(presupuesto).State = EntityState.Added;
                //  db.T_GUQ_PRESUPUESTO.Add(presupuesto);

                for (int i = 0; i < listaPartidas.Count(); i++)
                {
                    db.Entry(listaPartidas[i]).State = EntityState.Unchanged;
                }

                db.SaveChanges();
                exito = true;
            }

            catch (Exception ex)
            {
                exito = false;
                Bitacora.CrearLog("Error al crear el presupuesto", TipoLog.Error, ex);
            }
            return(exito);
        }