Exemplo n.º 1
0
        public bool anularDB(aca_Jornada_Info info)
        {
            try
            {
                using (EntitiesAcademico Context = new EntitiesAcademico())
                {
                    aca_Jornada Entity = Context.aca_Jornada.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdJornada == info.IdJornada);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.Estado             = info.Estado = false;
                    Entity.MotivoAnulacion    = info.MotivoAnulacion;
                    Entity.IdUsuarioAnulacion = info.IdUsuarioAnulacion;
                    Entity.FechaAnulacion     = info.FechaAnulacion = DateTime.Now;
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public aca_Jornada_Info getInfo(int IdEmpresa, int IdJornada)
        {
            try
            {
                aca_Jornada_Info info;

                using (EntitiesAcademico db = new EntitiesAcademico())
                {
                    var Entity = db.aca_Jornada.Where(q => q.IdEmpresa == IdEmpresa && q.IdJornada == IdJornada).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(null);
                    }

                    info = new aca_Jornada_Info
                    {
                        IdEmpresa    = Entity.IdEmpresa,
                        IdJornada    = Entity.IdJornada,
                        NomJornada   = Entity.NomJornada,
                        OrdenJornada = Entity.OrdenJornada,
                        Estado       = Entity.Estado
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 3
0
        public bool guardarDB(aca_Jornada_Info info)
        {
            try
            {
                using (EntitiesAcademico Context = new EntitiesAcademico())
                {
                    aca_Jornada Entity = new aca_Jornada
                    {
                        IdEmpresa         = info.IdEmpresa,
                        IdJornada         = info.IdJornada = getId(info.IdEmpresa),
                        NomJornada        = info.NomJornada,
                        OrdenJornada      = info.OrdenJornada,
                        Estado            = true,
                        IdUsuarioCreacion = info.IdUsuarioCreacion,
                        FechaCreacion     = info.FechaCreacion = DateTime.Now
                    };
                    Context.aca_Jornada.Add(Entity);

                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 4
0
        public bool modificarDB(aca_Jornada_Info info)
        {
            try
            {
                using (EntitiesAcademico Context = new EntitiesAcademico())
                {
                    aca_Jornada Entity = Context.aca_Jornada.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdJornada == info.IdJornada);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.IdEmpresa             = info.IdEmpresa;
                    Entity.NomJornada            = info.NomJornada;
                    Entity.OrdenJornada          = info.OrdenJornada;
                    Entity.IdUsuarioModificacion = info.IdUsuarioModificacion;
                    Entity.FechaModificacion     = info.FechaModificacion = DateTime.Now;

                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 5
0
 public ActionResult Nuevo(aca_Jornada_Info model)
 {
     model.IdUsuarioCreacion = SessionFixed.IdUsuario;
     if (!bus_jornada.GuardarDB(model))
     {
         return(View(model));
     }
     return(RedirectToAction("Index"));
 }
Exemplo n.º 6
0
        public ActionResult Modificar(aca_Jornada_Info model)
        {
            model.IdUsuarioModificacion = SessionFixed.IdUsuario;
            if (!bus_jornada.ModificarDB(model))
            {
                return(View(model));
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 7
0
 public bool AnularDB(aca_Jornada_Info info)
 {
     try
     {
         return(odata.anularDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 8
0
 public bool ModificarDB(aca_Jornada_Info info)
 {
     try
     {
         return(odata.modificarDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 9
0
        public ActionResult Modificar(int IdEmpresa = 0, int IdJornada = 0)
        {
            #region Validar Session
            if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession))
            {
                return(RedirectToAction("Login", new { Area = "", Controller = "Account" }));
            }
            SessionFixed.IdTransaccionSession       = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString();
            SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession;
            #endregion

            aca_Jornada_Info model = bus_jornada.GetInfo(IdEmpresa, IdJornada);
            if (model == null)
            {
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Exemplo n.º 10
0
        public ActionResult Nuevo(int IdEmpresa = 0)
        {
            #region Validar Session
            if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession))
            {
                return(RedirectToAction("Login", new { Area = "", Controller = "Account" }));
            }
            SessionFixed.IdTransaccionSession       = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString();
            SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession;
            #endregion
            var orden = bus_jornada.GetOrden(Convert.ToInt32(SessionFixed.IdEmpresa));
            aca_Jornada_Info model = new aca_Jornada_Info
            {
                IdEmpresa    = IdEmpresa,
                OrdenJornada = orden
            };

            return(View(model));
        }
Exemplo n.º 11
0
        public ActionResult Index()
        {
            #region Validar Session
            if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession))
            {
                return(RedirectToAction("Login", new { Area = "", Controller = "Account" }));
            }
            SessionFixed.IdTransaccionSession       = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString();
            SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession;
            #endregion

            aca_Jornada_Info model = new aca_Jornada_Info
            {
                IdEmpresa            = Convert.ToInt32(SessionFixed.IdEmpresa),
                IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession)
            };

            List <aca_Jornada_Info> lista = bus_jornada.GetList(model.IdEmpresa, true);
            Lista_Jornada.set_list(lista, Convert.ToDecimal(SessionFixed.IdTransaccionSession));

            return(View(model));
        }