Example #1
0
        /// <summary>
        /// 删除参数及相关信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tspPreParamSelDel_Click(object sender, EventArgs e)
        {
            List <int> PramasIdList = new List <int>();

            foreach (DataGridViewRow row in dgvPreParamSelection.Rows)
            {
                DataGridViewCheckBoxCell checkbox = (DataGridViewCheckBoxCell)row.Cells[0];
                if (checkbox.Value == null)
                {
                    checkbox.Value = 0;
                }
                if ((int)checkbox.Value == 1)
                {
                    if ((int)row.Cells["Type"].Value == 0)
                    {
                        MessageBox.Show("选项中有系统参数,无法删除!");
                        return;
                    }
                    else
                    {
                        PramasIdList.Add(Convert.ToInt32(row.Cells["PramasID"].Value));
                    }
                }
            }
            if (PramasIdList.Count > 0)
            {
                PramasBLL     pbll = new PramasBLL();
                IntroducerBLL ibll = new IntroducerBLL();
                if (pbll.Del_PramasById(PramasIdList))
                {
                    ibll.Del_IntroducerByPramasID(PramasIdList);
                    MessageBox.Show("删除成功!");
                    PreParamSelectionDataBind();
                }
            }
            else
            {
                MessageBox.Show("请选择要删除的参数信息!");
            }
        }