public bool GetMemberStatus(Member_Status member_Status) { using (SqlConnection con = new SqlConnection(ConnectionString)) { SqlCommand cmd = new SqlCommand("uspGetMemberStatus", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@MemberID", member_Status.MemberId); try { con.Open(); SqlDataReader dbReader = cmd.ExecuteReader(); bool isBlocked = false; while (dbReader.Read()) { if (int.Parse(dbReader["StatusID"].ToString()) == 1) { isBlocked = false; } else { isBlocked = true; } } return(isBlocked); } catch (Exception e) { e.Message.ToString(); HttpContext.Current.Response.Redirect("~/Error_Pages/503.htm"); return(false); } } }
protected void Page_Load(object sender, EventArgs e) { Literal title = (Literal)Master.FindControl("pageTitle"); title.Text = "Home"; MessagesDAL member = new MessagesDAL(); if (Session["memberID"] == null) { Response.Redirect("~/Login.aspx"); } else if (loginDAL.GetMemberStatus(member_Status = new Member_Status(Session["memberID"].ToString()))) { if (Request.Cookies["login"] != null) { var c = new HttpCookie("login"); c.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(c); Session.Abandon(); } Response.Redirect("~/Login.aspx"); } else { if (!IsPostBack) { #region NEWS FEED string TabName = "Posts"; BulabulaApp.WebServices.postsWebservice posts = new WebServices.postsWebservice(); newsfeed = posts.GetTabContents(TabName, -1, -1); #endregion } //END MAIN if else //ELSE THIS IS A POSTBACK { if (ThisFileToDownload.Value.ToString() != "") { // Get the file from the database PostDAL postDAL = new PostDAL(); DataTable file = postDAL.GetAFile(int.Parse(ThisFileToDownload.Value)); ThisFileToDownload.Value = ""; DataRow row = file.Rows[0]; string name = (string)row["FileName"]; string contentType = (string)row["FileCaption"]; Byte[] data = (Byte[])row["File"]; // Send the file to the browser Response.AddHeader("Content-type", contentType); Response.AddHeader("Content-Disposition", "attachment; filename=" + name); Response.BinaryWrite(data); Response.Flush(); Response.End(); //Refreshing file id hidden control } } //END ELSE } } //END PAGE_LOAD
protected void Page_Load(object sender, EventArgs e) { pageTitle.Text = "Profile"; if (!IsPostBack) { if (Session["memberID"] == null) { Response.Redirect("~/Login.aspx"); } else if (loginDAL.GetMemberStatus(member_Status = new Member_Status(Session["memberID"].ToString()))) { if (Request.Cookies["login"] != null) { var c = new HttpCookie("login"); c.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(c); Session.Abandon(); } Response.Redirect("~/Login.aspx"); } else if (Context.Session["profileFriendID"] != Context.Session["memberID"] && Context.Session["profileFriendID"] != null) { aFriend.MemberId = Context.Session["profileFriendID"].ToString(); aMember.MemberId = Context.Session["memberID"].ToString(); GenerateProfile(aFriend); #region BUILD PROFILE BUTTONS //Building profile buttons //To update status on form //===================================================================== FriendshipDAL.GetInvitationStatus(aMember, aFriend); List <Member_Friend> statusList = new List <Member_Friend>(); statusList = FriendshipDAL.GetInvitationStatus(aMember, aFriend); FriendshipDAL dal = new FriendshipDAL(); if (statusList.Count == 0) { btnProfile.Append("<a class='button big addfriend' id='addfriend' >Add as friend</a><br />"); } else { string InvitationStatus = statusList[0].InvitationStatus; //===================================================================== if (InvitationStatus == "Pending") { if (dal.MemberIsActaullyTheMember(aMember, aFriend) == 1) { btnProfile.Append("<a class='button big disabledBtn' id='requestPending' >Request Pending..</a><br />"); btnProfile.Append("<a class='button big ' id='blockfriend' >Block this Person</a><br />"); } else if (dal.FriendIsActaullyTheMember(aMember, aFriend) == 1) { btnProfile.Append("<a class='button big ' id='acceptRequest' >Accept Request</a><br />"); btnProfile.Append("<a class='button big ' id='blockfriend' >Block this Person</a><br />"); } } else if (InvitationStatus == "Ignored") { btnProfile.Append("<a class='button big ' id='Ignored' >Ignored</a><br />"); btnProfile.Append("<a class='button big ' id='blockfriend' >Block this Person</a><br />"); } else { //Accepted btnProfile.Append("<a class='button big ' id='reportfriend' >Report this Person</a><br />"); #region GET BLOCKED STATUS dal = new FriendshipDAL(); if (dal.MemberIsActaullyTheMember(aMember, aFriend) == 1) { List <Member_Friend> BlockedList = new List <Member_Friend>(); BlockedList = dal.GetFriendBlockedMemberStatus(aMember, aFriend); if (BlockedList.Count != 0) { if (BlockedList[0].FriendBlockedMember == false) { btnProfile.Append("<a class='button big ' id='sendMessage' >Send Message</a><br />"); //CHECK IF I BLOCKED THE FRIEND List <Member_Friend> IBlockedFriend = new List <Member_Friend>(); IBlockedFriend = dal.GetMemberBlockedFriendStatus(aFriend, aMember); if (IBlockedFriend.Count != 0) { if (IBlockedFriend[0].MemberBlockedFriend == false) { btnProfile.Append("<a class='button big ' id='blockfriend' >Block this Person</a><br />"); } else { btnProfile.Append("<a class='button big ' id='blockfriend' >Unblock this Person</a><br />"); } btnProfile.Append("<a class='button big removeFriend' id='addfriend'>Remove Friend</a><br />"); } } } } else if (dal.FriendIsActaullyTheMember(aMember, aFriend) == 1) { List <Member_Friend> BlockedList = new List <Member_Friend>(); BlockedList = dal.GetMemberBlockedFriendStatus(aMember, aFriend); if (BlockedList.Count != 0) { if (BlockedList[0].MemberBlockedFriend == false) { btnProfile.Append("<a class='button big ' id='sendMessage' >Send Message</a><br />"); //CHECK IF I BLOCKED THE FRIEND List <Member_Friend> IBlockedFriend = new List <Member_Friend>(); IBlockedFriend = dal.GetFriendBlockedMemberStatus(aFriend, aMember); if (IBlockedFriend.Count != 0) { if (IBlockedFriend[0].FriendBlockedMember == false) { btnProfile.Append("<a class='button big ' id='blockfriend' >Block this Person</a><br />"); } else { btnProfile.Append("<a class='button big ' id='blockfriend' >Unblock this Person</a><br />"); } btnProfile.Append("<a class='button big removeFriend' id='addfriend'>Remove Friend</a><br />"); } } } } //btnProfile.Append("<a class='button big ' id='blockfriend' >Block this Person</a><br />"); // <a class="button big " id="reportfriend" >Report this Person</a><br /> // <a class="button big " id="blockfriend" >Block this Person</a> #endregion } } profileButtons = btnProfile.ToString(); #endregion } else { aMember.MemberId = Context.Session["memberID"].ToString(); GenerateProfile(aMember); } }//END IF ITS NOT POSTBACK else if (profileFriendID.Value != "") { #region REDIRECT TO CLICKED PROFILE //REDIRECT TO CLICKED PROFILE=================================================================== if (profileFriendID.Value != null) { Session["profileFriendID"] = profileFriendID.Value; profileFriendID.Value = null; Response.Redirect("~/Profile.aspx"); } //============================================================================================= #endregion } else if (GoToGroupPageID.Value != "") { Session["GroupInfo"] = GoToGroupPageID.Value; Response.Redirect("~/Group.aspx"); } if (Context.Session["profileFriendID"] != Context.Session["memberID"] && Context.Session["profileFriendID"] != null) { heading = aFriend.FirstName + " " + aFriend.LastName; } else { heading = aMember.FirstName + " " + aMember.LastName; } profileName.Value = heading; }
protected void LoginButton_Click(object sender, EventArgs e) { Member_Status member_Status; dal = new LoginDAL(); string username = LoginUser.UserName; string password = LoginUser.Password; //Validate the Credentials against the active directory userInformation = new ActiveDirectoryDAL(username, password); username = SSTCryptographer.Encrypt(username); bool isValid = userInformation.ValidateCredentials(); if (!isValid) //Invalid Credentials { failureText = "Incorrect username or password."; ErrorInfo.Visible = true; } else if (dal.GetMemberStatus(member_Status = new Member_Status(username))) { failureText = "Your account has been suspended."; ErrorInfo.Visible = true; } else //Valid Credentials { userInformation.GetUserInformation(); if (IsSchoolOfICTMember()) { //treat the case where we set the remember me check box if (LoginUser.RememberMeSet) { RememberMe(username, password); } dal = new LoginDAL(); //save data into db if first time login Member member; if (!dal.MemberExists(member = new Member(username))) { //add member to database member = new Member(username, userInformation.GetFirstName(), userInformation.GetLastName(), userInformation.GetDisplayName(), userInformation.GetEmail(), userInformation.GetThumbnailPhoto(), userInformation.GetDescription(), userInformation.GetCompany(), ValidateMemberType()); dal.InsertMember(member); //assign member to groups AssignMemberToGroups(username); } Session["memberID"] = username; // Server.Transfer("~/Home.aspx"); Response.Redirect("~/Home.aspx"); //Redirect to home page if the user is a memeber of the faculty of ICT } else { //Display error message if the user is not a memeber of the faculty of ICT failureText = "Sorry. You need to be a registered school of ICT member in order to gain access to this site"; ErrorInfo.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { Literal title = (Literal)Master.FindControl("pageTitle"); title.Text = "Home"; MessagesDAL member = new MessagesDAL(); if (Session["memberID"] == null) { Response.Redirect("~/Login.aspx"); } else if (loginDAL.GetMemberStatus(member_Status = new Member_Status(Session["memberID"].ToString()))) { if (Request.Cookies["login"] != null) { var c = new HttpCookie("login"); c.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(c); Session.Abandon(); } Response.Redirect("~/Login.aspx"); } else { if (!IsPostBack) { #region NEWS FEED string TabName = "Posts"; BulabulaApp.WebServices.postsWebservice posts = new WebServices.postsWebservice(); newsfeed = posts.GetTabContents(TabName, -1, -1); #endregion }//END MAIN if else//ELSE THIS IS A POSTBACK { if (ThisFileToDownload.Value.ToString() != "") { // Get the file from the database PostDAL postDAL = new PostDAL(); DataTable file = postDAL.GetAFile(int.Parse(ThisFileToDownload.Value)); ThisFileToDownload.Value = ""; DataRow row = file.Rows[0]; string name = (string)row["FileName"]; string contentType = (string)row["FileCaption"]; Byte[] data = (Byte[])row["File"]; // Send the file to the browser Response.AddHeader("Content-type", contentType); Response.AddHeader("Content-Disposition", "attachment; filename=" + name); Response.BinaryWrite(data); Response.Flush(); Response.End(); //Refreshing file id hidden control } }//END ELSE } }
protected void Page_Load(object sender, EventArgs e) { Literal title = (Literal)Master.FindControl("pageTitle"); caption = (HiddenField)Master.FindControl("caption"); #region NEWSFEED MessagesDAL member = new MessagesDAL(); if (!IsPostBack) { if (Session["memberID"] == null) { Response.Redirect("~/Login.aspx"); } else if (loginDAL.GetMemberStatus(member_Status = new Member_Status(Session["memberID"].ToString()))) { if (Request.Cookies["login"] != null) { var c = new HttpCookie("login"); c.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(c); Session.Abandon(); } Response.Redirect("~/Login.aspx"); } else if (Session["GroupInfo"] != null) { string m = Session["GroupInfo"].ToString(); string[] data = m.Split('&'); groupID = int.Parse(data[0]); ThisGroupsID.Value = "" + groupID; title.Text = data[1]; #region RIGHT COLUMN GET 5 JOINEDGROUPS //JOINED GROUPS============================================================================== string memberId = Context.Session["memberID"].ToString(); aMember.MemberId = memberId; Reusable_Methods reusable_Methods = new Reusable_Methods(aMember); allgroups = reusable_Methods.RightColumnGet5JoinedGroups(); //=========================================================================================== #endregion #region NEWS FEED string TabName = "Posts"; BulabulaApp.WebServices.postsWebservice posts = new WebServices.postsWebservice(); newsfeed = posts.GetTabContents(TabName, groupID, -1); #endregion #region RIGHT COLUMN FRIENDS ONLINE //FRIENDS ONLINE============================================================================== memberId = Context.Session["memberID"].ToString(); aMember.MemberId = memberId; reusable_Methods = new Reusable_Methods(aMember); FriendsOnlineString = reusable_Methods.RightColumnGetFriendsOnline(); //=========================================================================================== #endregion } }//END MAIN if loading for first time #endregion #region Picture Upload if (Request.QueryString["preview"] == "1" && !string.IsNullOrEmpty(Request.QueryString["fileId"]) && uploadType == "Picture") { var fileId = Request.QueryString["fileId"]; var fileContentType = (string)Session["fileContentType_" + fileId]; var fileName = (string)Session["fileName_" + fileId]; byte[] imageBytes = File.ReadAllBytes(System.Web.HttpContext.Current.Server.MapPath("~") + "file.png"); var fileContents = imageBytes; string ct = (string)Session["fileContentType_" + fileId]; if (ct.Contains("jpg") || ct.Contains("gif") || ct.Contains("png") || ct.Contains("jpeg")) { fileContents = (byte[])Session["fileContents_" + fileId]; } MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length); // Convert byte[] to Image ms.Write(imageBytes, 0, imageBytes.Length); System.Drawing.Image image = System.Drawing.Image.FromStream(ms, true); Photo_Post photoPost = new Photo_Post(); Group g = new Group(); PostDAL postDAl = new PostDAL(); aMember.MemberId = "5ZMjMHEwVN7GyJ2miPDjeQ=="; g.GroupId = 1; photoPost.Photo = image; photoPost.PhotoName = fileName; photoPost.PhotoCaption = "STeVO"; postDAl.InsertPhoto(photoPost, g, aMember); Response.Clear(); Response.ContentType = fileContentType; Response.BinaryWrite(fileContents); Response.End(); } #endregion #region Video Upload if (Request.QueryString["preview"] == "1" && !string.IsNullOrEmpty(Request.QueryString["fileId"]) && uploadType == "Video") { var videoFileId = Request.QueryString["fileId"]; var videofileContentType = (string)Session["fileContentType_" + videoFileId]; var videofileName = (string)Session["fileName_" + videoFileId]; byte[] videoBytes = File.ReadAllBytes(System.Web.HttpContext.Current.Server.MapPath("~") + "file.png"); var videofileContents = videoBytes; string ct = (string)Session["fileContentType_" + videoFileId]; if (ct.Contains("mp4") || ct.Contains("mov") || ct.Contains("vlc") || ct.Contains("avi") || ct.Contains("jpeg")) { videofileContents = (byte[])Session["fileContents_" + videoFileId]; } // MemoryStream vs = new MemoryStream(videoBytes, 0, videoBytes.Length); // Convert byte[] to Image //vs.Write(videoBytes, 0, videoBytes.Length); //System.Drawing.Image image = System.Drawing.Image.FromStream(vs, true); Video_Post videoPost = new Video_Post(); Group g = new Group(); PostDAL postDAl = new PostDAL(); aMember.MemberId = "5ZMjMHEwVN7GyJ2miPDjeQ=="; g.GroupId = 1; videoPost.Video = videoBytes; videoPost.VideoName = videofileName; videoPost.VideoCaption = "STeVO"; //videoPost.VideoSize = //postDAl.InsertPhoto1(photoPost, g, aMember); postDAl.InsertVideo(videoPost, g, aMember); //Response.Clear(); //Response.ContentType = fileContentType; //Response.BinaryWrite(fileContents); //Response.End(); } #endregion }
protected void Page_Load(object sender, EventArgs e) { pageTitle.Text = "Profile"; if (!IsPostBack) { if (Session["memberID"] == null) { Response.Redirect("~/Login.aspx"); } else if (loginDAL.GetMemberStatus(member_Status = new Member_Status(Session["memberID"].ToString()))) { if (Request.Cookies["login"] != null) { var c = new HttpCookie("login"); c.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(c); Session.Abandon(); } Response.Redirect("~/Login.aspx"); } else if (Context.Session["profileFriendID"] != Context.Session["memberID"] && Context.Session["profileFriendID"] != null) { aFriend.MemberId = Context.Session["profileFriendID"].ToString(); aMember.MemberId = Context.Session["memberID"].ToString(); GenerateProfile(aFriend); #region BUILD PROFILE BUTTONS //Building profile buttons //To update status on form //===================================================================== FriendshipDAL.GetInvitationStatus(aMember, aFriend); List<Member_Friend> statusList = new List<Member_Friend>(); statusList = FriendshipDAL.GetInvitationStatus(aMember, aFriend); FriendshipDAL dal = new FriendshipDAL(); if (statusList.Count == 0) { btnProfile.Append("<a class='button big addfriend' id='addfriend' >Add as friend</a><br />"); } else { string InvitationStatus = statusList[0].InvitationStatus; //===================================================================== if (InvitationStatus == "Pending") { if (dal.MemberIsActaullyTheMember(aMember, aFriend) == 1) { btnProfile.Append("<a class='button big disabledBtn' id='requestPending' >Request Pending..</a><br />"); btnProfile.Append("<a class='button big ' id='blockfriend' >Block this Person</a><br />"); } else if (dal.FriendIsActaullyTheMember(aMember, aFriend) == 1) { btnProfile.Append("<a class='button big ' id='acceptRequest' >Accept Request</a><br />"); btnProfile.Append("<a class='button big ' id='blockfriend' >Block this Person</a><br />"); } } else if (InvitationStatus == "Ignored") { btnProfile.Append("<a class='button big ' id='Ignored' >Ignored</a><br />"); btnProfile.Append("<a class='button big ' id='blockfriend' >Block this Person</a><br />"); } else { //Accepted btnProfile.Append("<a class='button big ' id='reportfriend' >Report this Person</a><br />"); #region GET BLOCKED STATUS dal = new FriendshipDAL(); if (dal.MemberIsActaullyTheMember(aMember, aFriend) == 1) { List<Member_Friend> BlockedList = new List<Member_Friend>(); BlockedList = dal.GetFriendBlockedMemberStatus(aMember, aFriend); if (BlockedList.Count != 0) { if (BlockedList[0].FriendBlockedMember == false) { btnProfile.Append("<a class='button big ' id='sendMessage' >Send Message</a><br />"); //CHECK IF I BLOCKED THE FRIEND List<Member_Friend> IBlockedFriend = new List<Member_Friend>(); IBlockedFriend = dal.GetMemberBlockedFriendStatus(aFriend, aMember); if (IBlockedFriend.Count != 0) { if (IBlockedFriend[0].MemberBlockedFriend == false) { btnProfile.Append("<a class='button big ' id='blockfriend' >Block this Person</a><br />"); } else { btnProfile.Append("<a class='button big ' id='blockfriend' >Unblock this Person</a><br />"); } btnProfile.Append("<a class='button big removeFriend' id='addfriend'>Remove Friend</a><br />"); } } } } else if (dal.FriendIsActaullyTheMember(aMember, aFriend) == 1) { List<Member_Friend> BlockedList = new List<Member_Friend>(); BlockedList = dal.GetMemberBlockedFriendStatus(aMember, aFriend); if (BlockedList.Count != 0) { if (BlockedList[0].MemberBlockedFriend == false) { btnProfile.Append("<a class='button big ' id='sendMessage' >Send Message</a><br />"); //CHECK IF I BLOCKED THE FRIEND List<Member_Friend> IBlockedFriend = new List<Member_Friend>(); IBlockedFriend = dal.GetFriendBlockedMemberStatus(aFriend, aMember); if (IBlockedFriend.Count != 0) { if (IBlockedFriend[0].FriendBlockedMember == false) { btnProfile.Append("<a class='button big ' id='blockfriend' >Block this Person</a><br />"); } else { btnProfile.Append("<a class='button big ' id='blockfriend' >Unblock this Person</a><br />"); } btnProfile.Append("<a class='button big removeFriend' id='addfriend'>Remove Friend</a><br />"); } } } } //btnProfile.Append("<a class='button big ' id='blockfriend' >Block this Person</a><br />"); // <a class="button big " id="reportfriend" >Report this Person</a><br /> // <a class="button big " id="blockfriend" >Block this Person</a> #endregion } } profileButtons = btnProfile.ToString(); #endregion } else { aMember.MemberId = Context.Session["memberID"].ToString(); GenerateProfile(aMember); } }//END IF ITS NOT POSTBACK else if (profileFriendID.Value != "") { #region REDIRECT TO CLICKED PROFILE //REDIRECT TO CLICKED PROFILE=================================================================== if (profileFriendID.Value != null) { Session["profileFriendID"] = profileFriendID.Value; profileFriendID.Value = null; Response.Redirect("~/Profile.aspx"); } //============================================================================================= #endregion } else if (GoToGroupPageID.Value != "") { Session["GroupInfo"] = GoToGroupPageID.Value; Response.Redirect("~/Group.aspx"); } if (Context.Session["profileFriendID"] != Context.Session["memberID"] && Context.Session["profileFriendID"] != null) { heading = aFriend.FirstName + " " + aFriend.LastName; } else { heading = aMember.FirstName + " " + aMember.LastName; } profileName.Value = heading; }
public bool GetMemberStatus(Member_Status member_Status) { using (SqlConnection con = new SqlConnection(ConnectionString)) { SqlCommand cmd = new SqlCommand("uspGetMemberStatus", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@MemberID", member_Status.MemberId); try { con.Open(); SqlDataReader dbReader = cmd.ExecuteReader(); bool isBlocked = false; while (dbReader.Read()) { if (int.Parse(dbReader["StatusID"].ToString()) == 1) { isBlocked = false; } else { isBlocked = true; } } return isBlocked; } catch (Exception e) { e.Message.ToString(); HttpContext.Current.Response.Redirect("~/Error_Pages/503.htm"); return false; } } }
protected void Page_Load(object sender, EventArgs e) { //To use for notifications SessionMemberID.Value = Session["memberID"].ToString(); year = now.Year; if (Session["stayEx"] != null ) { if (Session["stayEx"].ToString() == "expanded") { StayExpanded.Value = "expanded"; } } if (StayExpanded.Value == "expanded") { Session["stayEx"] = "expanded"; } else { Session["stayEx"] = ""; } MessagesDAL member = new MessagesDAL(); if (!IsPostBack) { if (Session["memberID"] == null) { Response.Redirect("~/Login.aspx"); } else if (loginDAL.GetMemberStatus(member_Status = new Member_Status(Session["memberID"].ToString()))) { if (Request.Cookies["login"] != null) { var c = new HttpCookie("login"); c.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(c); Session.Abandon(); } Response.Redirect("~/Login.aspx"); } defaultEmailAddress = SSTCryptographer.Decrypt(Session["memberID"].ToString())+"@live.nmmu.ac.za"; }//END MAIN if LOADING FOR THE FIRST TIME else if (profileFriendID.Value != "") { #region REDIRECT TO CLICKED PROFILE //REDIRECT TO CLICKED PROFILE=================================================================== if (profileFriendID.Value != null) { Session["profileFriendID"] = profileFriendID.Value; profileFriendID.Value = null; Response.Redirect("~/Profile.aspx"); } //============================================================================================= #endregion } else if (GoToGroupPageID.Value != "") { Session["GroupInfo"] = GoToGroupPageID.Value; Response.Redirect("~/Group.aspx"); } else if (SelectedMessageID.Value != "") { Session["selectedMessageID"] = SelectedMessageID.Value; Response.Redirect("~/ViewMessages.aspx"); } if (Session["memberID"] == null) { Response.Redirect("~/Login.aspx"); } else { string memberId = Context.Session["memberID"].ToString(); thisMemberID.Value = memberId; aMember.MemberId = memberId; #region GO ONLINE MemberInfoDAL memberInfoDAL = new MemberInfoDAL(); memberInfoDAL.UpdateToOnline(aMember); #endregion #region MAIN ACTUAL DISPLAY NAME memberInfoDAL = new MemberInfoDAL(); aMember = memberInfoDAL.GetActualDisplayName(aMember); actualMemberDisplayName = aMember.DisplayName; #endregion #region RIGHT COLUMN GET 5 JOINEDGROUPS //JOINED GROUPS============================================================================== Reusable_Methods reusable_Methods = new Reusable_Methods(aMember); allgroups = reusable_Methods.RightColumnGet5JoinedGroups(); //=========================================================================================== #endregion #region RIGHT COLUMN FRIENDS ONLINE //FRIENDS ONLINE============================================================================== memberId = Context.Session["memberID"].ToString(); aMember.MemberId = memberId; reusable_Methods = new Reusable_Methods(aMember); FriendsOnlineString = reusable_Methods.RightColumnGetFriendsOnline(); //=========================================================================================== #endregion #region NOTIFICATIONS NotificationsString = reusable_Methods.RightColumnNotifications(); #endregion } }
protected void Page_Load(object sender, EventArgs e) { //To use for notifications SessionMemberID.Value = Session["memberID"].ToString(); year = now.Year; if (Session["stayEx"] != null) { if (Session["stayEx"].ToString() == "expanded") { StayExpanded.Value = "expanded"; } } if (StayExpanded.Value == "expanded") { Session["stayEx"] = "expanded"; } else { Session["stayEx"] = ""; } MessagesDAL member = new MessagesDAL(); if (!IsPostBack) { if (Session["memberID"] == null) { Response.Redirect("~/Login.aspx"); } else if (loginDAL.GetMemberStatus(member_Status = new Member_Status(Session["memberID"].ToString()))) { if (Request.Cookies["login"] != null) { var c = new HttpCookie("login"); c.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(c); Session.Abandon(); } Response.Redirect("~/Login.aspx"); } defaultEmailAddress = SSTCryptographer.Decrypt(Session["memberID"].ToString()) + "@live.nmmu.ac.za"; }//END MAIN if LOADING FOR THE FIRST TIME else if (profileFriendID.Value != "") { #region REDIRECT TO CLICKED PROFILE //REDIRECT TO CLICKED PROFILE=================================================================== if (profileFriendID.Value != null) { Session["profileFriendID"] = profileFriendID.Value; profileFriendID.Value = null; Response.Redirect("~/Profile.aspx"); } //============================================================================================= #endregion } else if (GoToGroupPageID.Value != "") { Session["GroupInfo"] = GoToGroupPageID.Value; Response.Redirect("~/Group.aspx"); } else if (SelectedMessageID.Value != "") { Session["selectedMessageID"] = SelectedMessageID.Value; Response.Redirect("~/ViewMessages.aspx"); } if (Session["memberID"] == null) { Response.Redirect("~/Login.aspx"); } else { string memberId = Context.Session["memberID"].ToString(); thisMemberID.Value = memberId; aMember.MemberId = memberId; #region GO ONLINE MemberInfoDAL memberInfoDAL = new MemberInfoDAL(); memberInfoDAL.UpdateToOnline(aMember); #endregion #region MAIN ACTUAL DISPLAY NAME memberInfoDAL = new MemberInfoDAL(); aMember = memberInfoDAL.GetActualDisplayName(aMember); actualMemberDisplayName = aMember.DisplayName; #endregion #region RIGHT COLUMN GET 5 JOINEDGROUPS //JOINED GROUPS============================================================================== Reusable_Methods reusable_Methods = new Reusable_Methods(aMember); allgroups = reusable_Methods.RightColumnGet5JoinedGroups(); //=========================================================================================== #endregion #region RIGHT COLUMN FRIENDS ONLINE //FRIENDS ONLINE============================================================================== memberId = Context.Session["memberID"].ToString(); aMember.MemberId = memberId; reusable_Methods = new Reusable_Methods(aMember); FriendsOnlineString = reusable_Methods.RightColumnGetFriendsOnline(); //=========================================================================================== #endregion #region NOTIFICATIONS NotificationsString = reusable_Methods.RightColumnNotifications(); #endregion } }//END PAGE_LOAD