public Offer Get(int id) { OfferRepository <Offer> Offerrepo = new OfferRepository <Offer>(); OfferPhasesRepository <OfferPhases> OfferPrepo = new OfferPhasesRepository <OfferPhases>(); var offer = Offerrepo.Get(id); offer.OfferPhases = new List <OfferPhases>(); offer.OfferPhases = OfferPrepo.GetPhasesByIdOffer(id).ToList(); return(offer); }
public List <OfferPhases> GetOfferPhases(int idoffer) { OfferPhasesRepository <OfferPhases> Offerrepo = new OfferPhasesRepository <OfferPhases>(); return(Offerrepo.GetPhasesByIdOffer(idoffer).ToList()); }
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() }