/// <summary> /// /// </summary> /// <returns></returns> static private object GetOrganizationDataSource() { DataTable tbl = WaterUserDBI.GetWaterUserDataTable(); NameIDPairCollection c = NameIDPairFactory.Create(tbl, "WaterUserName", "WaterUserID"); return(c); }
static private object GetOrganizationDataSource(WaterUserClass waterUser) { //LoginSession ls = SessionManager.LoginSession; //DataTable tbl = WaterUserDBI.GetManagementOrganization(ls.WaterUser.WaterUserID, DataTable tbl = WaterUserDBI.GetManagementOrganization(waterUser.WaterUserID, waterUser.WaterUserLevel.LevelOrdinal); NameIDPairCollection c = NameIDPairFactory.Create(tbl, "WaterUserName", "WaterUserID"); return(c); }
/// <summary> /// /// </summary> /// <param name="tbl"></param> /// <param name="nameColumn"></param> /// <param name="idColumn"></param> /// <returns></returns> static public NameIDPairCollection Create(DataTable tbl, string nameColumn, string idColumn) { NameIDPairCollection c = new NameIDPairCollection(); foreach (DataRow row in tbl.Rows) { string name = row[nameColumn].ToString().Trim(); int id = Convert.ToInt32(row[idColumn]); NameIDPair n = new NameIDPair(name, id); c.Add(n); } return(c); }
/// <summary> /// /// </summary> private void BindDuringWater() { DataTable dwtbl = DuringWaterDBI.GetDuringDataTable(); NameIDPairCollection nameids = NameIDPairFactory.Create(dwtbl, YongShuiGuanLiDBI.DBNames.tblDuringWater.Name, YongShuiGuanLiDBI.DBNames.tblDuringWater.DuringWaterID); nameids.Insert(0, NameIDPair.ALL); this.ddlDuringWaterName.DataSource = nameids; this.ddlDuringWaterName.DataTextField = "Name"; this.ddlDuringWaterName.DataValueField = "ID"; this.ddlDuringWaterName.DataBind(); }
/// <summary> /// /// </summary> /// <returns></returns> static private object GetStationDataSource(int orgaizationID, bool isAddAll) { //int waterUserID = GetSelectedOrganizationID(); int waterUserID = orgaizationID; DataTable tbl = StationDeviceDBI.GetStationDeviceDataTable(waterUserID); NameIDPairCollection c = NameIDPairFactory.Create(tbl, "StationName", "DeviceID"); if (isAddAll) { c.Insert(0, NameIDPair.ALL); } return(c); }
/// <summary> /// /// </summary> /// <param name="parent"></param> /// <param name="cbl"></param> static public void BindLowLevelWaterUser(WaterUserClass parent, CheckBoxList cbl) { if (parent == null) { throw new ArgumentNullException("parent"); } if (cbl == null) { throw new ArgumentNullException("ddl"); } NameIDPairCollection nips = new NameIDPairCollection(); foreach (WaterUserClass w in parent.LowLevelWaterUserCollection) { NameIDPair ni = new NameIDPair(w.Name, w.WaterUserID); nips.Add(ni); } cbl.DataSource = nips; cbl.DataTextField = "Name"; cbl.DataValueField = "id"; cbl.DataBind(); }
/// <summary> /// /// </summary> /// <returns></returns> static private object GetOrganizationDataSource() { LoginSession ls = SessionManager.LoginSession; WaterUserClass wu = ls.WaterUser; if (wu != null) { // 2011-06-19 // 只获取本单位用水户列表, 不获取本单位的下级单位 // //DataTable tbl = WaterUserDBI.GetManagementOrganization(ls.WaterUser.WaterUserID, // ls.WaterUser.WaterUserLevel.LevelOrdinal); //NameIDPairCollection c = NameIDPairFactory.Create(tbl, "WaterUserName", "WaterUserID"); NameIDPairCollection c = new NameIDPairCollection(); NameIDPair pair = new NameIDPair(wu.Name, wu.WaterUserID); c.Add(pair); return(c); } else { return(null); } }
/// <summary> /// /// </summary> /// <returns></returns> private static object GetOrganizationDataSource() { LoginSession ls = SessionManager.LoginSession; WaterUserClass wu = ls.WaterUser; if (wu != null) { // 2011-06-19 // 只获取本单位用水户列表, 不获取本单位的下级单位 // //DataTable tbl = WaterUserDBI.GetManagementOrganization(ls.WaterUser.WaterUserID, // ls.WaterUser.WaterUserLevel.LevelOrdinal); //NameIDPairCollection c = NameIDPairFactory.Create(tbl, "WaterUserName", "WaterUserID"); NameIDPairCollection c = new NameIDPairCollection(); NameIDPair pair = new NameIDPair(wu.Name, wu.WaterUserID); c.Add(pair); return c; } else { return null; } }
/// <summary> /// /// </summary> /// <param name="parent"></param> /// <param name="cbl"></param> public static void BindLowLevelWaterUser(WaterUserClass parent, CheckBoxList cbl) { if (parent == null) { throw new ArgumentNullException("parent"); } if (cbl == null) { throw new ArgumentNullException("ddl"); } NameIDPairCollection nips = new NameIDPairCollection(); foreach (WaterUserClass w in parent.LowLevelWaterUserCollection) { NameIDPair ni = new NameIDPair(w.Name, w.WaterUserID); nips.Add(ni); } cbl.DataSource = nips; cbl.DataTextField = "Name"; cbl.DataValueField = "id"; cbl.DataBind(); }