private void initializeDataGridComponentsDatasources() { DogRepository dogRepository = new DogRepository(); IList<Dog> dataSourceDogsList = dogRepository.GetAllDogs(); DogNameColumn.DataSource = dataSourceDogsList; DogNameColumn.DisplayMember = "FullName"; DogNameColumn.ValueMember = "DogId"; CostTypeRepository costTypeRepository = new CostTypeRepository(); IList<CostType> trainingCostTypes = costTypeRepository.GetAllSimilarCostTypes(CLASS_COST_TYPE); ClassColumn.DataSource = trainingCostTypes; ClassColumn.DisplayMember = "CostName"; ClassColumn.ValueMember = "CostTypeId"; CostType preK9DaycareCostType = costTypeRepository.GetByCostName(PRE_K9_DAYCARE_COST_TYPE); IList<Cost> possibleCosts1 = preK9DaycareCostType.PossibleCosts; ArrayList.Adapter((IList)possibleCosts1).Sort(); PreK9DaycareCostColumn.DataSource = possibleCosts1; PreK9DaycareCostColumn.DisplayMember = "CostValue"; PreK9DaycareCostColumn.ValueMember = "CostId"; CostOfClassColumn.DataSource = bindingSource; }
private void BoardingUserControl_Load(object sender, EventArgs e) { this.dataGridView1.AutoResizeRows(); DogRepository dogRepository = new DogRepository(); IList<Dog> dataSourceDogsList = dogRepository.GetAllDogs(); DogNameColumn.DataSource = dataSourceDogsList; DogNameColumn.DisplayMember = "FullName"; DogNameColumn.ValueMember = "DogId"; CostTypeRepository costTypeRepository = new CostTypeRepository(); CostType boardingRateCostType = costTypeRepository.GetByCostName(BOARDING_RATE_COST_TYPE); IList<Cost> possibleCosts1 = boardingRateCostType.PossibleCosts; ArrayList.Adapter((IList)possibleCosts1).Sort(); BoardingRateColumn.DataSource = possibleCosts1; BoardingRateColumn.DisplayMember = "CostValue"; BoardingRateColumn.ValueMember = "CostId"; CostType sundayDaycareCostType = costTypeRepository.GetByCostName(SUNDAY_DAYCARE_COST_TYPE); IList<Cost> possibleCosts2 = sundayDaycareCostType.PossibleCosts; ArrayList.Adapter((IList)possibleCosts2).Sort(); SundayDaycareColumn.DataSource = possibleCosts2; SundayDaycareColumn.DisplayMember = "CostValue"; SundayDaycareColumn.ValueMember = "CostId"; refreshDisplayFromDatabase(); }
private void initializeDataGridComponentsDatasources() { DogRepository dogRepository = new DogRepository(); IList<Dog> dataSourceDogsList = dogRepository.GetAllDogs(); DogNameColumn.DataSource = dataSourceDogsList; DogNameColumn.DisplayMember = "FullName"; DogNameColumn.ValueMember = "DogId"; CostTypeRepository costTypeRepository = new CostTypeRepository(); CostType pickupCostType = costTypeRepository.GetByCostName(PICKUP_COST_TYPE); IList<Cost> possibleCosts1 = pickupCostType.PossibleCosts; ArrayList.Adapter((IList)possibleCosts1).Sort(); PickupCostColumn.DataSource = possibleCosts1; PickupCostColumn.DisplayMember = "CostValue"; PickupCostColumn.ValueMember = "CostId"; CostType dropoffCostType = costTypeRepository.GetByCostName(DROPOFF_COST_TYPE); IList<Cost> possibleCosts2 = dropoffCostType.PossibleCosts; ArrayList.Adapter((IList)possibleCosts2).Sort(); DropoffCostColumn.DataSource = possibleCosts2; DropoffCostColumn.DisplayMember = "CostValue"; DropoffCostColumn.ValueMember = "CostId"; }