Ejemplo n.º 1
0
        public void ProcessRequest(HttpContext Context)
        {
            if (Context.Session["profileFriendID"] != null)
            {

                string memberId = Context.Request.QueryString["id"]; //get the querystring value that was pass on the ImageURL (see GridView MarkUp in Page1.aspx)
                memberId = SSTCryptographer.Encrypt(memberId);

                Member aMember = new Member(memberId);

                if (memberId != null)
                {
                    MemberInfoDAL dal = new MemberInfoDAL();
                    aMember = dal.GetAllMemberInfo(aMember);

                    MemoryStream ms = new MemoryStream();
                    aMember.ProfilePicture.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);

                    byte[] file = ms.ToArray();
                    ms.Write(file, 0, file.Length);
                    Context.Response.Buffer = true;
                    Context.Response.BinaryWrite(file);
                    ms.Dispose();
                }
                Context.Session["profileFriendID"] = Context.Session["memberID"].ToString();

            }
            else
            {
                string memberId = Context.Request.QueryString["id"]; //get the querystring value that was pass on the ImageURL (see GridView MarkUp in Page1.aspx)
                memberId = SSTCryptographer.Encrypt(memberId);

                Member aMember = new Member(memberId);

                if (memberId != null)
                {
                    MemberInfoDAL dal = new MemberInfoDAL();
                    aMember = dal.GetAllMemberInfo(aMember);

                    MemoryStream ms = new MemoryStream();
                    aMember.ProfilePicture.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);

                    byte[] file = ms.ToArray();
                    ms.Write(file, 0, file.Length);
                    Context.Response.Buffer = true;
                    Context.Response.BinaryWrite(file);
                    ms.Dispose();
                }

            }
        }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext Context)
        {
            if (Context.Session["profileFriendID"] != null)
            {
                string memberId = Context.Request.QueryString["id"]; //get the querystring value that was pass on the ImageURL (see GridView MarkUp in Page1.aspx)
                memberId = SSTCryptographer.Encrypt(memberId);


                Member aMember = new Member(memberId);

                if (memberId != null)
                {
                    MemberInfoDAL dal = new MemberInfoDAL();
                    aMember = dal.GetAllMemberInfo(aMember);

                    MemoryStream ms = new MemoryStream();
                    aMember.ProfilePicture.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);

                    byte[] file = ms.ToArray();
                    ms.Write(file, 0, file.Length);
                    Context.Response.Buffer = true;
                    Context.Response.BinaryWrite(file);
                    ms.Dispose();
                }
                Context.Session["profileFriendID"] = Context.Session["memberID"].ToString();
            }
            else
            {
                string memberId = Context.Request.QueryString["id"]; //get the querystring value that was pass on the ImageURL (see GridView MarkUp in Page1.aspx)
                memberId = SSTCryptographer.Encrypt(memberId);


                Member aMember = new Member(memberId);

                if (memberId != null)
                {
                    MemberInfoDAL dal = new MemberInfoDAL();
                    aMember = dal.GetAllMemberInfo(aMember);

                    MemoryStream ms = new MemoryStream();
                    aMember.ProfilePicture.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);

                    byte[] file = ms.ToArray();
                    ms.Write(file, 0, file.Length);
                    Context.Response.Buffer = true;
                    Context.Response.BinaryWrite(file);
                    ms.Dispose();
                }
            }
        }
Ejemplo n.º 3
0
        protected void btnLogout_Click(object sender, EventArgs e)
        {
            //GO OFFLINE
            aMember.MemberId = Context.Session["memberID"].ToString();
            MemberInfoDAL memberInfoDAL = new MemberInfoDAL();

            memberInfoDAL.UpdateToOffline(aMember);

            Session["memberID"] = null;

            if (Request.Cookies["login"] != null)
            {
                var c = new HttpCookie("login");
                c.Expires = DateTime.Now.AddDays(-1);
                Response.Cookies.Add(c);
                Session.Abandon();
                Session.Contents.RemoveAll();
            }

            Response.Redirect("~/Login.aspx");
        }
Ejemplo n.º 4
0
        protected void btnLogout_Click(object sender, EventArgs e)
        {
            //GO OFFLINE
            aMember.MemberId = Context.Session["memberID"].ToString();
            MemberInfoDAL memberInfoDAL = new MemberInfoDAL();
            memberInfoDAL.UpdateToOffline(aMember);

            Session["memberID"] = null;

            if (Request.Cookies["login"] != null)
            {
                var c = new HttpCookie("login");
                c.Expires = DateTime.Now.AddDays(-1);
                Response.Cookies.Add(c);
                Session.Abandon();
                Session.Contents.RemoveAll();

            }

            Response.Redirect("~/Login.aspx");
        }
