Пример #1
0
        public AspNetUsers GetUserById(Guid id)
        {
            UserRepository userrepo = new UserRepository();
            UserRepository2 <AspNetUsers> userrepo2   = new UserRepository2 <AspNetUsers>();
            CompanyRepository             companyrepo = new CompanyRepository();
            var skillsuser = userrepo.FindSkillsByUserID(id);
            //AspNetUsers user= userrepo2.Get(id);
            AspNetUsers user  = userrepo.FindByID(id);
            SCategory   scate = new SCategory();

            foreach (var skilluser in skillsuser)
            {
                user.Skills.Where(e => e.Id == skilluser.Id).FirstOrDefault().Visible  = true;
                user.Skills.Where(e => e.Id == skilluser.Id).FirstOrDefault().Category = scate.FindCategoryById(skilluser.CategoryId);
            }
            user.Companies = new List <Company>();
            user.Companies.Add(companyrepo.GetList(new { IdUser = id.ToString() }).FirstOrDefault());

            //UserRepository2<AspNetUsers> userrepo = new UserRepository2<AspNetUsers>();
            if (user.Image != null && user.Image.Contains("fakepath"))
            {
                user.Image = user.Image.Replace(@"C:\fakepath\", "");
            }

            user.PagosConfirmed = (user.Offers.Select(e => e.OfferPhases.Where(x => x.StatusPhase == StatusPhase.EnCurso)).FirstOrDefault() != null)? true: false;



            return(user);
        }
Пример #2
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);
            }
        }
Пример #3
0
        public Project Insert(Project Project)
        {
            ProjectRepository <Project> Projectrepo = new ProjectRepository <Project>();
            int?rta = Projectrepo.Insert(Project);

            if (rta == null)
            {
                return(null);
            }
            else
            {
                Log4NetLogger logger2 = new Log4NetLogger();
                SCategory     scate   = new SCategory();
                var           cate    = scate.FindCategoryById(Project.IdCategory);
                SOffer        sofer   = new SOffer();
                var           offer   = sofer.Get(Project.IdOffer);
                logger2.Info("Creación Proyecto:" + Project.Id + "," + "UsuarioOrigen:" + offer.IdUser + ",Categoria:" + cate.Name);
                return(Project);
            }
        }
Пример #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);
            }
        }
Пример #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);
            }
        }