コード例 #1
0
        private void CollectionInfoForm_Load(object sender, EventArgs e)
        {
            lblCollectionName.Text        = Control.currentCollection.Name;
            lblCollectionDescription.Text = Control.currentCollection.Description;
            lblCreatingDate.Text          = Control.currentCollection.CreatingDate.ToShortDateString();
            lblAverageMark.Text           = Control.currentCollection.AverageMark.ToString();
            cbMark.SelectedIndex          = 4;

            CompleteForm.dgvCollectionComments(this);
            CompleteForm.dgvCollectionCreators(this);
            CompleteForm.dgvCollectionObjects(this);
            CompleteForm.dgvCollectionCategories(this);
            CompleteForm.dgvCollectionMarks(this);
        }
コード例 #2
0
        private void btnAddComment_Click(object sender, EventArgs e)
        {
            if (tbCommentDescription.Text.Length == 0)
            {
                Control.Exclamation("Поле с описанием комментария не заполнено.", "Комментарий");
                return;
            }

            Comment newComment = new Comment();

            newComment.Title       = tbCommentTitle.Text;
            newComment.Description = tbCommentDescription.Text;
            newComment.Date        = DateTime.Now.Date;
            newComment.User        = Control.currentUser;
            newComment.Collection  = Control.currentCollection;

            Control.container.Comments.Add(newComment);
            Control.container.SaveChanges();

            tbCommentTitle.Clear();
            tbCommentDescription.Clear();

            CompleteForm.dgvCollectionComments(this);
        }