protected void GridViewDic_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridViewDic.PageIndex = e.NewPageIndex; if (tbKeyWord.Text.Trim().Equals("")) { bind(lbType.Text); } else { string strwhere = " like "; string strcondition = ddlSType.SelectedValue; if (strcondition == "0") { strwhere = " Code " + strwhere; } else { strwhere = " Name " + strwhere; } strwhere = strwhere + " '%" + tbKeyWord.Text.Trim() + "%' "; LabMS.BLL.Dictionary dic = new LabMS.BLL.Dictionary(); strwhere += " and DClass = '" + lbType.Text + "' " + " order by ID desc "; List<LabMS.Model.Dictionary> listDic = dic.GetModelList(strwhere); GridViewDic.DataSource = listDic; GridViewDic.DataBind(); } }
//�������ֵ� ����List protected List<LabMS.Model.Dictionary> DictionaryDropdownlist(string code) { string strwhere = "DClass='" + code + "'"; LabMS.BLL.Dictionary dic = new LabMS.BLL.Dictionary(); List<LabMS.Model.Dictionary> list = new List<LabMS.Model.Dictionary>(); list = dic.GetModelList(strwhere); return list; }
protected void btnSearch_Click(object sender, EventArgs e) { string strwhere = " like "; string strcondition = ddlSType.SelectedValue; if (strcondition == "0") { strwhere = " Code " + strwhere; } else { strwhere = " Name " + strwhere; } strwhere = strwhere + " '%" + tbKeyWord.Text.Trim() + "%' "; LabMS.BLL.Dictionary dic = new LabMS.BLL.Dictionary(); strwhere += " and DClass = '" + lbType.Text + "' " + " order by ID desc "; List<LabMS.Model.Dictionary> listDic = dic.GetModelList(strwhere); GridViewDic.DataSource = listDic; GridViewDic.DataBind(); }
/// <summary> /// 在新增项时检查Code是否存在 /// </summary> /// <param name="DClass"></param> /// <param name="Code"></param> /// <returns></returns> public int IsCodeExist(string DClass, string Code) { string str = "DClass='" + DClass + "' and Code='"+Code+"'"; LabMS.BLL.Dictionary BD = new LabMS.BLL.Dictionary(); List<LabMS.Model.Dictionary> list = new List<LabMS.Model.Dictionary>(); list=BD.GetModelList(str); if (list.Count > 0) { //已经存在 return 0; } else { //不存在 return 1; } }
/// <summary> /// 根据ID获得字典表中其它项的内容 /// </summary> public List<LabMS.Model.Dictionary> GetListByID(long ID) { string str = "ID="+ID; LabMS.BLL.Dictionary BD = new LabMS.BLL.Dictionary(); List<LabMS.Model.Dictionary> list = new List<LabMS.Model.Dictionary>(); list=BD.GetModelList(str); return list; }
public List<LabMS.Model.Dictionary> GetItemListByDClass(string DClass) { string StrWhere = ""; List<LabMS.Model.Dictionary> listCClass = new List<LabMS.Model.Dictionary>(); LabMS.BLL.Dictionary bDictionary = new LabMS.BLL.Dictionary(); if (!DClass.Equals(string.Empty)) { StrWhere = "DClass = '" + DClass + "' "; } else { return null; } try { listCClass = bDictionary.GetModelList(StrWhere); } catch(Exception ex) { throw(new Exception("数据库链接错误")); } return listCClass; }