示例#1
0
        public void AddEventPost(string sessionMemberID, string startDate, string endDate, string name, string host, string venue, int groupID, string details, string type)
        {
            memberID = sessionMemberID;
            StringBuilder htmlText = new StringBuilder();
            Member        aMember  = new Member(memberID);

            Group aGroup = new Group(groupID);

            PostDAL postDAL = new PostDAL();

            Reusable_Methods reusable_Methods = new Reusable_Methods();

            /*
             * NEEDS ATTENTION !!!!!!!!!
             *
             *
             */

            DateTime startDateD = reusable_Methods.CreateDateTime(startDate);
            DateTime endDateD   = reusable_Methods.CreateDateTime(endDate);


            /*
             * END NEEDS ATTENTION !!!!!!!!!
             */

            //DateTime startDateD = reusable_Methods.FormatDateFromDateTimePicker(startDate);
            //  DateTime endDateD = reusable_Methods.FormatDateFromDateTimePicker(endDate);

            Event_Post aEvent_Post = new Event_Post(name, details, venue, startDateD, endDateD, host, type);
            int        postId      = postDAL.InsertEvent(aEvent_Post, aGroup, aMember);

            #region GET POST
            ArrayPosts = bl.GetASinglePost(postId);
            int count = ArrayPosts.Count;

            for (int i = 0; i < count; ++i)
            {
                OpenWrapper(i);

                #region EVENT POST
                GetEventPosts();
                #endregion

                CloseWrapper();
            }

            #endregion

            string postToClients = concatinater.ToString();

            //Updating all Clients
            Clients.insertEvent(Context.ConnectionId, postToClients, groupID);
        }
示例#2
0
        protected void SaveVideo(AjaxFileUploadEventArgs file)
        {
            byte[] videoBytes = file.GetContents();
            string fileName   = file.FileName.Split('\\').Last();

            Video_Post videoPost = new Video_Post();
            Group      g         = new Group();
            PostDAL    postDAl   = new PostDAL();

            aMember.MemberId = (string)Session["memberID"];
            g.GroupId        = int.Parse(ThisGroupsID.Value);

            videoPost.Video        = videoBytes;
            videoPost.VideoName    = fileName;
            videoPost.VideoSize    = file.FileSize;
            videoPost.VideoCaption = captionP;

            postDAl.InsertVideo(videoPost, g, aMember);
        }
示例#3
0
        protected void SaveFile(AjaxFileUploadEventArgs file)
        {
            byte[] fileBytes = file.GetContents();
            string fileName  = file.FileName.Split('\\').Last();

            File_Post filePost = new File_Post();
            Group     g        = new Group();
            PostDAL   postDAl  = new PostDAL();

            aMember.MemberId = (string)Session["memberID"];
            g.GroupId        = int.Parse(ThisGroupsID.Value);


            filePost.File     = fileBytes;
            filePost.FileName = fileName;
            filePost.FileSize = file.FileSize;

            filePost.FileCaption = captionP;

            postDAl.InsertFile(filePost, g, aMember);
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PostDAL postDAL = new PostDAL();
            if (!String.IsNullOrEmpty(Request.Form["fileID"].ToString()))
            {
                int FileID = int.Parse(Request.Form["fileID"].ToString());
                DataTable file = postDAL.GetAFile(FileID);

                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();
            }
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PostDAL postDAL = new PostDAL();

            if (!String.IsNullOrEmpty(Request.Form["fileID"].ToString()))
            {
                int       FileID = int.Parse(Request.Form["fileID"].ToString());
                DataTable file   = postDAL.GetAFile(FileID);

                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();
            }
        }
示例#6
0
        protected void SavePicture(AjaxFileUploadEventArgs file)
        {
            byte[] imageBytes = file.GetContents();
            string fileName   = file.FileName.Split('\\').Last();

            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 = (string)Session["memberID"];
            g.GroupId        = int.Parse(ThisGroupsID.Value);

            photoPost.Photo        = image;
            photoPost.PhotoName    = fileName;
            photoPost.PhotoCaption = captionP;
            postDAl.InsertPhoto(photoPost, g, aMember);
        }
示例#7
0
        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
示例#8
0
        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
            }
        }
示例#9
0
        public void AddEventPost(string sessionMemberID, string startDate, string endDate, string name, string host, string venue, int groupID, string details, string type)
        {
            memberID = sessionMemberID;
            StringBuilder htmlText = new StringBuilder();
            Member aMember = new Member(memberID);

            Group aGroup = new Group(groupID);

            PostDAL postDAL = new PostDAL();

            Reusable_Methods reusable_Methods = new Reusable_Methods();

             /*
              * NEEDS ATTENTION !!!!!!!!!
              *
              *
              */

            DateTime startDateD = reusable_Methods.CreateDateTime(startDate);
            DateTime endDateD = reusable_Methods.CreateDateTime(endDate);

              /*
            * END NEEDS ATTENTION !!!!!!!!!
            */

            //DateTime startDateD = reusable_Methods.FormatDateFromDateTimePicker(startDate);
              //  DateTime endDateD = reusable_Methods.FormatDateFromDateTimePicker(endDate);

            Event_Post aEvent_Post = new Event_Post(name, details, venue, startDateD, endDateD, host, type);
            int postId = postDAL.InsertEvent(aEvent_Post, aGroup, aMember);

            #region GET POST
            ArrayPosts = bl.GetASinglePost(postId);
            int count = ArrayPosts.Count;

            for (int i = 0; i < count; ++i)
            {

                OpenWrapper(i);

                #region EVENT POST
                GetEventPosts();
                #endregion

                CloseWrapper();

            }

            #endregion

             string postToClients = concatinater.ToString();

            //Updating all Clients
            Clients.insertEvent(Context.ConnectionId, postToClients, groupID);
        }
示例#10
0
        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
        }