public void SetInfo(List <int> PramasIDlist) { PramasBLL pbll = new PramasBLL(); IntroducerBLL ibll = new IntroducerBLL(); PramasIDList = PramasIDlist; Pramas PramasInfo = pbll.Get_PramasInfo(PramasIDlist[0]); txtPramasName.Text = PramasInfo.Name; List <Introducer> Introducerlist = ibll.Get_IntroducerList(PramasIDlist[0]); if (Introducerlist != null) { dgvIntroducer.Columns.Clear(); DataGridViewTextBoxColumn a = new DataGridViewTextBoxColumn(); a.HeaderText = "序号"; dgvIntroducer.Columns.Add(a); DataGridViewTextBoxColumn b = new DataGridViewTextBoxColumn(); b.HeaderText = "引导词"; dgvIntroducer.Columns.Add(b); DataGridViewTextBoxColumn c = new DataGridViewTextBoxColumn(); c.HeaderText = "偏离描述"; dgvIntroducer.Columns.Add(c); for (int i = 0; i < Introducerlist.Count; i++) { int index = this.dgvIntroducer.Rows.Add(); this.dgvIntroducer.Rows[index].Cells[0].Value = index + 1; this.dgvIntroducer.Rows[index].Cells[1].Value = Introducerlist[i].IntroducerText; this.dgvIntroducer.Rows[index].Cells[2].Value = ""; } } }
/// <summary> /// /// </summary> /// <param name="PramasID"></param> /// <returns></returns> public Pramas Get_PramasInfo(int PramasID) { string sql = " select* from tb_Pramas where PramasID=@PramasID"; Pramas pramas = null; using (SqlDataReader sdr = SqlHelper.ExecuteReader(sql, new SqlParameter("@PramasID", PramasID))) { if (sdr.Read()) { //一个Pramas类型记录一条参数类型表中的数据 pramas = new Pramas(); pramas.PramasID = sdr.GetInt32(0); pramas.Name = sdr.GetString(1); pramas.Type = sdr.GetInt32(2); } } return(pramas); }
public bool Update_Pramas(Pramas PramasInfo) { bool IsSuccess = false; string sql = "update tb_Pramas set PramasText=@PramasText,Type=@Type where PramasID=@PramasID"; SqlParameter[] spm = { new SqlParameter("@PramasText", SqlDbType.VarChar), new SqlParameter("@Type", SqlDbType.Int), new SqlParameter("@PramasID", SqlDbType.Int) }; spm[0].Value = PramasInfo.Name; spm[1].Value = 1; spm[2].Value = PramasInfo.PramasID; if (SqlHelper.ExecuteNonQuery(sql, spm) > 0) { IsSuccess = true; } return(IsSuccess); }
private void dataBind() { string sqlstr = ""; sqlstr += Session["query"].ToString(); LoginInfo login = (LoginInfo)Session["login"]; SearchPageSet sps = SearchPageSetManager.getSearchPageSetByLoginId(login.Id, 003); if (sps == null) { Data data = new Data(); DataSet ds = data.DataPage("Parameter", "Id", "*", sqlstr, "Id", true, 5, 5, pages); Pramas.DataSource = ds; Pramas.DataBind(); } else { Data data = new Data(); DataSet ds = data.DataPage("Parameter", "Id", "*", sqlstr, "Id", true, sps.Pageitem, sps.Pagecount, pages); Pramas.DataSource = ds; Pramas.DataBind(); } }
/// <summary> /// 根据项目名获取未选择的参数列表,读取 /// </summary> /// <param name="ProName">项目名</param> /// <param name="Pramas">List<Pramas>中的Pramas是HOZAPModel命名空间中的Pramas类,参数类</param>> /// <returns>参数列表</returns> public List <Pramas> Get_PramasList(string ProName) { string sql = " select* from tb_Pramas where PramasID not in(select PramasID from tb_SelectedPramas where ProName =@ProName)"; List <Pramas> PramasList = null; using (SqlDataReader sdr = SqlHelper.ExecuteReader(sql, new SqlParameter("@ProName", ProName))) { if (sdr.HasRows) { PramasList = new List <Pramas>(); while (sdr.Read()) { //一个Pramas类型记录一条参数类型表中的数据 Pramas pramas = new Pramas(); pramas.PramasID = sdr.GetInt32(0); pramas.Name = sdr.GetString(1); pramas.Type = sdr.GetInt32(2); PramasList.Add(pramas); } } } return(PramasList); }
public bool Update_Pramas(Pramas PramasInfo) { return(dal.Update_Pramas(PramasInfo)); }
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(); } } } } }