public static DataTable GetUnitListByUserCode(string UserCode) { DataTable table2; try { DataTable tb = new DataTable(); DataColumn column = new DataColumn(); tb.Columns.Add("UnitCode"); tb.Columns.Add("UnitName"); EntityData userRoleByUserCode = SystemManageDAO.GetUserRoleByUserCode(UserCode); foreach (DataRow row in userRoleByUserCode.CurrentTable.Rows) { EntityData stationByCode = OBSDAO.GetStationByCode(row["StationCode"].ToString()); if (stationByCode.HasRecord()) { DataRow row2 = tb.NewRow(); row2["UnitCode"] = stationByCode.GetString("UnitCode"); row2["UnitName"] = GetUnitName(stationByCode.GetString("UnitCode")); tb.Rows.Add(row2); } stationByCode.Dispose(); } userRoleByUserCode.Dispose(); table2 = ConvertRule.GetDistinct(tb, "UnitCode", ""); } catch (Exception exception) { throw exception; } return(table2); }
public static string GetStationListByUserCode(string code) { string text2; try { string text = ""; EntityData userRoleByUserCode = SystemManageDAO.GetUserRoleByUserCode(code); foreach (DataRow row in userRoleByUserCode.CurrentTable.Rows) { text = text + row["StationCode"].ToString() + ","; } userRoleByUserCode.Dispose(); text2 = text; } catch (Exception exception) { throw exception; } return(text2); }