public ActionResult Index(ProfileViewModel model) { if (!this.ModelState.IsValid) { return this.View(model); } this.UpdateUserSettings(this.UserProfile, model); if (model.UploadedImage != null) { using (var memory = new MemoryStream()) { model.UploadedImage.InputStream.CopyTo(memory); var content = memory.GetBuffer(); this.UserProfile.Image = new Image { Content = content, FileExtension = model.UploadedImage.FileName.Split(new[] { '.' }).Last(), CreatedOn = DateTime.Now }; } } this.Users.Update(); return this.RedirectToAction("Index", "Organization", new {area = "Private" }); }
public static void CreateModel() { if (_pModel == null) { _pModel = new ProfileViewModel(); } }
public Profile() { InitializeComponent(); model = new ProfileViewModel(); this.DataContext = model; model.PropertyChanged += model_PropertyChanged; }
public ActionResult Edit(ProfileViewModel model) { if (ModelState.IsValid) { var profile = db.Profiles.Find(model.Profile.ID); if (profile == null) return RedirectToAction("Index"); //update fileds profile.FirstName = model.Profile.FirstName; profile.LastName = model.Profile.LastName; profile.About = model.Profile.About; profile.Faculty = model.Profile.Faculty; profile.StudyMajor = model.Profile.StudyMajor; profile.StudyYear = model.Profile.StudyYear; //upload user photo try { foreach (string upload in Request.Files) { if (Request.Files[upload].ContentLength == 0) continue; string path = AppDomain.CurrentDomain.BaseDirectory + "Content/profile-photos/"; FileInfo TheFile = new FileInfo(path + model.Profile.Photo); if (TheFile.Exists) { TheFile.Delete(); } string ext = Request.Files[upload].FileName.Substring(Request.Files[upload].FileName.LastIndexOf('.')); profile.Photo = model.Profile.UserName + ext; Request.Files[upload].SaveAs(Path.Combine(path, profile.Photo)); } } catch (NullReferenceException) { //no photo } //end of upload user photo try { var cats = db.NewsCategories.Where(r => model.CategoryIDs.Contains(r.ID)); profile.Subscriptions.Clear(); foreach (var cat in cats) { profile.Subscriptions.Add(cat); } } catch (NotSupportedException) { /* 0 categories */ } UpdateModel(profile); db.SaveChanges(); return RedirectToAction("Details", new { id = model.Profile.ID }); } return View(model); }
public async Task<ActionResult> Edit(ProfileViewModel model, HttpPostedFileBase upload) { var user = _userManager.FindById(User.Identity.GetUserId()); if (user == null) { return RedirectToAction("Start", "Main"); } if (upload != null && upload.ContentLength > 0) { WebImage img = new WebImage(upload.InputStream); if (img.Width > 32) img.Resize(32, 32); user.Avatar = img.GetBytes(); } user.FirstName = model.FirstName; user.LastName = model.LastName; user.UserName = model.Username; user.Email = model.Email; await _userManager.UpdateAsync(user); return RedirectToAction("Details", "Profile"); }
public ActionResult Profile() { if (this.User.Identity.IsAuthenticated) { string userId = this.User.Identity.GetUserId(); var user = this.Data.Users.All() .FirstOrDefault(u => u.Id == userId); IQueryable<TweetViewModel> tweets = this.Data.Tweets.All() .Where(t => t.UserId == userId) .Select(TweetViewModel.Create); IQueryable<UserViewModel> following = user.Following .AsQueryable() .Select(UserViewModel.Create); IQueryable<UserViewModel> followers = user.Followers .AsQueryable() .Select(UserViewModel.Create); IQueryable<TweetViewModel> favouriteTweets = user.FavouriteTweets .AsQueryable() .Select(TweetViewModel.Create); ProfileViewModel profileViewModel = new ProfileViewModel(); profileViewModel.Tweets = tweets.ToList(); profileViewModel.Following = following.ToList(); profileViewModel.Followers = followers.ToList(); profileViewModel.FavouriteTweets = favouriteTweets.ToList(); return View(profileViewModel); } else { return RedirectToAction("Login", "Account"); } }
public ActionResult Edit(ProfileViewModel model) { if (ModelState.IsValid) { Db.Create(model); } return View(model); }
private void UpdateUserSettings(User model, ProfileViewModel viewModel) { model.UserName = viewModel.Email; model.FirstName = viewModel.FirstName; model.LastName = viewModel.LastName; model.Email = viewModel.Email; model.Position = viewModel.Position; }
public MemberViewModel(Member member, IList<Role> roles) { this._member = member; this._roles = roles; this._profile = new ProfileViewModel(member.Profile); this._id = member.Id; this._password = member.Password; this._username = member.Username; }
public override void ViewDidLoad () { base.ViewDidLoad (); viewModel = App.ProfileViewModel; SetUpNickNameControls (); SetUpCollectionView (); SetUpAvatarControl (); spaceCalculator = new CollectionViewSpaceCalculator (CollectionView, AvatarCollectionViewCell.CellSize); gestureAttacher = new LongPressGestureAttacher (AvatarImg, TakeAvatar); }
public void EditPostTest() { // Act ProfileViewModel profilevm = new ProfileViewModel { Profile = new Profile { ID = 1, UserName = "******", LastName = "Doe" } }; controller.db.Profiles.Add(profilevm.Profile); profilevm.Profile.LastName = "Smith"; RedirectToRouteResult result = controller.Edit(profilevm) as RedirectToRouteResult; // Assert Assert.AreEqual("Details", result.RouteValues["action"]); Assert.AreEqual(profilevm.Profile.LastName, controller.db.Profiles.Find(1).LastName); }
public ActionResult Index(string searchString) { var profile = this.profiles.GetAll().To<DetailsProfileViewModel>().ToList(); if (!String.IsNullOrEmpty(searchString)) { profile = profile.Where(s => s.FullName.ToLower().Contains(searchString.ToLower())).ToList(); } var viewModel = new ProfileViewModel { Profiles = profile }; return this.View(viewModel); }
public ActionResult Edit() { var user = _userManager.FindById(User.Identity.GetUserId()); if (user == null) { return RedirectToAction("Start", "Main"); } var model = new ProfileViewModel() { Username = user.UserName, Email = user.Email, FirstName = user.FirstName, LastName = user.LastName }; return View(model); }
public ActionResult AtAGlance() { string name = User.Identity.Name; ApplicationUser user = db.Users.Single(x => x.UserName == name); ProfileViewModel vm = new ProfileViewModel { FirstName = user.FirstName, LastName = user.LastName, Email = user.Email, UserName = user.UserName, }; //pass all user households to view vm.Households = user.Households; string profilePicUrl = user.ProfilePicUrl; vm.ProfilePicUrl = profilePicUrl; return View(vm); }
public ActionResult Index(ProfileViewModel profileInfo) { //if (ModelState.IsValid) //{ using (InternetStoreDBContext dbc = new InternetStoreDBContext()) { var newUserInfo = new Classes.User(); var oldUserInfo = (from u in dbc.Users where u.Email == profileInfo.Email select u).ToList().FirstOrDefault(); if (oldUserInfo != null) { dbc.Users.DeleteOnSubmit(oldUserInfo); dbc.SubmitChanges(); //Currently constant fields: newUserInfo.ID = oldUserInfo.ID; newUserInfo.UserName = oldUserInfo.UserName; newUserInfo.Password = oldUserInfo.Password; //Changable fields: newUserInfo.FirstName = profileInfo.FirstName; newUserInfo.LastName = profileInfo.LastName; newUserInfo.Phone = profileInfo.Phone; newUserInfo.Address = profileInfo.Address; newUserInfo.Email = profileInfo.Email; dbc.Users.InsertOnSubmit(newUserInfo); dbc.SubmitChanges(); ProfileViewModel newProfile = new ProfileViewModel(); newProfile.UserName = newUserInfo.UserName ?? ""; newProfile.FirstName = newUserInfo.FirstName ?? ""; newProfile.LastName = newUserInfo.LastName ?? ""; newProfile.Email = newUserInfo.Email ?? ""; newProfile.Phone = newUserInfo.Phone ?? ""; newProfile.Address = newUserInfo.Address ?? ""; return View(newProfile); } } //} return View(profileInfo); }
public void ShouldBeAbleToCallSaveProfileMethod() { // arrange var controller = new ProfileController(this.MembershipService, this.FormsAuthentication); var profileView = new ProfileViewModel { FirstName = "Vitali", LastName = "Hatalski", NotifyOnOrderStatusChanged = true, NotifyOnPackageStatusChanged = true }; // act var actual = ((JsonNetResult)controller.Save(profileView)).Data as ProfileViewModel; // assert Assert.That(actual, Is.Not.Null); if (actual != null) { Assert.That(actual.MessageType, Is.EqualTo(MessageType.Success.ToString())); } }
public ActionResult Save(ProfileViewModel model) { var result = new ProfileViewModel(); var validator = new ProfileViewModelValidator(); var validationResult = validator.Validate(model); if (validationResult.IsValid) { var request = model.ConvertToUpdateProfileRequest(); request.IdentityToken = this.FormsAuthentication.GetAuthenticationToken(); var response = this.membershipService.UpdateProfile(request); result = response.ConvertToProfileViewModel(); result.Message = response.Message; } else { result.MessageType = MessageType.Warning.ToString(); result.Message = CommonResources.ProfileUpdateErrorMessage; result.FirstName = model.FirstName; result.LastName = model.LastName; result.NotifyOnOrderStatusChanged = model.NotifyOnOrderStatusChanged; result.NotifyOnPackageStatusChanged = model.NotifyOnPackageStatusChanged; result.BrokenRules = new List<BusinessRule>(); foreach (var failure in validationResult.Errors) { result.BrokenRules.Add(new BusinessRule(failure.PropertyName, failure.CustomState.ToString())); } } result.Email = this.FormsAuthentication.GetAuthenticationToken(); var jsonNetResult = new JsonNetResult { Formatting = (Formatting)Newtonsoft.Json.Formatting.Indented, Data = result }; return jsonNetResult; }
public ActionResult Settings(ProfileViewModel profile) { if (profile == null) return null; var user = GetUser(); if (user == null) RedirectToAction("Index", "Home"); profile.Id = user.Id; bool success = _profileService.Update(EntityConvert<ProfileViewModel, UserProfileBLL>(profile)); if (success) { ViewBag.Success = true; return View(profile); } ViewBag.NotSuccess = true; return View(profile); }
public ActionResult Index(string returnUrl) { ProfileViewModel profile = new ProfileViewModel(); if (User.Identity.IsAuthenticated) { using (InternetStoreDBContext dbc = new InternetStoreDBContext()) { var currentUser = (from u in dbc.Users where u.Email == User.Identity.Name select u).ToList().FirstOrDefault(); if (currentUser != null) { profile.UserName = currentUser.UserName ?? ""; profile.FirstName = currentUser.FirstName ?? ""; profile.LastName = currentUser.LastName ?? ""; profile.Email = currentUser.Email ?? ""; profile.Phone = currentUser.Phone ?? ""; profile.Address = currentUser.Address ?? ""; } } } ViewBag.ReturnUrl = returnUrl; return View(profile); }
public async Task <ActionResult> ListProfiles() { string acess_token = Session["access_token"]?.ToString(); ICollection <ProfileViewModel> profilesViewModel = new List <ProfileViewModel>(); using (var client = new HttpClient()) { client.BaseAddress = UriAccount; var response = await client.GetAsync("api/Profiles/ListProfiles"); var responseContent = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { ICollection <Profiles> profiles = JsonConvert.DeserializeObject <ICollection <Profiles> >(responseContent); foreach (Profiles profile in profiles) { ProfileViewModel profileVM = BuildProfileViewModel(profile); profilesViewModel.Add(profileVM); } } else if (response.StatusCode == HttpStatusCode.Unauthorized) { return(RedirectToAction("Login", "Account")); } else { return(RedirectToAction("Error")); } if (string.IsNullOrEmpty(acess_token)) { return(View(profilesViewModel)); } client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", $"{acess_token}"); // pega o perfil da conta var responseAccountProfile = await client.GetAsync("api/Profiles/getProfileByAccount"); if (responseAccountProfile.IsSuccessStatusCode) { var responseContentAccountProfile = await responseAccountProfile.Content.ReadAsStringAsync(); Profiles profileAcc = JsonConvert.DeserializeObject <Profiles>(responseContentAccountProfile); // Remove o perfil da lista, para não aparecer na view profilesViewModel = profilesViewModel.Where(x => x.Id != profileAcc.Id).ToList(); foreach (ProfileViewModel friend in profilesViewModel) { friend.IsFriend = false; if (profileAcc.Following.Count() > 0) { friend.IsFriend = profileAcc.Following.Any(x => x.Id == friend.Id); } } } return(View(profilesViewModel)); } }
public Profile(tblUser user) { InitializeComponent(); DataContext = new ProfileViewModel(this, user); }
public async Task <IActionResult> Index(string userName) { userName = userName ?? User.Identity.Name; var userId = await _accountManager.GetUserIdByNameAsync(userName); var profile = await _profileManager.GetProfileAsync(userId); var comments = await _orderManager.GetUserCommentsAsync(userId); var tags = await _tagManager.GetUserTagsAsync(userId); var commentViewModels = new List <CommentViewModel>(); var tagViewModels = new List <TagViewModel>(); double?rating = null; if (comments.Any()) { foreach (var comment in comments) { var author = await _profileManager.GetProfileAsync(comment.AuthorId); commentViewModels.Add(new CommentViewModel { OrderId = comment.OrderId, Created = comment.Created, Rating = comment.Rating, Text = comment.Text, AuthorName = author.Name, AuthorAvatar = author.Avatar, AuthorUserName = await _accountManager.GetUserNameByIdAsync(author.UserId) }); } rating = commentViewModels.Select(comment => comment.Rating).Average(); } if (tags.Any()) { foreach (var tag in tags) { tagViewModels.Add(new TagViewModel { Id = tag.Id, Name = tag.Name }); } } var ordersCompleted = (await _orderManager.GetIncomingOrdersAsync(profile.UserId)) .Where(order => order.State == StateType.Completed).Count(); var profileViewModel = new ProfileViewModel() { Id = profile.Id, UserId = profile.UserId, UserName = userName, Avatar = profile.Avatar, Created = profile.Created, IsVendor = profile.IsVendor, Info = profile.Info, Name = profile.Name, Rating = rating, Comments = commentViewModels, Tags = tagViewModels, OrdersCompleted = ordersCompleted }; return(View(profileViewModel)); }
private async Task <AggregatedWorkitemsETAReport> GenerateReport(GenerateAggregatedWorkitemsETAReport command, IDataSource dataSource, ProfileViewModel profile) { var workItems = await GetAllWorkItems(dataSource, profile.Members); if (!workItems.Any()) { return(AggregatedWorkitemsETAReport.Empty); } var team = await GetAllTeamMembers(dataSource, profile.Members); var scope = new ClassificationScope(team, command.Start, command.End); var resolutions = workItems.SelectMany(w => _workItemClassificationContext.Classify(w, scope)) .GroupBy(r => r.AssociatedUser.Email) .ToDictionary(k => k.Key, v => v.AsEnumerable()); var report = new AggregatedWorkitemsETAReport(team.Count()); foreach (var member in team) { var individualReport = GetIndividualReport(resolutions, workItems, dataSource, member, team); report.IndividualReports.Add(individualReport); } report.Workdays = CalculateWorkdaysAmount(command.Start, command.End); return(report); }
// GET: Profile/Details/5 public ActionResult Details(string id) { ProfileViewModel profileViewModel = GetProfileViewModel(id); return(View(profileViewModel)); }
public ActionResult ViewEdit(ProfileViewModel model) { return View(model); }
public UserProfileAppViewModel() { Content = new ProfileViewModel(); }
public ProfilePage(string parameter) { InitializeComponent(); BindingContext = _viewModel = new ProfileViewModel(); }
public ProfilePage() { InitializeComponent(); webApiRestClient = new WebApiRestClient(); BindingContext = new ProfileViewModel(Navigation); }
public async Task <ActionResult> Create(ProfileViewModel model) { string access_token = Session["access_token"]?.ToString(); if (string.IsNullOrEmpty(access_token)) { return(RedirectToAction("Login", "Account", null)); } if (ModelState.IsValid) { using (var client = new HttpClient()) { using (var content = new MultipartFormDataContent()) { client.BaseAddress = new Uri("http://localhost:24260"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", $"{access_token}"); content.Add(new StringContent(JsonConvert.SerializeObject(model))); if (Request.Files.Count > 0) { byte[] fileBytes; using (var inputStream = Request.Files[0].InputStream) { var memoryStream = inputStream as MemoryStream; if (memoryStream == null) { memoryStream = new MemoryStream(); inputStream.CopyTo(memoryStream); } fileBytes = memoryStream.ToArray(); } var fileContent = new ByteArrayContent(fileBytes); fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment"); fileContent.Headers.ContentDisposition.FileName = Request.Files[0].FileName.Split('\\').Last(); content.Add(fileContent); } var response = await client.PostAsync("api/Profiles", content); if (response.IsSuccessStatusCode) { Session.Add("user_name", model.FirstName); return(RedirectToAction("Index", "Home")); } else { return(View("Error")); } } } } return(View()); }
public IActionResult Profile() { var model = new ProfileViewModel(); return(View(model)); }
public ResponseModel <ProfileViewModel> UpdateProfileDetail(ProfileViewModel model, string imagePath, string signPath) { ResponseModel <ProfileViewModel> response = new ResponseModel <ProfileViewModel> { Data = new ProfileViewModel() }; try { var details = acmContext.ProfileInfo.Where(x => x.CheckInId == model.CheckInId).FirstOrDefault(); if (details != null) { details.IsActive = model.IsActive; if (!string.IsNullOrEmpty(model.Photo)) { var photoImage = Path.Combine(imagePath, details.Photo.ToString()); if (System.IO.File.Exists(photoImage)) { System.IO.File.Delete(photoImage); } string photoName = Guid.NewGuid().ToString() + "." + Convert.ToString(ImageFormat.Jpeg); var path = Path.Combine(imagePath, photoName.ToString()); string Photo64Base = model.Photo.Replace("\r", "").Replace("\n", ""); byte[] imageBytes = Convert.FromBase64String(Photo64Base); File.WriteAllBytes(path, imageBytes); details.Photo = photoName; } if (!string.IsNullOrEmpty(model.Signature)) { var signImage = Path.Combine(signPath, details.Signature.ToString()); if (System.IO.File.Exists(signImage)) { System.IO.File.Delete(signImage); } string signName = Guid.NewGuid().ToString() + "." + Convert.ToString(ImageFormat.Png); var _signPath = Path.Combine(signPath, signName.ToString()); string Signature64Base = model.Signature.Replace("\r", "").Replace("\n", ""); byte[] _imageBytes = Convert.FromBase64String(Signature64Base); File.WriteAllBytes(_signPath, _imageBytes); details.Photo = signName; } acmContext.SaveChanges(); ProfileViewModel _profile = new ProfileViewModel(); _profile.CheckInId = details.CheckInId; _profile.CreatedOn = details.CreatedOn; _profile.IsActive = details.IsActive; _profile.Photo = details.Photo; _profile.Signature = details.Signature; response.Data = _profile; response.Message = "Success"; response.Status = true; } } catch (Exception ex) { response.Status = false; response.Message = ex.Message; } return(response); }
public ActionResult UpdateDetails(int id) { customer = customerBL.GetCustomerDetails(id); profileViewModel = AutoMapper.Mapper.Map <CustomerDetails, ProfileViewModel>(customer); return(View(profileViewModel)); }
public async Task <ActionResult> Details(string id) { CVGSAppEntities db = new CVGSAppEntities(); var applicationUserManager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>(); ProfileViewModel model; // determine if the profile owner is friend of the current user bool isInFriendList = false; bool isFriendedUser = false; if ((System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); isFriendedUser = userId == id || db.FriendLists.Any(f => f.userId == id && f.friendId == userId); isInFriendList = db.FriendLists.Any(f => f.userId == userId && f.friendId == id); } try { var user = await db.MemberUsers.FindAsync(id); if (user != null) { // Get user's preferences var categoryPrefs = (GameCategoryOptions)user.CategoryOptions; var platformPrefs = (FavoritePlatforms)user.PlatformOptions; model = new ProfileViewModel { Id = id, DisplayName = applicationUserManager.FindById(id).UserName, FirstName = user.FirstName, LastName = user.LastName, FavoriteCatefories = categoryPrefs.ToString(), FavoritePlatforms = platformPrefs.ToString(), IsInUserFriendList = isInFriendList, UserInProfileFriendList = isFriendedUser, //ActionChecked = categoryPrefs.HasFlag(GameCategoryOptions.Action), //AdventureChecked = categoryPrefs.HasFlag(GameCategoryOptions.Adventure), //RolePlayingChecked = categoryPrefs.HasFlag(GameCategoryOptions.RolePlaying), //SimulationChecked = categoryPrefs.HasFlag(GameCategoryOptions.Simulation), //StrategyChecked = categoryPrefs.HasFlag(GameCategoryOptions.Strategy), //PuzzleChecked = categoryPrefs.HasFlag(GameCategoryOptions.Puzzle), //PCChecked = platformPrefs.HasFlag(FavoritePlatforms.PC), //PlayStationChecked = platformPrefs.HasFlag(FavoritePlatforms.PlayStation), //XboxChecked = platformPrefs.HasFlag(FavoritePlatforms.Xbox), //NintendoChecked = platformPrefs.HasFlag(FavoritePlatforms.Nintendo), //MobileChecked = platformPrefs.HasFlag(FavoritePlatforms.Mobile) }; if (isFriendedUser) { // Get wish list games var wishListIds = db.WishLists.Where(u => u.userId == id).Select(i => i.gameId).ToList(); var wishListGames = db.Games.Where(g => wishListIds.Contains(g.Id)).ToList(); // Get owned games var orderIds = db.Orders.Where(o => o.UserId == id).Select(o => o.Id).ToList(); var gameIds = db.OrderItems.Where(oi => orderIds.Contains(oi.OrderId)).Select(oi => oi.GameId).ToList(); var purchasedGames = db.Games.Where(g => gameIds.Contains(g.Id)).ToList(); model.WishList = wishListGames; model.OwnedGames = purchasedGames; // Attach category and platform to wish list and games list var categories = db.GameCategories.ToDictionary(item => item.Id, item => item.Name); var platforms = db.GamePlatforms.ToDictionary(item => item.Id, item => item.Name); foreach (var game in model.WishList) { if (categories.Any()) { game.CategoryName = game.CategoryId == null ? "None" : categories[(int)game.CategoryId]; } if (platforms.Any()) { game.PlatformName = game.PlatformId == null ? "None" : platforms[(int)game.PlatformId]; } } foreach (var game in model.OwnedGames) { if (categories.Any()) { game.CategoryName = game.CategoryId == null ? "None" : categories[(int)game.CategoryId]; } if (platforms.Any()) { game.PlatformName = game.PlatformId == null ? "None" : platforms[(int)game.PlatformId]; } } } } else { return(RedirectToAction("FriendList", "Manage")); } } catch (Exception) { TempData["message"] = "Unexpected error occurred while retrieving user profile."; return(RedirectToAction("FriendList", "Manage")); } return(View(model)); }
public EditedUserStatus UpdateProfile(ProfileViewModel viewModel) { throw new NotImplementedException(); }
public NotificationsListViewModel(Dictionary<IEventEntity, bool> dictionaryEntitiesSeen, ProfileViewModel profile) { NotificationEntities = dictionaryEntitiesSeen.Keys.ToList(); SeenDictionary = dictionaryEntitiesSeen; Profile = profile; }
public ActionResult EditProfile() { ProfileViewModel profile = accountService.GetUserByUserName(User.Identity.Name).ToMvcProfile(); return(View(profile)); }
public static void SendSMSTemplate(Dictionary <string, int> smsTemplateEnumValues, IPrincipal loggedInUser = null, string ownerDataUserName = "", int assignedToId = 0, int caseId = 0) { foreach (var data in smsTemplateEnumValues) { var allMsgTemplates = LanguageFallbackHelper.GetBothLanguageSMSTemplate(data.Value); var msgDefaultLanguage = allMsgTemplates.Select(t => t.DefaultTemplateLanguage).Distinct().FirstOrDefault(); var msgData = allMsgTemplates.Where(t => t.LanguageId == msgDefaultLanguage).FirstOrDefault(); if (msgData == null) { var defaultSystemLanguage = CultureHelper.GetDefaultLanguageId(); if (defaultSystemLanguage != msgDefaultLanguage) { msgData = allMsgTemplates.Where(t => t.LanguageId == defaultSystemLanguage).FirstOrDefault(); } } if (msgData != null && !(string.IsNullOrEmpty(msgData.Description) || string.IsNullOrWhiteSpace(msgData.Description))) { var smsServiceRequest = new SendSmsRequest() { Url = SettingHelper.GetOrCreate(Constants.SystemSettings.SMSApiUrl, "https://019sms.co.il/api").Value, Username = SettingHelper.GetOrCreate(Constants.SystemSettings.SMSUsername, "sectorspr").Value, Password = SettingHelper.GetOrCreate(Constants.SystemSettings.SMSPassword, "faraj123").Value, Destinations = new List <string>(), Message = string.Empty, Source = SettingHelper.GetOrCreate(Constants.SystemSettings.SMSSource, "123").Value }; var smsService = new Crm.Sms.SmsService(); var destinationUserData = new ProfileViewModel(); if (data.Key == GeneralEnums.Send_SMS_To.Citizen.ToString()) { destinationUserData = LanguageFallbackHelper.GetUserProfileByUsername(ownerDataUserName, msgData.DefaultTemplateLanguage); } else if (data.Key == GeneralEnums.Send_SMS_To.Employee.ToString()) { destinationUserData = LanguageFallbackHelper.GetUserProfile(assignedToId, msgData.DefaultTemplateLanguage);; } else { destinationUserData = null; } if (destinationUserData != null && destinationUserData.Id > 0) { msgData.Description = GetMsgBodyWithParameters(destinationUserData, msgData.Description, caseId); smsServiceRequest.Destinations = new List <string> { destinationUserData.Mobile }; smsServiceRequest.Message = msgData.Description; var _result = smsService.Execute(smsServiceRequest); if (_result) { AddSMSToCommunicationLog((int)GeneralEnums.CommunicationLogEnum.Sms, smsServiceRequest.Message, loggedInUser); } } } } }
public EditHomeFacultyResponseDto(ProfileViewModel profile, AuthorizedUserDto?authorizedUser) { Profile = profile; AuthorizedUser = authorizedUser; }
/* public HttpResponseMessage Post([FromBody] ProfileViewModel profile) * { * using (CirohubDBEntities entities = new CirohubDBEntities()) * { * int personID; * int profileID; * try { * * * //Save Person * try * { * * Person person = new Person(); * person.FirstName = profile.FirstName; * person.LastName = profile.LastName; * person.City = profile.City; * person.State = profile.State; * person.ZipCode = profile.ZipCode; * person.Phone1 = profile.PrimaryPhone; * person.Inactive = "0"; * entities.People.Add(person); * * entities.SaveChanges(); * * personID = person.PersonId; * } * catch (DbEntityValidationException ex) * { * string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); * throw new DbEntityValidationException(errorMessages); * * } * * //save profile * try * { * Profile newProfile = new Profile(); * newProfile.LoginName = profile.EmailAddress; * newProfile.Password = profile.Password; * newProfile.PersonID = personID; * newProfile.Inactive = "0"; * entities.Profiles.Add(newProfile); * entities.SaveChanges(); * profileID = newProfile.ProfileId; * } * catch (DbEntityValidationException ex) * { * string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); * throw new DbEntityValidationException(errorMessages); * } * * //save profile company * if (profile.Company != null) * { * * try * { * ProfileCompany company = new ProfileCompany(); * company.CompanyID = profile.Company.CompanyID; * company.City = profile.Company.City; * company.State = profile.Company.State; * company.ZipCode = profile.Company.ZipCode; * company.EmployeeCountID = profile.Company.NumberEmployeesID; * company.Phone1 = profile.Company.PrimaryPhone; * company.IndustryID = profile.Company.IndustryID; * company.Title = profile.Company.JobTitle; * company.ModifiedDate = Convert.ToDateTime("1/1/2017"); * company.ProfileID = profileID; * entities.ProfileCompanies.Add(company); * entities.SaveChanges(); * * * * } * catch (DbEntityValidationException ex) * { * string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); * throw new DbEntityValidationException(errorMessages); * } * } * * //save profile services * if(profile.ProfileServicesBuy != null ) * { * try * { * foreach (ProfileViewModelService svc in profile.ProfileServicesBuy) * { * ProfileService newSvc = new ProfileService(); * newSvc.ProfileID = profileID; * newSvc.ServiceID = svc.ServiceID; * newSvc.ServiceCatID = svc.ServiceCatID; * newSvc.Buy = "Y"; * newSvc.ModifiedDate = Convert.ToDateTime("1/1/2017"); * * var existingEnity = entities.ProfileServices.Find(profileID, svc.ServiceID); * if(existingEnity == null) * { * entities.ProfileServices.Add(newSvc); * } * * entities.SaveChanges(); * } * } * catch (DbEntityValidationException ex) * { * string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); * throw new DbEntityValidationException(errorMessages); * } * * } * * //save profile services * if (profile.ProfileServicesSell != null) * { * try * { * foreach (ProfileViewModelService svc in profile.ProfileServicesSell) * { * ProfileService newSvc = new ProfileService(); * newSvc.ProfileID = profileID; * newSvc.ServiceID = svc.ServiceID; * newSvc.ServiceCatID = svc.ServiceCatID; * newSvc.Sell = "Y"; * newSvc.ModifiedDate = Convert.ToDateTime("1/1/2017"); * var existingEnity = entities.ProfileServices.Find(profileID, svc.ServiceID); * if (existingEnity == null) * { * entities.ProfileServices.Add(newSvc); * } * entities.SaveChanges(); * } * } * catch (DbEntityValidationException ex) * { * string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); * throw new DbEntityValidationException(errorMessages); * } * * } * //save profile Industries * if (profile.IndustrySellingProfile != null) * { * try * { * foreach (ProfileViewModelIndustry svc in profile.IndustrySellingProfile) * { * ProfileIndustry newSvc = new ProfileIndustry(); * newSvc.ProfileID = profileID; * newSvc.IndustryID= svc.IndustryID; * newSvc.Buy = "N"; * newSvc.Sell = "Y"; * newSvc.ModifiedDate = Convert.ToDateTime("1/1/2017"); * entities.ProfileIndustries.Add(newSvc); * entities.SaveChanges(); * } * } * catch (DbEntityValidationException ex) * { * string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); * throw new DbEntityValidationException(errorMessages); * } * } * * //save profile Partner Companies * if (profile.PartnerCompaniesBuy != null) * { * try * { * foreach (ProfileViewModelPartnerCompany svc in profile.PartnerCompaniesBuy) * { * ProfilePartnerCompany newSvc = new ProfilePartnerCompany(); * newSvc.ProfileID = profileID; * newSvc.CompanyID = svc.CompanyID; * newSvc.Buy = "Y"; * newSvc.ModifiedDate = Convert.ToDateTime("1/1/2017"); * var existingEnity = entities.ProfilePartnerCompanies.Find(profileID, svc.CompanyID); * if (existingEnity == null) * { * entities.ProfilePartnerCompanies.Add(newSvc); * } * entities.SaveChanges(); * } * } * catch (DbEntityValidationException ex) * { * string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); * throw new DbEntityValidationException(errorMessages); * } * } * * if (profile.PartnerCompaniesSell != null) * { * try * { * foreach (ProfileViewModelPartnerCompany svc in profile.PartnerCompaniesSell) * { * ProfilePartnerCompany newSvc = new ProfilePartnerCompany(); * newSvc.ProfileID = profileID; * newSvc.CompanyID = svc.CompanyID; * newSvc.Sell = "Y"; * newSvc.ModifiedDate = Convert.ToDateTime("1/1/2017"); * var existingEnity = entities.ProfilePartnerCompanies.Find(profileID, svc.CompanyID); * if (existingEnity == null) * { * entities.ProfilePartnerCompanies.Add(newSvc); * } * entities.SaveChanges(); * } * } * catch (DbEntityValidationException ex) * { * string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); * throw new DbEntityValidationException(errorMessages); * } * } * * } //end try to save all entities * * catch (Exception ex) * { * return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message); * } * * //All entities saved, return profile ID to client * var message = Request.CreateResponse(HttpStatusCode.Created, profile); * message.Headers.Location = new Uri(Request.RequestUri + "/" + profileID.ToString()); * return message; * } * * }*/ public ProfileCompositeView Post([FromBody] ProfileViewModel profile) { using (CirohubDBEntities entities = new CirohubDBEntities()) { int personID; int profileID; try { //Save Person try { Person person = new Person(); person.FirstName = profile.FirstName; person.LastName = profile.LastName; person.City = profile.City; person.State = profile.State; person.ZipCode = profile.ZipCode; person.Phone1 = profile.PrimaryPhone; person.Inactive = "0"; entities.People.Add(person); entities.SaveChanges(); personID = person.PersonId; } catch (DbEntityValidationException ex) { string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); throw new DbEntityValidationException(errorMessages); } //save profile try { Profile newProfile = new Profile(); newProfile.LoginName = profile.EmailAddress; newProfile.Password = profile.Password; newProfile.PersonID = personID; newProfile.YearsExperienceID = 1; //Hard code to satisfy rule. Fix later newProfile.Inactive = "0"; entities.Profiles.Add(newProfile); entities.SaveChanges(); profileID = newProfile.ProfileId; } catch (DbEntityValidationException ex) { string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); throw new DbEntityValidationException(errorMessages); } //save profile company if (profile.Company != null) { try { ProfileCompany company = new ProfileCompany(); company.CompanyID = profile.Company.CompanyID; company.City = profile.Company.City; company.State = profile.Company.State; company.ZipCode = profile.Company.ZipCode; company.EmployeeCountID = profile.Company.NumberEmployeesID; company.Phone1 = profile.Company.PrimaryPhone; company.IndustryID = profile.Company.IndustryID; company.Title = profile.Company.JobTitle; company.ModifiedDate = Convert.ToDateTime("1/1/2017"); company.ProfileID = profileID; entities.ProfileCompanies.Add(company); entities.SaveChanges(); } catch (DbEntityValidationException ex) { string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); throw new DbEntityValidationException(errorMessages); } } //save profile services if (profile.ProfileServicesBuy != null) { try { foreach (ProfileViewModelService svc in profile.ProfileServicesBuy) { ProfileService newSvc = new ProfileService(); newSvc.ProfileID = profileID; newSvc.ServiceID = svc.ServiceID; newSvc.ServiceCatID = svc.ServiceCatID; newSvc.Buy = "Y"; newSvc.ModifiedDate = Convert.ToDateTime("1/1/2017"); var existingEnity = entities.ProfileServices.Find(profileID, svc.ServiceID); if (existingEnity == null) { entities.ProfileServices.Add(newSvc); } entities.SaveChanges(); } } catch (DbEntityValidationException ex) { string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); throw new DbEntityValidationException(errorMessages); } } //save profile services if (profile.ProfileServicesSell != null) { try { foreach (ProfileViewModelService svc in profile.ProfileServicesSell) { ProfileService newSvc = new ProfileService(); newSvc.ProfileID = profileID; newSvc.ServiceID = svc.ServiceID; newSvc.ServiceCatID = svc.ServiceCatID; newSvc.Sell = "Y"; newSvc.ModifiedDate = Convert.ToDateTime("1/1/2017"); var existingEnity = entities.ProfileServices.Find(profileID, svc.ServiceID); if (existingEnity == null) { entities.ProfileServices.Add(newSvc); } entities.SaveChanges(); } } catch (DbEntityValidationException ex) { string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); throw new DbEntityValidationException(errorMessages); } } //save profile Industries if (profile.IndustrySellingProfile != null) { try { foreach (ProfileViewModelIndustry svc in profile.IndustrySellingProfile) { ProfileIndustry newSvc = new ProfileIndustry(); newSvc.ProfileID = profileID; newSvc.IndustryID = svc.IndustryID; newSvc.Buy = "N"; newSvc.Sell = "Y"; newSvc.ModifiedDate = Convert.ToDateTime("1/1/2017"); entities.ProfileIndustries.Add(newSvc); entities.SaveChanges(); } } catch (DbEntityValidationException ex) { string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); throw new DbEntityValidationException(errorMessages); } } //save profile Partner Companies if (profile.PartnerCompaniesBuy != null) { try { foreach (ProfileViewModelPartnerCompany svc in profile.PartnerCompaniesBuy) { ProfilePartnerCompany newSvc = new ProfilePartnerCompany(); newSvc.ProfileID = profileID; newSvc.CompanyID = svc.CompanyID; newSvc.Buy = "Y"; newSvc.ModifiedDate = Convert.ToDateTime("1/1/2017"); var existingEnity = entities.ProfilePartnerCompanies.Find(profileID, svc.CompanyID); if (existingEnity == null) { entities.ProfilePartnerCompanies.Add(newSvc); } entities.SaveChanges(); } } catch (DbEntityValidationException ex) { string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); throw new DbEntityValidationException(errorMessages); } } if (profile.PartnerCompaniesSell != null) { try { foreach (ProfileViewModelPartnerCompany svc in profile.PartnerCompaniesSell) { ProfilePartnerCompany newSvc = new ProfilePartnerCompany(); newSvc.ProfileID = profileID; newSvc.CompanyID = svc.CompanyID; newSvc.Sell = "Y"; newSvc.ModifiedDate = Convert.ToDateTime("1/1/2017"); var existingEnity = entities.ProfilePartnerCompanies.Find(profileID, svc.CompanyID); if (existingEnity == null) { entities.ProfilePartnerCompanies.Add(newSvc); } entities.SaveChanges(); } } catch (DbEntityValidationException ex) { string errorMessages = string.Join("; ", ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage)); throw new DbEntityValidationException(errorMessages); } } } //end try to save all entities catch (Exception ex) { //return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message); throw new Exception(ex.Message); } //All entities saved, return list of matching profiles var ProfileList = entities.GetProfileView(profileID).FirstOrDefault(); ProfileCompositeView model = entities.GetProfileView(profileID).FirstOrDefault(); //EXECUTE ALGORITHM TO BUILD PROFILE MATCHES model.BuildProfileMatches(); //GET ALL MATCHING PROFILES model.ProfileConnections = entities.GetProfileConnections(profileID).ToList(); return(model); } }
public IActionResult Profile(ProfileViewModel profileViewModel) { var citizen = mapper.Map<CitizenUser>(profileViewModel); citizenUserRepository.Save(citizen); return View(profileViewModel); }
public ProfilePage() { InitializeComponent(); BindingContext = new ProfileViewModel(); }
public ActionResult My(ProfileViewModel model) { Edit(model); return RedirectToAction("Details", new { id = model.Profile.ID }); }
/// <summary> /// Gets the profile details. /// </summary> /// <param name="id">User profile ID.</param> /// <returns>Profile view model.</returns> private ProfileViewModel GetProfile(long id) { var profileDetails = ProfileService.GetProfile(id); var userDetail = new ProfileViewModel(); if (profileDetails != null) { Mapper.Map(profileDetails, userDetail); userDetail.IsCurrentUser = CurrentUserId == profileDetails.ID; userDetail.ProfileName = profileDetails.GetProfileName(); userDetail.ProfilePhotoLink = string.IsNullOrWhiteSpace(userDetail.ProfilePhotoLink) ? "~/Content/Images/profile.png" : Url.Action("Thumbnail", "File", new { id = userDetail.ProfilePhotoLink }); } return userDetail; }
public ServiceOperationResult UpdateProfile(ProfileViewModel model) { User oldUser = UserRepository.GetUser(model.Id); User newUser = Mapper.Map<ProfileViewModel, User>(model); return Mapper.Map<DataResult, ServiceOperationResult>(UserRepository.UpdateProfile(oldUser, newUser)); }
public static void AddProfileViewModel(this ViewDataDictionary viewData, ProfileViewModel model) => viewData["ProfileViewModel"] = model;
//// GET: /Account/Manage/Index public ActionResult Index(ManageMessageId? message) { ViewBag.StatusMessage = message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed." : message == ManageMessageId.ChangeEmailSuccess ? "Your email has been changed." : message == ManageMessageId.Error ? "An error has occurred." : string.Empty; var user = this.UserManager.FindById(User.Identity.GetUserId()); var model = new ProfileViewModel { UserName = user.UserName, Email = user.Email, CreateOn = user.CreatedOn }; return this.View(model); }
protected override async Task <ReportResult> GenerateAsync(GenerateAggregatedWorkitemsETAReport command, IDataSource dataSource, ProfileViewModel profile) { var report = await GenerateReport(command, dataSource, profile); return(report); }
public async Task <IActionResult> Index(string userId) { ApplicationUser user = null; if (userId != null) { user = await _userManager.FindByIdAsync(userId); } else { user = await _userManager.GetUserAsync(User); } var illegalObjects = _context.IllegalObjects .Include(x => x.Status) .Where(x => x.ApplicationUserId == user.Id && x.DeletedAt == null) .Select(x => new IllegalObjectViewModel { IllegalObjectId = x.IllegalObjectId, Address = x.Address, Description = x.Description, Infringement = x.Infringement, ResultsOfReview = x.ResultsOfReview, StatusName = x.Status.IllegalObjectStatusName, StatusColor = x.Status.IllegalObjectColor, CreatedAt = x.CreatedAt }) .OrderByDescending(x => x.CreatedAt) .ToList(); var forumThreads = _context.ForumThreads .Include(x => x.IllegalObject) .Where(x => x.ApplicationUserId == user.Id && x.DeletedAt == null) .Select(x => new ForumThreadViewModel { ForumThreadId = x.ForumThreadId, Theme = x.Theme, LastUpdate = x.CreatedAt, Description = x.IllegalObject.Address }) .OrderByDescending(x => x.LastUpdate) .ToList(); var comments = _context.Comments .Where(x => x.ApplicationUserId == user.Id && x.DeletedAt == null) .Select(x => new CommentViewModel { CommentText = x.CommentText, ForumThreadId = x.ForumThreadId, CreatedAt = x.CreatedAt }) .OrderByDescending(x => x.CreatedAt) .ToList(); var viewModel = new ProfileViewModel { ApplicationUserId = user.Id, UserName = user.UserName, Email = user.Email, IllegalObjects = illegalObjects, ForumThreads = forumThreads, Comments = comments }; return(View(viewModel)); }
public static void AddProfile(ProfileViewModel instance) { AddProfile(new ProfileInfo { Name = instance.Name?.Trim(), Host = instance.Host?.Trim(), CredentialID = instance.CredentialID, Group = instance.Group?.Trim(), Tags = instance.Tags?.Trim(), NetworkInterface_Enabled = instance.NetworkInterface_Enabled, NetworkInterface_EnableStaticIPAddress = instance.NetworkInterface_EnableStaticIPAddress, NetworkInterface_IPAddress = instance.NetworkInterface_IPAddress?.Trim(), NetworkInterface_Gateway = instance.NetworkInterface_Gateway?.Trim(), NetworkInterface_SubnetmaskOrCidr = instance.NetworkInterface_SubnetmaskOrCidr?.Trim(), NetworkInterface_EnableStaticDNS = instance.NetworkInterface_EnableStaticDNS, NetworkInterface_PrimaryDNSServer = instance.NetworkInterface_PrimaryDNSServer?.Trim(), NetworkInterface_SecondaryDNSServer = instance.NetworkInterface_SecondaryDNSServer?.Trim(), IPScanner_Enabled = instance.IPScanner_Enabled, IPScanner_InheritHost = instance.IPScanner_InheritHost, IPScanner_HostOrIPRange = instance.IPScanner_InheritHost ? instance.Host?.Trim() : instance.IPScanner_HostOrIPRange?.Trim(), PortScanner_Enabled = instance.PortScanner_Enabled, PortScanner_InheritHost = instance.PortScanner_InheritHost, PortScanner_Host = instance.PortScanner_InheritHost ? instance.Host?.Trim() : instance.PortScanner_Host?.Trim(), PortScanner_Ports = instance.PortScanner_Ports?.Trim(), Ping_Enabled = instance.Ping_Enabled, Ping_InheritHost = instance.Ping_InheritHost, Ping_Host = instance.Ping_InheritHost ? instance.Host?.Trim() : instance.Ping_Host?.Trim(), Traceroute_Enabled = instance.Traceroute_Enabled, Traceroute_InheritHost = instance.Traceroute_InheritHost, Traceroute_Host = instance.Traceroute_InheritHost ? instance.Host?.Trim() : instance.Traceroute_Host?.Trim(), DNSLookup_Enabled = instance.DNSLookup_Enabled, DNSLookup_InheritHost = instance.Traceroute_InheritHost, DNSLookup_Host = instance.DNSLookup_InheritHost ? instance.Host?.Trim() : instance.DNSLookup_Host?.Trim(), RemoteDesktop_Enabled = instance.RemoteDesktop_Enabled, RemoteDesktop_InheritHost = instance.RemoteDesktop_InheritHost, RemoteDesktop_Host = instance.RemoteDesktop_InheritHost ? instance.Host?.Trim() : instance.RemoteDesktop_Host?.Trim(), RemoteDesktop_OverrideDisplay = instance.RemoteDesktop_OverrideDisplay, RemoteDesktop_AdjustScreenAutomatically = instance.RemoteDesktop_AdjustScreenAutomatically, RemoteDesktop_UseCurrentViewSize = instance.RemoteDesktop_UseCurrentViewSize, RemoteDesktop_UseFixedScreenSize = instance.RemoteDesktop_UseFixedScreenSize, RemoteDesktop_ScreenWidth = instance.RemoteDesktop_ScreenWidth, RemoteDesktop_ScreenHeight = instance.RemoteDesktop_ScreenHeight, RemoteDesktop_UseCustomScreenSize = instance.RemoteDesktop_UseCustomScreenSize, RemoteDesktop_CustomScreenWidth = int.Parse(instance.RemoteDesktop_CustomScreenWidth), RemoteDesktop_CustomScreenHeight = int.Parse(instance.RemoteDesktop_CustomScreenHeight), RemoteDesktop_OverrideColorDepth = instance.RemoteDesktop_OverrideColorDepth, RemoteDesktop_ColorDepth = instance.RemoteDesktop_SelectedColorDepth, RemoteDesktop_OverridePort = instance.RemoteDesktop_OverridePort, RemoteDesktop_Port = instance.RemoteDesktop_Port, RemoteDesktop_OverrideCredSspSupport = instance.RemoteDesktop_OverrideCredSspSupport, RemoteDesktop_EnableCredSspSupport = instance.RemoteDesktop_EnableCredSspSupport, RemoteDesktop_OverrideAuthenticationLevel = instance.RemoteDesktop_OverrideAuthenticationLevel, RemoteDesktop_AuthenticationLevel = instance.RemoteDesktop_AuthenticationLevel, RemoteDesktop_OverrideAudioRedirectionMode = instance.RemoteDesktop_OverrideAudioRedirectionMode, RemoteDesktop_AudioRedirectionMode = instance.RemoteDesktop_AudioRedirectionMode, RemoteDesktop_OverrideAudioCaptureRedirectionMode = instance.RemoteDesktop_OverrideAudioCaptureRedirectionMode, RemoteDesktop_AudioCaptureRedirectionMode = instance.RemoteDesktop_AudioCaptureRedirectionMode, RemoteDesktop_OverrideApplyWindowsKeyCombinations = instance.RemoteDesktop_OverrideApplyWindowsKeyCombinations, RemoteDesktop_KeyboardHookMode = instance.RemoteDesktop_KeyboardHookMode, RemoteDesktop_OverrideRedirectClipboard = instance.RemoteDesktop_OverrideRedirectClipboard, RemoteDesktop_RedirectClipboard = instance.RemoteDesktop_RedirectClipboard, RemoteDesktop_OverrideRedirectDevices = instance.RemoteDesktop_OverrideRedirectDevices, RemoteDesktop_RedirectDevices = instance.RemoteDesktop_RedirectDevices, RemoteDesktop_OverrideRedirectDrives = instance.RemoteDesktop_OverrideRedirectDrives, RemoteDesktop_RedirectDrives = instance.RemoteDesktop_RedirectDrives, RemoteDesktop_OverrideRedirectPorts = instance.RemoteDesktop_OverrideRedirectPorts, RemoteDesktop_RedirectPorts = instance.RemoteDesktop_RedirectPorts, RemoteDesktop_OverrideRedirectSmartcards = instance.RemoteDesktop_OverrideRedirectSmartcards, RemoteDesktop_RedirectSmartCards = instance.RemoteDesktop_RedirectSmartCards, RemoteDesktop_OverrideRedirectPrinters = instance.RemoteDesktop_OverrideRedirectPrinters, RemoteDesktop_RedirectPrinters = instance.RemoteDesktop_RedirectPrinters, RemoteDesktop_OverridePersistentBitmapCaching = instance.RemoteDesktop_OverridePersistentBitmapCaching, RemoteDesktop_PersistentBitmapCaching = instance.RemoteDesktop_PersistentBitmapCaching, RemoteDesktop_OverrideReconnectIfTheConnectionIsDropped = instance.RemoteDesktop_OverrideReconnectIfTheConnectionIsDropped, RemoteDesktop_ReconnectIfTheConnectionIsDropped = instance.RemoteDesktop_ReconnectIfTheConnectionIsDropped, RemoteDesktop_OverrideNetworkConnectionType = instance.RemoteDesktop_OverrideNetworkConnectionType, RemoteDesktop_NetworkConnectionType = instance.RemoteDesktop_NetworkConnectionType, RemoteDesktop_DesktopBackground = instance.RemoteDesktop_DesktopBackground, RemoteDesktop_FontSmoothing = instance.RemoteDesktop_FontSmoothing, RemoteDesktop_DesktopComposition = instance.RemoteDesktop_DesktopComposition, RemoteDesktop_ShowWindowContentsWhileDragging = instance.RemoteDesktop_ShowWindowContentsWhileDragging, RemoteDesktop_MenuAndWindowAnimation = instance.RemoteDesktop_MenuAndWindowAnimation, RemoteDesktop_VisualStyles = instance.RemoteDesktop_VisualStyles, PowerShell_Enabled = instance.PowerShell_Enabled, PowerShell_EnableRemoteConsole = instance.PowerShell_EnableRemoteConsole, PowerShell_InheritHost = instance.PowerShell_InheritHost, PowerShell_Host = instance.PowerShell_InheritHost ? instance.Host?.Trim() : instance.PowerShell_Host?.Trim(), PowerShell_OverrideAdditionalCommandLine = instance.PowerShell_OverrideAdditionalCommandLine, PowerShell_AdditionalCommandLine = instance.PowerShell_AdditionalCommandLine, PowerShell_OverrideExecutionPolicy = instance.PowerShell_OverrideExecutionPolicy, PowerShell_ExecutionPolicy = instance.PowerShell_ExecutionPolicy, PuTTY_Enabled = instance.PuTTY_Enabled, PuTTY_ConnectionMode = instance.PuTTY_ConnectionMode, PuTTY_InheritHost = instance.PuTTY_InheritHost, PuTTY_HostOrSerialLine = instance.PuTTY_ConnectionMode == PuTTY.PuTTY.ConnectionMode.Serial ? instance.PuTTY_HostOrSerialLine?.Trim() : (instance.PuTTY_InheritHost ? instance.Host?.Trim() : instance.PuTTY_HostOrSerialLine?.Trim()), PuTTY_OverridePortOrBaud = instance.PuTTY_OverridePortOrBaud, PuTTY_PortOrBaud = instance.PuTTY_PortOrBaud, PuTTY_OverrideUsername = instance.PuTTY_OverrideUsername, PuTTY_Username = instance.PuTTY_Username?.Trim(), PuTTY_OverrideProfile = instance.PuTTY_OverrideProfile, PuTTY_Profile = instance.PuTTY_Profile?.Trim(), PuTTY_OverrideAdditionalCommandLine = instance.PuTTY_OverrideAdditionalCommandLine, PuTTY_AdditionalCommandLine = instance.PuTTY_AdditionalCommandLine?.Trim(), TigerVNC_Enabled = instance.TigerVNC_Enabled, TigerVNC_InheritHost = instance.TigerVNC_InheritHost, TigerVNC_Host = instance.TigerVNC_InheritHost ? instance.Host?.Trim() : instance.TigerVNC_Host?.Trim(), TigerVNC_OverridePort = instance.TigerVNC_OverridePort, TigerVNC_Port = instance.TigerVNC_Port, WakeOnLAN_Enabled = instance.WakeOnLAN_Enabled, WakeOnLAN_MACAddress = instance.WakeOnLAN_MACAddress?.Trim(), WakeOnLAN_Broadcast = instance.WakeOnLAN_Broadcast?.Trim(), WakeOnLAN_OverridePort = instance.WakeOnLAN_OverridePort, WakeOnLAN_Port = instance.WakeOnLAN_Port, HTTPHeaders_Enabled = instance.HTTPHeaders_Enabled, HTTPHeaders_Website = instance.HTTPHeaders_Website, Whois_Enabled = instance.Whois_Enabled, Whois_InheritHost = instance.Whois_InheritHost, Whois_Domain = instance.Whois_InheritHost ? instance.Host?.Trim() : instance.Whois_Domain?.Trim() }); }
public ProfileView() { InitializeComponent(); DataContext = new ProfileViewModel(StationManager.CurrentUser.Login); Update(); }
public ActionResult Delete(ProfileViewModel model) { return(View(model)); }
public void ShouldNotBeAbleToSaveInvalidProfileView() { // arrange var controller = new ProfileController(this.MembershipService, this.FormsAuthentication); controller.ViewData.ModelState.Clear(); var profileViewModel = new ProfileViewModel { FirstName = "Vitali", LastName = string.Empty, NotifyOnOrderStatusChanged = true, NotifyOnPackageStatusChanged = true }; // act var actual = controller.Save(profileViewModel) as JsonNetResult; // assert Assert.That(actual, Is.Not.Null); if (actual != null) { var model = actual.Data as ProfileViewModel; Debug.Assert(model != null, "model != null"); Assert.That(model.MessageType, Is.EqualTo(MessageType.Warning.ToString())); } }
public void Update() { DataContext = new ProfileViewModel(StationManager.CurrentUser.Login); }
public ActionResult Index(int id) { var profile = new ProfileViewModel(); return View(profile); }
public async Task<IActionResult> UpdateAvatar(ProfileViewModel viewModel) { var fileName = viewModel.Avatar.FileName; var wwwrootPath = hostEnvironment.WebRootPath; var path = @$"{wwwrootPath}\image\avatar\{fileName}";
public JsonResult GetUserProfile(string key, string username) { if (apiServices.IsValidKey(key)) { UserProfileModel upm = accountServices.GetUserProfileByUsername(username); ProfileViewModel pvm = new ProfileViewModel(); pvm.FirstName = upm.FirstName; pvm.LastName = upm.LastName; pvm.Description = upm.Description; pvm.Reputation = upm.Reputation; pvm.Birthdate = upm.Birthdate; pvm.GenderText = upm.IsFemale ? "Female" : "Male"; apiServices.IncrementKeyUsage(key); return Json(pvm, JsonRequestBehavior.AllowGet); } else { return Json(null, JsonRequestBehavior.AllowGet); } }
public JsonResult GetFriends(string key, string username) { if (apiServices.IsValidKey(key)) { UserProfileModel userProfile = accountServices.GetUserProfileByUsername(username); GetFriendsModel gfm = new GetFriendsModel(); gfm.UserProfileId = userProfile.UserProfileId; List<UserProfileModel> friends = accountServices.GetAllFriends(gfm).ToList(); ProfileViewModel[] result = new ProfileViewModel[friends.Count]; ProfileViewModel pvm; for (int i = 0; i < friends.Count; i++) { pvm = new ProfileViewModel(); pvm.FirstName = friends[i].FirstName; pvm.LastName = friends[i].LastName; pvm.Description = friends[i].Description; pvm.Reputation = friends[i].Reputation; pvm.Birthdate = friends[i].Birthdate; pvm.GenderText = friends[i].IsFemale ? "Female" : "Male"; result[i] = pvm; } apiServices.IncrementKeyUsage(key); return Json(result, JsonRequestBehavior.AllowGet); } else { return Json(null, JsonRequestBehavior.AllowGet); } }
public void Create(ProfileViewModel ProfileViewModel) { var Profile = new Profile { ProfileName = ProfileViewModel.ProfileName, FatherName = ProfileViewModel.FatherName, MotherName = ProfileViewModel.MotherName, DateofBirth = ProfileViewModel.DateofBirth, BirthPlace = ProfileViewModel.BirthPlace, Genderid = ProfileViewModel.Genderid, BloodGroupId = ProfileViewModel.BloodGroupId, NationalityID = ProfileViewModel.NationalityID, MaritalStatusId = ProfileViewModel.MaritalStatusId, DateofMarriage = ProfileViewModel.DateofMarriage, RegionId = ProfileViewModel.RegionId, NID = ProfileViewModel.NID, TIN = ProfileViewModel.TIN, SpouseName = ProfileViewModel.SpouseName, SpouseProfession = ProfileViewModel.SpouseProfession, MailAddress = ProfileViewModel.MailAddress, ContactNumber = ProfileViewModel.ContactNumber, EmergencyContactNumber = ProfileViewModel.EmergencyContactNumber, PassportNumber = ProfileViewModel.PassportNumber, DrivingLicenceNumber = ProfileViewModel.DrivingLicenceNumber, Hobby = ProfileViewModel.Hobby, CreateBy = ProfileViewModel.CreateBy, CreateDate = ProfileViewModel.CreateDate, UpdateBy = ProfileViewModel.UpdateBy, UpdateDate = ProfileViewModel.UpdateDate, ImagePath = ProfileViewModel.ImagePath }; var PressentAddress = new PressentAddress { ProfileId = ProfileViewModel.ProfileId, PresentAddressFull = ProfileViewModel.PresentAddressFull, PrePostOfficeId = ProfileViewModel.PrePostOfficeId, PrePoliceStationId = ProfileViewModel.PrePoliceStationId, PreDistrictId = ProfileViewModel.PreDistrictId, PreDivisionId = ProfileViewModel.PreDivisionId, PreCountryId = ProfileViewModel.PreCountryId }; var PermanentAddress = new PermanentAddress { ProfileId = ProfileViewModel.ProfileId, PermanentAddressFull = ProfileViewModel.PermanentAddressFull, PerPostOfficeId = ProfileViewModel.PerPostOfficeId, PerPoliceStationId = ProfileViewModel.PerPoliceStationId, PerDistrictId = ProfileViewModel.PerDistrictId, PerDivisionId = ProfileViewModel.PerDivisionId, PerCountryId = ProfileViewModel.PerCountryId }; unitOfWork.ProfileRepository.Insert(Profile); unitOfWork.PressentAddressRepository.Insert(PressentAddress); unitOfWork.PermanentAddressRepository.Insert(PermanentAddress); unitOfWork.Save(); }
private ProfileViewModel GetProfileViewModel(string username) { UserProfileModel profile = accountServices.GetUserProfileByUsername(username); if (profile == null) return null; ProfileViewModel model = new ProfileViewModel { AvatarUrl = profile.Avatar, Birthdate = profile.Birthdate, Description = profile.Description, FirstName = profile.FirstName, GenderText = profile.IsFemale ? "Female" : "Male", LastName = profile.LastName, Reputation = profile.Reputation, UserProfileId = profile.UserProfileId }; model.Friends = accountServices.GetFriendsList(profile.UserProfileId, NUM_FRIENDS); model.UserEvents = EventServices.GetInstance().GetAllEventsByUserProfileId(profile.UserProfileId).Take(NUM_EVENTS); UserModel temp = accountServices.GetUserByUsername(username); model.Username = username; model.UserId = temp.UserId; model.ViewingFriend = accountServices.AreFriends(User.Identity.Name, username); model.ViewingOwn = User.Identity.Name == username; int numFriends = accountServices.GetAllFriends(new GetFriendsModel { UserProfileId = profile.UserProfileId }).Count(); model.Sidebar = new ProfileSidebarViewModel { AvatarUrl = profile.Avatar, FriendCount = numFriends, Name = profile.FirstName + " " + profile.LastName, Reputation = profile.Reputation, Username = username }; model.ThisDudeHasSentAFriendRequestToYou = (User.Identity.Name == "") ? false : accountServices.HasPendingFriendRequest(username, User.Identity.Name); model.FriendRequested = (User.Identity.Name == "") ? false : accountServices.HasPendingFriendRequest(User.Identity.Name, username); return model; }
public ActionResult Update(ProfileViewModel model) { var currentMember = Members.GetCurrentMember(); if (currentMember == null) { return(Redirect(UmbracoContext.Current.UrlProvider.GetUrl(CurrentPage.Parent.Id))); } var member = Services.MemberService.GetById(currentMember.Id); PersistProfileModel(model, member); if (!ModelState.IsValid) { return(PartialView("Profile/Index", model)); } // check if Amka is taken by other member. if (!string.IsNullOrEmpty(model.AmkaNumber) && Services.MemberService.GetMembersByPropertyValue("memberAmkaNumber", model.AmkaNumber?.Trim()).Any(z => z.Id != member.Id)) { ModelState.AddModelError("FormGenericError", "Check if your AMKA is valid. Another member is already using it."); Logger.Error(typeof(ProfileSurfaceController), $"Member {member.Name}, {member.Id} try to use others AMKA number while update his profile.", new InvalidOperationException("Fraud")); return(PartialView("Profile/Index", model)); } // check if Amka is taken by other member. if (!string.IsNullOrEmpty(model.IdentityNumber) && Services.MemberService.GetMembersByPropertyValue("memberIdentityNumber", model.IdentityNumber?.Trim()).Any(z => z.Id != member.Id)) { ModelState.AddModelError("FormGenericError", "Check if your Identity is valid. Another member is already using it!"); Logger.Error(typeof(ProfileSurfaceController), $"Member {member.Name}, {member.Id} try to use others IDENTITY number while update his profile.", new InvalidOperationException("Fraud")); return(PartialView("Profile/Index", model)); } // maybe if all data are the do, not update information of member. member.Name = $"{model.Surname} {model.Name}"; member.SetValue("memberMobilePhone", model.MobilePhone); member.SetValue("memberDoy", model.DoyModel?.Doy); member.SetValue("memberAmkaNumber", model.AmkaNumber); member.SetValue("memberIdentityNumber", model.IdentityNumber); member.SetValue("memberDateOfBirth", model.DateOfBirth.Value); member.SetValue("memberMobilePhone", model.MobilePhone); member.SetValue("memberPostalCode", model.PostalCode); member.SetValue("memberVatNumber", model.VatNumber); member.SetValue("memberAddress", model.Address); Services.MemberService.Save(member); //// check if new password is set. //if (!string.IsNullOrWhiteSpace(model.Password) && !string.IsNullOrWhiteSpace(model.ConfirmPassword)) //{ // if (string.Compare(model.Password.Trim(), model.ConfirmPassword.Trim()) == 0 // && model.Password.Trim().Length >= 8 && model.ConfirmPassword.Trim().Length >= 8) // { // // good passwords, save them. // Services.MemberService.SavePassword(member, model.ConfirmPassword.Trim()); // model.HasPasswordChanged = true; // var lang = CurrentPage.GetCulture()?.Name; // var website = CurrentPage?.Ancestors<Website>(1)?.First(); // await EmailHelper.PasswordChangedSuccessfully(currentMember, website, lang); // } // else // { // ModelState.AddModelError("FormGenericError", u.s("Forms.Profile.PasswordChangingRules", "Your password must be the same as confirm password, and at least 10 characters long!")); // return PartialView("Profile/Index", model); // } //} //else if ((string.IsNullOrWhiteSpace(model.Password) && !string.IsNullOrWhiteSpace(model.ConfirmPassword)) // || (!string.IsNullOrWhiteSpace(model.Password) && string.IsNullOrWhiteSpace(model.ConfirmPassword))) //{ // ModelState.AddModelError("FormGenericError", u.s("Forms.Profile.PasswordChangingRules", "Your password must be the same as confirm password, and at least 10 characters long!")); // return PartialView("Profile/Index", model); //} model.Success = true; return(PartialView("Profile/Index", model)); }