Ejemplo n.º 1
0
        public Project Update(Project Project)
        {
            ProjectRepository <Project> Projectrepo = new ProjectRepository <Project>();
            int?rta = Projectrepo.Update(Project);

            if (rta == null)
            {
                return(null);
            }
            else
            {
                SUser    suser = new SUser();
                SProject spro  = new SProject();
                var      user  = suser.GetUserByOffer(Project.IdOffer, 1);
                //var user = suser.GetUserById(new Guid(Project.Offer.IdUser));

                try
                {
                    Log4NetLogger logger2 = new Log4NetLogger();
                    SCategory     scate   = new SCategory();
                    var           cate    = scate.FindCategoryById(Project.IdCategory);
                    logger2.Info("Creación Proyecto:" + Project.Id + "," + "UsuarioOrigen:" + user.UserName + ",Categoria:" + cate.Name);
                }
                catch
                {
                }

                return(Project);
            }
        }
Ejemplo n.º 2
0
        public void UpdatePhases(List <OfferPhases> listOfferPhases, int IdOffer)
        {
            OfferRepository <OfferPhases> Offerrepo = new OfferRepository <OfferPhases>();

            Offerrepo.UpdatePhases(listOfferPhases, IdOffer);
            Log4NetLogger logger2 = new Log4NetLogger();
            SUser         suser   = new SUser();

            foreach (var oferfases in listOfferPhases)
            {
                var user = suser.GetUserById(new Guid(oferfases.Offer.IdUser));
                logger2.Info("Actualización Fases Oferta:" + IdOffer + "," + "UsuarioOrigen:" + user.UserName + ",Fase:" + oferfases.Name);
            }
        }
Ejemplo n.º 3
0
        public List <Log4Net_Error> GetNotificationsAdministrator(string idUser)
        {
            NotificationRepository <Log4Net_Error> notirepo = new NotificationRepository <Log4Net_Error>();
            SUser suser = new SUser();

            var           user       = suser.GetUserById(new Guid(idUser));
            var           categories = user.Skills.Where(e => e.Visible).Select(e => e.Name).Distinct();
            StringBuilder sb         = new StringBuilder();

            sb.Append("where ([Message] like 'Creación Oferta%' Or [Message] like 'Creación Proyecto%' OR [Message] like 'Registro Usuario%' Or [Message] like 'Proyecto finalizado%' ) ");
            foreach (var cat in categories)
            {
                sb.Append("Or [Message] like '%Categoria:" + cat + "'");
            }
            return(notirepo.GetList(sb.ToString()).ToList());
        }
Ejemplo n.º 4
0
        public Offer Insert(Offer Offer)
        {
            OfferRepository <Offer> Offerrepo = new OfferRepository <Offer>();
            SCategory scate = new SCategory();
            var       cate  = scate.FindCategoryById(Offer.CategoryId);

            Offer.DateOffer = DateTime.Now;
            int?rta = Offerrepo.Insert(Offer);

            if (rta == null)
            {
                return(null);
            }
            else
            {
                Offer.Id = (int)rta;
                Log4NetLogger logger2 = new Log4NetLogger();
                SUser         suser   = new SUser();
                var           user    = suser.GetUserById(new Guid(Offer.IdUser));
                logger2.Info("Creación Oferta:" + Offer.TitleOffer + "," + "Por:" + user.UserName + ",Categoria:" + cate.Name);
                return(Offer);
            }
        }
Ejemplo n.º 5
0
        public Offer Update(Offer Offer)
        {
            OfferRepository <Offer> Offerrepo = new OfferRepository <Offer>();

            Offer.DateOffer = DateTime.Now;
            int?          rta     = Offerrepo.Update(Offer);
            Log4NetLogger logger2 = new Log4NetLogger();
            SUser         suser   = new SUser();
            var           user    = suser.GetUserById(new Guid(Offer.IdUser));
            SCategory     scate   = new SCategory();
            var           cate    = scate.FindCategoryById(Offer.CategoryId);

            logger2.Info("Actualización Oferta:" + Offer.TitleOffer + "," + "UsuarioOrigen:" + user.UserName + ",Categoria:" + cate.Name);

            if (rta == null)
            {
                return(null);
            }
            else
            {
                return(Offer);
            }
        }
Ejemplo n.º 6
0
        public int?InsertUserOffer(int idoffer, string iduser, bool sendemail)
        {
            OfferUserRepository <OfferUser>     OfferUrepo = new OfferUserRepository <OfferUser>();
            OfferPhasesRepository <OfferPhases> OfferPrepo = new OfferPhasesRepository <OfferPhases>();
            ProjectRepository <Project>         Offerrepo  = new ProjectRepository <Project>();

            if (OfferUrepo.GetOfferUser(idoffer, iduser) == null)
            {
                OfferUrepo.InsertUserOffer(idoffer, iduser);
            }
            else
            {
                return(-1);
            }


            List <OfferPhases> lista = OfferPrepo.GetPhasesByIdOffer(idoffer).ToList();
            var   offer       = GetById(idoffer);
            SUser suser       = new SUser();
            var   contratante = suser.GetUserById(new Guid(offer.IdUser));
            var   aplicante   = suser.GetUserById(new Guid(iduser));

            //if (Offerrepo.GetByOffer(idoffer) == null)
            //{
            //    Project project = new Project();
            //    project.IdOffer = idoffer;
            //    project.IdCategory = offer.CategoryId;
            //    project.Postulantes = offer.OfferUsers.Count + 1;
            //    project.Qualification = 0;
            //    project.Status = Persistence.Entities.StatusPhase.Publicada;
            //    Offerrepo.Insert(project);
            //}



            if (sendemail && ChangeStatusPhases(lista, StatusPhase.EnCurso, offer) != -1)
            {
                string Url  = "http://zonafl.com/Static/index.html#iniciar";
                string body = "El Usuario," + aplicante.UserName;
                body += " ha aplicado al proyecto " + offer.TitleOffer;
                body += " favor ingresar <a href = '" + Url + "'>aqui para ingresar al sitio.</a>";
                body += "<br /><br />Gracias";


                var smail = SMail.Instance;


                smail.Send("*****@*****.**", contratante.Email, "Usuario Aplicó proyecto", body);
            }
            else
            {
                return(-1);
            }
            return(1);

            Log4NetLogger logger2 = new Log4NetLogger();


            var user = suser.GetUserById(new Guid(iduser));

            logger2.Info("Postulación Oferta:" + idoffer + "," + "UsuarioOrigen:" + user.UserName);
            //Offerrepo.Insert()
        }