public void InitEveryThing() { this.findModels = new List <RecordsBaseInfoModel>(); this.bds = new BindingSource(); //string node = ConfigHelper.GetNode("orgCode"); //if (node.Length == 12) //{ // this.dt_user = new SysUserBLL().GetList(" VillageID = " + new SysOrgVillangBLL().GetModel(node).ID).Tables[0]; //} //else if (node.Length == 9) //{ // this.dt_user = new SysUserBLL().GetList(" TownID = " + new SysOrgTownBLL().GetModel(node).ID).Tables[0]; //} //else if (node.Length == 6) //{ // this.dt_user = new SysOrgDistrictBLL().GetList(" DistrictID = " + new SysOrgDistrictBLL().GetModel(node).ID).Tables[0]; //} //DataRow row = this.dt_user.NewRow(); //row.ItemArray = new object[] { -1, "ph", "不限" }; //this.dt_user.Rows.InsertAt(row, 0); //this.cbxUser.ValueMember = "ID"; //this.cbxUser.DisplayMember = "USERNAME"; //this.cbxUser.DataSource = this.dt_user; this.dt_user = new RecordsBaseInfoBLL().GetUserDt("").Tables[0]; if (this.dt_user.Rows.Count > 0) { DataRow row = this.dt_user.NewRow(); row.ItemArray = new object[] { "不限", 0, "" }; this.dt_user.Rows.InsertAt(row, 0); this.cbxUser.ValueMember = "ID"; this.cbxUser.DisplayMember = "CreateMenName"; this.cbxUser.DataSource = this.dt_user; } DataTable dt_Town = new RecordsCustomerBaseInfoBLL().GetTownList().Tables[0]; if (dt_Town.Rows.Count > 0) { DataRow row = dt_Town.NewRow(); row.ItemArray = new object[] { "不限" }; dt_Town.Rows.InsertAt(row, 0); this.cbxTown.DisplayMember = "TownName"; this.cbxTown.DataSource = dt_Town; } this.EveryThingIsOk = true; }
private void cbxTown_SelectedIndexChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(cbxTown.Text)) { string strwhere = string.Format("and TownName LIKE '%{0}%'", cbxTown.Text); DataTable dt_Village = new RecordsCustomerBaseInfoBLL().GetVillageList(strwhere).Tables[0]; if (dt_Village.Rows.Count > 0) { DataRow row = dt_Village.NewRow(); row.ItemArray = new object[] { "不限" }; dt_Village.Rows.InsertAt(row, 0); this.cbxVillage.DisplayMember = "VillageName"; this.cbxVillage.DataSource = dt_Village; } else { this.cbxVillage.DataSource = null; } } }