public ActionResult Edit(UserProfileInfo userprofile) { if (ModelState.IsValid) { string username = User.Identity.Name; // Get the userprofile UserProfileInfo userProfileInfo = db.UserProfileInfo.FirstOrDefault(u => u.UserName.Equals(username)); // Update fields userProfileInfo.FirstName = userprofile.FirstName; userProfileInfo.LastName = userprofile.LastName; userProfileInfo.Gender = userprofile.Gender; userProfileInfo.Age = userprofile.Age; userProfileInfo.Height = userprofile.Height; userProfileInfo.Weight = userprofile.Weight; db.Entry(userProfileInfo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Home")); // or whatever } return(View(userprofile)); }
public HttpResponseMessage GetProfileImage() { string userId = User.Identity.GetUserId(); UserProfileInfo currentUserProfile = _dbContext.UserProfileInfo.Where(x => x.User.Id == userId).FirstOrDefault(); return(Request.CreateResponse(HttpStatusCode.OK, currentUserProfile.UrlProfilePicture)); }
/// <summary> /// Sets a user profile. /// </summary> /// <param name="userId">A user identifier.</param> /// <param name="userProfile">A <see cref="UserProfileInfo"/>.</param> /// <returns>A <see cref="Task"/>.</returns> public async Task SetProfileAsync(Guid userId, UserProfileInfo userProfile) { if (userProfile == null) { throw new ArgumentNullException(nameof(userProfile)); } var user = await Users.SingleOrDefaultAsync(u => userId == u.DomainId); if (user == null) { throw new UserNotFoundException(userId.ToString()); } var profile = await _context.UserProfiles.SingleOrDefaultAsync(p => user.Id == p.UserId); if (profile == null) { throw new UserProfileNotFoundException(userId.ToString()); } profile.FirstName = userProfile.FirstName; profile.LastName = userProfile.LastName; await _context.SaveChangesAsync(); }
public async Task <IHttpActionResult> PutUserProfileInfo(int id, UserProfileInfo userProfileInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != userProfileInfo.Id) { return(BadRequest()); } _dbContext.Entry(userProfileInfo).State = EntityState.Modified; try { await _dbContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserProfileInfoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
// GET: Games/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UserHandler userHandler = new UserHandler(); UserProfileInfo user = userHandler.GetUserLogged(); Game game = db.Game.Find(id); if (game == null) { return(HttpNotFound()); } GameHandler GameHandler = new GameHandler(); ViewBag.GameSerieID = GameHandler.SelectGameSeries(user, game); ViewBag.Players = new SelectList(user.Groups .Where(i => i.DominoesGroupID == user.GroupAdministered) .Select(i => i.Users).First(), "UserProfileInfoID", "FirstName"); return(View(game)); }
protected void Page_Load(object sender, EventArgs e) { try { // 檢查權限 if (!IsPostBack) { ClearField(); if (!UserProfileInfo.CheckUserRight(User.Identity.Name, ProgramRight)) { HintAndRedirect(TextMessage.Error.T00264(User.Identity.Name, ProgramRight)); return; } // 載入預設畫面 LoadDefaultControl(); } else { } } catch (Exception ex) { HandleError(ex); } }
/// <summary> /// Adds a user profile. /// </summary> /// <param name="userId">A user identifier.</param> /// <param name="userProfile">A <see cref="UserProfileInfo"/>.</param> /// <returns>A <see cref="Task"/>.</returns> public async Task AddProfileAsync(Guid userId, UserProfileInfo userProfile) { if (userProfile == null) { throw new ArgumentNullException(nameof(userProfile)); } var user = await Users.SingleOrDefaultAsync(u => userId == u.DomainId).ConfigureAwait(false); if (user == null) { throw new UserNotFoundException(userId.ToString()); } var profile = await _context.UserProfiles.SingleOrDefaultAsync(u => user.Id == u.UserId).ConfigureAwait(false); if (profile != null) { _context.UserProfiles.Remove(profile); } _context.UserProfiles.Add(new ApplicationUserProfile { UserId = user.Id, FirstName = userProfile.FirstName, LastName = userProfile.LastName }); await _context.SaveChangesAsync().ConfigureAwait(false); }
public void updateMobileActStatusTest() { var m = new MobileActStatusDO(); m.mdComDate = DateTime.Now; m.sequenceId = "12345"; m.status = "test"; m.svcNo = "98989855"; // "82365755"; m.switchId = "123"; m.workOrdNo = "SING100045"; var u = new UserProfileInfo(); u.accessType = "testAccessType"; u.accessValue = "testAccessValue"; u.firstNm = "testFirstName"; u.function = "testFunction"; u.lastNm = "testLastName"; u.omUserGroup = "testUserGroup"; u.password = "******"; u.sAcct = "qqq"; u.userId = "testUserId"; u.userRole = "testUserRole"; var MdCallBack = new MDBCCNotification(); var response = new StatusDo(); response = MdCallBack.updateMobileActStatus(u, m); Assert.AreEqual(response.status, true, "Response status is excepted to be true"); }
public ActionResult Sign(Campaign campaign, int?id) { campaign = db.Campaigns.Find(id); //Campaign campaign = db.Campaigns.Where() CampaignSignViewModel viewModel = new CampaignSignViewModel(); var user = User.Identity.Name; UserProfileInfo profile = db.UserProfileInfo.Where(x => x.Username == user).FirstOrDefault(); ProfileViewModel model = new ProfileViewModel { Address = profile.Address, ZipCode = profile.ZipCode, FirstName = profile.FirstName, LastName = profile.LastName, CellPhone = profile.CellPhone, BirthDate = profile.BirthDate, //Activity = profile.Activity }; SignUpList list = new SignUpList(); list.FirstName = profile.FirstName; list.LastName = profile.LastName; list.UserID = profile.UserID; list.CampaignID = campaign.CampaignID; list.CampaignName = campaign.CampaignName; //list.DateSigned = System.DateTime.Now; foreach (var item in db.SignnUpList) { if (list.UserID == item.UserID && list.CampaignID == item.CampaignID) { return(RedirectToAction("AlreadySigned", "SignUpList")); } } //if (db.SignnUpList.Any((o => o.UserID == list.UserID))) //{ // if (db.SignnUpList(o => o.CampaignID == list.CampaignID)) // { // return RedirectToAction("AlreadySigned", "SignUpList"); // } //} campaign.UsersSignedUp = campaign.UsersSignedUp + 1; //campaign.UsersSignedUp++; //var item = from n in db.Campaigns // where n.CampaignID == Int32.Parse(Request.QueryString["CampaignID"]) // select n; //item.UsersSignedUp += //db.Entry(campaign).State = EntityState.Modified; //db.SaveChanges(); db.SignnUpList.Add(list); db.SaveChanges(); return(RedirectToAction("Index", "Campaign")); }
/// <summary> /// 检查用户是否存在 /// </summary> /// <param name="up"></param> /// <returns></returns> public bool IsExist(UserProfileInfo up) { try { if (string.IsNullOrEmpty(up.Email)) { return(false); //表示不存在 } string sql = "SProc_Admin_UserIsExist"; int retCount = 0; SqlParameter[] parms = { new SqlParameter("@email", up.Email) }; SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, sql, parms); if (dr != null) { if (dr.Read()) { retCount = dr.GetInt32(0); if (retCount == 0) { return(false); } } } return(true); //异常情况不能输入 } catch (Exception ex) { DBManager.RecoreErrorProfile(ex, "UserProfileDAL.IsExist", DBManager.GetCurrentUserAD()); return(false); } }
public int Invit(int projectId, int userId, string message, UserProfileInfo currentUser) { Invit test = this.repoInvit.Get(projectId, userId); if (test != null) { test.Message = message; test.ModifiedOn = DateTime.Now; test.Status = InvitStatus.Pending; this.repoInvit.SaveChanges(test); return(test.Id); } Invit Invit = new Invit() { ProjectId = projectId , UserId = userId , CreatedBy = currentUser , Status = InvitStatus.Pending , Message = message }; int createdId = this.repoInvit.Create(Invit); return(createdId); }
public static string AddUserLicenseInfo(string LicenseNumber, string LicenseName, int StateId) { //bool isAdded = false;string LicensingAgency, UserProfileInfo userProfileInfo = new UserProfileInfo(); string message = Constant.CONST_LICENSE_INFORMATION_FAILURE; if (SessionWrapper.LoggedUser == null) { return(message = Constant.SESSION_EXPIRE); } try { UserLicenseInfo userLicenseInfo = new UserLicenseInfo(); userLicenseInfo.LicenseName = LicenseName.Trim(); userLicenseInfo.LicenseNumber = LicenseNumber.Trim(); //userLicenseInfo.LicensingAgency = LicensingAgency.Trim(); userLicenseInfo.UserId = SessionWrapper.LoggedUser.UserId; userLicenseInfo.StateId = StateId; userProfileInfo = UserLicenseInfoHelper.SaveUserLicenseInfo(userLicenseInfo); } catch { } if (userProfileInfo.IsFirstRecord) { message = Constant.CONST_LICENSE_INFORMATION_ADD_SUCCESS; } else { message = Constant.CONST_LICENSE_INFORMATION_SUCCESS; } return(message); }
protected void Page_Load(object sender, System.EventArgs e) { try { // Check User Right ,防止User直接打網址進入 //ID = "ToolTypeR4"; if (!UserProfileInfo.CheckUserRight(User.Identity.Name, _ProgramInformationBlock.ProgramRight)) { HintAndRedirect(TextMessage.Error.T00264(User.Identity.Name, ProgramRight)); return; } // 修改警告訊息多國語言化 DelConfirmStr = TextMessage.Error.T00771(); ttbToolType.Attributes["onkeypress"] = " if (window.event.keyCode==13) {btnQuery.click();return false; }"; //修改多國語言資源檔讀取方式 if (!IsPostBack) { ToolTypeList = null; UIControl(); QueryData(); ttbToolType.Focus(); } else { gvQuery.DataSource = ToolTypeList; } } catch (Exception ex) { HandleError(ex, CurrentUpdatePanel, string.Empty, MessageShowOptions.OnLabel); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!UserProfileInfo.CheckUserRight(User.Identity.Name, ProgramRight)) { HintAndRedirect(TextMessage.Error.T00264(User.Identity.Name, ProgramRight)); return; } if (!IsPostBack) { //第一次開啟頁面 ClearField(); AjaxFocus(ttbToolName); } else { } } catch (Exception ex) { HandleError(ex); } }
protected void btnDeleteProfilePic_Click(object sender, EventArgs e) { try { UserProfileInfo objinfo = new UserProfileInfo(); objinfo = UserProfileController.GetProfile(GetUsername, GetPortalID); if (objinfo.Image != "") { string imagePath = ResolveUrl(this.AppRelativeTemplateSourceDirectory) + "UserPic/" + objinfo.Image; string path = Server.MapPath(imagePath); if (File.Exists(path)) { File.Delete(path); } } UserProfileController.DeleteProfilePic(GetUsername, GetPortalID); ShowHideProfile(); GetUserDetails(); LoadUserDetails(); Session[SessionKeys.Profile_Image] = null; } catch (Exception) { throw; } }
private void InitUserInfo() { UserProfileBLL bll = new UserProfileBLL(); UserProfileInfo up = bll.GetUserProfile(UserCode); //UserProfile up = DBManager.GetUserProfile(UserCode); txtADAccount.Text = up.ADAccount; txtBirthDate.Text = up.Birthdate; txtCellPhone.Text = up.CellPhone; txtCHNName.Text = up.CHName; txtCostCenter.Text = up.CostCenter; txtEmail.Text = up.Email; txtENName.Text = up.ENName; txtHireDate.Text = up.HireDate; txtManagerAccount.Text = up.ManagerAccount; txtOfficePhone.Text = up.OfficePhone; txtFax.Text = up.FAX; txtBlackBerry.Text = up.BlackBerry; txtGraduateFrom.Text = up.GraduateFrom; txtOAC.Text = up.OAC; txtPA.Text = up.PoliticalAffiliation; txtPositionDesc.Text = up.PositionName; txtEductionBackground.Text = up.EducationalBackground; txtWorkExperienceBefore.Text = up.WorkExperienceBefore; txtWorkExperienceNow.Text = up.WorkExperienceNow; txtOrderNO.Text = up.OrderNo.ToString(); txtPhotoUrl.Text = up.PhotoUrl; imgPhono.ImageUrl = string.IsNullOrEmpty(up.PhotoUrl) ? imgPhono.ImageUrl : up.PhotoUrl; ddlGender.SelectedIndex = ddlGender.Items.IndexOf(ddlGender.Items.FindByValue(up.Gender)); ddlPosition.SelectedIndex = ddlPosition.Items.IndexOf(ddlPosition.Items.FindByValue(up.PositionGuid.ToString())); ddlWorkPlace.SelectedIndex = ddlWorkPlace.Items.IndexOf(ddlWorkPlace.Items.FindByValue(up.WorkPlace)); }
public string AskForRegistrationUrl(UserProfileInfo user, string redirectUrl, out int tempCredentialId) { var _client = new DropNetClient(MogConstants.DROPBOX_KEY, MogConstants.DROPBOX_SECRET); UserLogin login = _client.GetToken(); // UserLogin login = _client.GetAccessToken(); var url = _client.BuildAuthorizeUrl(login, redirectUrl); var query = repoAuthCredential.GetByUserId(user.Id); List <AuthCredential> existingCredentials = null; if (query != null) {//TODO : gerer le cas des accounts multiples existingCredentials = query.Where(a => a.CloudService == CloudStorageServices.Dropbox).ToList(); foreach (var credential in existingCredentials) { repoAuthCredential.Delete(credential); } } AuthCredential newCredential = new AuthCredential(); newCredential.Token = login.Token; newCredential.Secret = login.Secret; newCredential.UserId = user.Id; newCredential.CloudService = CloudStorageServices.Dropbox; this.repoAuthCredential.Create(newCredential); tempCredentialId = newCredential.Id; return(url); }
public static string AddPostGraduationDetails(string PostGraduation, string Specialization, string University, string Municipality, int StateID, int StartMonth, int StartYear, int EndMonth, int EndYear, bool Attending) { UserProfileInfo userProfileInfo = new UserProfileInfo(); string message = Constant.CONST_EDUCATION_INFORMATION_FAILURE; if (SessionWrapper.LoggedUser == null) { return(message = Constant.SESSION_EXPIRE); } try { OrderDetails orderDetails = GetSessionOrderDetails(); PostGraduationDetail postGraduationDetails = new PostGraduationDetail(); UserPostGraduation userPostGraduation; postGraduationDetails.PostGraduation = PostGraduation.Trim(); postGraduationDetails.Specialization = Specialization.Trim(); postGraduationDetails.University = University.Trim(); postGraduationDetails.Municipality = Specialization.Trim(); postGraduationDetails.StateId = StateID; postGraduationDetails.StartMonth = StartMonth; postGraduationDetails.StartYear = StartYear; postGraduationDetails.EndMonth = EndMonth; postGraduationDetails.EndYear = EndYear; postGraduationDetails.IsAttending = Attending; orderDetails.EducationalDetail.PostGraduationDetails = new List <PostGraduationDetail>(); orderDetails.EducationalDetail.PostGraduationDetails.Add(postGraduationDetails); userPostGraduation = new UserPostGraduation(); userPostGraduation.PostGraduation = PostGraduation.Trim(); userPostGraduation.Specialization = Specialization.Trim(); userPostGraduation.University = University.Trim(); userPostGraduation.Municipality = Specialization.Trim(); userPostGraduation.StateId = StateID; userPostGraduation.StartMonth = StartMonth; userPostGraduation.StartYear = StartYear; userPostGraduation.EndMonth = EndMonth; userPostGraduation.EndYear = EndYear; userPostGraduation.IsAttending = Attending; userPostGraduation.UserId = SessionWrapper.LoggedUser.UserId; userProfileInfo = UserEducationalDetailHelper.SaveUserPostGraduation(userPostGraduation); if (userProfileInfo.IsFirstRecord) { message = Constant.CONST_EDUCATION_INFORMATION_ADD_SUCCESS; } else { message = Constant.CONST_EDUCATION_INFORMATION_SUCCESS; } } catch { } return(message); }
protected void Page_Load(object sender, EventArgs e) { try { if (!UserProfileInfo.CheckUserRight(User.Identity.Name, ProgramRight)) { HintAndRedirect(TextMessage.Error.T00264(User.Identity.Name, ProgramRight)); return; } if (!IsPostBack) { //第一次開啟頁面 ClearField(); gvDefect.CimesEmptyDataText = GetUIResource("NoDefectData"); gvDefect.Initialize(); //查詢不良品資料 Query(); } else { // gvDefect.SetDataSource(_LotDatas, true); } } catch (Exception ex) { HandleError(ex); } }
public void Execute() { var list = MainWindow.Current.Setting.UserProfileList; // プロファイル取得 Profile pf = null; if (1 <= Value && list.Count >= Value) { var userProfileInfo = list[Value - 1]; if (userProfileInfo.Profile == null) { string xmlDir = Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).FullName + "\\Profile"; string xmlPath = xmlDir + "\\" + userProfileInfo.RelativePath; pf = UserProfileInfo.LoadProfileFromXmlFile(xmlPath); } else { pf = userProfileInfo.Profile; } } // プロファイルのロード if (pf != null) { MainWindow.Current.LoadUserProfile(pf); } }
private async Task <User> ImportUserFromPodAsync(UserProfileInfo profileInfo) { var user = new User { EmailAddress = string.IsNullOrEmpty(profileInfo.Email) ? $"{profileInfo.Username}@pod.login" : profileInfo.Email, Name = profileInfo.FirstName, Surname = profileInfo.LastName, PodUserId = profileInfo.UserId, UserName = profileInfo.Username, PhoneNumber = profileInfo.CellphoneNumber, ProfileImage = profileInfo.ProfileImage, IsPhoneNumberConfirmed = true, IsEmailConfirmed = false, IsImported = true, TenantId = 1 }; var res = await userManager.CreateAsync(user, "123qwe@QWE"); if (!res.Succeeded) { Logger.Error(string.Join(',', res.Errors.Select(ff => ff.Description))); throw new UserFriendlyException("Importing user failed"); } await AssignStaticRoles(profileInfo, user); return(user); }
protected void Page_Load(object sender, EventArgs e) { try { this.ID = "T026"; if (!IsPostBack) { // Check User Right ,防止User直接打網址進入 if (!UserProfileInfo.CheckUserRight(User.Identity.Name, ProgramRight)) { HintAndRedirect(TextMessage.Error.T00264(User.Identity.Name, ProgramRight)); } AllTools = new List <ToolInfoEx>(); QueryAllTool(); UIControl(); } else { gvToolList.DataSource = AllTools; } } catch (Exception ex) { HandleError(ex, CurrentUpdatePanel, string.Empty, MessageShowOptions.OnLabel); } }
public UserStorageVM GetUserStorages(UserProfileInfo userProfile) { UserStorageVM model = new UserStorageVM(); List <AuthCredential> credentials = this.repoAuthCredential .GetByUserId(userProfile.Id) .Where(c => c.Status != CredentialStatus.Canceled) .ToList(); var values = from MoG.Domain.Models.CloudStorageServices e in Enum.GetValues(typeof(MoG.Domain.Models.CloudStorageServices)) select new { Id = e, Name = e.ToString() }; foreach (var cloudStorage in Enum.GetValues(typeof(MoG.Domain.Models.CloudStorageServices))) { CloudStorageServices currentCloudStorage = (CloudStorageServices)cloudStorage; var userCredentials = credentials.Where(c => c.CloudService == currentCloudStorage).ToList(); if (userCredentials.Count > 0) { model.CloudStorages.AddRange(userCredentials); } else { model.CloudStorages.Add(new AuthCredential() { CloudService = currentCloudStorage, Status = CredentialStatus.NotRegistered }); } } return(model); }
//Save or Update UserLicenseInfo public static UserProfileInfo SaveUserLicenseInfo(UserLicenseInfo userLicenseInfo) { //bool isAdded = false; UserProfileInfo userProfileInfo = new UserProfileInfo(); try { Repository <UserLicenseInfo> orderRepository = new Repository <UserLicenseInfo>("UserId"); UserLicenseInfo licenseInfo = orderRepository.SelectByKey(userLicenseInfo.UserId.ToString()); if (licenseInfo == null) { orderRepository.Add(userLicenseInfo); userProfileInfo.IsFirstRecord = true; } else { licenseInfo.LicenseName = userLicenseInfo.LicenseName; licenseInfo.LicenseNumber = userLicenseInfo.LicenseNumber; //licenseInfo.LicensingAgency = userLicenseInfo.LicensingAgency; licenseInfo.StateId = userLicenseInfo.StateId; userProfileInfo.IsFirstRecord = false; } orderRepository.Save(); // isAdded = true; } catch { } return(userProfileInfo); }
public static UserProfileInfo SaveUserPostGraduation(UserPostGraduation UserPostGraduation) { UserProfileInfo userProfileInfo = new UserProfileInfo(); try { Repository <UserPostGraduation> repository = new Repository <UserPostGraduation>("UserId"); UserPostGraduation userPost = repository.SelectByKey(UserPostGraduation.UserId.ToString()); if (userPost == null) { repository.Add(UserPostGraduation); userProfileInfo.IsFirstRecord = true; } else { userPost.PostGraduation = UserPostGraduation.PostGraduation; userPost.Specialization = UserPostGraduation.Specialization; userPost.University = UserPostGraduation.University; userPost.Municipality = UserPostGraduation.Municipality; userPost.StateId = UserPostGraduation.StateId; userPost.StartMonth = UserPostGraduation.StartMonth; userPost.StartYear = UserPostGraduation.StartYear;; userPost.EndMonth = UserPostGraduation.EndMonth; userPost.EndYear = UserPostGraduation.EndYear; userPost.IsAttending = UserPostGraduation.IsAttending; userPost.UserId = UserPostGraduation.UserId; userProfileInfo.IsFirstRecord = false; } repository.Save(); } catch { } return(userProfileInfo); }
protected void Page_Load(object sender, EventArgs e) { try { if (!UserProfileInfo.CheckUserRight(User.Identity.Name, ProgramRight)) { HintAndRedirect(TextMessage.Error.T00264(User.Identity.Name, ProgramRight)); return; } if (!IsPostBack) { //確認是否要顯示結單選項 rdbCLOSE.Visible = UserProfileInfo.CheckUserRight(User.Identity.Name, _QCCloseFlag); //第一次開啟頁面 ClearField(); AjaxFocus(ttbLot); gvInspectionData.Initialize(); } else { } } catch (Exception ex) { HandleError(ex); } }
public bool IsFollowed(Project project, UserProfileInfo user) { if (project == null || user == null) { return(false); } return(this.repo.IsFollowed(project.Id, user.Id)); }
private SendNotificationVM sendNotification(UserProfileInfo user, List <Notification> notifs) { SendNotificationVM result = new SendNotificationVM(); result.User = user; result.Notifications = notifs.Where(n => n.UserId == user.Id).ToList(); return(result); }
private string GetScore(UserProfileInfo profile) { var results = _exercisesResultsService.GetCandidateExercisesResults(profile.Id).ToArray(); var score = results.Sum(result => result.Score); var maxScore = results.Sum(result => result.CandidateExercise.MaximumScore); return(string.Concat(score, "/", maxScore)); }
public KorisnikOdabirZanimanja(UserProfileInfo user) { HKOPodaciService podaciService = new HKOPodaciService(); UserService userService = new UserService(); this.svaZanimanja = podaciService.fetchDistinctZanimanjaDictionary(); this.odabranaZanimanja = userService.getSelectedProffesionsForUser(user); }
private void TopicDisplay_Init(object sender, System.EventArgs e) { SettingsInfo MainSettings = DataCache.MainSettings(ControlConfig.InstanceId); PageSize = MainSettings.PageSize; string sTemp = string.Empty; if ((ControlConfig != null)) { object obj = DataCache.CacheRetrieve(ControlConfig.InstanceId + CurrentView); if (obj == null) { sTemp = ParseTemplate(); } else { sTemp = Convert.ToString(obj); } if (sTemp.Contains("[NOPAGING]")) { RowIndex = 0; PageSize = int.MaxValue; sTemp = sTemp.Replace("[NOPAGING]", string.Empty); } sTemp = Utilities.ParseTokenConfig(sTemp, "topic", ControlConfig); string Subject = string.Empty; string Body = string.Empty; System.DateTime CreateDate = null; System.DateTime EditDate = null; string Tags = string.Empty; string AuthorRoles = string.Empty; string IPAddress = string.Empty; System.DateTime LastPostDate = null; string LastPostData = string.Empty; UserProfileInfo tAuthor = null; int ReplyCount = 0; Data.Topics tc = new Data.Topics(); int rowCount = 0; int nextTopic = 0; int prevTopic = 0; int statusId = -1; double topicRating = 0; IDataReader dr = tc.TopicForDisplay(ControlConfig.SiteId, ControlConfig.InstanceId, -1, TopicId, UserId, RowIndex, PageSize, "ASC"); while (dr.Read()) { ForumId = int.Parse(dr["ForumId"].ToString()); Subject = dr["Subject"].ToString(); Body = dr["Body"].ToString(); CreateDate = Convert.ToDateTime(dr["DateCreated"].ToString()); EditDate = Convert.ToDateTime(dr["DateUpdated"].ToString()); Tags = dr["Tags"].ToString(); IPAddress = dr["IPAddress"].ToString(); LastPostDate = System.DateTime.Parse(Utilities.GetDate(System.DateTime.Parse(dr["LastPostDate"].ToString()), ControlConfig.InstanceId)); LastPostData = dr["LastPostData"].ToString(); ReplyCount = int.Parse(dr["ReplyCount"].ToString()); nextTopic = int.Parse(dr["NextTopic"].ToString()); prevTopic = int.Parse(dr["PrevTopic"].ToString()); topicRating = double.Parse(dr["TopicRating"].ToString()); UserProfileInfo profile = new UserProfileInfo(); var _with1 = profile; _with1.UserID = int.Parse(dr["AuthorId"].ToString()); if (string.IsNullOrEmpty(dr["DisplayName"].ToString())) { _with1.DisplayName = dr["AuthorName"].ToString(); } else { _with1.DisplayName = dr["DisplayName"].ToString(); } _with1.FirstName = dr["FirstName"].ToString(); _with1.LastName = dr["LastName"].ToString(); _with1.Username = dr["Username"].ToString(); _with1.UserCaption = dr["UserCaption"].ToString(); _with1.AnswerCount = int.Parse(dr["AnswerCount"].ToString()); _with1.AOL = dr["AOL"].ToString(); _with1.Avatar = dr["Avatar"].ToString(); _with1.AvatarType = (AvatarTypes)int.Parse(dr["AvatarType"].ToString()); _with1.DateCreated = System.DateTime.Parse(Utilities.GetDate(System.DateTime.Parse(dr["UserDateCreated"].ToString()), ControlConfig.InstanceId)); _with1.DateLastActivity = System.DateTime.Parse(Utilities.GetDate(System.DateTime.Parse(dr["DateLastActivity"].ToString()), ControlConfig.InstanceId)); _with1.DateLastPost = System.DateTime.Parse(Utilities.GetDate(System.DateTime.Parse(dr["DateLastPost"].ToString()), ControlConfig.InstanceId)); if (!string.IsNullOrEmpty(dr["UserDateUpdated"].ToString())) { _with1.DateUpdated = System.DateTime.Parse(Utilities.GetDate(System.DateTime.Parse(dr["UserDateUpdated"].ToString()), ControlConfig.InstanceId)); } _with1.Interests = dr["Interests"].ToString(); _with1.IsUserOnline = bool.Parse(dr["IsUserOnline"].ToString()); _with1.Location = dr["Location"].ToString(); _with1.MSN = dr["MSN"].ToString(); _with1.Occupation = dr["Occupation"].ToString(); _with1.TopicCount = int.Parse(dr["UserTopicCount"].ToString()); _with1.ReplyCount = int.Parse(dr["UserReplyCount"].ToString()); _with1.RewardPoints = int.Parse(dr["RewardPoints"].ToString()); _with1.Roles = dr["UserRoles"].ToString(); _with1.Signature = dr["Signature"].ToString(); _with1.TrustLevel = int.Parse(dr["TrustLevel"].ToString()); _with1.WebSite = dr["WebSite"].ToString(); _with1.Yahoo = dr["Yahoo"].ToString(); tAuthor = profile; if (DataPageId == 1) { sTemp = ParseTopic(sTemp, Subject, CreateDate, Body, Tags, Convert.ToString(EditDate), IPAddress, ForumUser, rowCount); rowCount += 1; } else { sTemp = TemplateUtils.ReplaceSubSection(sTemp, string.Empty, "[TOPIC]", "[/TOPIC]"); } } if (ForumInfo == null) { ForumController fc = new ForumController(); Forum fi = null; fi = fc.Forums_Get(ForumId, UserId, true, true); ForumInfo = fi; } sTemp = sTemp.Replace("[FORUMID]", ForumId.ToString); sTemp = sTemp.Replace("[FORUMNAME]", ForumInfo.ForumName); sTemp = sTemp.Replace("[TOPICID]", TopicId.ToString); sTemp = sTemp.Replace("[CREATEROLES]", ForumInfo.Security.Create); sTemp = sTemp.Replace("[USERROLES]", ForumUser.UserRoles); sTemp = sTemp.Replace("[THEMEPATH]", ThemePath); sTemp = sTemp.Replace("[SUBJECT]", Subject); sTemp = sTemp.Replace("[PAGEID]", PageId.ToString); sTemp = sTemp.Replace("[REPLYROLES]", ForumInfo.Security.Reply); sTemp = sTemp.Replace("AF:SECURITY:MODROLES]", "AF:SECURITY:MODROLES:" + ForumInfo.Security.ModApprove + "]"); sTemp = sTemp.Replace("AF:SECURITY:MODAPPROVE]", "AF:SECURITY:MODAPPROVE:" + ForumInfo.Security.ModApprove + "]"); sTemp = sTemp.Replace("AF:SECURITY:DELETE]", "AF:SECURITY:DELETE:" + ForumInfo.Security.Delete + ForumInfo.Security.ModDelete + "]"); sTemp = sTemp.Replace("AF:SECURITY:EDIT]", "AF:SECURITY:EDIT:" + ForumInfo.Security.Edit + ForumInfo.Security.ModEdit + "]"); sTemp = sTemp.Replace("AF:SECURITY:LOCK]", "AF:SECURITY:LOCK:" + ForumInfo.Security.Lock + ForumInfo.Security.ModLock + "]"); sTemp = sTemp.Replace("AF:SECURITY:MOVE]", "AF:SECURITY:MOVE:" + ForumInfo.Security.ModMove + "]"); sTemp = sTemp.Replace("AF:SECURITY:PIN]", "AF:SECURITY:PIN:" + ForumInfo.Security.Pin + ForumInfo.Security.ModPin + "]"); sTemp = sTemp.Replace("AF:SECURITY:SPLIT]", "AF:SECURITY:SPLIT:" + ForumInfo.Security.ModSplit + "]"); sTemp = sTemp.Replace("AF:SECURITY:REPLY]", "AF:SECURITY:REPLY:" + ForumInfo.Security.Reply + "]"); if (LastPostDate == null) { LastPostDate = CreateDate; } string LastPostAuthor = string.Empty; if (((bRead & tAuthor.UserID == this.UserId)) & statusId >= 0) { sTemp = sTemp.Replace("[AF:CONTROL:STATUS]", "<asp:placeholder id=\"plhStatus\" runat=\"server\" />"); sTemp = sTemp.Replace("[AF:CONTROL:STATUSICON]", "<img alt=\"[RESX:PostStatus" + statusId.ToString() + "]\" src=\"" + ThemePath + "status" + statusId.ToString() + ".png\" />"); } else if (statusId >= 0) { sTemp = sTemp.Replace("[AF:CONTROL:STATUS]", string.Empty); sTemp = sTemp.Replace("[AF:CONTROL:STATUSICON]", "<img alt=\"[RESX:PostStatus" + statusId.ToString() + "]\" src=\"" + ThemePath + "status" + statusId.ToString() + ".png\" />"); } else { sTemp = sTemp.Replace("[AF:CONTROL:STATUS]", string.Empty); sTemp = sTemp.Replace("[AF:CONTROL:STATUSICON]", string.Empty); sTemp = sTemp.Replace("[ACTIONS:ANSWER]", string.Empty); } if (string.IsNullOrEmpty(LastPostData)) { LastPostAuthor = UserProfiles.GetDisplayName(ControlConfig.InstanceId, MainSettings.ProfileVisibility, false, tAuthor.UserID, MainSettings.UserNameDisplay, MainSettings.DisableUserProfiles, tAuthor.Username, tAuthor.FirstName, tAuthor.LastName, tAuthor.DisplayName); } else { Author la = new Author(); System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument(); xDoc.LoadXml(LastPostData); System.Xml.XmlNode xNode = xDoc.SelectSingleNode("//root/lastpost"); if ((xNode != null)) { var _with2 = la; _with2.AuthorId = int.Parse(xNode["authorid"].InnerText.ToString()); _with2.DisplayName = xNode["displayname"].InnerText; _with2.FirstName = xNode["firstname"].InnerText; _with2.LastName = xNode["lastname"].InnerText; _with2.Username = xNode["username"].InnerText; } LastPostAuthor = UserProfiles.GetDisplayName(ControlConfig.InstanceId, MainSettings.ProfileVisibility, false, la.AuthorId, MainSettings.UserNameDisplay, MainSettings.DisableUserProfiles, la.Username, la.FirstName, la.LastName, la.DisplayName); } //TODO:Fix LastPostDate Format sTemp = sTemp.Replace("[AF:LABEL:LastPostDate]", LastPostDate.ToString()); sTemp = sTemp.Replace("[AF:LABEL:LastPostAuthor]", LastPostAuthor); sTemp = sTemp.Replace("[AF:LABEL:ReplyCount]", ReplyCount.ToString()); string sURL = "<a rel=\"nofollow\" href=\"" + Utilities.NavigateUrl(PageId, "", ParamKeys.ForumId + "=" + ForumId, ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.TopicId + "=" + TopicId, "mid=" + ControlConfig.InstanceId.ToString, "dnnprintmode=true") + "?skinsrc=" + HttpUtility.UrlEncode("[G]" + DotNetNuke.UI.Skins.SkinInfo.RootSkin + "/" + DotNetNuke.Common.glbHostSkinFolder + "/" + "No Skin") + "&containersrc=" + HttpUtility.UrlEncode("[G]" + DotNetNuke.UI.Skins.SkinInfo.RootContainer + "/" + DotNetNuke.Common.glbHostSkinFolder + "/" + "No Container") + "\" target=\"_blank\">"; sURL += "<img src=\"" + ThemePath + "images/spacer.gif\" alt=\"[RESX:PrinterFriendly]\" class=\"aficon aficonprint\" /></a>"; sTemp = sTemp.Replace("[AF:CONTROL:PRINTER]", sURL); if (HttpContext.Current.Request.IsAuthenticated) { sURL = Utilities.NavigateUrl(PageId, "", new string[] { ParamKeys.ViewType + "=sendto", ParamKeys.ForumId + "=" + ForumId, ParamKeys.TopicId + "=" + TopicId }); sTemp = sTemp.Replace("[AF:CONTROL:EMAIL]", "<a href=\"" + sURL + "\" rel=\"nofollow\"><img src=\"" + ThemePath + "images/spacer.gif\" class=\"aficon aficonemail\" alt=\"[RESX:EmailThis]\" /></a>"); } else { sTemp = sTemp.Replace("[AF:CONTROL:EMAIL]", string.Empty); } if (ForumInfo.AllowRSS) { string Url = null; Url = DotNetNuke.Common.AddHTTP(DotNetNuke.Common.GetDomainName(HttpContext.Current.Request)) + "/DesktopModules/ActiveForums/feeds.aspx?portalid=" + ControlConfig.SiteId + "&forumid=" + ForumId + "&tabid=" + PageId + "&moduleid=" + ControlConfig.InstanceId; sTemp = sTemp.Replace("[RSSLINK]", "<a href=\"" + Url + "\"><img src=\"" + ThemePath + "images/rss.png\" runat=server border=\"0\" alt=\"[RESX:RSS]\" /></a>"); } else { sTemp = sTemp.Replace("[RSSLINK]", string.Empty); } if (nextTopic == 0) { sTemp = sTemp.Replace("[NEXTTOPICID]", string.Empty); sTemp = sTemp.Replace("[HASNEXTTOPIC]", "False"); } else { sTemp = sTemp.Replace("[NEXTTOPICID]", nextTopic.ToString()); sTemp = sTemp.Replace("[HASNEXTTOPIC]", "True"); } if (prevTopic == 0) { sTemp = sTemp.Replace("[PREVTOPICID]", string.Empty); sTemp = sTemp.Replace("[HASPREVTOPIC]", "False"); } else { sTemp = sTemp.Replace("[PREVTOPICID]", prevTopic.ToString()); sTemp = sTemp.Replace("[HASPREVTOPIC]", "True"); } dr.NextResult(); //Process Replies StringBuilder sb = new StringBuilder(); sb.Append(string.Empty); int replyId = 0; while (dr.Read()) { Subject = dr["Subject"].ToString(); Body = dr["Body"].ToString(); CreateDate = Convert.ToDateTime(dr["DateCreated"].ToString()); EditDate = Convert.ToDateTime(dr["DateUpdated"].ToString()); IPAddress = dr["IPAddress"].ToString(); replyId = int.Parse(dr["ReplyId"].ToString()); UserProfileInfo profile = new UserProfileInfo(); var _with3 = profile; _with3.UserID = int.Parse(dr["AuthorId"].ToString()); if (string.IsNullOrEmpty(dr["DisplayName"].ToString())) { _with3.DisplayName = dr["AuthorName"].ToString(); } else { _with3.DisplayName = dr["DisplayName"].ToString(); } _with3.FirstName = dr["FirstName"].ToString(); _with3.LastName = dr["LastName"].ToString(); _with3.Username = dr["Username"].ToString(); _with3.UserCaption = dr["UserCaption"].ToString(); _with3.AnswerCount = int.Parse(dr["AnswerCount"].ToString()); _with3.AOL = dr["AOL"].ToString(); _with3.Avatar = dr["Avatar"].ToString(); _with3.AvatarType = (AvatarTypes)int.Parse(dr["AvatarType"].ToString()); _with3.DateCreated = System.DateTime.Parse(Utilities.GetDate(System.DateTime.Parse(dr["UserDateCreated"].ToString()), ControlConfig.InstanceId)); _with3.DateLastActivity = System.DateTime.Parse(Utilities.GetDate(System.DateTime.Parse(dr["DateLastActivity"].ToString()), ControlConfig.InstanceId)); if (!string.IsNullOrEmpty(dr["DateLastPost"].ToString())) { _with3.DateLastPost = System.DateTime.Parse(Utilities.GetDate(System.DateTime.Parse(dr["DateLastPost"].ToString()), ControlConfig.InstanceId)); } if (!string.IsNullOrEmpty(dr["UserDateUpdated"].ToString())) { _with3.DateUpdated = System.DateTime.Parse(Utilities.GetDate(System.DateTime.Parse(dr["UserDateUpdated"].ToString()), ControlConfig.InstanceId)); } _with3.Interests = dr["Interests"].ToString(); _with3.IsUserOnline = bool.Parse(dr["IsUserOnline"].ToString()); _with3.Location = dr["Location"].ToString(); _with3.MSN = dr["MSN"].ToString(); _with3.Occupation = dr["Occupation"].ToString(); _with3.TopicCount = int.Parse(dr["UserTopicCount"].ToString()); _with3.ReplyCount = int.Parse(dr["UserReplyCount"].ToString()); _with3.RewardPoints = int.Parse(dr["RewardPoints"].ToString()); _with3.Roles = dr["UserRoles"].ToString(); _with3.Signature = dr["Signature"].ToString(); _with3.TrustLevel = int.Parse(dr["TrustLevel"].ToString()); _with3.WebSite = dr["WebSite"].ToString(); _with3.Yahoo = dr["Yahoo"].ToString(); sb.Append(ParseReply(sTemp, replyId, Subject, CreateDate, Body, Convert.ToString(EditDate), IPAddress, ForumUser, rowCount)); rowCount += 1; } dr.Close(); sTemp = TemplateUtils.ReplaceSubSection(sTemp, sb.ToString(), "[REPLIES]", "[/REPLIES]"); sTemp = Utilities.LocalizeControl(sTemp); sTemp = sTemp.Replace("[TOPICID]", TopicId.ToString); sTemp = sTemp.Replace("[GROUPNAME]", ForumInfo.GroupName); sTemp = sTemp.Replace("[FORUMNAME]", ForumInfo.ForumName); sTemp = sTemp.Replace("[TOPICRATING]", topicRating.ToString()); sTemp = sTemp.Replace("[CURRENTUSERID]", UserId.ToString); sTemp = Utilities.ParseSecurityTokens(sTemp, ForumUser.UserRoles); if (!sTemp.Contains(Globals.ControlRegisterAFTag)) { sTemp = Globals.ControlRegisterAFTag + sTemp; } Control ctl = Page.ParseControl(sTemp); LinkControls(ctl.Controls); this.Controls.Add(ctl); } }
private UserProfileInfo GetUserInfo() { if (Session[UserInfoSessionKey] == null) Session[UserInfoSessionKey] = new UserProfileInfo(); return (UserProfileInfo) Session[UserInfoSessionKey]; }
protected override bool Insert() { if (!txtPassword.Text.Equals(txtComfirmPassword.Text)) { ErrorInfo error = new ErrorInfo(); error.Name = "User Create Error!"; error.Message = "Password and Confirm Password mismatch!"; error.Ok = false; ErrorList.Add(error); return CheckErrors(); } MembershipCreateStatus status; Membership.CreateUser(txtUserName.Text, txtPassword.Text, txtEmail.Text, null, null, chbxIsActive.Checked, out status); if (CheckErrors(status)) { Roles.AddUserToRole(txtUserName.Text, drlRoles.SelectedValue); if (pnlContentType.Visible) { _userProfileProvider.DeleteUserProfile(txtUserName.Text, ErrorList); ShowContentType(); mainForm.SaveData(); UserProfileInfo userProfileInfo = new UserProfileInfo(); userProfileInfo.ContentId = mainForm.ContentId; userProfileInfo.ContentTypeId = mainForm.ContentTypeId; userProfileInfo.UserId = txtUserName.Text; _userProfileProvider.Create(userProfileInfo, ErrorList); } } return CheckErrors(); }
protected override bool Update() { MembershipUser user = Membership.GetUser(Id); if (user != null) { user.Email = txtEmail.Text; user.IsApproved = chbxIsActive.Checked; Membership.UpdateUser(user); string[] selectedRoles = Roles.GetRolesForUser(user.UserName); if (selectedRoles != null && selectedRoles.Length > 0) Roles.RemoveUserFromRoles(user.UserName, selectedRoles); Roles.AddUserToRole(user.UserName, drlRoles.SelectedValue); if (pnlContentType.Visible) { ShowContentType(); mainForm.SaveData(); _userProfileProvider.DeleteUserProfile(user.UserName, ErrorList); UserProfileInfo userProfileInfo = new UserProfileInfo(); userProfileInfo.ContentId = mainForm.ContentId; userProfileInfo.ContentTypeId = mainForm.ContentTypeId; userProfileInfo.UserId = user.UserName; _userProfileProvider.Create(userProfileInfo, ErrorList); } } return CheckErrors(); }
protected void btnSave_Click(object sender, EventArgs e) { try { UserProfileInfo objinfo = new UserProfileInfo(); string filename = ""; string thumbTarget = Server.MapPath("~/Modules/Admin/UserManagement/UserPic"); if (!Directory.Exists(thumbTarget)) { Directory.CreateDirectory(thumbTarget); } System.Drawing.Image.GetThumbnailImageAbort thumbnailImageAbortDelegate = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback); if (fuImage.HasFile) { string fName = fuImage.PostedFile.FileName; FileInfo fi = new FileInfo(fName); string ext = fi.Extension.ToLower(); if (ext == ".jpeg" || ext == ".jpg" || ext == ".png") { double fs = fuImage.PostedFile.ContentLength / (1024 * 1024); if (fs > 3) { ShowHideProfile(); ShowMessage("", GetSageMessage("UserManagement", "ImageTooLarge"), "", SageMessageType.Alert); return; } else { Random ran = new Random(); int rand = ran.Next(1111111, 9999999); if (!File.Exists(Server.MapPath("~/Modules/Admin/UserManagement/UserPic/" + fName))) { string fullfileName = Path.GetFileNameWithoutExtension(fName) + rand + ext; Session[SessionKeys.Profile_Image] = fullfileName; imgUser.ImageUrl = "~/Modules/Admin/UserManagement/UserPic/" + fullfileName; using ( System.Drawing.Bitmap originalImage = new System.Drawing.Bitmap(fuImage.PostedFile.InputStream)) { using ( System.Drawing.Image thumbnail = originalImage.GetThumbnailImage(200, 150, thumbnailImageAbortDelegate, IntPtr.Zero)) { thumbnail.Save(System.IO.Path.Combine(thumbTarget, fullfileName)); } } } } } else { { ShowHideProfile(); ShowMessage("", GetSageMessage("UserManagement", "InvalidImageFormat"), "", SageMessageType.Error); return; } } } if (filename == "") { if (Session[SessionKeys.Profile_Image] != null) { filename = Session[SessionKeys.Profile_Image].ToString(); } btnDeleteProfilePic.Visible = false; } else { btnDeleteProfilePic.Visible = true; } objinfo.Image = filename; objinfo.UserName = GetUsername; objinfo.FirstName = txtFName.Text; objinfo.LastName = txtLName.Text; objinfo.FullName = txtFullName.Text; objinfo.Location = txtLocation.Text; objinfo.AboutYou = txtAboutYou.Text; objinfo.Email = txtEmail1.Text + "," + (txtEmail2.Text != "" ? txtEmail2.Text + ',' : "") + (txtEmail3.Text != "" ? txtEmail3.Text + ',' : ""); objinfo.ResPhone = txtResPhone.Text; objinfo.MobilePhone = txtMobile.Text; objinfo.Others = txtOthers.Text; objinfo.AddedOn = DateTime.Now; objinfo.AddedBy = GetUsername; objinfo.UpdatedOn = DateTime.Now; objinfo.PortalID = GetPortalID; objinfo.UpdatedBy = GetUsername; objinfo.BirthDate = txtBirthDate.Text == string.Empty ? DateTime.Parse(falseDate) : DateTime.Parse(txtBirthDate.Text); objinfo.Gender = rdbGender.SelectedIndex; UserProfileController.AddUpdateProfile(objinfo); LoadUserDetails(); divUserInfo.Visible = true; tblEditProfile.Visible = false; tblViewProfile.Visible = true; imgProfileEdit.Visible = false; imgProfileView.Visible = true; btnDeleteProfilePic.Visible = false; divEditprofile.Visible = true; sfUserProfile.Visible = false; Session[SessionKeys.Profile_Image] = null; ShowMessage("", GetSageMessage("UserManagement", "UserProfileSavedSuccessfully"), "", SageMessageType.Success); } catch (Exception ex) { ProcessException(ex); } }
protected void btnDeleteProfilePic_Click(object sender, EventArgs e) { try { UserProfileInfo objinfo = new UserProfileInfo(); objinfo = UserProfileController.GetProfile(GetUsername, GetPortalID); if (objinfo.Image != "") { string imagePath = ResolveUrl(this.AppRelativeTemplateSourceDirectory) + "UserPic/" + objinfo.Image; string path = Server.MapPath(imagePath); if (File.Exists(path)) { File.Delete(path); } } UserProfileController.DeleteProfilePic(GetUsername, GetPortalID); ShowHideProfile(); GetUserDetails(); LoadUserDetails(); Session[SessionKeys.Profile_Image] = null; } catch (Exception) { throw; } }
public void LoadUserDetails() { try { UserProfileInfo objinfo = new UserProfileInfo(); objinfo = UserProfileController.GetProfile(GetUsername, GetPortalID); if (objinfo != null) { string[] Emails = objinfo.Email.Split(','); if (objinfo.Image != "") { imgViewImage.ImageUrl = "~/Modules/Admin/UserManagement/UserPic/" + objinfo.Image; imgViewImage.Visible = true; imgProfileEdit.Visible = true; } else { imgProfileEdit.Visible = false; imgViewImage.Visible = false; } lblViewUserName.Text = objinfo.UserName; lblViewFirstName.Text = objinfo.FirstName; lblViewLastName.Text = objinfo.LastName; if (objinfo.FullName != "") { lblviewFullName.Text = objinfo.FullName; trviewFullName.Visible = true; } else { trviewFullName.Visible = false; } if (objinfo.Location != "") { lblViewLocation.Text = objinfo.Location; trViewLocation.Visible = true; } else { trViewLocation.Visible = false; } string AboutYou = objinfo.AboutYou.Replace("\r\n", "<br>"); if (AboutYou != "") { lblViewAboutYou.Text = AboutYou; trViewAboutYou.Visible = true; } else { trViewAboutYou.Visible = false; } if (Emails.Length != 0) { trViewEmail.Visible = true; } if (Emails.Length == 2) { lblViewEmail1.Text = Emails[0]; } if (Emails.Length == 3) { lblViewEmail1.Text = Emails[0]; lblViewEmail2.Text = Emails[1]; } if (Emails.Length == 4) { lblViewEmail1.Text = Emails[0]; lblViewEmail2.Text = Emails[1]; lblViewEmail3.Text = Emails[2]; } else { trViewEmail.Visible = false; } if (objinfo.ResPhone != "") { lblViewResPhone.Text = objinfo.ResPhone; trViewResPhone.Visible = true; } else { trViewResPhone.Visible = false; } if (objinfo.Mobile != "") { lblViewMobile.Text = objinfo.Mobile; trViewMobile.Visible = true; } else { trViewMobile.Visible = false; } if (objinfo.Others != "") { lblViewOthers.Text = objinfo.Others; trViewOthers.Visible = true; } else { trViewOthers.Visible = false; } if (objinfo.Gender != null) { int gender = objinfo.Gender; trviewGender.Visible = false; if (gender == 0) { trviewGender.Visible = true; lblviewGender.Text = "Male"; } else if (gender == 1) { trviewGender.Visible = true; lblviewGender.Text = "Female"; } } else { trviewGender.Visible = false; } if (objinfo.BirthDate.ToShortDateString() != falseDate && objinfo.BirthDate.ToShortDateString() != defaultDate) { trviewBirthDate.Visible = true; lblviewBirthDate.Text = objinfo.BirthDate.ToShortDateString(); } else { trviewBirthDate.Visible = false; } } } catch (Exception) { throw; } }
public void GetUserDetails() { try { UserProfileInfo objinfo = new UserProfileInfo(); objinfo = UserProfileController.GetProfile(GetUsername, GetPortalID); string UserImage = Server.MapPath("~/Modules/Admin/UserManagement/UserPic/"); if (!Directory.Exists(UserImage)) { Directory.CreateDirectory(UserImage); } if (objinfo != null) { string[] Emails = objinfo.Email.Split(','); if (objinfo.Image != "") { imgUser.ImageUrl = "~/Modules/Admin/UserManagement/UserPic/" + objinfo.Image; imgUser.Visible = true; imgProfileEdit.Visible = true; btnDeleteProfilePic.Visible = true; Session[SessionKeys.Profile_Image] = objinfo.Image; } else { imgUser.Visible = false; imgProfileEdit.Visible = false; } lblDisplayUserName.Text = objinfo.UserName; txtFName.Text = objinfo.FirstName; txtLName.Text = objinfo.LastName; txtFullName.Text = objinfo.FullName; txtLocation.Text = objinfo.Location; txtAboutYou.Text = objinfo.AboutYou; txtEmail1.Text = Emails[0]; txtBirthDate.Text = (objinfo.BirthDate.ToShortDateString() == falseDate || objinfo.BirthDate.ToShortDateString() == defaultDate) ? "" : objinfo.BirthDate.ToShortDateString(); rdbGender.SelectedIndex = objinfo.Gender; if (Emails.Length == 3) { txtEmail2.Text = Emails[1]; } if (Emails.Length == 4) { txtEmail2.Text = Emails[1]; txtEmail3.Text = Emails[2]; } txtResPhone.Text = objinfo.ResPhone; txtMobile.Text = objinfo.Mobile; txtOthers.Text = objinfo.Others; } } catch (Exception) { throw; } }