public List <Budget_Locations> SelectAll() { List <Budget_Locations> LocationsList = null; try { string sSQL = "SELECT * FROM Locations"; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL); if (ds.Tables[0].Rows.Count > 0) { LocationsList = new List <Budget_Locations>(); Budget_Locations location = null; List <Detais> detailList = null; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { location = new Budget_Locations(); location.LocationOID = new Guid(ds.Tables[0].Rows[i]["LocationOID"].ToString()); location.LocationCode = ds.Tables[0].Rows[i]["LocationCode"].ToString(); location.Phone = ds.Tables[0].Rows[i]["Phone"].ToString(); location.Fax = ds.Tables[0].Rows[i]["Fax"].ToString(); location.Email = ds.Tables[0].Rows[i]["Email"].ToString(); location.Latitude = ds.Tables[0].Rows[i]["Latitude"].ToString(); location.Longitude = ds.Tables[0].Rows[i]["Longitude"].ToString(); location.ProvinceCode = ds.Tables[0].Rows[i]["ProvinceCode"].ToString(); location.mfOpen = ds.Tables[0].Rows[i]["mfOpen"].ToString(); location.mfClose = ds.Tables[0].Rows[i]["mfClose"].ToString(); location.satOpen = ds.Tables[0].Rows[i]["satOpen"].ToString(); location.satClose = ds.Tables[0].Rows[i]["satClose"].ToString(); location.sunOpen = ds.Tables[0].Rows[i]["sunOpen"].ToString(); location.sunClose = ds.Tables[0].Rows[i]["sunClose"].ToString(); location.FileName = ds.Tables[0].Rows[i]["FileName"].ToString(); detailList = getDetails(location.LocationOID); if (detailList != null) { location.LocationDetais = new List <Detais>(); location.LocationDetais = detailList; } LocationsList.Add(location); } } } catch (Exception ex) { } return(LocationsList); }
public List <Budget_Locations> SelectByProvince(string ProvinceCode) { List <Budget_Locations> locationList = null; try { string sSQL = "SELECT * FROM Locations WHERE ProvinceCode=@ProvinceCode"; SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter("@ProvinceCode", SqlDbType.NVarChar); sqlParam[0].Value = ProvinceCode; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL, sqlParam); if (ds.Tables[0].Rows.Count > 0) { locationList = new List <Budget_Locations>(); List <Detais> detailList = null; Budget_Locations location = new Budget_Locations(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { location = new Budget_Locations(); location.LocationOID = new Guid(ds.Tables[0].Rows[i]["LocationOID"].ToString()); location.LocationCode = ds.Tables[0].Rows[i]["LocationCode"].ToString(); location.Phone = ds.Tables[0].Rows[i]["Phone"].ToString(); location.Fax = ds.Tables[0].Rows[i]["Fax"].ToString(); location.Email = ds.Tables[0].Rows[i]["Email"].ToString(); location.Latitude = ds.Tables[0].Rows[i]["Latitude"].ToString(); location.Longitude = ds.Tables[0].Rows[i]["Longitude"].ToString(); location.ProvinceCode = ds.Tables[0].Rows[i]["ProvinceCode"].ToString(); location.mfOpen = ds.Tables[0].Rows[i]["mfOpen"].ToString(); location.mfClose = ds.Tables[0].Rows[i]["mfClose"].ToString(); location.satOpen = ds.Tables[0].Rows[i]["satOpen"].ToString(); location.satClose = ds.Tables[0].Rows[i]["satClose"].ToString(); location.sunOpen = ds.Tables[0].Rows[i]["sunOpen"].ToString(); location.sunClose = ds.Tables[0].Rows[i]["sunClose"].ToString(); location.FileName = ds.Tables[0].Rows[i]["FileName"].ToString(); detailList = getDetails(location.LocationOID); if (detailList != null) { location.LocationDetais = detailList; } locationList.Add(location); } } } catch (Exception ex) { } return(locationList); }
public Budget_Locations SelectByOID(Guid guidLocationOID) { Budget_Locations location = null; try { string sSQL = "SELECT * FROM Locations WHERE LocationOID=@LocationOID"; SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter("@LocationOID", SqlDbType.UniqueIdentifier); sqlParam[0].Value = guidLocationOID; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL, sqlParam); if (ds.Tables[0].Rows.Count > 0) { List <Detais> detailList = null; location = new Budget_Locations(); location.LocationOID = new Guid(ds.Tables[0].Rows[0]["LocationOID"].ToString()); location.LocationCode = ds.Tables[0].Rows[0]["LocationCode"].ToString(); location.Phone = ds.Tables[0].Rows[0]["Phone"].ToString(); location.Fax = ds.Tables[0].Rows[0]["Fax"].ToString(); location.Email = ds.Tables[0].Rows[0]["Email"].ToString(); location.Latitude = ds.Tables[0].Rows[0]["Latitude"].ToString(); location.Longitude = ds.Tables[0].Rows[0]["Longitude"].ToString(); location.ProvinceCode = ds.Tables[0].Rows[0]["ProvinceCode"].ToString(); location.mfOpen = ds.Tables[0].Rows[0]["mfOpen"].ToString(); location.mfClose = ds.Tables[0].Rows[0]["mfClose"].ToString(); location.satOpen = ds.Tables[0].Rows[0]["satOpen"].ToString(); location.satClose = ds.Tables[0].Rows[0]["satClose"].ToString(); location.sunOpen = ds.Tables[0].Rows[0]["sunOpen"].ToString(); location.sunClose = ds.Tables[0].Rows[0]["sunClose"].ToString(); location.FileName = ds.Tables[0].Rows[0]["FileName"].ToString(); detailList = getDetails(location.LocationOID); if (detailList != null) { location.LocationDetais = new List <Detais>(); location.LocationDetais = detailList; } } } catch (Exception ex) { } return(location); }