示例#1
0
        public Boolean GuardarDB(ref ro_area_Info Info)
        {
            try
            {
                List <ro_area_Info> Lst = new List <ro_area_Info>();
                using (EntitiesRoles Context = new EntitiesRoles())
                {
                    var Address = new ro_area();

                    Address.IdEmpresa       = Info.IdEmpresa;
                    Address.IdDivision      = Info.IdDivision;
                    Info.IdArea             = Address.IdArea = getId(Info.IdEmpresa, Info.IdDivision);
                    Address.estado          = "A";
                    Address.Descripcion     = Info.Descripcion;
                    Address.IdUsuario       = Info.IdUsuario;
                    Address.Fecha_Transac   = Info.FechaTransac;
                    Address.IdUsuarioUltMod = Info.IdUsuarioUltModi;
                    Address.Fecha_UltMod    = Info.FechaUltModi;

                    Context.ro_area.Add(Address);
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.InnerException.ToString());
            }
        }
示例#2
0
        public ro_area_Info get_info(int IdEmpresa, int IdArea)
        {
            try
            {
                ro_area_Info info = new ro_area_Info();

                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    ro_area Entity = Context.ro_area.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdArea == IdArea);
                    if (Entity == null)
                    {
                        return(null);
                    }

                    info = new ro_area_Info
                    {
                        IdEmpresa   = Entity.IdEmpresa,
                        IdArea      = Entity.IdArea,
                        Descripcion = Entity.Descripcion,
                        IdDivision  = Entity.IdDivision,
                        estado      = Entity.estado,
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#3
0
        public bool modificarDB(ro_area_Info info)
        {
            try
            {
                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    ro_area Entity = Context.ro_area.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdArea == info.IdArea);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.IdDivision      = info.IdDivision;
                    Entity.Descripcion     = info.Descripcion;
                    Entity.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    Entity.Fecha_UltMod    = info.Fecha_UltMod = DateTime.Now;
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#4
0
        public bool anularDB(ro_area_Info info)
        {
            try
            {
                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    ro_area Entity = Context.ro_area.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdArea == info.IdArea);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.estado = info.estado = "I";

                    Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                    Entity.Fecha_UltAnu    = info.Fecha_UltAnu = DateTime.Now;
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#5
0
 public bool guardarDB(ro_area_Info info)
 {
     try
     {
         using (Entities_rrhh Context = new Entities_rrhh())
         {
             ro_area Entity = new ro_area
             {
                 IdEmpresa     = info.IdEmpresa,
                 IdDivision    = info.IdDivision,
                 IdArea        = info.IdArea = get_id(info.IdEmpresa),
                 Descripcion   = info.Descripcion,
                 estado        = info.estado = "A",
                 IdUsuario     = info.IdUsuario,
                 Fecha_Transac = info.Fecha_Transac = DateTime.Now
             };
             Context.ro_area.Add(Entity);
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }