示例#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("请选择要删除的参数信息!");
            }
        }
示例#2
0
        private void btnSub_Click(object sender, EventArgs e)
        {
            PramasBLL     pbll = new PramasBLL();
            IntroducerBLL ibll = new IntroducerBLL();
            List <HOZAPModel.Introducer> IntroducerList = null;
            string PramasName = txtPramasName.Text.Trim();

            if (!string.IsNullOrEmpty(PramasName))
            {
                Pramas PramasInfo = new Pramas();
                PramasInfo.PramasID = PramasIDList[0];
                PramasInfo.Name     = PramasName;
                PramasInfo.Type     = 1;
                if (pbll.Update_Pramas(PramasInfo))
                {
                    if (dgvIntroducer.Rows.Count > 0)
                    {
                        IntroducerList = new List <HOZAPModel.Introducer>();
                        foreach (DataGridViewRow row in dgvIntroducer.Rows)
                        {
                            HOZAPModel.Introducer IntroducerInfo = new HOZAPModel.Introducer();
                            IntroducerInfo.IntroducerText = row.Cells[1].Value.ToString();
                            IntroducerInfo.PramasId       = PramasIDList[0];
                            IntroducerList.Add(IntroducerInfo);
                        }
                    }
                    if (IntroducerList != null)
                    {
                        if (ibll.Check_IntroducerByPramasID(PramasIDList[0]))
                        {
                            if (ibll.Del_IntroducerByPramasID(PramasIDList))
                            {
                                if (ibll.Add_Introducerinfo(IntroducerList))
                                {
                                    if (MyPreParamSelectionDataBindEvents != null)
                                    {
                                        MyPreParamSelectionDataBindEvents();
                                    }
                                    MessageBox.Show("更新成功!");
                                    this.Close();
                                }
                            }
                        }
                        else
                        {
                            if (ibll.Add_Introducerinfo(IntroducerList))
                            {
                                if (MyPreParamSelectionDataBindEvents != null)
                                {
                                    MyPreParamSelectionDataBindEvents();
                                }
                                MessageBox.Show("更新成功!");
                                this.Close();
                            }
                        }
                    }
                    else
                    {
                        if (ibll.Del_IntroducerByPramasID(PramasIDList))
                        {
                            if (MyPreParamSelectionDataBindEvents != null)
                            {
                                MyPreParamSelectionDataBindEvents();
                            }
                            MessageBox.Show("更新成功!");
                            this.Close();
                        }
                    }
                }
            }
        }