Example #1
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();
                        }
                    }
                }
            }
        }