public ActionResult DetailsByEmail(string id) { ZonaFl.Persistence.Entities.AspNetUsers useru = null; ZonaFl.Business.SubSystems.SUser usern = new Business.SubSystems.SUser(); ZonaFl.Business.SubSystems.SProject userp = new Business.SubSystems.SProject(); // trae las calificacion promedio del usuario por los proyectos useru = usern.GetUserByEmail(id); int calif = userp.GetCalificationAverageUser(useru.Id); //calif = 3; ViewBag.Calification = calif; var projects = userp.GetProjectsEndedByUser(useru.Id); List <Models.Project> projetsm = new List <Models.Project>(); projetsm = projects.Select(e => new Models.Project().InjectFrom(e)).Cast <Models.Project>().ToList(); projetsm.Select(e => new Models.Project().InjectFrom(usern.GetUserByOffer(e.IdOffer, 0))).Cast <Models.Project>().ToList(); //projetsm.ForEach(e => e.CommentsUser = usern.GetUserNameByOffer(e.IdOffer).UserName); //projetsm.ForEach(e => e.Image = usern.GetUserNameByOffer(e.IdOffer).Image); //-prueba // projetsm.Add(new Models.Project() {Comments="Comentario Prueba", UserName = "******",Image= "FotoJuanFdoCastro3.jpg" } // ); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); //--- ViewBag.Commentaries = projetsm; useru = usern.GetUserById(new Guid(id)); if (useru.Image != null && useru.Image.Contains("fakepath")) { useru.Image = useru.Image.Replace(@"C:\fakepath\", ""); } RegisterBindingModel regbm = new RegisterBindingModel(); regbm.InjectFrom(useru); regbm.Skills = useru.Skills.Where(e => e.Visible).Select(e => new ZonaFl.Models.Skill().InjectFrom(e)).Cast <ZonaFl.Models.Skill>().ToList(); SessionBag.Current.User = regbm; ViewBag.User = useru.UserName; ViewBag.IdUser = useru.Id; ViewBag.ImageUser = useru.Image; return(View("Details", regbm)); }
public ActionResult EditById(string id) { ZonaFl.Persistence.Entities.AspNetUsers useru = null; ZonaFl.Business.SubSystems.SUser usern = new Business.SubSystems.SUser(); useru = usern.GetCurriculumUserById(new Guid(id)); if (SessionBag.Current.User == null) { SessionBag.Current.User = useru; } Curriculum curr = new Curriculum(); RegisterBindingModel regbm = new RegisterBindingModel(); regbm.InjectFrom(useru); regbm.Skills = useru.Skills.Select(e => new ZonaFl.Models.Skill().InjectFrom(e)).Cast <ZonaFl.Models.Skill>().ToList(); curr.User = regbm; curr.Experiences = useru.Experiences.Select(e => new ZonaFl.Models.Experience().InjectFrom(e)).Cast <ZonaFl.Models.Experience>().ToList(); curr.Certifications = useru.Certifications.Select(e => new ZonaFl.Models.Certification().InjectFrom(e)).Cast <ZonaFl.Models.Certification>().ToList(); curr.Educations = useru.Certifications.Select(e => new ZonaFl.Models.Education().InjectFrom(e)).Cast <ZonaFl.Models.Education>().ToList(); curr.Languages = useru.Certifications.Select(e => new ZonaFl.Models.Language().InjectFrom(e)).Cast <ZonaFl.Models.Language>().ToList(); ZonaFl.Business.SubSystems.SProject userp = new Business.SubSystems.SProject(); // trae las calificacion promedio del usuario por los proyectos int calif = userp.GetCalificationAverageUser(id); //calif = 3; var projects = userp.GetProjectsEndedByUser(id); List <Models.Project> projetsm = new List <Models.Project>(); projetsm = projects.Select(e => new Models.Project().InjectFrom(e)).Cast <Models.Project>().ToList(); projetsm.Select(e => new Models.Project().InjectFrom(usern.GetUserByOffer(e.IdOffer, 0))).Cast <Models.Project>().ToList(); ViewBag.Calification = calif; ViewBag.Commentaries = projetsm; ViewBag.User = useru.UserName; ViewBag.ImageUser = useru.Image; ViewBag.IdUser = id; return(View("Edit", curr)); }
public ActionResult DetailsByEmail(string id) { RegisterBindingModel regbm = new RegisterBindingModel(); try { ZonaFl.Persistence.Entities.AspNetUsers useru = null; ZonaFl.Business.SubSystems.SUser usern = new Business.SubSystems.SUser(); useru = usern.GetUserByEmail(id); regbm.InjectFrom(useru); if (useru.Companies.Count > 0 && useru.Companies.FirstOrDefault() != null) { regbm.Company = useru.Companies.Select(e => new Models.Company().InjectFrom(e)).Cast <Models.Company>().ToList(); } SessionBag.Current.User = regbm; //regbm.Skills = useru.Skills.Select(e => new ZonaFl.Models.Skill().InjectFrom(e)).Cast<ZonaFl.Models.Skill>().ToList(); ViewBag.User = useru.UserName; ViewBag.IdUser = useru.Id; ViewBag.ImageUser = useru.Image; ZonaFl.Business.SubSystems.SProject userp = new Business.SubSystems.SProject(); var projects = userp.GetProjectsEndedByUser(useru.Id); List <Models.Project> projetsm = new List <Models.Project>(); projetsm = projects.Select(e => new Models.Project().InjectFrom(e)).Cast <Models.Project>().ToList(); projetsm.Select(e => new Models.Project().InjectFrom(usern.GetUserByOffer(e.IdOffer, 1))).Cast <Models.Project>().ToList(); //-prueba // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } // ); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); // projetsm.Add(new Models.Project() { Comments = "Comentario Prueba", UserName = "******", Image = "FotoJuanFdoCastro3.jpg" } //); //--- ViewBag.Commentaries = projetsm; int calif = userp.GetCalificationAverageUser(useru.Id); //calif = 3; ViewBag.Calification = calif; return(View("Details", regbm)); } catch (Exception er) { Log4NetLogger logger2 = new Log4NetLogger(); logger2.CurrentUser = SessionBag.Current.User.Id; if (Request != null) { logger2.Error(er, Request.Path, Request.RawUrl); throw new Exception(er.Message); } else { logger2.Error(er); } } return(View("Details", regbm)); }
// GET: Project public ActionResult Index(string id) { int statusProject = 0; if (Request.QueryString["statusProject"] != null) { statusProject = int.Parse(Request.QueryString["statusProject"]); } ViewBag.Status = statusProject; SOffer soffer = new SOffer(); int pagenumber = 1; //int.Parse( Request.QueryString.Get("pagenumber")); int itemsperpage = 50; // int.Parse(Request.QueryString.Get("itemsperpage")); string conditions = ""; ZonaFl.Persistence.Entities.AspNetUsers useru = null; ZonaFl.Business.SubSystems.SUser usern = new Business.SubSystems.SUser(); useru = usern.GetUserById(new Guid(id)); if (SessionBag.Current.User == null) { SessionBag.Current.User = useru; } //if (statusProject == 2 && !useru.Freelance) // statusProject = 1; // Publicada = 0, //EnCurso = 1, //Finalizada = 2, //Eliminada = 3 if (statusProject == 0) { if (!useru.Freelance) { //conditions = " where O.Id NOT IN(SELECT Project.idoffer from project) and O.iduser='******' and (OP.StatusPhase=" + statusProject + " "; //Request.QueryString.Get("conditions"); conditions = " where O.Id NOT IN(SELECT Project.idoffer from project) and (O.iduser='******' and O.Status=0"; //and (OP.StatusPhase=" + statusProject + " "; //Request.QueryString.Get("conditions"); } else { conditions = " where O.Id NOT IN(SELECT Project.idoffer from project) and (OU.iduser='******' and O.Status=0";// and (OP.StatusPhase=" + statusProject + " "; //Request.QueryString.Get("conditions"); } } else if (statusProject >= 1) { if (!useru.Freelance) { conditions = " where O.IdUser = '******' and (project.Status = " + statusProject + " OR O.Status=" + statusProject; //conditions = " where O.Id IN(SELECT Project.idoffer from project) and (O.iduser='******' and project.Status="+ statusProject; } else { //conditions = " where O.IdUser = '******' and project.Status = " + statusProject; conditions = " where O.Id IN(SELECT Project.idoffer from project where project.Status=" + statusProject + ") and (OU.iduser='******'"; //Request.QueryString.Get("conditions"); } } ///user session bag ZonaFl.Business.SubSystems.SProject userp = new Business.SubSystems.SProject(); var projects = userp.GetProjectsEndedByUser(id); List <Models.Project> projetsm = new List <Models.Project>(); projetsm = projects.Select(e => new Models.Project().InjectFrom(e)).Cast <Models.Project>().ToList(); projetsm.Select(e => new Models.Project().InjectFrom(usern.GetUserByOffer(e.IdOffer, 1))).Cast <Models.Project>().ToList(); ViewBag.Commentaries = projetsm; int calif = userp.GetCalificationAverageUser(id); //calif = 3; ViewBag.Calification = calif; RegisterBindingModel regbm = new RegisterBindingModel(); regbm.InjectFrom(useru); regbm.Skills = useru.Skills.Select(e => new ZonaFl.Models.Skill().InjectFrom(e)).Cast <ZonaFl.Models.Skill>().ToList(); SessionBag.Current.User = regbm; ViewBag.IdUser = id; ViewBag.NameUser = regbm.UserName; ViewBag.User = useru.UserName; ViewBag.ImageUser = useru.Image; ViewBag.EmailUserBuyer = regbm.Email; ViewBag.EmailConfirmed = (useru.EmailConfirmed)? @"verified": @""; ViewBag.PagosConfirmed = (useru.PagosConfirmed) ? @"verified" : @""; // ViewBag.MobileConfirmed= ///// string order = Request.QueryString.Get("order"); SCategory scat = new SCategory(); List <ZonaFl.Persistence.Entities.Category> listcat = scat.FindAll(); ViewBag.Categories = listcat; List <Persistence.Entities.Offer> lista = new List <Persistence.Entities.Offer>(); if (!regbm.Freelance) { //if (statusProject == 0) //{ // conditions += " or OP.StatusPhase =" + 1+")"; //} //else //{ conditions += " )"; //} lista = soffer.GetListPaged(pagenumber, itemsperpage, conditions + ";", order, statusProject); } else { conditions += " )"; lista = soffer.GetAppliedOfferByUserListPaged(pagenumber, itemsperpage, conditions, order); } List <Models.Offer> listoffers = lista.Select(e => new Models.Offer().InjectFrom(e)).Cast <Models.Offer>().ToList(); SProject spro = new SProject(); listoffers.ForEach(e => e.Comments = spro.GetByOffer(e.Id) != null ? spro.GetByOffer(e.Id).Comments : ""); listoffers.ForEach(e => e.Qualification = spro.GetByOffer(e.Id) != null ? spro.GetByOffer(e.Id).Qualification : 0); if (statusProject == 1) { listoffers.ForEach(e => e.IsForFinally = spro.IsProjectForFinally(e.Id)); } List <Persistence.Entities.Category> listcategories = lista.Select(e => e.Category).ToList(); foreach (var offer in lista) { var offerget = soffer.GetById(offer.Id); if (offerget != null) { offer.OfferPhases = offerget.OfferPhases.Select(e => new Persistence.Entities.OfferPhases().InjectFrom(e)).Cast <Persistence.Entities.OfferPhases>().ToList(); } listoffers.FirstOrDefault(e => e.Id == offer.Id).OfferPhases = offer.OfferPhases.Where(e => e.IdOffer == offer.Id).ToList().Select(t => new OfferPhase().InjectFrom(t)).Cast <OfferPhase>().ToList(); //new OfferPhase().InjectFrom(e)).Cast<OfferPhase>().ToList(); //foreach(var of in offer.OfferPhases.Where(e => e.IdOffer == offer.Id).ToList()) // { // Models.OfferPhase newof = new Models.OfferPhase(); // newof.InjectFrom(of); // listoffers.FirstOrDefault(e => e.Id == offer.Id).OfferPhases.Add(newof); // } if (listoffers.FirstOrDefault(e => e.Id == offer.Id) != null) { listoffers.FirstOrDefault(e => e.Id == offer.Id).Category = new Models.Category();//.InjectFrom(offer.Category); } listoffers.FirstOrDefault(e => e.Id == offer.Id).Category.InjectFrom(offer.Category); listoffers.FirstOrDefault(e => e.Id == offer.Id).ContractorCity = ((RegisterBindingModel)SessionBag.Current.User).City; listoffers.FirstOrDefault(e => e.Id == offer.Id).ContractorCountry = ((RegisterBindingModel)SessionBag.Current.User).Country; listoffers.FirstOrDefault(e => e.Id == offer.Id).NameContractor = ((RegisterBindingModel)SessionBag.Current.User).FirstMiddleName; listoffers.FirstOrDefault(e => e.Id == offer.Id).NoPostulados = soffer.GetNoPostuladosByOffer(offer.Id); var dateoferfase1 = soffer.GetPhaseInitial(offer.Id); if (dateoferfase1 == null) { listoffers.FirstOrDefault(e => e.Id == offer.Id).DateIniPhase1 = DateTime.Parse("01/01/1900"); } else { ViewBag.InicioEst = dateoferfase1.InitPhase; if (offer.OfferPhases.Count > 0) { var finest = offer.OfferPhases.LastOrDefault(e => e.FinishPhase != null).FinishPhase; ViewBag.FinEst = finest; listoffers.FirstOrDefault(e => e.Id == offer.Id).FinEst = finest; } else { ViewBag.FinEst = dateoferfase1.FinishPhase; listoffers.FirstOrDefault(e => e.Id == offer.Id).FinEst = dateoferfase1.FinishPhase; } listoffers.FirstOrDefault(e => e.Id == offer.Id).DateIniPhase1 = dateoferfase1.InitPhase; listoffers.FirstOrDefault(e => e.Id == offer.Id).InicioEst = dateoferfase1.InitPhase; } } if (!regbm.Freelance) { return(View("DetailsForEmployer", listoffers)); } else { return(View("DetailsForFreelance", listoffers)); } }
public ActionResult ReadForEmployer(string id) { SUser suser = new SUser(); SPortfolio sportfolio = new SPortfolio(); RegisterBindingModel regbm = new RegisterBindingModel(); try { var portfolio = sportfolio.GetPortFolioByUserId(id); ZonaFl.Persistence.Entities.AspNetUsers useru = null; ZonaFl.Business.SubSystems.SUser usern = new Business.SubSystems.SUser(); useru = usern.GetCurriculumUserById(new Guid(id)); ZonaFl.Business.SubSystems.SProject userp = new Business.SubSystems.SProject(); // trae las calificacion promedio del usuario por los proyectos int calif = userp.GetCalificationAverageUser(id); //calif = 3; var projects = userp.GetProjectsEndedByUser(id); List <Models.Project> projetsm = new List <Models.Project>(); projetsm = projects.Select(e => new Models.Project().InjectFrom(e)).Cast <Models.Project>().ToList(); projetsm.Select(e => new Models.Project().InjectFrom(usern.GetUserByOffer(e.IdOffer, 0))).Cast <Models.Project>().ToList(); Curriculum curr = new Curriculum(); regbm.InjectFrom(useru); regbm.Skills = useru.Skills.Select(e => new ZonaFl.Models.Skill().InjectFrom(e)).Cast <ZonaFl.Models.Skill>().ToList(); curr.User = regbm; curr.Experiences = useru.Experiences.Select(e => new ZonaFl.Models.Experience().InjectFrom(e)).Cast <ZonaFl.Models.Experience>().ToList(); curr.Experiences.ForEach(e => e.DateIni = useru.Experiences.Where(t => t.Id == e.Id).FirstOrDefault().DateIni.ToString()); curr.Experiences.ForEach(e => e.DateEnd = useru.Experiences.Where(t => t.Id == e.Id).FirstOrDefault().DateEnd.ToString()); curr.Experiences.ForEach(e => e.DateIni2 = useru.Experiences.Where(t => t.Id == e.Id).FirstOrDefault().DateIni.ToString()); curr.Experiences.ForEach(e => e.DateEnd2 = useru.Experiences.Where(t => t.Id == e.Id).FirstOrDefault().DateEnd.ToString()); curr.Experiences.ForEach(e => e.DateIni3 = useru.Experiences.Where(t => t.Id == e.Id).FirstOrDefault().DateIni.ToString()); curr.Experiences.ForEach(e => e.DateEnd3 = useru.Experiences.Where(t => t.Id == e.Id).FirstOrDefault().DateEnd.ToString()); curr.Certifications = useru.Certifications.Select(e => new ZonaFl.Models.Certification().InjectFrom(e)).Cast <ZonaFl.Models.Certification>().ToList(); curr.Certifications.ForEach(e => e.DateCert = useru.Certifications.Where(t => t.Id == e.Id).FirstOrDefault().DateCert.ToString()); curr.Certifications.ForEach(e => e.DateCert2 = useru.Certifications.Where(t => t.Id == e.Id).FirstOrDefault().DateCert.ToString()); curr.Certifications.ForEach(e => e.DateCert3 = useru.Certifications.Where(t => t.Id == e.Id).FirstOrDefault().DateCert.ToString()); curr.Educations = useru.Educations.Select(e => new ZonaFl.Models.Education().InjectFrom(e)).Cast <ZonaFl.Models.Education>().ToList(); curr.Educations.ForEach(e => e.DateIniE = useru.Educations.Where(t => t.Id == e.Id).FirstOrDefault().DateIni.ToString()); curr.Educations.ForEach(e => e.DateEndE = useru.Educations.Where(t => t.Id == e.Id).FirstOrDefault().DateEnd.ToString()); curr.Educations.ForEach(e => e.DateIni2E = useru.Educations.Where(t => t.Id == e.Id).FirstOrDefault().DateIni.ToString()); curr.Educations.ForEach(e => e.DateEnd2E = useru.Educations.Where(t => t.Id == e.Id).FirstOrDefault().DateEnd.ToString()); curr.Educations.ForEach(e => e.DateIni3E = useru.Educations.Where(t => t.Id == e.Id).FirstOrDefault().DateIni.ToString()); curr.Educations.ForEach(e => e.DateEnd3E = useru.Educations.Where(t => t.Id == e.Id).FirstOrDefault().DateEnd.ToString()); curr.Languages = useru.Languages.Select(e => new ZonaFl.Models.Language().InjectFrom(e)).Cast <ZonaFl.Models.Language>().ToList(); regbm.Curriculum = curr; ViewBag.UserId = id; ViewBag.User = SessionBag.Current.User.UserName; ViewBag.ImageUser = SessionBag.Current.User.Image; ViewBag.ImageUserFrelance = useru.Image; ViewBag.Portfolio = portfolio; ViewBag.Calification = calif; ViewBag.Commentaries = projetsm; } catch (Exception er) { Log4NetLogger logger2 = new Log4NetLogger(); logger2.CurrentUser = SessionBag.Current.User.Id; if (Request != null) { logger2.Error(er, Request.Path, Request.RawUrl); throw new Exception(er.Message); } else { logger2.Error(er); } } return(View(regbm)); }