示例#1
0
        public List <tlh_evaluacion_opciones_preguntas_respuesta_det_info> get_list_empleado_x_nomina(int IdEmpresa, int IdNomina)
        {
            try
            {
                List <tlh_evaluacion_opciones_preguntas_respuesta_det_info> lista = new List <tlh_evaluacion_opciones_preguntas_respuesta_det_info>();
                using (Entity_talento_humano db = new Entity_talento_humano())
                {
                    lista = (from q in db.vwtlh_evaluacion_opciones_preguntas_respuesta
                             where q.IdEmpresa == IdEmpresa &&
                             q.IdTipoNomina == IdNomina
                             select new tlh_evaluacion_opciones_preguntas_respuesta_det_info
                    {
                        IdEmpresa = q.IdEmpresa,
                        IdTipoNomina = q.IdTipoNomina,
                        pe_apellido = q.pe_apellido + " " + q.pe_nombre,
                        pe_nombre = q.pe_nombre,
                        IdEmpleado = q.IdEmpleado,
                        pe_cedulaRuc = q.pe_cedulaRuc,
                        Respueta = false,
                        eliminar = true
                    }).ToList();
                }

                return(lista);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public List <tlh_evaluacion_opciones_preguntas_info> get_list(int IdEmpresa)
        {
            try
            {
                List <tlh_evaluacion_opciones_preguntas_info> lista = new List <tlh_evaluacion_opciones_preguntas_info>();
                using (Entity_talento_humano db = new Entity_talento_humano())
                {
                    lista = (from q in db.tlh_evaluacion_opciones_preguntas
                             where q.IdEmpresa == IdEmpresa
                             select new tlh_evaluacion_opciones_preguntas_info
                    {
                        IdEmpresa = q.IdEmpresa,
                        IdPregunta = q.IdPregunta,
                        IdOpciones = q.IdOpciones,
                        Numero_opciones = q.Numero_opciones,
                        Descripcion = q.Descripcion,
                        estado = q.estado
                    }).ToList();
                }

                return(lista);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
示例#3
0
 private bool si_existe(int IdEmpresa, int IdCalendario)
 {
     try
     {
         using (Entity_talento_humano db = new Entity_talento_humano())
         {
             var query = (from q in db.tlh_evaluacion_opciones_preguntas_respuesta
                          where q.IdEmpresa == IdEmpresa &&
                          q.IdCalendario == IdCalendario
                          select q);
             if (query.Count() == 0)
             {
                 return(false);
             }
             else
             {
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        public List <tlh_evaluacion_opciones_preguntas_det_info> get_list(int IdEmpresa, int IdPregunta)
        {
            try
            {
                List <tlh_evaluacion_opciones_preguntas_det_info> lista = new List <tlh_evaluacion_opciones_preguntas_det_info>();
                using (Entity_talento_humano db = new Entity_talento_humano())
                {
                    lista = (from q in db.tlh_evaluacion_opciones_preguntas_det
                             where q.IdEmpresa == IdEmpresa &&
                             q.IdPregunta == IdPregunta
                             select new tlh_evaluacion_opciones_preguntas_det_info
                    {
                        IdEmpresa = q.IdEmpresa,
                        IdPregunta = q.IdPregunta,
                        Descripcion_opcion = q.Descripcion_opcion,
                        secuencia = q.secuencia
                    }).ToList();
                }

                return(lista);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
示例#5
0
        public List <tlh_evaluacion_opciones_preguntas_respuesta_info> get_list(int IdEmpresa)
        {
            try
            {
                List <tlh_evaluacion_opciones_preguntas_respuesta_info> lista = new List <tlh_evaluacion_opciones_preguntas_respuesta_info>();
                using (Entity_talento_humano db = new Entity_talento_humano())
                {
                    lista = (from q in db.tlh_evaluacion_opciones_preguntas_respuesta
                             where q.IdEmpresa == IdEmpresa
                             select new tlh_evaluacion_opciones_preguntas_respuesta_info
                    {
                        IdEmpresa = q.IdEmpresa,
                        IdCalendario = q.IdCalendario,
                        Observacion = q.Observacion,
                        Fecha_evaluacion = q.Fecha_evaluacion,
                        Numero_preguntas = q.Numero_preguntas,
                        estado = q.estado
                    }).ToList();
                }

                return(lista);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
示例#6
0
 public bool Guardar_DB(tlh_evaluacion_opciones_preguntas_respuesta_info info)
 {
     try
     {
         if (si_existe(info.IdEmpresa, info.IdCalendario))
         {
             return(true);
         }
         using (Entity_talento_humano entity = new Entity_talento_humano())
         {
             tlh_evaluacion_opciones_preguntas_respuesta add = new tlh_evaluacion_opciones_preguntas_respuesta();
             add.IdEmpresa        = info.IdEmpresa;
             add.IdCalendario     = info.IdCalendario;
             add.Numero_preguntas = info.Numero_preguntas;
             add.Fecha_evaluacion = info.Fecha_evaluacion;
             add.Observacion      = (info.Observacion == null) ? "Evaluacion de la preunta " + info.info_pregunta.Descripcion + " al " + info.Fecha_evaluacion.Date: info.Observacion;
             add.estado           = true;
             entity.tlh_evaluacion_opciones_preguntas_respuesta.Add(add);
             entity.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        public List <tlh_evaluacion_opciones_preguntas_info> get_list_pregunta_con_detalle(int IdEmpresa, int IdCalendario)
        {
            try
            {
                tlh_evaluacion_opciones_preguntas_det_data    data_detalle = new tlh_evaluacion_opciones_preguntas_det_data();
                List <tlh_evaluacion_opciones_preguntas_info> lista        = new List <tlh_evaluacion_opciones_preguntas_info>();
                using (Entity_talento_humano db = new Entity_talento_humano())
                {
                    lista = (from q in db.vwtlh_evaluacion_opciones_preguntas
                             where q.IdEmpresa == IdEmpresa &&
                             q.IdCalendario == IdCalendario
                             select new tlh_evaluacion_opciones_preguntas_info
                    {
                        IdEmpresa = q.IdEmpresa,
                        IdPregunta = q.IdPregunta,
                        IdOpciones = q.IdOpciones,
                        Numero_opciones = q.Numero_opciones,
                        Descripcion = q.Descripcion,
                        eliminar = true,
                        check = true
                    }).ToList();
                }

                foreach (var item in lista)
                {
                    item.detalle = new List <tlh_evaluacion_opciones_preguntas_det_info>();
                    item.detalle = data_detalle.get_list(item.IdEmpresa, item.IdPregunta);
                }
                return(lista);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
示例#8
0
        public List <tlh_evaluacion_opciones_preguntas_respuesta_det_info> get_list(int IdEmpresa, int IdCalendario)
        {
            try
            {
                List <tlh_evaluacion_opciones_preguntas_respuesta_det_info> lista = new List <tlh_evaluacion_opciones_preguntas_respuesta_det_info>();
                using (Entity_talento_humano db = new Entity_talento_humano())
                {
                    lista = (from q in db.tlh_evaluacion_opciones_preguntas_respuesta_det
                             where q.IdEmpresa == IdEmpresa &&
                             q.IdCalendario == IdCalendario
                             select new tlh_evaluacion_opciones_preguntas_respuesta_det_info
                    {
                        IdEmpresa = q.IdEmpresa,
                        IdCalendario = q.IdCalendario,
                        IdPregunta = q.IdPregunta,
                        secuencia = q.secuencia,
                        IdEmpleado = q.IdEmpleado,
                        Observacion = q.Observacion,
                        Respueta = q.Respueta,
                        eliminar = true
                    }).ToList();
                }

                return(lista);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        private int GetId(int IdEmpresa)
        {
            try
            {
                int Secuencia = 0;

                using (Entity_talento_humano db = new Entity_talento_humano())
                {
                    var query = (from q in db.tlh_evaluacion_opciones_preguntas
                                 where q.IdEmpresa == IdEmpresa
                                 select q);

                    if (query.Count() == 0)
                    {
                        Secuencia = 1;
                    }
                    else
                    {
                        var query2 = (from q in db.tlh_evaluacion_opciones_preguntas
                                      where q.IdEmpresa == IdEmpresa
                                      select q.IdPregunta).Max() + 1;
                        Secuencia = Convert.ToInt32(query2.ToString());
                    }

                    return(Secuencia);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
示例#10
0
        public List <tlh_evaluacion_opciones_preguntas_respuesta_det_info> get_list_empleado_x_nomina(int IdEmpresa, int IdNomina, int IdCalendario, int IdPregunta)
        {
            try
            {
                List <tlh_evaluacion_opciones_preguntas_respuesta_det_info> lista = new List <tlh_evaluacion_opciones_preguntas_respuesta_det_info>();
                using (Entity_talento_humano db = new Entity_talento_humano())
                {
                    var query = (from q in db.vwtlh_evaluacion_opciones_preguntas_respuesta_det
                                 where q.IdEmpresa == IdEmpresa &&
                                 q.IdCalendario == IdCalendario &&
                                 q.IdPregunta == IdPregunta

                                 select q);

                    foreach (var item in query)
                    {
                        tlh_evaluacion_opciones_preguntas_respuesta_det_info info = new tlh_evaluacion_opciones_preguntas_respuesta_det_info();
                        info.IdEmpresa    = item.IdEmpresa;
                        info.IdTipoNomina = item.IdTipoNomina;
                        info.pe_apellido  = item.pe_apellido + " " + item.pe_nombre;
                        info.pe_nombre    = item.pe_nombre;
                        info.IdEmpleado   = item.IdEmpleado;
                        info.pe_cedulaRuc = item.pe_cedulaRuc;
                        info.check        = true;
                        if (item.secuencia == 1)
                        {
                            info.check1 = true;
                        }
                        if (item.secuencia == 2)
                        {
                            info.check2 = true;
                        }
                        if (item.secuencia == 3)
                        {
                            info.check3 = true;
                        }
                        if (item.secuencia == 4)
                        {
                            info.check4 = true;
                        }
                        if (item.secuencia == 5)
                        {
                            info.check5 = true;
                        }
                        info.eliminar = true;
                        lista.Add(info);
                    }
                }

                return(lista);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
示例#11
0
 public bool EliminarDB_DB(int IdEmpresa, int IdCalendario, int IdPregunta)
 {
     try
     {
         using (Entity_talento_humano db = new Entity_talento_humano())
         {
             string Sql = "delete Talento_humano.tlh_evaluacion_opciones_preguntas_respuesta_det where IdEmpresa='" + IdEmpresa + "' and IdCalendario='" + IdCalendario + "' and IdPregunta='" + IdPregunta + "'";
             db.Database.ExecuteSqlCommand(Sql);
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public bool Modificar_DB(tlh_evaluacion_opciones_preguntas_info info)
 {
     try
     {
         using (Entity_talento_humano db = new Entity_talento_humano())
         {
             var add = db.tlh_evaluacion_opciones_preguntas.FirstOrDefault(v => v.IdEmpresa == info.IdEmpresa && v.IdPregunta == info.IdPregunta);
             add.IdOpciones  = info.IdOpciones;
             add.Descripcion = info.Descripcion;
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#13
0
 public bool Modificar_DB(tlh_evaluacion_opciones_preguntas_respuesta_info info)
 {
     try
     {
         using (Entity_talento_humano db = new Entity_talento_humano())
         {
             var add = db.tlh_evaluacion_opciones_preguntas_respuesta.FirstOrDefault(v => v.IdEmpresa == info.IdEmpresa && v.IdCalendario == info.IdCalendario);
             add.Fecha_evaluacion = info.Fecha_evaluacion;
             add.Numero_preguntas = info.Numero_preguntas;
             add.Observacion      = info.Observacion;
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#14
0
 public bool Anular_DB(tlh_evaluacion_opciones_preguntas_respuesta_info info)
 {
     try
     {
         using (Entity_talento_humano db = new Entity_talento_humano())
         {
             var add = db.tlh_evaluacion_opciones_preguntas_respuesta.FirstOrDefault(v => v.IdEmpresa == info.IdEmpresa && v.IdCalendario == info.IdCalendario);
             if (add == null)
             {
                 return(false);
             }
             add.estado = false;
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public bool Guardar_DB(tlh_evaluacion_opciones_preguntas_det_info info)
 {
     try
     {
         using (Entity_talento_humano entity = new Entity_talento_humano())
         {
             tlh_evaluacion_opciones_preguntas_det add = new tlh_evaluacion_opciones_preguntas_det();
             add.IdEmpresa          = info.IdEmpresa;
             add.IdPregunta         = info.IdPregunta;
             add.secuencia          = info.secuencia;
             add.Descripcion_opcion = info.Descripcion_opcion;
             entity.tlh_evaluacion_opciones_preguntas_det.Add(add);
             entity.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#16
0
        public bool Guardar_DB(tlh_evaluacion_opciones_preguntas_respuesta_det_info info)
        {
            try
            {
                using (Entity_talento_humano entity = new Entity_talento_humano())
                {
                    if (!si_existe(info.IdEmpresa, info.IdCalendario, info.IdEmpleado, info.IdPregunta))

                    {
                        tlh_evaluacion_opciones_preguntas_respuesta_det add = new tlh_evaluacion_opciones_preguntas_respuesta_det();
                        add.IdEmpresa    = info.IdEmpresa;
                        add.IdCalendario = info.IdCalendario;
                        add.IdEmpleado   = info.IdEmpleado;
                        add.IdPregunta   = info.IdPregunta;
                        add.secuencia    = info.secuencia;
                        add.Respueta     = info.Respueta;
                        add.Observacion  = info.Observacion;
                        entity.tlh_evaluacion_opciones_preguntas_respuesta_det.Add(add);
                    }
                    else
                    {
                        var modifi = entity.tlh_evaluacion_opciones_preguntas_respuesta_det.FirstOrDefault(v => v.IdEmpresa == info.IdEmpresa &&
                                                                                                           v.IdCalendario == info.IdCalendario &&
                                                                                                           v.IdCalendario == info.IdCalendario &&
                                                                                                           v.IdPregunta == info.IdPregunta &&
                                                                                                           v.IdEmpleado == info.IdEmpleado);
                        modifi.secuencia = info.secuencia;
                    }
                    entity.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
 public bool Guardar_DB(tlh_evaluacion_opciones_preguntas_info info, ref int IdPregunta)
 {
     try
     {
         using (Entity_talento_humano entity = new Entity_talento_humano())
         {
             tlh_evaluacion_opciones_preguntas add = new tlh_evaluacion_opciones_preguntas();
             add.IdEmpresa       = info.IdEmpresa;
             add.IdOpciones      = info.IdOpciones;
             add.IdPregunta      = GetId(info.IdEmpresa);
             add.Numero_opciones = info.Numero_opciones;
             add.Descripcion     = info.Descripcion;
             add.estado          = true;
             entity.tlh_evaluacion_opciones_preguntas.Add(add);
             entity.SaveChanges();
             IdPregunta = add.IdPregunta;
             return(true);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }