Esempio n. 1
0
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Вы действительно желаете удалить узел <" + _knotName + ">", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         DataMethods.DeleteKnot(_knotId);
         RefreshTable();
     }
 }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
 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);
     }
 }
Esempio n. 5
0
        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();
            }
        }
Esempio n. 6
0
 private void textBoxSearch_TextChanged(object sender, EventArgs e)
 {
     dataGridViewKnots.DataSource = DataMethods.SearchKnots(textBoxSearch.Text);
 }
Esempio n. 7
0
 private void RefreshTable()
 {
     dataGridViewKnots.DataSource = DataMethods.GetKnots();
 }
Esempio n. 8
0
 private void Main_FormClosed(object sender, FormClosedEventArgs e)
 {
     DataMethods.DisposeDB();
 }