예제 #1
0
        public aca_Paralelo_Info getInfo(int IdEmpresa, int IdParalelo)
        {
            try
            {
                aca_Paralelo_Info info;

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

                    info = new aca_Paralelo_Info
                    {
                        IdEmpresa      = Entity.IdEmpresa,
                        IdParalelo     = Entity.IdParalelo,
                        CodigoParalelo = Entity.CodigoParalelo,
                        NomParalelo    = Entity.NomParalelo,
                        OrdenParalelo  = Entity.OrdenParalelo,
                        Estado         = Entity.Estado
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #2
0
        public bool modificarDB(aca_Paralelo_Info info)
        {
            try
            {
                using (EntitiesAcademico Context = new EntitiesAcademico())
                {
                    aca_Paralelo Entity = Context.aca_Paralelo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdParalelo == info.IdParalelo);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.IdEmpresa             = info.IdEmpresa;
                    Entity.NomParalelo           = info.NomParalelo;
                    Entity.OrdenParalelo         = info.OrdenParalelo;
                    Entity.IdUsuarioModificacion = info.IdUsuarioModificacion;
                    Entity.FechaModificacion     = info.FechaModificacion = DateTime.Now;

                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #3
0
        public bool anularDB(aca_Paralelo_Info info)
        {
            try
            {
                using (EntitiesAcademico Context = new EntitiesAcademico())
                {
                    aca_Paralelo Entity = Context.aca_Paralelo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdParalelo == info.IdParalelo);
                    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;
            }
        }
예제 #4
0
        public bool guardarDB(aca_Paralelo_Info info)
        {
            try
            {
                using (EntitiesAcademico Context = new EntitiesAcademico())
                {
                    aca_Paralelo Entity = new aca_Paralelo
                    {
                        IdEmpresa         = info.IdEmpresa,
                        IdParalelo        = info.IdParalelo = getId(info.IdEmpresa),
                        NomParalelo       = info.NomParalelo,
                        CodigoParalelo    = info.CodigoParalelo,
                        OrdenParalelo     = info.OrdenParalelo,
                        Estado            = true,
                        IdUsuarioCreacion = info.IdUsuarioCreacion,
                        FechaCreacion     = info.FechaCreacion = DateTime.Now
                    };
                    Context.aca_Paralelo.Add(Entity);

                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #5
0
        public ActionResult Anular(aca_Paralelo_Info model)
        {
            model.IdUsuarioAnulacion = SessionFixed.IdUsuario;
            if (!bus_paralelo.AnularDB(model))
            {
                return(View(model));
            }

            return(RedirectToAction("Index"));
        }
예제 #6
0
 public bool AnularDB(aca_Paralelo_Info info)
 {
     try
     {
         return(odata.anularDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #7
0
 public bool ModificarDB(aca_Paralelo_Info info)
 {
     try
     {
         return(odata.modificarDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #8
0
        private bool validar(aca_Paralelo_Info info, ref string msg)
        {
            var existe = bus_paralelo.ExisteCodigo(info.IdEmpresa, info.CodigoParalelo);

            if (existe != null || existe.IdParalelo > 0)
            {
                msg = "El código del paralelo ya existe";
                return(false);
            }

            return(true);
        }
예제 #9
0
        public ActionResult Nuevo(aca_Paralelo_Info model)
        {
            model.IdUsuarioCreacion = SessionFixed.IdUsuario;

            if (!validar(model, ref mensaje))
            {
                ViewBag.mensaje = mensaje;
                return(View(model));
            }

            if (!bus_paralelo.GuardarDB(model))
            {
                return(View(model));
            }

            return(RedirectToAction("Index"));
        }
예제 #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_paralelo.GetOrden(Convert.ToInt32(SessionFixed.IdEmpresa));
            aca_Paralelo_Info model = new aca_Paralelo_Info
            {
                IdEmpresa     = IdEmpresa,
                OrdenParalelo = orden
            };

            return(View(model));
        }
예제 #11
0
        public ActionResult Modificar(int IdEmpresa = 0, int IdParalelo = 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_Paralelo_Info model = bus_paralelo.GetInfo(IdEmpresa, IdParalelo);
            if (model == null)
            {
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
예제 #12
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_Paralelo_Info model = new aca_Paralelo_Info
            {
                IdEmpresa            = Convert.ToInt32(SessionFixed.IdEmpresa),
                IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession)
            };

            List <aca_Paralelo_Info> lista = bus_paralelo.GetList(model.IdEmpresa, true);
            Lista_Paralelo.set_list(lista, Convert.ToDecimal(SessionFixed.IdTransaccionSession));

            return(View(model));
        }