public List <Budget_Zone> SelectAll() { List <Budget_Zone> ZoneList = null; try { string sSQL = "SELECT * FROM Zone"; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL); if (ds.Tables[0].Rows.Count > 0) { ZoneList = new List <Budget_Zone>(); Budget_Zone zone = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { zone = new Budget_Zone(); zone.ZoneCode = ds.Tables[0].Rows[i]["ZoneCode"].ToString(); zone.Culture = ds.Tables[0].Rows[i]["Culture"].ToString(); zone.ZoneName = ds.Tables[0].Rows[i]["ZoneName"].ToString(); zone.FileName = ds.Tables[0].Rows[i]["FileName"].ToString(); ZoneList.Add(zone); } } } catch (Exception ex) { } return(ZoneList); }
public List <Budget_Zone> SelectByCulture(string Culture) { List <Budget_Zone> allZone = null; try { string sSQL = "SELECT * FROM Zone WHERE Culture=@Culture"; SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter("@Culture", SqlDbType.NVarChar); sqlParam[0].Value = Culture; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL, sqlParam); if (ds.Tables[0].Rows.Count > 0) { DataRow oneRow; allZone = new List <Budget_Zone>(); Budget_Zone zone = new Budget_Zone(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { oneRow = ds.Tables[0].Rows[i]; zone = new Budget_Zone(); zone.ZoneCode = oneRow["ZoneCode"].ToString(); zone.Culture = oneRow["Culture"].ToString(); zone.ZoneName = oneRow["ZoneName"].ToString(); zone.FileName = oneRow["FileName"].ToString(); allZone.Add(zone); } } } catch (Exception ex) { } return(allZone); }
private string getZoneName(string ZoneCode, string Culture) { Budget_Zone zone = new Budget_Zone(); List <Budget_Zone> zoneList = zone.SelectByCode(ZoneCode); zone = zoneList.Find(x => x.Culture == Culture); return(zone.ZoneName); }