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)) { pbll.Add_Pramas(PramasName); int pramasid = pbll.Get_PramasId(PramasName); 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 = pramasid; IntroducerList.Add(IntroducerInfo); } } if (ibll.Add_Introducerinfo(IntroducerList)) { if (MyPreParamSelectionDataBindEvents != null) { MyPreParamSelectionDataBindEvents(); } MessageBox.Show("添加成功!"); this.Close(); } } }