public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) { if ((value == null)) { return(null); } CustomerKind valueCasted = ((CustomerKind)(value)); if ((valueCasted == CustomerKind.Residential)) { return("residential"); } if ((valueCasted == CustomerKind.InternalUse)) { return("internalUse"); } if ((valueCasted == CustomerKind.WindMachine)) { return("windMachine"); } if ((valueCasted == CustomerKind.CommercialIndustrial)) { return("commercialIndustrial"); } if ((valueCasted == CustomerKind.EnergyServiceScheduler)) { return("energyServiceScheduler"); } if ((valueCasted == CustomerKind.ResidentialStreetlightOthers)) { return("residentialStreetlightOthers"); } if ((valueCasted == CustomerKind.EnergyServiceSupplier)) { return("energyServiceSupplier"); } if ((valueCasted == CustomerKind.ResidentialAndStreetlight)) { return("residentialAndStreetlight"); } if ((valueCasted == CustomerKind.ResidentialFarmService)) { return("residentialFarmService"); } if ((valueCasted == CustomerKind.PumpingLoad)) { return("pumpingLoad"); } if ((valueCasted == CustomerKind.ResidentialAndCommercial)) { return("residentialAndCommercial"); } if ((valueCasted == CustomerKind.Other)) { return("other"); } throw new ArgumentOutOfRangeException("value"); }
public Customer GetCustomer(CustomerKind kind) { return(_repository.Customers.FirstOrDefault(t => t.Kind == kind)); }