private void btnAddCollectionToObject_Click(object sender, EventArgs e) { if (Control.currentUser.Collections.ToList().Count == 0) { Control.Exclamation("Вы еще ни создали ни одной коллекции.", "Список коллекций объекта"); return; } try { int id = Control.FindID(dgvExistingCollections); if (!Control.tempCollections.Exists(x => x.Id == id)) { Control.tempCollections.Add(Control.container.Collections.Find(id)); } else { MessageBox.Show(string.Format("Объект уже назначен коллекции \"{0}\".", id), "Список коллекций объекта", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } CompleteForm.dgvObjectCollections(this); } catch (Exception) { MessageBox.Show("Выберите коллекцию, чтобы добавить в нее объект.", "Список коллекций объекта", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void btnDeleteCollectionsFromObject_Click(object sender, EventArgs e) { if (Control.tempCollections.Count == 0) { Control.Exclamation("Объект не содержит ни одной коллекции.", "Список коллекций объекта"); return; } Control.tempCollections.Clear(); CompleteForm.dgvObjectCollections(this); }
private void btnAddAllCollectionsToObject_Click(object sender, EventArgs e) { if (Control.tempCollections.Count == Control.currentUser.Collections.ToList().Count) { Control.Exclamation("К объекту уже добавлены все коллекции.", "Список коллекций объекта"); return; } Control.tempCollections = Control.currentUser.Collections.ToList(); CompleteForm.dgvObjectCollections(this); }
private void CreatingObjectForm_Load(object sender, EventArgs e) { Control.tempUsers.Clear(); Control.tempUsers.Add(Control.currentUser); CompleteForm.dgvExistingUsers(this); CompleteForm.dgvExistingCollections(this); CompleteForm.dgvExistingCategories(this); CompleteForm.dgvObjectUsers(this); CompleteForm.dgvObjectCollections(this); CompleteForm.dgvObjectCategories(this); }
private void btnDeleteCollectionFromObject_Click(object sender, EventArgs e) { if (Control.tempCollections.Count == 0) { Control.Exclamation("Объект не содержит ни одной коллекции.", "Список коллекций объекта"); return; } try { int id = Control.FindID(dgvObjectCollections); Control.tempCollections.Remove(Control.container.Collections.Find(id)); CompleteForm.dgvObjectCollections(this); } catch (Exception) { Control.Exclamation("Выберите коллекцию, чтобы удалить ее из списка коллекций объекта.", "Список коллекций объекта"); } }
private void EditObjectForm_Load(object sender, EventArgs e) { tbObjectName.Text = Control.currentObject.Name; tbObjectDescription.Text = Control.currentObject.Description; lblFilename.Text = Control.currentObject.File.Name; pbOverview.BackgroundImage = Image.FromFile(Control.currentObject.File.Name); CompleteForm.dgvExistingUsers(this); CompleteForm.dgvExistingCollections(this); CompleteForm.dgvExistingCategories(this); Control.tempUsers = Control.currentObject.Users.ToList(); Control.tempCategories = Control.currentObject.Categories.ToList(); Control.tempCollections = Control.currentObject.Collections.ToList(); CompleteForm.dgvObjectUsers(this); CompleteForm.dgvObjectCollections(this); CompleteForm.dgvObjectCategories(this); }