コード例 #1
0
ファイル: Comment.xaml.cs プロジェクト: CloudEDU/Courstore
        /// <summary>
        /// Invoked when Add Comment button clicked and add comment.
        /// </summary>
        /// <param name="sender">The Add Comment button clicked.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void AddCommentButton_Click(object sender, RoutedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(newTitleTextBox.Text);
            if (newTitleTextBox.Text == "" || newContentTextBox.Text == "" || newTitleTextBox.Text.Trim() == "Title")
            {
                WarningTextBlock.Visibility = Visibility.Visible;
                return;
            }


            COMMENT commentEntity = new COMMENT();

            commentEntity.COURSE_ID   = course.ID.Value;
            commentEntity.CUSTOMER_ID = Constants.User.ID;
            commentEntity.TITLE       = newTitleTextBox.Text;
            commentEntity.RATE        = globalRate;
            commentEntity.TIME        = DateTime.Now;
            commentEntity.CONTENT     = newContentTextBox.Text;
            ctx.AddToCOMMENT(commentEntity);
            ctx.BeginSaveChanges(OnAddCommentComplete, null);
        }