public string getCssClass(int senderID) { if (user == null) { userManager = new BLLUserMngr(); user = userManager.BLLGetCurrentUser(Session); } if (user.ID.Equals(senderID)) return sentCss; else return receivedCss; }
protected void Page_Load(object sender, EventArgs e) { try { userManager = new BLLUserMngr(); user = userManager.BLLGetCurrentUser(Session); if (!IsPostBack && user!=null) { txtEmail.Text = user.Email; } } catch (Exception) { //Log error Response.Redirect("404.aspx", false); } }
protected void Page_Load(object sender, EventArgs e) { // Instantiate selectedConversation, if required. if (selectedConversation == null) { selectedConversation = new Conversation(); } // Check if query string contains ConversationID value String selectedConvoID = Request.ServerVariables["QUERY_STRING"]; if (selectedConvoID.Length > 0 && conversationList.Count > 0) { /* If a conversation was selected, retreive the selected conversation * according to its ID in conversation<List> and present its messages to the user. * */ int selectedIDasInt; if (int.TryParse(selectedConvoID, out selectedIDasInt)) { for (int i = 0; i < conversationList.Count; i++) { if (conversationList.ElementAt(i).ConversationID.Equals(selectedIDasInt)) { selectedConversation = conversationList.ElementAt(i); break; } } mySummaries.Visible = false; MessageThread.Visible = true; PopulateMessageThread(selectedConversation); } } try { userManager = new BLLUserMngr(); user = userManager.BLLGetCurrentUser(Session); messageManager = new BLLMessageMngr(user.ID); getMessages(); } catch (Exception) { //Log error Response.Redirect("404.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { try { userManager = new BLLUserMngr(); user = userManager.BLLGetCurrentUser(Session); } catch (Exception) { //Log error Response.Redirect("404.aspx", false); } if (!IsPostBack) { /*Retrieve and load the values of each attribute*/ attManager = new BLLAttributeMngr(); hobbies = attManager.BLLGetHobbiesTable(); attributes = attManager.BLLGetBuild(); ddlBuild.DataSource = attributes; ddlBuild.DataBind(); attributes = attManager.BLLGetCounty(); ddlCounty.DataSource = attributes; ddlCounty.DataBind(); attributes = attManager.BLLGetEthnicity(); ddlEthnicity.DataSource = attributes; ddlEthnicity.DataBind(); attributes = attManager.BLLGetEyeColor(); ddlEyeColor.DataSource = attributes; ddlEyeColor.DataBind(); attributes = attManager.BLLGetGenders(); ddlGender.DataSource = attributes; ddlGender.DataBind(); attributes = attManager.BLLGetHairColor(); ddlHairColor.DataSource = attributes; ddlHairColor.DataBind(); attributes = attManager.BLLGetHeight(); ddlHeight.DataSource = attributes; ddlHeight.DataBind(); attributes = attManager.BLLGetRelationshipStatus(); ddlRelationshipStatus.DataSource = attributes; ddlRelationshipStatus.DataBind(); attributes = attManager.BLLGetSexualOrientation(); ddlOrientation.DataSource = attributes; ddlOrientation.DataBind(); cblHobbies.DataSource = hobbies; cblHobbies.DataValueField = Resources.HOBBIES_ID_COLUMN; cblHobbies.DataTextField = Resources.HOBBIES_NAME_COLUMN; cblHobbies.DataBind(); if (user != null) { if (user.Age != null && user.Age > 0) txtAge.Text = user.Age.ToString(); if (user.IdealDate!=null && user.IdealDate.Length > 0) txtIdealDate.Text = user.IdealDate; if (user.Profession != null && user.Profession.Length > 0) txtProfession.Text = user.Profession; if (user.Town != null && user.Town.Length > 0) txtTown.Text = user.Town; if (user.Comments != null && user.Comments.Length > 0) txtComments.Text = user.Comments; if (user.Build != null && user.Build.Length > 0) ddlBuild.Items.FindByValue(user.Build).Selected = true; if (user.County != null && user.County.Length > 0) ddlCounty.Items.FindByValue(user.County).Selected = true; if (user.Ethnicity != null && user.Ethnicity.Length > 0) ddlEthnicity.Items.FindByValue(user.Ethnicity).Selected = true; if (user.EyeColor != null && user.EyeColor.Length > 0) ddlEyeColor.Items.FindByValue(user.EyeColor).Selected = true; if (user.Gender != null && user.Gender.Length > 0) ddlGender.Items.FindByValue(user.Gender).Selected = true; if (user.HairColor != null && user.HairColor.Length > 0) ddlHairColor.Items.FindByValue(user.HairColor).Selected = true; if (user.Height != null && user.Height.Length > 0) ddlHeight.Items.FindByValue(user.Height).Selected = true; if (user.RelationshipStatus != null && user.RelationshipStatus.Length > 0) ddlRelationshipStatus.Items.FindByValue(user.RelationshipStatus).Selected = true; if (user.SexualOrientation != null && user.SexualOrientation.Length > 0) ddlOrientation.Items.FindByValue(user.SexualOrientation).Selected = true; // Populate the CheckBoxList items only when it's not a postback. foreach (int i in user.Hobbies) { cblHobbies.Items[i].Selected = true; } } } }
protected void Page_Load(object sender, EventArgs e) { try { userManager = new BLLUserMngr(); UserModel user = userManager.BLLGetCurrentUser(Session); if (user != null) { Response.Redirect("SearchFor.aspx",false); } else if (!IsPostBack) { //loginPage2.Visible = false; fillRegistrationData(); } } catch (Exception) { //Log error Response.Redirect("404.aspx", false); } }