Exemplo n.º 1
0
        public ActionResult AsignacionRRHH(ServicioEmpresarialEntidad entidad)
        {
            if (entidad == null)
            {
                return(RedirectToAction("Index", "ServicioEmpresarial"));
            }
            ServicioEmpresarialDominio            oServicioEmpresarialDominio            = new ServicioEmpresarialDominio();
            ServicioEmpresarialCompetenciaDominio oServicioEmpresarialCompetenciaDominio = new ServicioEmpresarialCompetenciaDominio();
            var oServiciosEmpresarial = oServicioEmpresarialDominio.FiltrarxCodigo(entidad.Cod_Servicio_Empresarial.ToString());

            SessionManager.ListaConsultoresAsignados = oServicioEmpresarialCompetenciaDominio.BuscarRRHHAsignados(entidad.Cod_Servicio_Empresarial.ToString());
            ViewBag.ExisteConsultoresAsignados       = 0;
            ViewBag.MaximoConsultores = SessionManager.ListaConsultoresAsignados.Count;
            if (SessionManager.ListaConsultoresAsignados.Exists(x => x.Consultor.Cod_Consultor != 0))
            {
                if (SessionManager.ListaConsultoresAsignados.Exists(x => x.Consultor.Cod_Consultor == 0))
                {
                    ViewBag.ExisteConsultoresAsignados = 1;
                    //SessionManager.ListaConsultoresAsignados = SessionManager.ListaConsultoresAsignados.Where(x => x.Consultor.Cod_Consultor != 0).ToList();
                }

                else
                {
                    ViewBag.ExisteConsultoresAsignados = 2;
                }
            }
            else
            {
                SessionManager.ListaConsultoresAsignados = null;
            }
            return(View(oServiciosEmpresarial));
        }
Exemplo n.º 2
0
        public ActionResult BuscarServiciosEmpresarial(ServicioEmpresarialEntidad entidad)
        {
            ServicioEmpresarialDominio oServicioEmpresarialDominio = new ServicioEmpresarialDominio();
            var ListaServiciosEmpresarial = oServicioEmpresarialDominio.Filtrar(entidad);

            return(PartialView("_ResultadoBusquedaServEmpresarial", ListaServiciosEmpresarial));
        }
Exemplo n.º 3
0
        public ActionResult GrabarRechazoAsignacionConsultores(ServicioEmpresarialEntidad entidad)
        {
            ServicioEmpresarialDominio oServicioEmpresarialDominio = new ServicioEmpresarialDominio();
            var respuesta = oServicioEmpresarialDominio.GrabarRechazoAsignacionConsultores(entidad.Cod_Servicio_Empresarial.ToString());

            return(Json(respuesta));
        }
Exemplo n.º 4
0
        public List <ServicioEmpresarialEntidad> listarActivos()
        {
            SqlConnection cn = new SqlConnection(Conexion.CnConsultora);

            try
            {
                Conexion.abrirConexion(cn);
                SqlCommand cmd = new SqlCommand("usp_Servicio_Empresarial_listaractivos", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                List <ServicioEmpresarialEntidad> ListaServicioEmpresarial = new List <ServicioEmpresarialEntidad>();
                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        ServicioEmpresarialEntidad oServicioEmpresarialEntidad = new ServicioEmpresarialEntidad();
                        oServicioEmpresarialEntidad.Cod_Servicio_Empresarial = Reader.GetIntValue(reader, "Cod_Servicio_Empresarial");
                        oServicioEmpresarialEntidad.Nom_Servicio_Empresarial = Reader.GetStringValue(reader, "Nom_Servicio_Empresarial");
                        ListaServicioEmpresarial.Add(oServicioEmpresarialEntidad);
                    }
                }
                return(ListaServicioEmpresarial);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                Conexion.cerrarConexion(cn);
            }
        }
