public ActionResult _GeneralInformation(int id)
        {
            try
            {
                GeneralInformationViewModel model = new GeneralInformationViewModel();

                int LoggedUserId = 0;
                if (User.Identity.IsAuthenticated)
                {
                    LoggedUserId = UserSession.UserId;
                }

                model = _userService.GetGeneralInformationViewModel(id, LoggedUserId);
                if (model != null && model.UserId > 0)
                {
                    model.CanUserEditProfile = _userService.CanUserEditProfile(id, User.Identity.Name);

                    if (User.Identity.IsAuthenticated)
                    {
                        model.IsLoggedUserProfile = (id == UserSession.UserId);
                    }


                    return(PartialView("~/Views/Profile/Profile/_GeneralInformation.cshtml", model));
                }
            }
            catch (Exception e)
            {
                Logger.GenerateError(e, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "id = " + id);
            }
            return(Content(PartialViewResults.UnknownError));
        }
Exemple #2
0
        public IActionResult GeneralInformation(GeneralInformationViewModel model)
        {
            if (model.Temperature < 30)
            {
                var rand = new Faker().Random;
                model.Gender                = Gender.Male;
                model.Temperature           = rand.Int(36, 40) + rand.Decimal();
                model.Age                   = rand.Int(15, 85);
                model.BloodoOxygenationRate = rand.Int(70, 100) + rand.Decimal();
                model.Heartbeat             = rand.Int(70, 130);
            }

            return(View(model));
        }
        public static void UpdateGeneralInformationlDataViewModel(this GeneralInformationViewModel viewModel, ClientFieldData[] clientFieldData, IEnumMappingService enumMappingService)
        {
            // Reviewer
            viewModel.ESGReviewers.UpdateEsgReviewer(clientFieldData, enumMappingService);

            // Components
            viewModel.SustainabilityComponents.UpdateSustainabilityComponents(clientFieldData, enumMappingService);

            //Documents
            viewModel.Documents.UpdateDocuments(clientFieldData, enumMappingService);

            //Comments
            viewModel.CommentsESGOperation.UpdateCommentsESGOperation(clientFieldData, enumMappingService);
        }
Exemple #4
0
        public GeneralInformationViewModel GetGeneralInformationViewModel(int UserId, int LoggedUserId)
        {
            GeneralInformationViewModel model = new GeneralInformationViewModel();

            try
            {
                var user = _userRepo.Get(UserId);
                if (user != null)
                {
                    model.UserId = user.Id;
                    model.BackgroundPictureSrc = (user.BackgroundPictureSrc ?? DefaultImage.BackgroundPicture).Replace("~", "");
                    model.ImageSrc             = (user.PictureSrc ?? DefaultImage.DefaultImageUser).Replace("~", "");
                    model.FirstName            = user.FirstName;
                    model.LastName             = user.LastName;
                    model.CreationDateTxt      = "[[[Joined ]]]" + user.CreationDate.ToLocalTime().ToString("MMMM yyyy");
                    model.Description          = user.Description;
                    model.Facebook             = user.FacebookLink;
                    model.LastConnectionDate   = user.DateLastConnection;
                    //   model.City = user.Address?.ci
                    model.Province = user.Address?.Province.Name;
                    model.Country  = user.Address?.Province?.Country.Name;



                    if (LoggedUserId > 0)
                    {
                        model.FollowedUser = _userFollowRepo.FindAllBy(u => u.FollowedUserId == UserId && u.UserId == LoggedUserId).Any();
                    }
                    else
                    {
                        model.FollowedUser = false;
                    }
                }
            }
            catch (Exception e)
            {
                model = new GeneralInformationViewModel();
                Commons.Logger.GenerateError(e, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "UserId = " + UserId + " and LoggedUserId = " + LoggedUserId);
            }
            return(model);
        }
Exemple #5
0
 public IActionResult Logo(GeneralInformationViewModel model)
 {
     return(View(model));
 }