public List <VehicleRange> SelectAll(string PrefixTable) { List <VehicleRange> VehicleRangeList = null; try { string sSQL = "SELECT * FROM ##VehicleRange"; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL.Replace("##", PrefixTable)); if (ds.Tables[0].Rows.Count > 0) { VehicleRangeList = new List <VehicleRange>(); VehicleRange vehicleRange = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { vehicleRange = new VehicleRange(); vehicleRange.VehicleRangeOID = new Guid(ds.Tables[0].Rows[i]["VehicleRangeOID"].ToString()); vehicleRange.Enable = Convert.ToBoolean(ds.Tables[0].Rows[i]["Enable"].ToString()); vehicleRange.FileName = ds.Tables[0].Rows[i]["FileName"].ToString(); vehicleRange.VehicleRangeURL = ds.Tables[0].Rows[i]["VehicleRangeURL"].ToString(); VehicleRangeList.Add(vehicleRange); } } } catch (Exception ex) { } return(VehicleRangeList); }
public VehicleRange SelectByOID(string PrefixTable, Guid guidVehicleRangeOID) { VehicleRange vehicleRange = null; try { string sSQL = "SELECT * FROM ##VehicleRange WHERE VehicleRangeOID=@VehicleRangeOID"; SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter("@VehicleRangeOID", SqlDbType.UniqueIdentifier); sqlParam[0].Value = guidVehicleRangeOID; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL.Replace("##", PrefixTable), sqlParam); if (ds.Tables[0].Rows.Count > 0) { vehicleRange = new VehicleRange(); vehicleRange.VehicleRangeOID = new Guid(ds.Tables[0].Rows[0]["VehicleRangeOID"].ToString()); vehicleRange.Enable = Convert.ToBoolean(ds.Tables[0].Rows[0]["Enable"].ToString()); vehicleRange.FileName = ds.Tables[0].Rows[0]["FileName"].ToString(); vehicleRange.VehicleRangeURL = ds.Tables[0].Rows[0]["VehicleRangeURL"].ToString(); } } catch (Exception ex) { } return(vehicleRange); }