示例#1
0
文件: MainForm.cs 项目: kokorink/lawn
        private void dataGridViewServices_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;
            var indexItem  = 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 == "Изменить")
                {
                    services = GetIdService(indexItem);
                    AddServiceForm f = new AddServiceForm(services);
                    f.ShowDialog();
                    EditService(f.item);
                }

                else
                {
                    DeleteService(indexItem);
                }

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

            f.ShowDialog();
            AddService(f.item);

            var items = GetServices();

            dataGridViewServices.DataSource = items;
        }