コード例 #1
0
        public bool modificarDB(aca_Sede_Info info)
        {
            try
            {
                using (EntitiesAcademico Context = new EntitiesAcademico())
                {
                    aca_Sede Entity = Context.aca_Sede.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdSede == info.IdSede);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.IdEmpresa        = info.IdEmpresa;
                    Entity.IdSucursal       = info.IdSucursal;
                    Entity.NomSede          = info.NomSede;
                    Entity.NombreRector     = info.NombreRector;
                    Entity.NombreSecretaria = info.NombreSecretaria;
                    Entity.Direccion        = info.Direccion;

                    Entity.IdUsuarioModificacion = info.IdUsuarioModificacion;
                    Entity.FechaModificacion     = info.FechaModificacion = DateTime.Now;

                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public bool anularDB(aca_Sede_Info info)
        {
            try
            {
                using (EntitiesAcademico Context = new EntitiesAcademico())
                {
                    aca_Sede Entity = Context.aca_Sede.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdSede == info.IdSede);
                    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;
            }
        }
コード例 #3
0
        public bool guardarDB(aca_Sede_Info info)
        {
            try
            {
                using (EntitiesAcademico Context = new EntitiesAcademico())
                {
                    aca_Sede Entity = new aca_Sede
                    {
                        IdEmpresa         = info.IdEmpresa,
                        IdSucursal        = info.IdSucursal,
                        IdSede            = info.IdSede = get_id(info.IdEmpresa),
                        NomSede           = info.NomSede,
                        NombreRector      = info.NombreRector,
                        NombreSecretaria  = info.NombreSecretaria,
                        Direccion         = info.Direccion,
                        Estado            = true,
                        IdUsuarioCreacion = info.IdUsuarioCreacion,
                        FechaCreacion     = info.FechaCreacion = DateTime.Now
                    };
                    Context.aca_Sede.Add(Entity);

                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }