private void BindText() { Units unit = new Units(); unit.Unit_id = Convert.ToInt32(id); UnitProvider provider = new UnitProvider(); DataTable table = new DataTable(); table = provider.Select(unit); this.txt_unit_name.Text = table.Rows[0]["unit_name"].ToString(); }
/// <summary> /// 绑定Units信息的数据源 /// </summary> private void BindSource(int start, string name) { if (name != null) { Units unit = new Units(); unit.Unit_name = name; UnitProvider provider = new UnitProvider(); DataTable table = provider.Select(unit, start, this.ListPager1.PageSize); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); } else { UnitProvider provider = new UnitProvider(); DataTable table = provider.GetAll(start, this.ListPager1.PageSize); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); } }
private int IsSame() { Units unit = new Units(); UnitProvider provider = new UnitProvider(); unit.Unit_name = this.txt_unit_name.Text; DataTable table = new DataTable(); table = provider.Select(unit); if (table.Rows.Count != 0) { this.Alert("该单位已经存在,请重新输入!!!"); return(1); } else { return(0); } }