コード例 #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            //MessageBox.Show(DatabaseManager.Instance.GetMaxId("mf_type", "id_mf_type").ToString());

            var formAdd = new TypeEdit(DatabaseManager.Instance.GetMaxId("mf_type", "id_mf_type") + 1, "", "", TypeEdit.InsertEnum.INSERT);

            formAdd.Owner = this;
            if (formAdd.ShowDialog() == DialogResult.OK)
            {
                //MessageBox.Show("OK");
            }
        }
コード例 #2
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (dataGridViewTypes.SelectedCells.Count > 0)
            {
                var i = dataGridViewTypes.SelectedCells[0].RowIndex;

                var formAdd = new TypeEdit(
                    Convert.ToInt64(dataGridViewTypes.Rows[i].Cells[0].Value),
                    Convert.ToString(dataGridViewTypes.Rows[i].Cells[1].Value),
                    Convert.ToString(dataGridViewTypes.Rows[i].Cells[2].Value),
                    TypeEdit.InsertEnum.UPDATE);
                formAdd.Owner = this;
                if (formAdd.ShowDialog() == DialogResult.OK)
                {
                    //MessageBox.Show("OK");
                }
            }
            else
            {
                MessageBox.Show("Ничего не выделено для редактирования!", "Объект не выделен", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }