Ejemplo n.º 1
0
        public bool anularDB(ro_horario_Info info)
        {
            try
            {
                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    ro_horario Entity = Context.ro_horario.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdHorario == info.IdHorario);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.Estado = "I";

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

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
 public bool guardarDB(ro_horario_Info info)
 {
     try
     {
         using (Entities_rrhh Context = new Entities_rrhh())
         {
             ro_horario Entity = new ro_horario
             {
                 IdEmpresa          = info.IdEmpresa,
                 IdHorario          = get_id(info.IdEmpresa),
                 HoraFin            = info.HoraFin,
                 HoraIni            = info.HoraIni,
                 SalLunch           = info.SalLunch,
                 RegLunch           = info.RegLunch,
                 ToleranciaEnt      = info.ToleranciaEnt,
                 ToleranciaReg_lunh = info.ToleranciaReg_lunh,
                 Descripcion        = info.Descripcion,
                 Estado             = "A",
                 IdUsuario          = info.IdUsuario,
                 Fecha_Transac      = DateTime.Now
             };
             Context.ro_horario.Add(Entity);
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 3
0
        public bool modificarDB(ro_horario_Info info)
        {
            try
            {
                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    ro_horario Entity = Context.ro_horario.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdHorario == info.IdHorario);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.HoraFin            = info.HoraFin;
                    Entity.HoraIni            = info.HoraIni;
                    Entity.SalLunch           = info.SalLunch;
                    Entity.RegLunch           = info.RegLunch;
                    Entity.ToleranciaEnt      = info.ToleranciaEnt;
                    Entity.ToleranciaReg_lunh = info.ToleranciaReg_lunh;
                    Entity.Descripcion        = info.Descripcion;
                    Entity.IdUsuarioUltMod    = info.IdUsuarioUltMod;
                    Entity.Fecha_UltMod       = info.Fecha_UltMod = DateTime.Now;
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 4
0
        public Boolean GuardarDB(ro_Horario_Info Item, ref decimal Id, ref string mensaje)
        {
            try
            {
                using (EntitiesRoles Context = new EntitiesRoles())
                {
                    ro_horario infoHorario = new ro_horario();

                    infoHorario.IdEmpresa     = Item.IdEmpresa;
                    infoHorario.IdHorario     = Id = GetIdHorario(Item.IdEmpresa);
                    infoHorario.HoraIni       = Item.HoraIni;
                    infoHorario.HoraFin       = Item.HoraFin;
                    infoHorario.ToleranciaEnt = Item.ToleranciaEnt;
                    infoHorario.ToleranciaSal = Item.ToleranciaSal;
                    infoHorario.InicioEntrada = Item.InicioEntrada;
                    infoHorario.FinalEntrada  = Item.FinalEntrada;
                    infoHorario.InicioSal     = Item.InicioSal;
                    infoHorario.FinalSalida   = Item.FinalSalida;
                    infoHorario.SalLunch      = Item.SalLunch;
                    infoHorario.RegLunch      = Item.RegLunch;
                    infoHorario.IdUsuario     = Item.IdUsuario;
                    infoHorario.Fecha_Transac = DateTime.Now;
                    infoHorario.MinLunch      = Item.Min_Almuerzo;
                    //infoHorario.TotalHoras = Item.TotalHoras;
                    infoHorario.Tolerancia_Hora   = Item.Tolerancia_Hora;
                    infoHorario.Tolerancia_Minuto = Item.Tolerancia_Minuto;
                    infoHorario.Estado            = Item.Estado;
                    infoHorario.Descripcion       = Item.Descripcion;


                    Context.ro_horario.Add(infoHorario);
                    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());
            }
        }
Ejemplo n.º 5
0
        public ro_horario_Info get_info(int IdEmpresa, int IdHorario)
        {
            try
            {
                ro_horario_Info info = new ro_horario_Info();

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

                    info = new ro_horario_Info
                    {
                        IdEmpresa          = Entity.IdEmpresa,
                        IdHorario          = Entity.IdHorario,
                        HoraFin            = Entity.HoraFin,
                        HoraIni            = Entity.HoraIni,
                        SalLunch           = Entity.SalLunch,
                        RegLunch           = Entity.RegLunch,
                        ToleranciaEnt      = Entity.ToleranciaEnt,
                        ToleranciaReg_lunh = Entity.ToleranciaReg_lunh,
                        Estado             = Entity.Estado,
                        Descripcion        = Entity.Descripcion
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }