Example #1
0
        private void NotificacionCalificadoConcepto(ConceptViewModel pConceptViewModel)
        {
            var                     base_url                 = ConfigurationManager.AppSettings["site.url"];
            UserBL                  userBL                   = new UserBL();
            UserViewModel           investigador             = userBL.ObtenerUser(pConceptViewModel.user_id_created.Value);
            SendEmailNotificationBL oSendEmailNotificationBL = new SendEmailNotificationBL();

            NotificationConceptViewModel oNotificationConceptViewModel = new NotificationConceptViewModel();

            oNotificationConceptViewModel.name             = investigador.contact_name;
            oNotificationConceptViewModel.url_view_concept = base_url + @"/Concept";
            oNotificationConceptViewModel.to = investigador.user_email;


            oNotificationConceptViewModel.url_politicas  = ConfigurationManager.AppSettings["site.url.politicas"];
            oNotificationConceptViewModel.url_contacto   = ConfigurationManager.AppSettings["site.url.contacto"];
            oNotificationConceptViewModel.url_privacidad = ConfigurationManager.AppSettings["site.url.privacidad"];

            oNotificationConceptViewModel.draft_law_title = pConceptViewModel.title;
            oSendEmailNotificationBL.EnviarNotificacionConcepto(oNotificationConceptViewModel, "notificacion.concept.calificado");

            NotificationBL        oNotificationBL        = new NotificationBL();
            NotificationViewModel pNotificationViewModel = new NotificationViewModel();

            pNotificationViewModel.user_id = investigador.id;
            pNotificationViewModel.message = "El concepto con número '" + pConceptViewModel.concept_id + "' ha sido calificado.";
            pNotificationViewModel.url     = @"/Concept";
            oNotificationBL.Agregar(pNotificationViewModel);
        }
Example #2
0
        private void NotificacionNuevaSolicitud(ConsultationViewModel pConsultationViewModel, string subject)
        {
            var base_url = ConfigurationManager.AppSettings["site.url"];

            UserBL userBL = new UserBL();

            List <UserViewModel> evaluadores = userBL.ObtenerPorPermiso(118);// 12 = perfil evaluador

            foreach (UserViewModel evaluador in evaluadores)
            {
                SendEmailNotificationBL oSendEmailNotificationBL = new SendEmailNotificationBL();

                NotificationGeneralAccountViewModel oNotificationConceptViewModel = new NotificationGeneralAccountViewModel();
                oNotificationConceptViewModel.name = evaluador.contact_name;
                oNotificationConceptViewModel.url_solicitud_concepto = base_url + @"/Consultation/Ver/" + pConsultationViewModel.consultation_id;
                oNotificationConceptViewModel.to = evaluador.user_email;

                oNotificationConceptViewModel.url_home = ConfigurationManager.AppSettings["site.url"];

                oNotificationConceptViewModel.url_politicas  = ConfigurationManager.AppSettings["site.url.politicas"];
                oNotificationConceptViewModel.url_contacto   = ConfigurationManager.AppSettings["site.url.contacto"];
                oNotificationConceptViewModel.url_privacidad = ConfigurationManager.AppSettings["site.url.privacidad"];


                oSendEmailNotificationBL.EnviarNotificacionSolicitudConcepto(oNotificationConceptViewModel, subject);


                NotificationBL        oNotificationBL        = new NotificationBL();
                NotificationViewModel pNotificationViewModel = new NotificationViewModel();
                pNotificationViewModel.user_id = evaluador.id;
                pNotificationViewModel.message = "Hay una nueva solicitud de concepto con número '" + pConsultationViewModel.consultation_id + "'";
                pNotificationViewModel.url     = @"/Consultation/Ver/" + pConsultationViewModel.consultation_id;

                oNotificationBL.Agregar(pNotificationViewModel);
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            try
            {
                new Program();
                logger.Info("Inicio Proceso: Notificacion.Nuevos.Proyectos.Ley");
                DraftLawBL oDraftLawBL        = new DraftLawBL();
                List <DraftLawViewModel> list = oDraftLawBL.ObtenerNotificables();

                logger.Info("Proceso Notificacion.Nuevos.Proyectos.Ley: " + list.Count());

                if (list.Count() > 0)
                {
                    UserBL oUserBL = new UserBL();
                    List <InvestigatorViewModel> investigadores           = oUserBL.ObtenerInvestigadores();
                    SendEmailNotificationBL      oSendEmailNotificationBL = new SendEmailNotificationBL();

                    foreach (InvestigatorViewModel investigador in investigadores)
                    {
                        try
                        {
                            logger.Info("Inicio Investigador: " + investigador.contact_name);


                            List <DraftLawViewModel> proyectos_asociados = list.Where(a => investigador.commissions.Contains(a.commission_id.Value) && investigador.interest_areas.Contains(a.interest_area_id.Value)).ToList();
                            logger.Info("Proyectyso Nuevos: " + proyectos_asociados.Count());
                            if (proyectos_asociados != null && proyectos_asociados.Count > 0)
                            {
                                NotificationDraftLawViewModel oNotification = new NotificationDraftLawViewModel();
                                oNotification.name      = investigador.contact_name;
                                oNotification.url       = ConfigurationManager.AppSettings["site.url"] + "/Investigator/MisProyectosLey";
                                oNotification.to        = investigador.user_email;
                                oNotification.DraftLaws = proyectos_asociados;

                                oNotification.url_home = ConfigurationManager.AppSettings["site.url"];

                                oNotification.url_politicas  = ConfigurationManager.AppSettings["site.url.politicas"];
                                oNotification.url_contacto   = ConfigurationManager.AppSettings["site.url.contacto"];
                                oNotification.url_privacidad = ConfigurationManager.AppSettings["site.url.privacidad"];
                                oSendEmailNotificationBL.EnviarNotificacionInvestigadorProyectosNuevos(oNotification);

                                NotificationBL        oNotificationBL        = new NotificationBL();
                                NotificationViewModel pNotificationViewModel = new NotificationViewModel();
                                pNotificationViewModel.user_id = investigador.user_id;
                                pNotificationViewModel.message = "Se han registrado proyecto(s) de ley de sus áreas de interés";
                                pNotificationViewModel.url     = @"/Investigator/MisProyectosLey";

                                oNotificationBL.Agregar(pNotificationViewModel);
                            }

                            logger.Info("Fin Investigador: " + investigador.contact_name);
                        }
                        catch (Exception ex)
                        {
                            logger.Info("Error en Notificacion.Nuevos.Proyectos.Ley:");
                            logger.Info("Mensaje: " + ex.Message);
                            logger.Info("StackTrace: " + ex.StackTrace);
                            logger.Error("Notificacion.Nuevos.Proyectos.Ley: ", ex);
                        }
                    }

                    oDraftLawBL.ActualizarNotificacion(list);
                }


                logger.Info("Fin de Proceso: Notificacion.Nuevos.Proyectos.Ley");
            }
            catch (Exception ex)
            {
                logger.Info("Error en Notificacion.Nuevos.Proyectos.Ley:");
                logger.Info("Mensaje: " + ex.Message);
                logger.Info("StackTrace: " + ex.StackTrace);
                logger.Error("Notificacion.Nuevos.Proyectos.Ley: ", ex);
            }
        }