Ejemplo n.º 5
0
        private void GenerateProfile(Member aMember)
        {
            #region RIGHT COLUMN GET ALL JOINED GROUPS

            //JOINED GROUPS==============================================================================

            Reusable_Methods reusable_Methods = new Reusable_Methods(aMember);

            allgroups = reusable_Methods.RightColumnGetAllJoinedGroups();
            //============================================================================================
            #endregion

            #region RIGHT COLUMN MEMBER INFORMATION
            //MEMBER INFORMATION ON RIGHT COLUMN==========================================================================

            //MEMBER INFO AND PROFILE



            MemberInfoDAL dal = new MemberInfoDAL();


            //  Member member = new Member();
            aMember = dal.GetAllMemberInfo(aMember);

            profilesMemnerID.Value = aMember.MemberId;



            //Set the ImageUrl to the path of the handler with the querystring value
            ProfileImage.ImageUrl = "ProfilePicHandler.ashx?id=" + SSTCryptographer.Decrypt(aMember.MemberId);
            //call the method to get the image information and display it in Label Control


            //=======================================================================================================
            #endregion

            #region MAIN COLUMN MEMBER INFORMATION
            //MEMBER INFORMATION ON MAIN DISPLAY==========================================================================
            StringBuilder memberData = new StringBuilder();

            memberData.Append("<tr><td style='font-weight: bold;' > ");
            memberData.Append("First Name:</td><td>");
            memberData.Append(aMember.FirstName);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;'>");

            memberData.Append("Last Name:</td><td>");
            memberData.Append(aMember.LastName);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > ");

            memberData.Append("Display Name:</td><td>");
            memberData.Append(aMember.DisplayName);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > ");

            memberData.Append("Email:</td><td>");
            memberData.Append(aMember.Email);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > ");

            memberData.Append("Description:</td><td>");
            memberData.Append(aMember.Description);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > ");

            memberData.Append("Campus:</td><td>");
            memberData.Append(aMember.Campus);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > ");

            memberData.Append("Account Type:</td><td>");
            memberData.Append(aMember.MemberType);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > ");


            if (aMember.IsOnline == false)
            {
                memberData.Append("Online Status:</td><td style='color:red;'>");
                memberData.Append("Offline");
                memberData.Append("</td></tr>");
            }
            else
            {
                memberData.Append("Online Status:</td><td style='color:green;'>");
                memberData.Append("Online");
                memberData.Append("</td></tr>");
            }

            memberDataMain = memberData.ToString();


            #endregion

            #region MAIN COLUMN MOST RECENT POST DATE
            //MOST RECENT POST DATE ON MAIN DISPLAY==========================================================================
            NotificationDAL notificationDAL = new NotificationDAL();

            StringBuilder recentPostDate = new StringBuilder();
            Post          aPost          = new Post();
            aPost = notificationDAL.GetMostRecentPostDate(aMember);


            if (aPost.CreateDate == DateTime.Parse("1/1/0001 12:00:00 AM"))
            {
                reusable_Methods = new Reusable_Methods();
                string date = reusable_Methods.FormatDateTime(aPost.CreateDate);



                recentPostDate.Append("<p style='font-size: 1.2em; color: #A3ADB5;'>Most recent post date<span style='color: #0e93be;'> - ");
                recentPostDate.Append("No posts");
                recentPostDate.Append("</span></p>");

                mostRecentPostDate = recentPostDate.ToString();
            }
            else
            {
                reusable_Methods = new Reusable_Methods();
                string date = reusable_Methods.FormatDateTime(aPost.CreateDate);



                recentPostDate.Append("<p style='font-size: 1.2em; color: #A3ADB5;'>Most recent post date<span style='color: #0e93be;'> - ");
                recentPostDate.Append(date);
                recentPostDate.Append("</span></p>");

                mostRecentPostDate = recentPostDate.ToString();
            }
            #endregion

            #region MAIN ACTUAL DISPLAY NAME
            MemberInfoDAL memberInfoDAL = new MemberInfoDAL();
            Member        actualMember  = new Member(Context.Session["memberID"].ToString());
            aMember = memberInfoDAL.GetActualDisplayName(actualMember);

            actualMemberDisplayName = aMember.DisplayName;
            #endregion
        }
Ejemplo n.º 6
0
        private void GenerateProfile(Member aMember)
        {
            #region RIGHT COLUMN GET ALL JOINED GROUPS

            //JOINED GROUPS==============================================================================

            Reusable_Methods reusable_Methods = new Reusable_Methods(aMember);

            allgroups = reusable_Methods.RightColumnGetAllJoinedGroups();
            //============================================================================================
            #endregion

            #region RIGHT COLUMN MEMBER INFORMATION
            //MEMBER INFORMATION ON RIGHT COLUMN==========================================================================

            //MEMBER INFO AND PROFILE

            MemberInfoDAL dal = new MemberInfoDAL();

            //  Member member = new Member();
            aMember = dal.GetAllMemberInfo(aMember);

            profilesMemnerID.Value = aMember.MemberId;

            //Set the ImageUrl to the path of the handler with the querystring value
            ProfileImage.ImageUrl = "ProfilePicHandler.ashx?id=" + SSTCryptographer.Decrypt(aMember.MemberId);
            //call the method to get the image information and display it in Label Control

            //=======================================================================================================
            #endregion

            #region MAIN COLUMN MEMBER INFORMATION
            //MEMBER INFORMATION ON MAIN DISPLAY==========================================================================
            StringBuilder memberData = new StringBuilder();

            memberData.Append("<tr><td style='font-weight: bold;' > ");
            memberData.Append("First Name:</td><td>");
            memberData.Append(aMember.FirstName);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;'>");

            memberData.Append("Last Name:</td><td>");
            memberData.Append(aMember.LastName);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > ");

            memberData.Append("Display Name:</td><td>");
            memberData.Append(aMember.DisplayName);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > ");

            memberData.Append("Email:</td><td>");
            memberData.Append(aMember.Email);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > ");

            memberData.Append("Description:</td><td>");
            memberData.Append(aMember.Description);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > ");

            memberData.Append("Campus:</td><td>");
            memberData.Append(aMember.Campus);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > ");

            memberData.Append("Account Type:</td><td>");
            memberData.Append(aMember.MemberType);
            memberData.Append("</td></tr> <tr><td style='font-weight: bold;' > ");

            if (aMember.IsOnline == false)
            {
                memberData.Append("Online Status:</td><td style='color:red;'>");
                memberData.Append("Offline");
                memberData.Append("</td></tr>");

            }
            else
            {
                memberData.Append("Online Status:</td><td style='color:green;'>");
                memberData.Append("Online");
                memberData.Append("</td></tr>");

            }

            memberDataMain = memberData.ToString();

            #endregion

            #region MAIN COLUMN MOST RECENT POST DATE
            //MOST RECENT POST DATE ON MAIN DISPLAY==========================================================================
            NotificationDAL notificationDAL = new NotificationDAL();

            StringBuilder recentPostDate = new StringBuilder();
            Post aPost = new Post();
            aPost = notificationDAL.GetMostRecentPostDate(aMember);

            if (aPost.CreateDate == DateTime.Parse("1/1/0001 12:00:00 AM"))
            {
                reusable_Methods = new Reusable_Methods();
                string date = reusable_Methods.FormatDateTime(aPost.CreateDate);

                recentPostDate.Append("<p style='font-size: 1.2em; color: #A3ADB5;'>Most recent post date<span style='color: #0e93be;'> - ");
                recentPostDate.Append("No posts");
                recentPostDate.Append("</span></p>");

                mostRecentPostDate = recentPostDate.ToString();
            }
            else
            {
                reusable_Methods = new Reusable_Methods();
                string date = reusable_Methods.FormatDateTime(aPost.CreateDate);

                recentPostDate.Append("<p style='font-size: 1.2em; color: #A3ADB5;'>Most recent post date<span style='color: #0e93be;'> - ");
                recentPostDate.Append(date);
                recentPostDate.Append("</span></p>");

                mostRecentPostDate = recentPostDate.ToString();
            }
            #endregion

            #region MAIN ACTUAL DISPLAY NAME
            MemberInfoDAL memberInfoDAL = new MemberInfoDAL();
            Member actualMember = new Member(Context.Session["memberID"].ToString());
            aMember = memberInfoDAL.GetActualDisplayName(actualMember);

            actualMemberDisplayName = aMember.DisplayName;
            #endregion
        }
Ejemplo n.º 7
0
        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

            }
        }
Ejemplo n.º 8
0
        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