private List <Detais> getDetails(Guid guidLocationOID) { List <Detais> DetaisList = null; try { string sSQL = "SELECT * FROM LocationDetails 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) { DetaisList = new List <Detais>(); Detais detail = new Detais(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { detail = new Detais(); detail.Culture = ds.Tables[0].Rows[i]["Culture"].ToString(); detail.Address = ds.Tables[0].Rows[i]["Address"].ToString(); detail.LocationName = ds.Tables[0].Rows[i]["LocationName"].ToString(); detail.Description = ds.Tables[0].Rows[i]["Description"].ToString(); DetaisList.Add(detail); } } } catch (Exception ex) { } return(DetaisList); }
public List <Budget_Locations> SelectByCulture(string Culture) { List <Budget_Locations> locationList = null; try { string sSQL = "SELECT * FROM Locations"; DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL); if (ds.Tables[0].Rows.Count > 0) { locationList = new List <Budget_Locations>(); List <Detais> detailList = null; Budget_Locations location = new Budget_Locations(); Detais detail = 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(); detail = getDetails(location.LocationOID).Find(x => x.Culture == Culture); if (detail != null) { location.LocationDetais = new List <Detais>(); detailList = new List <Detais>(); detailList.Add(detail); location.LocationDetais = detailList; } locationList.Add(location); } } } catch (Exception ex) { } return(locationList); }