コード例 #1
0
        protected void UploadButton_Click(object sender, EventArgs e)
        {
            if (Page.IsValid == true)
            {
                Photo photo = new Photo();

                string path = "~/uploads/" + Membership.GetUser().ProviderUserKey.ToString();

                bool IsUpload = photo.DocumentUpload(DocumentUpload, path, photo);

                if (IsUpload == true)
                {
                    comment.CommentText   = DocumentUploadComment.Text.Trim();
                    comment.CreatedBy     = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());
                    comment.ContextTypeId = (int)Enums.ContextType.Student;
                    comment.CommentTypeId = (int)Enums.CommentType.Document;
                    comment.FilePath      = photo.FilePath;
                    comment.RatingValue   = 0;

                    save(comment);
                    string AccessCode = Utility.GetQueryStringValueByKey(Request, "AccessCode");
                    Response.Redirect("~/Student/Student_Public_Profile.aspx?AccessCode=" + AccessCode);
                }
            }
        }