Пример #1
0
        public bool si_Existe(int IdEmpresa, int idnomina_tipo, decimal idempleado)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    var query = from q in db.ro_empleado_x_parametro_x_pago_variable
                                where
                                q.IdEmpresa == IdEmpresa &&
                                q.IdNomina_Tipo == idnomina_tipo &&
                                q.IdEmpleado == idempleado
                                select q;

                    if (query.Count() > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #2
0
        public bool si_existe_planificacion(int IdEmpresa, int IdNomina_tipo, int IdPeriodo, int?IdDivision)
        {
            try
            {
                List <ro_planificacion_x_jornada_desfasada_Info> lista = new List <ro_planificacion_x_jornada_desfasada_Info>();
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    var query = from q in db.vwro_planificacion_x_jornada_desfasada
                                where
                                q.IdEmpresa == IdEmpresa &&
                                q.IdNomina_Tipo == IdNomina_tipo &&
                                q.IdPeriodo == IdPeriodo &&
                                q.IdDivision == IdDivision
                                select q;

                    if (query.Count() > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #3
0
        public bool Modificar_DB(ro_planificacion_x_jornada_desfasada_Info Info)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    var add = db.ro_planificacion_x_jornada_desfasada.FirstOrDefault(v => v.IdEmpresa == Info.IdEmpresa && v.IdPeriodo == Info.IdPeriodo && v.IdDivision == Info.IdDivision);
                    if (add != null)
                    {
                        add.Observación     = Info.Observación;
                        add.Fecha_UltMod    = DateTime.Now;
                        add.IdDivision      = Info.IdDivision;
                        add.IdUsuarioUltMod = Info.IdUsuarioUltMod;
                        db.SaveChanges();
                        Info.IdPlanificacion = add.IdPlanificacion;
                    }


                    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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #4
0
        public bool Guardar_DB(ro_fectividad_Entrega_x_Periodo_Empleado_Info info, ref int IdEfectividad)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    ro_fectividad_Entrega_x_Periodo_Empleado add = new ro_fectividad_Entrega_x_Periodo_Empleado();
                    add.IdEmpresa         = info.IdEmpresa;
                    add.IdNomina_Tipo     = info.IdNomina_Tipo;
                    add.IdNomina_tipo_Liq = info.IdNomina_tipo_Liq;
                    add.IdEfectividad     = getId(info.IdEmpresa);
                    add.IdPeriodo         = info.IdPeriodo;
                    add.Observacion       = info.Observacion;
                    add.FechaTransac      = DateTime.Now;
                    add.IdUsuario         = info.IdUsuario;
                    add.Estado            = info.Estado;

                    db.ro_fectividad_Entrega_x_Periodo_Empleado.Add(add);
                    db.SaveChanges();
                    IdEfectividad = add.IdEfectividad;
                    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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #5
0
        public bool Anular_DB(ro_fectividad_Entrega_x_Periodo_Empleado_Info info)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    var add = db.ro_planificacion_x_ruta_x_empleado.FirstOrDefault(v => v.IdEmpresa == info.IdEmpresa && v.IdNomina_Tipo == info.IdNomina_Tipo && v.IdPeriodo == info.IdPeriodo);

                    add.Estado          = false;
                    add.Fecha_UltAnu    = DateTime.Now;
                    add.IdUsuarioUltAnu = info.IdUsuarioAnu;

                    db.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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #6
0
        public bool Anular_DB(List <ro_empleado_x_turno_Info> lista)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    foreach (var item in lista)
                    {
                        var add = db.ro_empleado_x_turno.FirstOrDefault(v => v.IdEmpresa == item.IdEmpresa &&
                                                                        v.IdPeriodo == item.IdPeriodo && v.IdEmpleado == item.IdEmpleado);
                        add.Estado = "I";
                        db.ro_empleado_x_turno.Add(add);
                        db.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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #7
0
        public Boolean EliminarDB(ro_marcaciones_x_empleado_x_incidentes_falt_Perm_Info item, ref string msg)
        {
            try
            {
                using (EntityRoles_FJ context = new EntityRoles_FJ())
                {
                    string sql1 = "delete Fj_servindustrias.ro_empleado_Novedad_x_horasExtras_Pendiente_Aprobar where IdEmpresa='" + item.IdEmpresa + "' and IdEmpleado='" + item.IdEmpleado + "' and IdRegistro='" + item.IdRegistro + "'";
                    context.Database.ExecuteSqlCommand(sql1);


                    string sql = "delete Fj_servindustrias.ro_marcaciones_x_empleado_x_incidentes_falt_Perm where IdEmpresa='" + item.IdEmpresa + "' and IdEmpleado='" + item.IdEmpleado + "' and IdRegistro='" + item.IdRegistro + "'";
                    context.Database.ExecuteSqlCommand(sql);
                }

                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);

                throw new Exception(ex.InnerException.ToString());
            }
        }
Пример #8
0
 public bool ModificarDB(ro_placa_Info Info, ref string mensaje)
 {
     try
     {
         using (EntityRoles_FJ Context = new EntityRoles_FJ())
         {
             ro_placa contact = Context.ro_placa.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdPlaca == Info.IdPlaca);
             if (contact != null)
             {
                 contact.Placa            = Info.Placa;
                 contact.IdUsuarioUltModi = Info.IdUsuarioUltModi;
                 contact.Fecha_UltMod     = DateTime.Now;
                 contact.nom_pc           = Info.nom_pc;
                 contact.ip = Info.ip;
                 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);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
 public int Get_Id(int IdEmpresa, ref string mensaje)
 {
     try
     {
         int            Id;
         EntityRoles_FJ db      = new EntityRoles_FJ();
         var            selecte = db.ro_fectividad_Entrega_tipoServicio.Count(q => q.IdEmpresa == IdEmpresa);
         if (selecte == 0)
         {
             Id = 1;
         }
         else
         {
             var select_em = (from q in db.ro_fectividad_Entrega_tipoServicio
                              where q.IdEmpresa == IdEmpresa
                              select q.IdServicio).Max();
             Id = Convert.ToInt32(select_em.ToString()) + 1;
         }
         return(Id);
     }
     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);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
 public bool Guardar_DB(List <ro_parametro_x_pago_variable_Det_Info> lista)
 {
     try
     {
         using (EntityRoles_FJ db = new EntityRoles_FJ())
         {
             foreach (var info in lista)
             {
                 ro_parametro_x_pago_variable_Det add = new ro_parametro_x_pago_variable_Det();
                 add.Idempresa             = info.Idempresa;
                 add.IdNomina_Tipo         = info.IdNomina_Tipo;
                 add.Id_Tipo_Pago_Variable = info.Id_Tipo_Pago_Variable;
                 add.Meta = info.Meta;
                 add.cod_Pago_Variable = info.cod_Pago_Variable;
                 add.Variable_porcentaje_prorrateado = info.Variable_porcentaje_prorrateado;
                 db.ro_parametro_x_pago_variable_Det.Add(add);
                 db.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);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         MensajeError = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
Пример #11
0
        public bool GuardarDB(ro_placa_Info Info, ref int IdPlaca, ref string mensaje)
        {
            try
            {
                IdPlaca = Get_Id(Info.IdEmpresa, ref mensaje);

                using (EntityRoles_FJ Context = new EntityRoles_FJ())
                {
                    ro_placa contact = new ro_placa();

                    contact.IdEmpresa         = Info.IdEmpresa;
                    contact.IdPlaca           = Info.IdPlaca = IdPlaca;
                    contact.Placa             = Info.Placa;
                    contact.Estado            = Info.Estado;
                    contact.IdUsuario         = Info.IdUsuario;
                    contact.Fecha_Transaccion = Info.Fecha_Transaccion;
                    contact.nom_pc            = Info.nom_pc;
                    contact.ip = Info.ip;

                    Context.ro_placa.Add(contact);
                    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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #12
0
        public bool Eliminar(int IdEmpresa, int IdActivo_fijo)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    db.Database.ExecuteSqlCommand("delete Fj_servindustrias.ro_empleado_x_Activo_Fijo where IdEmpresa =" + IdEmpresa
                                                  + " AND IdActivo_fijo=" + IdActivo_fijo

                                                  );


                    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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #13
0
 public bool Guardar_DB(ro_empleado_x_Activo_Fijo_Info info)
 {
     try
     {
         using (EntityRoles_FJ db = new EntityRoles_FJ())
         {
             ro_empleado_x_Activo_Fijo add = new ro_empleado_x_Activo_Fijo();
             add.IdEmpresa        = info.IdEmpresa;
             add.IdNomina_tipo    = info.IdNomina_tipo;
             add.IdPeriodo        = info.IdPeriodo;
             add.IdActivo_fijo    = info.IdActivo_fijo;
             add.IdEmpleado       = info.IdEmpleado;
             add.Fecha_Asignacion = info.Fecha_Asignacion;
             add.Fecha_Hasta      = info.Fecha_Hasta;
             db.ro_empleado_x_Activo_Fijo.Add(add);
             db.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);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         MensajeError = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
Пример #14
0
 public bool Guardar_DB(ro_empleado_x_parametro_x_pago_variable_Info info)
 {
     try
     {
         if (!si_Existe(info.IdEmpresa, info.IdNomina_Tipo, info.IdEmpleado))
         {
             using (EntityRoles_FJ db = new EntityRoles_FJ())
             {
                 ro_empleado_x_parametro_x_pago_variable add = new ro_empleado_x_parametro_x_pago_variable();
                 add.IdEmpresa         = info.IdEmpresa;
                 add.IdNomina_Tipo     = info.IdNomina_Tipo;;
                 add.IdEmpleado        = info.IdEmpleado;
                 add.IdUsuario         = info.IdUsuario;
                 add.Fecha_Transaccion = DateTime.Now;
                 add.Estado            = true;
                 db.ro_empleado_x_parametro_x_pago_variable.Add(add);
                 db.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);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         MensajeError = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
Пример #15
0
 public bool Modificar_DB(List <ro_Grupo_empleado_det_Info> lista)
 {
     try
     {
         int sec = 0;
         using (EntityRoles_FJ db = new EntityRoles_FJ())
         {
             foreach (var info in lista)
             {
                 if (sec == 0)
                 {
                     db.Database.ExecuteSqlCommand("delete Fj_servindustrias.ro_Grupo_empleado_det where IdEmpresa='" + info.IdEmpresa + "' and IdGrupo='" + info.IdGrupo + "' ");
                 }
                 sec++;
                 ro_Grupo_empleado_det add = new ro_Grupo_empleado_det();
                 add.IdEmpresa          = info.IdEmpresa;
                 add.IdGrupo            = info.IdGrupo;
                 add.cod_Pago_Variable  = info.cod_Pago_Variable;
                 add.Porcentaje_calculo = info.Porcentaje_calculo;
                 db.ro_Grupo_empleado_det.Add(add);
                 db.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);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         MensajeError = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
        public bool ModificarDB(ro_fectividad_Entrega_tipoServicio_Info Info, ref string mensaje)
        {
            try
            {
                using (EntityRoles_FJ Context = new EntityRoles_FJ())
                {
                    ro_fectividad_Entrega_tipoServicio contact = Context.ro_fectividad_Entrega_tipoServicio.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdServicio == Info.IdServicio);
                    if (contact != null)
                    {
                        contact.ts_Descripcion = Info.ts_Descripcion;
                        contact.ts_codigo      = Info.ts_codigo;
                        contact.Porcentaje     = Info.Porcentaje;

                        contact.Efectividad_entrega  = Info.Efectividad_entrega;
                        contact.Efectividad_volumen  = Info.Efectividad_volumen;
                        contact.Recuperacion_cartera = Info.Recuperacion_cartera;
                        contact.Genera_novedad       = Info.Genera_novedad;

                        contact.IdUsuarioUltModi = Info.IdUsuarioUltModi;
                        contact.Fecha_UltMod     = DateTime.Now;
                        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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #17
0
 public bool Guardar_DB(ro_empleado_x_turno_Info info)
 {
     try
     {
         using (EntityRoles_FJ db = new EntityRoles_FJ())
         {
             ro_empleado_x_turno add = new ro_empleado_x_turno();
             add.IdEmpresa     = info.IdEmpresa;
             add.IdNomina_Tipo = info.IdNomina_Tipo;
             add.IdEmpleado    = info.IdEmpleado;
             add.IdPeriodo     = info.IdPeriodo;
             add.IdTurno       = info.IdTurno;
             add.Observacion   = info.Observacion;
             add.IdUsuario     = info.IdUsuario;
             add.Fecha_Transac = DateTime.Now;
             add.Estado        = "A";
             db.ro_empleado_x_turno.Add(add);
             db.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);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         MensajeError = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
Пример #18
0
        public bool ModificarDB(List <ro_empleado_Novedad_x_horasExtras_Pendiente_Aprobar_Info> lista)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    foreach (var item in lista)
                    {
                        var modifi = db.ro_empleado_Novedad_x_horasExtras_Pendiente_Aprobar.FirstOrDefault(v => v.IdEmpresa == item.IdEmpresa && v.IdEmpleado == item.IdEmpleado && v.IdRegistro == item.IdRegistro);
                        if (modifi != null)
                        {
                            modifi.Estado_aprobacion = true;
                            db.SaveChanges();
                        }
                    }
                }

                return(true);
            }
            catch (DbEntityValidationException ex)
            {
                string array = 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(), "", array, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
Пример #19
0
        public Boolean ModificarDB(ro_marcaciones_x_empleado_x_incidentes_falt_Perm_Info item, ref string msg)
        {
            try
            {
                using (EntityRoles_FJ context = new EntityRoles_FJ())
                {
                    var contact = context.ro_marcaciones_x_empleado_x_incidentes_falt_Perm.First(obj => obj.IdEmpresa == item.IdEmpresa &&
                                                                                                 obj.IdEmpleado == item.IdEmpleado &&
                                                                                                 obj.IdRegistro == item.IdRegistro);

                    contact.Id_catalogo_Cat = item.Id_catalogo_Cat;

                    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);

                throw new Exception(ex.InnerException.ToString());
            }
        }
Пример #20
0
 public bool GuardarDB(ro_empleado_Novedad_x_horasExtras_Pendiente_Aprobar_Info info)
 {
     try
     {
         using (EntityRoles_FJ db = new EntityRoles_FJ())
         {
             ro_empleado_Novedad_x_horasExtras_Pendiente_Aprobar add = new ro_empleado_Novedad_x_horasExtras_Pendiente_Aprobar();
             add.IdEmpleado        = info.IdEmpleado;
             add.IdNomina_Tipo     = info.IdNomina;
             add.IdEmpresa         = info.IdEmpresa;
             add.IdRegistro        = info.IdRegistro;
             add.IdRubro           = info.IdRubro;
             add.es_fecha_registro = info.es_fecha_registro;
             add.Num_horasExtras   = info.Num_horasExtras;
             add.Observacion       = info.Observacion;
             add.Estado_aprobacion = false;
             db.ro_empleado_Novedad_x_horasExtras_Pendiente_Aprobar.Add(add);
             db.SaveChanges();
             return(true);
         }
     }
     catch (DbEntityValidationException ex)
     {
         string array = 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(), "", array, "", "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.InnerException + " " + ex.Message;
         throw new Exception(ex.InnerException.ToString());
     }
 }
Пример #21
0
 public bool Si_existe(int IdEmpresa, int idNomina_tipo, int IdPeriodo)
 {
     try
     {
         List <ro_fectividad_Entrega_x_Periodo_Empleado_Info> lista = new List <ro_fectividad_Entrega_x_Periodo_Empleado_Info>();
         using (EntityRoles_FJ db = new EntityRoles_FJ())
         {
             var query = from q in db.ro_fectividad_Entrega_x_Periodo_Empleado
                         where
                         q.IdEmpresa == IdEmpresa &&
                         q.IdNomina_Tipo == idNomina_tipo &&
                         q.IdPeriodo == IdPeriodo
                         select q;
             if (query.Count() > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     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);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         MensajeError = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
Пример #22
0
        public int GetId(int IdEmpresa)
        {
            try
            {
                using (EntityRoles_FJ database = new EntityRoles_FJ())
                {
                    var query = (from i in database.ro_fectividad_Entrega_x_Periodo_Empleado
                                 where i.IdEmpresa == IdEmpresa
                                 select i);

                    if (query.Count() == 0)
                    {
                        return(1);
                    }
                    else
                    {
                        var query_ = (from i in database.ro_fectividad_Entrega_x_Periodo_Empleado
                                      where i.IdEmpresa == IdEmpresa
                                      select i.IdEfectividad).Count();
                        return(query.Count() + 1);
                    }
                }
            }
            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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #23
0
        public int getId(int IdEmpresa)
        {
            try
            {
                int            Id;
                EntityRoles_FJ OEEmpleado = new EntityRoles_FJ();
                var            select     = from q in OEEmpleado.ro_fectividad_Entrega_x_Periodo_Empleado
                                            where q.IdEmpresa == IdEmpresa
                                            select q;

                if (select.Count() == 0)
                {
                    Id = 1;
                }
                else
                {
                    var select_em = (from q in OEEmpleado.ro_fectividad_Entrega_x_Periodo_Empleado
                                     where q.IdEmpresa == IdEmpresa
                                     select q.IdEfectividad).Max();
                    Id = Convert.ToInt32(select_em) + 1;
                }
                return(Id);
            }
            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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
 public int Get_Id(int IdEmpresa, int IdTipo_Nomina, ref string mensaje)
 {
     try
     {
         int            Id;
         EntityRoles_FJ db      = new EntityRoles_FJ();
         var            selecte = db.ro_Calculo_Pago_Variable_Porcentaje.Count(q => q.IdEmpresa == IdEmpresa && q.IdTipo_Nomina == IdTipo_Nomina);
         if (selecte == 0)
         {
             Id = 1;
         }
         else
         {
             var select_em = (from q in db.ro_Calculo_Pago_Variable_Porcentaje
                              where q.IdEmpresa == IdEmpresa &&
                              q.IdTipo_Nomina == IdTipo_Nomina
                              select q.IdEfectividad).Max();
             Id = Convert.ToInt32(select_em.ToString()) + 1;
         }
         return(Id);
     }
     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);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
Пример #25
0
        public bool Cerrar_Planificacion(ro_planificacion_x_jornada_desfasada_Info Info)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    var add = db.ro_planificacion_x_jornada_desfasada.FirstOrDefault(v => v.IdEmpresa == Info.IdEmpresa && v.IdPeriodo == Info.IdPeriodo && v.IdNomina_Tipo == Info.IdNomina_Tipo);
                    add.Esta_Proceso    = "CERRADO";
                    add.Fecha_UltMod    = DateTime.Now;
                    add.IdUsuarioUltMod = Info.IdUsuarioUltMod;
                    db.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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
        public bool AnularDB(ro_Calculo_Pago_Variable_Porcentaje_Info Info, ref string mensaje)
        {
            try
            {
                using (EntityRoles_FJ Context = new EntityRoles_FJ())
                {
                    ro_Calculo_Pago_Variable_Porcentaje contact = Context.ro_Calculo_Pago_Variable_Porcentaje.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdTipo_Nomina == Info.IdTipo_Nomina && q.IdTipoServicio == Info.IdTipoServicio);
                    if (contact != null)
                    {
                        contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                        contact.Fecha_UltAnu    = Info.Fecha_UltAnu;
                        contact.MotivoAnulacion = Info.MotivoAnulacion;
                        contact.Estado          = false;

                        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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #27
0
 public int Get_Id(int IdEmpresa)
 {
     try
     {
         int            Id;
         EntityRoles_FJ db      = new EntityRoles_FJ();
         var            selecte = db.ro_planificacion_x_jornada_desfasada.Count(q => q.IdEmpresa == IdEmpresa);
         if (selecte == 0)
         {
             Id = 1;
         }
         else
         {
             var select_em = (from q in db.ro_planificacion_x_jornada_desfasada
                              where q.IdEmpresa == IdEmpresa
                              select q.IdPlanificacion).Max();
             Id = Convert.ToInt32(select_em.ToString()) + 1;
         }
         return(Id);
     }
     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);
         throw new Exception(ex.ToString());
     }
 }
Пример #28
0
 public bool Guardar_DB(List <ro_Grupo_empleado_det_Info> lista)
 {
     try
     {
         using (EntityRoles_FJ db = new EntityRoles_FJ())
         {
             foreach (var item in lista)
             {
                 ro_Grupo_empleado_det add = new ro_Grupo_empleado_det();
                 add.IdEmpresa         = item.IdEmpresa;
                 add.IdGrupo           = item.IdGrupo;
                 add.cod_Pago_Variable = item.cod_Pago_Variable;
                 //add.Valor = item.Valor;
                 //  add.Observacion = item.Observacion;
                 db.ro_Grupo_empleado_det.Add(add);
                 db.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);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         MensajeError = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
Пример #29
0
        public bool Anular_DB(ro_planificacion_x_jornada_desfasada_Info info)
        {
            try
            {
                using (EntityRoles_FJ db = new EntityRoles_FJ())
                {
                    string SQL = "";
                    SQL = " delete Fj_servindustrias.ro_planificacion_x_jornada_desfasada_empleado where IdEmpresa='" + info.IdEmpresa + "'  and IdNomina_Tipo='" + info.IdNomina_Tipo + "'  and IdPeriodo='" + info.IdPeriodo + "' and IdPlanificacion='" + info.IdPlanificacion + "'";

                    db.Database.ExecuteSqlCommand(SQL);

                    SQL = " delete Fj_servindustrias.ro_planificacion_x_jornada_desfasada where IdEmpresa='" + info.IdEmpresa + "'  and IdNomina_Tipo='" + info.IdNomina_Tipo + "'  and IdPeriodo='" + info.IdPeriodo + "' and IdPlanificacion='" + info.IdPlanificacion + "'";

                    db.Database.ExecuteSqlCommand(SQL);


                    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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
 public bool Anular_DB(ro_fectividad_Entrega_x_Periodo_Empleado_Info info)
 {
     try
     {
         using (EntityRoles_FJ db = new EntityRoles_FJ())
         {
             string IdCalendario = info.IdCalendario;
             string DeteNov      = "delete ro_empleado_novedad_det where idempresa='" + info.IdEmpresa + "' and IdCalendario like '" + IdCalendario + "'";
             string CabeNov      = "delete ro_empleado_novedad where idempresa='" + info.IdEmpresa + "' and IdCalendario like '" + IdCalendario + "'";
             string DeteEfec     = "delete fj_servindustrias.ro_fectividad_Entrega_x_Periodo_Empleado_Det where idempresa='" + info.IdEmpresa + "' and IdPeriodo = '" + info.IdPeriodo + "' and IdEfectividad='" + info.IdEfectividad + "'";
             string CabeEfec     = "delete fj_servindustrias.ro_fectividad_Entrega_x_Periodo_Empleado where idempresa='" + info.IdEmpresa + "' and IdPeriodo = '" + info.IdPeriodo + "'  and IdEfectividad='" + info.IdEfectividad + "'";
             db.Database.ExecuteSqlCommand(DeteNov);
             db.Database.ExecuteSqlCommand(CabeNov);
             db.Database.ExecuteSqlCommand(DeteEfec);
             db.Database.ExecuteSqlCommand(CabeEfec);
             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);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         MensajeError = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }