Exemple #1
0
        public ActionResult Read(string id)
        {
            ZonaFl.Persistence.Entities.AspNetUsers useru  = null;
            ZonaFl.Business.SubSystems.SUser        usern  = new Business.SubSystems.SUser();
            ZonaFl.Business.SubSystems.SOffer       offern = new Business.SubSystems.SOffer();
            useru = usern.GetUserById(new Guid(id));
            RegisterBindingModel regbm = new RegisterBindingModel();

            regbm.InjectFrom(useru);

            regbm.Offers = offern.GetList(new { IdUser = id }).Select(e => new Models.Offer().InjectFrom(e)).Cast <Models.Offer>().ToList();
            regbm.Offers.ForEach(e => e.OfferPhases = offern.GetOfferPhases(e.Id).Select(t => new Models.OfferPhase().InjectFrom(t)).Cast <Models.OfferPhase>().ToList());
            regbm.Offers.ForEach(e => e.Status      = (Models.Offer.StatusOffer)offern.GetPhaseFinal(e.Id).StatusPhase);
            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;

            return(View("ReadForAdmin", regbm));
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        public ActionResult Read(string id)
        {
            ZonaFl.Persistence.Entities.AspNetUsers useru = null;
            ZonaFl.Business.SubSystems.SUser        usern = new Business.SubSystems.SUser();
            useru = usern.GetUserById(new Guid(id));

            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("ReadForAdmin", regbm));
        }
Exemple #4
0
        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));
        }
Exemple #5
0
        public ActionResult EditById(string id)
        {
            //if (SessionBag.Current.Logout != null && SessionBag.Current.Logout)
            //{

            //    SessionBag.Current.Logout = false;
            //    return RedirectToAction("Index", "Home");
            //}
            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;
            }
            ZonaFl.Business.SubSystems.SCategory scategory = new Business.SubSystems.SCategory();
            RegisterBindingModel regbm = new RegisterBindingModel();

            regbm.InjectFrom(useru);
            regbm.Skills = useru.Skills.Select(e => new ZonaFl.Models.Skill().InjectFrom(e)).Cast <ZonaFl.Models.Skill>().ToList();
            if (useru.Companies.FirstOrDefault() != null)
            {
                regbm.Company = useru.Companies.Select(e => new ZonaFl.Models.Company().InjectFrom(e)).Cast <ZonaFl.Models.Company>().ToList();
            }

            List <Models.Category> categorysm = new List <Models.Category>();

            foreach (var skill in useru.Skills)
            {
                Models.Category categorym = new Models.Category();
                if (categorysm.Find(e => e.Id == skill.CategoryId) == null)
                {
                    var category = scategory.FindCategoryById(skill.CategoryId);
                    categorym.InjectFrom(category);
                    categorysm.Add(categorym);
                }
            }


            regbm.Categories = categorysm;
            //regbm.Categories.ForEach(e => e.Skills = useru.Skills.Select(y => new ZonaFl.Models.Skill().InjectFrom(y)).Cast<ZonaFl.Models.Skill>().ToList());
            ViewBag.User      = useru.UserName;
            ViewBag.IdUser    = useru.Id;
            ViewBag.ImageUser = useru.Image;
            ViewBag.EmailUser = useru.Email;
            //ViewBag.Country = useru.Country;
            ZonaFl.Business.SubSystems.SCountry scountry = new Business.SubSystems.SCountry();


            var itemciudad = scountry.FindCityByName(useru.City);
            var item       = scountry.FindCountrybyName(useru.Country);

            var items = item != null?scountry.FindAll().Where(e => e.Id != item.Id).ToList() : scountry.FindAll();

            if (item != null)
            {
                items.Insert(0, item);
            }

            var countries = new SelectList(items, "ID", "Name").ToList();

            ViewBag.Countrysel = item != null ? item.Id: items.First().Id;
            var countryfirst = scountry.FindFirstCityByCountry(int.Parse(ViewBag.Countrysel.ToString()));

            ViewBag.Ciudadsel = string.IsNullOrEmpty(itemciudad.Name) ? countryfirst.Name : itemciudad.Name;
            ViewBag.Country   = countries;

            if (regbm.Company == null)
            {
                regbm.Company = new List <Models.Company>();
                regbm.Company.Add(new Models.Company());
            }

            if (regbm.PhoneNumber == null)
            {
                regbm.PhoneNumber = regbm.Company.FirstOrDefault().Telefono;
            }
            ViewBag.Title = "Contratante";
            //TempData["SkillsUser"] = regbm.Skills;
            return(View("Edit", 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));
            }
        }
Exemple #7
0
        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));
        }
Exemple #8
0
        public ActionResult EditById(string id)
        {
            ZonaFl.Persistence.Entities.AspNetUsers useru     = null;
            ZonaFl.Business.SubSystems.SUser        usern     = new Business.SubSystems.SUser();
            ZonaFl.Business.SubSystems.SCategory    scategory = new Business.SubSystems.SCategory();

            ZonaFl.Business.SubSystems.SCountry scountry = new Business.SubSystems.SCountry();

            useru = usern.GetUserById(new Guid(id));
            if (SessionBag.Current.User == null)
            {
                SessionBag.Current.User = useru;
            }

            RegisterBindingModel regbm = new RegisterBindingModel();

            regbm.InjectFrom(useru);
            regbm.Skills     = useru.Skills.Select(e => new ZonaFl.Models.Skill().InjectFrom(e)).Cast <ZonaFl.Models.Skill>().ToList();
            regbm.Categories = useru.Skills.Select(e => new ZonaFl.Models.Category().InjectFrom(scategory.FindCategoryById(e.CategoryId))).Cast <ZonaFl.Models.Category>().GroupBy(t => t.Id).Select(g => g.First()).ToList();
            regbm.Categories.ForEach(e => e.Skills = useru.Skills.Where(w => w.CategoryId == e.Id).Select(y => new ZonaFl.Models.Skill().InjectFrom(y)).Cast <ZonaFl.Models.Skill>().ToList());

            ViewBag.CountAllCategories = regbm.Skills != null?regbm.Skills.Where(e => e.Visible).Count() : 0;

            //var query = regbm.Categories.Select(s => s.Skills.Where(v => v.Visible).GroupBy(c => c.CategoryId)).SelectMany(r => r).ToList();


            var query = from skill in regbm.Skills
                        where skill.Visible
                        group skill by skill.CategoryId
                        into grouping
                        select new { Key = grouping.Key, Count = grouping.Count() };

            foreach (var VARIABLE in query)
            {
                regbm.GetType().GetProperty("Count" + VARIABLE.Key.ToString()).SetValue(regbm, VARIABLE.Count);
            }

            ViewBag.Skills     = regbm.Skills;
            ViewBag.Categories = regbm.Categories;
            ViewBag.User       = useru.UserName;
            ViewBag.IdUser     = useru.Id;
            ViewBag.ImageUser  = useru.Image;
            Persistence.Entities.City    itemciudad = null;
            Persistence.Entities.Country item       = null;
            if (useru.City != null)
            {
                itemciudad = scountry.FindCityByName(useru.City);
            }
            else
            {
                itemciudad = scountry.FindCityByName("Bogota");
            }
            if (useru.Country != null)
            {
                item = scountry.FindCountrybyName(useru.Country);
            }
            else
            {
                item = scountry.FindCountrybyName("Colombia");
            }
            List <SelectListItem> countries = null;

            if (item != null)
            {
                var items = scountry.FindAll().Where(e => e.Id != item.Id).ToList();

                items.Insert(0, item);
                countries = new SelectList(items, "ID", "Name").ToList();
            }
            else
            {
                var items = scountry.FindAll();
                countries = new SelectList(items, "ID", "Name").ToList();
                item      = items.FirstOrDefault();
            }

            ViewBag.Countrysel     = item.Id;
            ViewBag.Ciudadsel      = itemciudad.Name;
            ViewBag.Country        = countries;
            TempData["SkillsUser"] = regbm.Skills;
            ViewBag.Title          = "Freelance";
            return(View("Edit", regbm));
        }
Exemple #9
0
        // GET: Offer

        public ActionResult Index(string id)
        {
            try
            {
                SOffer soffer       = new SOffer();
                int    pagenumber   = 1;  //int.Parse( Request.QueryString.Get("pagenumber"));
                int    itemsperpage = 50; // int.Parse(Request.QueryString.Get("itemsperpage"));
                string conditions   = "";

                ///user session bag
                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 (!useru.Freelance)
                {
                    conditions = " where iduser='******'and(O.Status=0 )"; //Request.QueryString.Get("conditions");
                }
                else
                {
                    conditions = " where OP.StatusPhase<>2 and OP.StatusPhase<>3 and OP.StatusPhase<>4 AND  O.Id NOT IN(SELECT Project.idoffer  from project)"; //Request.QueryString.Get("conditions");
                }

                var skills     = useru.Skills.Where(e => e.CategoryId != null).ToList();
                var categories = skills.GroupBy(n => n.CategoryId).ToList();
                int i          = 0;
                foreach (var cat in categories)
                {
                    if (i == 0)
                    {
                        conditions += " and (O.CategoryId=" + cat.Key;
                    }
                    else
                    {
                        conditions += " or O.CategoryId=" + cat.Key;
                    }
                    i += 1;
                }
                conditions += ")";

                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.User            = useru.UserName;
                ViewBag.ImageUser       = SessionBag.Current.User.Image;
                /////

                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             = soffer.GetListPaged(pagenumber, itemsperpage, conditions, order);
                List <Models.Offer> listoffers                      = lista.Select(e => new Models.Offer().InjectFrom(e)).Cast <Models.Offer>().ToList();
                List <Persistence.Entities.Category> listcategories = lista.Select(e => e.Category).ToList();

                Dictionary <int, string> dicofferexiste = new Dictionary <int, string>();
                int offeruserexist = -1;
                if (TempData["OfferMessage"] != null)
                {
                    dicofferexiste = (Dictionary <int, string>)TempData["OfferMessage"];
                    offeruserexist = dicofferexiste.FirstOrDefault().Key;
                }

                foreach (var offer in lista)
                {
                    var offerget = soffer.GetById(offer.Id);
                    if (offerget != null)
                    {
                        offer.OfferPhases = offerget.OfferPhases.Select(e => new OfferPhases().InjectFrom(e)).Cast <OfferPhases>().ToList();
                    }
                    listoffers.FirstOrDefault(e => e.Id == offer.Id).OfferPhases = offer.OfferPhases.Select(e => new OfferPhase().InjectFrom(e)).Cast <OfferPhase>().ToList();
                    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);
                    if (offer.Id == offeruserexist)
                    {
                        listoffers.FirstOrDefault(e => e.Id == offer.Id).Applicada = true;
                    }

                    var dateoferfase1 = soffer.GetPhaseInitial(offer.Id);
                    if (dateoferfase1 == null)
                    {
                        listoffers.FirstOrDefault(e => e.Id == offer.Id).DateIniPhase1 = DateTime.Parse("01/01/1900");
                    }
                    else
                    {
                        listoffers.FirstOrDefault(e => e.Id == offer.Id).DateIniPhase1 = dateoferfase1.InitPhase;
                    }
                }
                //listoffers.ForEach(e => e.Category.InjectFrom(listcategories.Where(i => i.Id == e.Id).FirstOrDefault()));
                if (((RegisterBindingModel)SessionBag.Current.User).Freelance)
                {
                    return(View("DetailsForFreelance", listoffers));
                }
                else
                {
                    return(RedirectToAction("Index", "Projects", new { id = SessionBag.Current.User.Id }));
                }
            }
            catch (Exception er)
            {
                Log4NetLogger logger2 = new Log4NetLogger();
                logger2.CurrentUser = SessionBag.Current.User.Id;
                if (Request != null)
                {
                    logger2.Error(er, Request.Path, Request.RawUrl);
                }
                else
                {
                    logger2.Error(er);
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
Exemple #10
0
        public ActionResult Filter(string filter)
        {
            if (!string.IsNullOrEmpty(filter) && filter.EndsWith("or "))
            {
                filter = " and " + ReplaceLastOccurrence(filter, "or", "");
            }

            if (!string.IsNullOrEmpty(filter) && filter.EndsWith("and "))
            {
                filter = " and " + ReplaceLastOccurrence(filter, "and", "");
            }

            SOffer soffer       = new SOffer();
            int    pagenumber   = 1;  //int.Parse( Request.QueryString.Get("pagenumber"));
            int    itemsperpage = 50; // int.Parse(Request.QueryString.Get("itemsperpage"));
            string conditions   = "";

            ///user session bag
            ZonaFl.Persistence.Entities.AspNetUsers useru = null;
            ZonaFl.Business.SubSystems.SUser        usern = new Business.SubSystems.SUser();
            string id = ((RegisterBindingModel)SessionBag.Current.User).Id;

            useru = usern.GetUserById(new Guid(id));
            if (!useru.Freelance)
            {
                conditions = " where iduser='******' " + filter + "' and OP.StatusPhase<>2 and OP.StatusPhase<>3; "; //Request.QueryString.Get("conditions");
            }
            else
            {
                conditions = " where OP.StatusPhase<>2 and OP.StatusPhase<>3 AND  O.Id NOT IN(SELECT Project.idoffer  from project) " + filter;  //Request.QueryString.Get("conditions");
            }
            //se  quitan los skill porque aqui se puede haber filtrado por skills diferentes
            //var skills = useru.Skills.Where(e => e.CategoryId != null).ToList();
            //var categories = skills.GroupBy(n => n.CategoryId).ToList();
            //int i = 0;
            //foreach (var cat in categories)
            //{
            //    if (i == 0)
            //    {
            //        conditions += " and (O.CategoryId=" + cat.Key;
            //    }
            //    else
            //    {
            //        conditions += " or O.CategoryId=" + cat.Key;

            //    }
            //    i += 1;
            //}
            //conditions += ")";

            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;
            /////

            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             = soffer.GetListPaged(pagenumber, itemsperpage, conditions, order);
            List <Models.Offer> listoffers                      = lista.Select(e => new Models.Offer().InjectFrom(e)).Cast <Models.Offer>().ToList();
            List <Persistence.Entities.Category> listcategories = lista.Select(e => e.Category).ToList();

            Dictionary <int, string> dicofferexiste = new Dictionary <int, string>();
            int offeruserexist = -1;

            if (TempData["OfferMessage"] != null)
            {
                dicofferexiste = (Dictionary <int, string>)TempData["OfferMessage"];
                offeruserexist = dicofferexiste.FirstOrDefault().Key;
            }

            foreach (var offer in lista)
            {
                var offerget = soffer.GetById(offer.Id);
                if (offerget != null)
                {
                    offer.OfferPhases = offerget.OfferPhases.Select(e => new OfferPhases().InjectFrom(e)).Cast <OfferPhases>().ToList();
                }
                listoffers.FirstOrDefault(e => e.Id == offer.Id).OfferPhases = offer.OfferPhases.Select(e => new OfferPhase().InjectFrom(e)).Cast <OfferPhase>().ToList();
                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;
                if (offer.Id == offeruserexist)
                {
                    listoffers.FirstOrDefault(e => e.Id == offer.Id).Applicada = true;
                }

                var dateoferfase1 = soffer.GetPhaseInitial(offer.Id);
                if (dateoferfase1 == null)
                {
                    listoffers.FirstOrDefault(e => e.Id == offer.Id).DateIniPhase1 = DateTime.Parse("01/01/1900");
                }
                else
                {
                    listoffers.FirstOrDefault(e => e.Id == offer.Id).DateIniPhase1 = dateoferfase1.InitPhase;
                }
            }
            //listoffers.ForEach(e => e.Category.InjectFrom(listcategories.Where(i => i.Id == e.Id).FirstOrDefault()));
            if (((RegisterBindingModel)SessionBag.Current.User).Freelance)
            {
                return(PartialView("PartialFilterOffer", listoffers));
            }
            else
            {
                return(RedirectToAction("Index", "Projects", new { id = SessionBag.Current.User.Id }));
            }

            //SOffer soffer = new SOffer();
            //int pagenumber = 1;//int.Parse( Request.QueryString.Get("pagenumber"));
            //int itemsperpage = 50;// int.Parse(Request.QueryString.Get("itemsperpage"));

            //string conditions = " where iduser='******' " + filter + "; "; //Request.QueryString.Get("conditions");
            //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 = soffer.GetListPaged(pagenumber, itemsperpage, conditions, order);
            //List<Models.Offer> listoffers = lista.Select(e => new Models.Offer().InjectFrom(e)).Cast<Models.Offer>().ToList();
            //List<Persistence.Entities.Category> listcategories = lista.Select(e => e.Category).ToList();
            //foreach (var offer in lista)
            //{
            //    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;
            //   var phase= soffer.GetPhaseInitial(offer.Id);
            //    if (phase != null)
            //    {
            //        ViewBag.InicioEst = phase.InitPhase;
            //        if(offer.OfferPhases.Count>0)
            //        ViewBag.FinEst = offer.OfferPhases.LastOrDefault(e => e.FinishPhase != null).FinishPhase;
            //        listoffers.FirstOrDefault(e => e.Id == offer.Id).DateIniPhase1 = soffer.GetPhaseInitial(offer.Id).InitPhase;

            //    }
            //    else
            //    {
            //        listoffers.FirstOrDefault(e => e.Id == offer.Id).DateIniPhase1 = DateTime.Parse("01/01/1900");
            //    }
            //}
            ////listoffers.ForEach(e => e.Category.InjectFrom(listcategories.Where(i => i.Id == e.Id).FirstOrDefault()));
            //if (((RegisterBindingModel)SessionBag.Current.User).Freelance)
            //{
            //    return PartialView("PartialFilterOffer", listoffers);
            //}
            //else
            //{
            //    return PartialView("PartialFilterOffer", listoffers);
            //}
        }