Пример #1
0
        private void buttonDeleteDerdataRelationInfo_Click(object sender, EventArgs e)
        {
            int         count            = dataGridView1.Rows.Count;
            AutoService autoTotalService = new AutoService();

            try
            {
                for (int i = 0; i < count; i++)
                {
                    string Id;
                    DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)dataGridView1.Rows[i].Cells[0];
                    Boolean flag = Convert.ToBoolean(checkCell.Value);

                    if (flag == true)
                    {
                        ///赋值
                        Id = this.dataGridView1.Rows[i].Cells[1].Value.ToString();

                        bool deleteResult = autoTotalService.ServiceDeleteDerdataRelationInfo(Id);

                        if (deleteResult == true)
                        {
                            MessageBox.Show("删除成功");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }