private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show("Вы действительно желаете удалить узел <" + _knotName + ">", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { DataMethods.DeleteKnot(_knotId); RefreshTable(); } }
private void Guide_Load(object sender, EventArgs e) { pictureBoxGuide.SizeMode = PictureBoxSizeMode.StretchImage; StructGuide structGuide = DataMethods.GetGuide(_knotID); pictureBoxGuide.Image = ImageMethods.BinaryToImage(structGuide.guideBinary); richTextBoxGuide.Text = structGuide.guideComment; structGuide.guideBinary = _guideBinary; }
public KnotEdit(int knotId) { InitializeComponent(); _update = true; _knotId = knotId; StructGuideKnot structGuideKnot = DataMethods.GetKnot(_knotId); _knotName = structGuideKnot.knotName; _knotComment = structGuideKnot.knotComment; _guideComment = structGuideKnot.guideComment; _knotBinary = structGuideKnot.knotBinary; _guideBinary = structGuideKnot.guideBinary; _typeName = structGuideKnot.typeName; }
private void buttonEdit_Click(object sender, EventArgs e) { if (textBoxName.Text != "" && pictureBoxKnot.Image != null && comboBoxTypes.Text != "") { if (_update == true) { DataMethods.UpdateKnot(_knotId, textBoxName.Text, richTextBoxKnot.Text, _knotBinary, richTextBoxGuide.Text, _guideBinary, (int)comboBoxTypes.SelectedValue); } else { DataMethods.InsertKnot(textBoxName.Text, richTextBoxKnot.Text, _knotBinary, richTextBoxGuide.Text, _guideBinary, (int)comboBoxTypes.SelectedValue); FillForms(); } } else { MessageBox.Show("Необходимо заполнить *обязательные поля.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FillForms() { comboBoxTypes.DataSource = DataMethods.GetTypes(); comboBoxTypes.DisplayMember = "name"; comboBoxTypes.ValueMember = "id"; if (_update == true) { Text = "Изменение"; buttonEdit.Text = "Изменить"; textBoxName.Text = _knotName; comboBoxTypes.Text = _typeName; richTextBoxKnot.Text = _knotComment; richTextBoxGuide.Text = _guideComment; pictureBoxKnot.Image = ImageMethods.BinaryToImage(_knotBinary); pictureBoxGuide.Image = ImageMethods.BinaryToImage(_guideBinary); } else { Text = "Добавление"; buttonEdit.Text = "Добавить"; CleanerForms(); } }
private void textBoxSearch_TextChanged(object sender, EventArgs e) { dataGridViewKnots.DataSource = DataMethods.SearchKnots(textBoxSearch.Text); }
private void RefreshTable() { dataGridViewKnots.DataSource = DataMethods.GetKnots(); }
private void Main_FormClosed(object sender, FormClosedEventArgs e) { DataMethods.DisposeDB(); }