private void ObjectInfoForm_Load(object sender, EventArgs e) { lblObjectName.Text = Control.currentObject.Name; lblObjectDescription.Text = Control.currentObject.Description; lblFile.Text = Control.currentObject.File.Name; lblCreatingDate.Text = Control.currentObject.CreatingDate.ToShortDateString(); lblAverageMark.Text = Control.currentObject.AvarageMark.ToString(); cbMark.SelectedIndex = 4; CompleteForm.dgvObjectComments(this); CompleteForm.dgvAuthors(this); CompleteForm.dgvCollections(this); CompleteForm.dgvCategories(this); CompleteForm.dgvMarks(this); }
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.Object = Control.currentObject; Control.container.Comments.Add(newComment); Control.container.SaveChanges(); tbCommentTitle.Clear(); tbCommentDescription.Clear(); CompleteForm.dgvObjectComments(this); }