示例#1
0
文件: MainForm.cs 项目: kokorink/lawn
        private void dataGridViewClients_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;
            var indexItem  = Convert.ToInt16(senderGrid.Rows[e.RowIndex].Cells[0].Value.ToString());

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                var but = (DataGridViewButtonColumn)senderGrid.Columns[e.ColumnIndex];
                if (but.Text == "Изменить")
                {
                    clients = GetIdClient(indexItem);
                    AddClientForm f = new AddClientForm(clients);
                    f.ShowDialog();
                    EditClient(f.item);
                }

                else
                {
                    DeleteClient(indexItem);
                }

                var items = GetClients();
                dataGridViewClients.DataSource = items;
            }
        }
示例#2
0
文件: MainForm.cs 项目: kokorink/lawn
        private void button2_Click(object sender, EventArgs e)
        {
            AddClientForm f = new AddClientForm();

            f.ShowDialog();
            AddClient(f.item);

            var items = GetClients();

            dataGridViewClients.DataSource = items;
        }