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