Exemplo n.º 5
0
        public ServicioEmpresarialEntidad FiltrarxCodigo(string Codigo)
        {
            SqlConnection cn = new SqlConnection(Conexion.CnConsultora);

            try
            {
                Conexion.abrirConexion(cn);
                SqlCommand cmd = new SqlCommand("usp_Servicio_Empresarial_FiltrarxCodigo", cn);
                cmd.Parameters.Add(new SqlParameter("@Cod_Servicio_Empresarial", SqlDbType.Int)).Value = Int32.Parse(Codigo);
                cmd.CommandType = CommandType.StoredProcedure;
                ServicioEmpresarialEntidad oServicioEmpresarialEntidad = new ServicioEmpresarialEntidad();
                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        oServicioEmpresarialEntidad.Cod_Servicio_Empresarial         = Reader.GetIntValue(reader, "Cod_Servicio_Empresarial");
                        oServicioEmpresarialEntidad.Nom_Servicio_Empresarial         = Reader.GetStringValue(reader, "Nom_Servicio_Empresarial");
                        oServicioEmpresarialEntidad.Descripcion_Servicio_Empresarial = Reader.GetStringValue(reader, "Descripcion_Servicio_Empresarial");
                        oServicioEmpresarialEntidad.Cliente = new ClienteEntidad
                        {
                            Razon_Social = Reader.GetStringValue(reader, "Razon_Social"),
                        };
                        oServicioEmpresarialEntidad.Empleado = new EmpleadoEntidad
                        {
                            Nom_Empleado = Reader.GetStringValue(reader, "Nom_Empleado"),
                            AP_Empleado  = Reader.GetStringValue(reader, "AP_Empleado"),
                            AM_Empleado  = Reader.GetStringValue(reader, "AM_Empleado"),
                        };
                        oServicioEmpresarialEntidad.Servicio = new ServicioEntidad
                        {
                            Nom_Servicio = Reader.GetStringValue(reader, "Nom_Servicio"),
                        };
                        oServicioEmpresarialEntidad.Negocio = new NegocioEntidad
                        {
                            Nom_Negocio = Reader.GetStringValue(reader, "Nom_Negocio"),
                        };
                        oServicioEmpresarialEntidad.ResponsableServicio = new UsuarioEntidad
                        {
                            Empleado = new EmpleadoEntidad
                            {
                                Ema_Empleado = Reader.GetStringValue(reader, "Ema_Empleado")
                            }
                        };
                        oServicioEmpresarialEntidad.Fecha_Inicio = Reader.GetDateTimeValue(reader, "Fecha_Inicio");
                        oServicioEmpresarialEntidad.Fecha_Fin    = Reader.GetDateTimeValue(reader, "Fecha_Fin");
                    }
                }
                return(oServicioEmpresarialEntidad);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                Conexion.cerrarConexion(cn);
            }
        }
Exemplo n.º 6
0
        public ActionResult AprobacionAsignacionConsultores(ServicioEmpresarialEntidad entidad)
        {
            if (entidad == null)
            {
                return(RedirectToAction("AprobacionAsignacionAutomatica", "ServicioEmpresarial"));
            }
            ServicioEmpresarialDominio            oServicioEmpresarialDominio            = new ServicioEmpresarialDominio();
            ServicioEmpresarialCompetenciaDominio oServicioEmpresarialCompetenciaDominio = new ServicioEmpresarialCompetenciaDominio();
            var oServiciosEmpresarial = oServicioEmpresarialDominio.FiltrarxCodigo(entidad.Cod_Servicio_Empresarial.ToString());

            return(View(oServiciosEmpresarial));
        }
Exemplo n.º 7
0
        public List <ServicioEmpresarialEntidad> Filtrar(ServicioEmpresarialEntidad entidad)
        {
            SqlConnection cn = new SqlConnection(Conexion.CnConsultora);

            try
            {
                Conexion.abrirConexion(cn);
                SqlCommand cmd = new SqlCommand("usp_Servicio_Empresarial_Filtrar", cn);
                cmd.Parameters.Add(new SqlParameter("@Cod_Servicio", SqlDbType.Int)).Value = entidad.Servicio.Cod_Servicio;
                cmd.Parameters.Add(new SqlParameter("@Cod_Servicio_Generado", SqlDbType.VarChar, 10)).Value = (entidad.Cod_Servicio_Generado != null ? entidad.Cod_Servicio_Generado : "");
                cmd.Parameters.Add(new SqlParameter("@Cod_Cliente", SqlDbType.Int)).Value = entidad.Cliente.Cod_Cliente;
                cmd.Parameters.Add(new SqlParameter("@Nom_Servicio_Empresarial", SqlDbType.VarChar, 100)).Value = (entidad.Nom_Servicio_Empresarial != null ? entidad.Nom_Servicio_Empresarial : "");
                cmd.CommandType = CommandType.StoredProcedure;
                List <ServicioEmpresarialEntidad> ListaServicioEmpresarial = new List <ServicioEmpresarialEntidad>();
                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        ServicioEmpresarialEntidad oServicioEmpresarialEntidad = new ServicioEmpresarialEntidad();
                        oServicioEmpresarialEntidad.Cod_Servicio_Empresarial = Reader.GetIntValue(reader, "Cod_Servicio_Empresarial");
                        oServicioEmpresarialEntidad.Nom_Servicio_Empresarial = Reader.GetStringValue(reader, "Nom_Servicio_Empresarial");
                        oServicioEmpresarialEntidad.Cliente = new ClienteEntidad
                        {
                            Razon_Social = Reader.GetStringValue(reader, "Razon_Social"),
                        };
                        oServicioEmpresarialEntidad.Servicio = new ServicioEntidad
                        {
                            Nom_Servicio = Reader.GetStringValue(reader, "Nom_Servicio"),
                        };
                        oServicioEmpresarialEntidad.Empleado = new EmpleadoEntidad
                        {
                            Nom_Empleado = Reader.GetStringValue(reader, "Nom_Empleado"),
                            AP_Empleado  = Reader.GetStringValue(reader, "AP_Empleado"),
                            AM_Empleado  = Reader.GetStringValue(reader, "AM_Empleado"),
                        };
                        oServicioEmpresarialEntidad.Fecha_Inicio = Reader.GetDateTimeValue(reader, "Fecha_Inicio");
                        oServicioEmpresarialEntidad.Fecha_Fin    = Reader.GetDateTimeValue(reader, "Fecha_Fin");
                        ListaServicioEmpresarial.Add(oServicioEmpresarialEntidad);
                    }
                }
                return(ListaServicioEmpresarial);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                Conexion.cerrarConexion(cn);
            }
        }
Exemplo n.º 8
0
        public ActionResult AsignarRRHH(ServicioEmpresarialEntidad entidad)
        {
            ServicioEmpresarialCompetenciaDominio oServicioEmpresarialCompetenciaDominio = new ServicioEmpresarialCompetenciaDominio();

            entidad.Empleado = new EmpleadoEntidad
            {
                Cod_Empleado = SessionManager.Usuario.Empleado.Cod_Empleado,
            };
            var respuesta = oServicioEmpresarialCompetenciaDominio.GrabarAsignacionAutomatica(SessionManager.ListaConsultoresAsignados.Where(x => x.Consultor.Cod_Consultor != 0).ToList(), entidad);
            ServicioEmpresarialDominio oServicioEmpresarialDominio = new ServicioEmpresarialDominio();
            var objeto = oServicioEmpresarialDominio.FiltrarxCodigo(entidad.Cod_Servicio_Empresarial.ToString());

            SendEmail.NotificacionAsignacionConsultores(AppSettings.valueString("EmailGerenteOperaciones"), objeto);
            return(Json(respuesta));
        }
Exemplo n.º 9
0
        public List <ServicioEmpresarialEntidad> BuscarAsignaciones()
        {
            SqlConnection cn = new SqlConnection(Conexion.CnConsultora);

            try
            {
                Conexion.abrirConexion(cn);
                SqlCommand cmd = new SqlCommand("usp_Servicio_Empresarial_BuscarAsignaciones", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                List <ServicioEmpresarialEntidad> ListaServicioEmpresarial = new List <ServicioEmpresarialEntidad>();
                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        ServicioEmpresarialEntidad oServicioEmpresarialEntidad = new ServicioEmpresarialEntidad();
                        oServicioEmpresarialEntidad.Cod_Servicio_Empresarial = Reader.GetIntValue(reader, "Cod_Servicio_Empresarial");
                        oServicioEmpresarialEntidad.Nom_Servicio_Empresarial = Reader.GetStringValue(reader, "Nom_Servicio_Empresarial");
                        oServicioEmpresarialEntidad.Cliente = new ClienteEntidad
                        {
                            Razon_Social = Reader.GetStringValue(reader, "Razon_Social"),
                        };
                        oServicioEmpresarialEntidad.Servicio = new ServicioEntidad
                        {
                            Nom_Servicio = Reader.GetStringValue(reader, "Nom_Servicio"),
                        };
                        oServicioEmpresarialEntidad.Empleado = new EmpleadoEntidad
                        {
                            Nom_Empleado = Reader.GetStringValue(reader, "Nom_Empleado"),
                            AP_Empleado  = Reader.GetStringValue(reader, "AP_Empleado"),
                            AM_Empleado  = Reader.GetStringValue(reader, "AM_Empleado"),
                        };
                        oServicioEmpresarialEntidad.Fecha_Asignacion = Reader.GetDateTimeValue(reader, "Fecha_Asignacion");
                        ListaServicioEmpresarial.Add(oServicioEmpresarialEntidad);
                    }
                }
                return(ListaServicioEmpresarial);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                Conexion.cerrarConexion(cn);
            }
        }
Exemplo n.º 10
0
        public static bool NotificacionAsignacionConsultores(string ToEmail, ServicioEmpresarialEntidad entidad)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Estimado/a:");
            sb.AppendLine("<br/><br/>");
            sb.AppendLine("Se ha registrado una nueva solicitud para aprobar los consultores de un servicio. <br/>Por favor, ingrese al portal para revisar la propuesta de consultores.<br/><br/>");
            sb.AppendLine("<br/>");
            sb.AppendLine("     * Nombre: " + entidad.Nom_Servicio_Empresarial + "<br/>");
            sb.AppendLine("     * Descripción:" + entidad.Descripcion_Servicio_Empresarial + "<br/>");
            sb.AppendLine("     * Cliente: " + entidad.Cliente.Razon_Social + "<br/>");
            sb.AppendLine("     * Unidad Negocio: " + entidad.Negocio.Nom_Negocio + "<br/>");
            sb.AppendLine("     * Tipo Servicio: " + entidad.Servicio.Nom_Servicio + "<br/>");
            sb.AppendLine("<br/><br/>");
            sb.AppendLine("Saludos cordiales");

            return(EnviarCorreo(ToEmail, "Asignacion de Consultores", sb.ToString()));
        }
Exemplo n.º 11
0
        public bool AsignacionAutomatica(ServicioEmpresarialEntidad entidad)
        {
            SqlConnection  cn    = new SqlConnection(Conexion.CnConsultora);
            SqlTransaction trans = null;

            try
            {
                bool estado = true;
                Conexion.abrirConexion(cn);
                trans = cn.BeginTransaction();
                SqlCommand cmd = new SqlCommand("usp_Servicio_Empresarial_AsignacionAutomatica", cn);
                cmd.Parameters.Add(new SqlParameter("@Cod_Servicio_Empresarial", SqlDbType.Int)).Value = entidad.Cod_Servicio_Empresarial;
                cmd.Parameters.Add(new SqlParameter("@Cod_Empleado", SqlDbType.Int)).Value             = entidad.Empleado.Cod_Empleado;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Transaction = trans;
                if (cmd.ExecuteNonQuery() < 1)
                {
                    estado = false;
                }

                if (estado)
                {
                    trans.Commit();
                }
                else
                {
                    trans.Rollback();
                }

                return(estado);
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                Conexion.cerrarConexion(cn);
            }
        }
Exemplo n.º 12
0
        public static bool NotificacionAprobacionAsignacion(ServicioEmpresarialEntidad entidad, List <ServicioEmpresarialCompetenciaEntidad> ListaConsultores)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Estimado/a:");
            sb.AppendLine("<br/><br/>");
            sb.AppendLine("Ha sido asignado a un servicio. El responsable del servicio se contactará con usted para darle los detalles.<br/><br/>");
            sb.AppendLine("<br/>");
            sb.AppendLine("     * Nombre: " + entidad.Nom_Servicio_Empresarial + "<br/>");
            sb.AppendLine("     * Descripción:" + entidad.Descripcion_Servicio_Empresarial + "<br/>");
            sb.AppendLine("     * Cliente: " + entidad.Cliente.Razon_Social + "<br/>");
            sb.AppendLine("     * Unidad Negocio: " + entidad.Negocio.Nom_Negocio + "<br/>");
            sb.AppendLine("     * Tipo Servicio: " + entidad.Servicio.Nom_Servicio + "<br/>");
            sb.AppendLine("<br/><br/>");
            sb.AppendLine("Saludos cordiales");

            var estado = EnviarCorreo(entidad.ResponsableServicio.Empleado.Ema_Empleado, "Aprobación de Asignación de Consultores", sb.ToString());

            foreach (var item in ListaConsultores)
            {
                estado = EnviarCorreo(item.Consultor.Empleado.Ema_Empleado, "Aprobación de Asignación de Consultores", sb.ToString());
            }
            return(estado);
        }
Exemplo n.º 13
0
        public bool GrabarAsignacionAutomatica(List <ServicioEmpresarialCompetenciaEntidad> lista, ServicioEmpresarialEntidad entidad)
        {
            bool estado = false;
            ServicioEmpresarialRepositorio oServicioEmpresarialRepositorio = new ServicioEmpresarialRepositorio();

            if (oServicioEmpresarialRepositorio.AsignacionAutomatica(entidad))
            {
                estado = oServicioEmpresarialCompetenciaRepositorio.AsignarRRHH(lista);
            }
            return(estado);
        }
Exemplo n.º 14
0
 public List <ServicioEmpresarialEntidad> Filtrar(ServicioEmpresarialEntidad entidad)
 {
     return(oServicioEmpresarialRepositorio.Filtrar(entidad));
 }