public void AddField( string variableType, string variableName, string region, string accessLevel = "", string defaultValue = null) { var sb = new StringBuilder(); if (!IsInterface && !string.IsNullOrEmpty(accessLevel)) { sb.Append($"{accessLevel} "); } sb.Append($"{variableType} {variableName}"); if (defaultValue != null && !IsInterface) { sb.Append($" = {defaultValue}"); } sb.Append(";"); if (Regions.Contains(region)) { if (!regionVariables.ContainsKey(region)) { regionVariables[region] = new List <string>() { } } ; regionVariables[region].Add(sb.ToString()); } }
public string GetRegionNames() { var result = ""; if (Regions != null && Regions.Any()) { result = Session.Query <Region>().Where(x => Regions.Contains(x.Id)).Select(x => x.Name).OrderBy(x => x).ToList().Implode(); } return(result); }
private void Generate(WebBrowser browser) { Regions.Clear(); foreach (var address in _addressRepository.All()) { if (!Regions.Contains(address.Province)) { Regions.Add(address.Province); } } _browser = browser; var tasks = _taskRepository.All(); var DataElementList = new List <NewInspectionDataElement>(); var values = new Dictionary <string, int>(); foreach (var item in tasks) { if (((item.Customer == SelectedCustomer) || SelectAllCustomers) && (item.DatetimeCreated != null) && (item.DateTimeEnd != null) && (item.DateTimeStart != null) && (item.ParkingLot?.Address != null)) { if ((item.DatetimeCreated < EndDateTime) && (item.DatetimeCreated > BeginDateTime) && (item.ParkingLot.Address.Province.Equals(SelectedRegion) || SelectAllRegions)) { var month = item.DatetimeCreated.ToString("MMMMM"); if (!values.ContainsKey(month)) { values.Add(month, 0); } values[month]++; } } } foreach (var item in values) { DataElementList.Add(new NewInspectionDataElement { month = item.Key, amount = item.Value.ToString() }); } var o = JsonConvert.SerializeObject(DataElementList); browser.InvokeScript("go", o); Customers.Clear(); _customerRepository.All().ForEach(Customers.Add); }
public Regions PickStartingRegions(Map map, Regions availableOptions) { int numberToPick = availableOptions.Count > 6 ? 6 : availableOptions.Count; IEnumerable<RegionScore<StartRegion>> scores = _calc.CalculateStartRegions(map); var pickList = new Regions(); pickList.AddRange(scores .OrderByCumulativeScore() .Where(r => availableOptions.Contains(r.Region)) .Select(r => r.Region) .Take(numberToPick)); return pickList; }
/// <summary> /// Specifies an AWS region to use. /// </summary> /// <param name="accountId">The AWS region to use.</param> /// <returns> /// The current <see cref="MessagingConfigurationBuilder"/>. /// </returns> /// <exception cref="ArgumentNullException"> /// <paramref name="accountId"/> is <see cref="null"/>. /// </exception> public MessagingConfigurationBuilder WithRegion(string region) { if (region == null) { throw new ArgumentNullException(nameof(region)); } if (Regions == null) { Regions = new List <string>(); } if (!Regions.Contains(region)) { Regions.Add(region); } return(this); }
void RefreshRegions() { if (Country != null) { Regions = new ObservableCollection <Region>( (from region in Session.DataModel.Regions where region.CountryId == Country.Id orderby region.Name select region)); } else { Regions = new ObservableCollection <Region>(); } if (!Regions.Contains(Region)) { Region = null; } }
public void RemoveRegion(VehicleRegion r) { if (!Regions.Contains(r)) { Log.Error(string.Concat(new object[] { "Tried to remove region from Room but this region is not here. region=", r, ", room=", this })); return; } Regions.Remove(r); if (r.touchesMapEdge) { numRegionsTouchingMapEdge--; } if (Regions.Count == 0) { Map.GetCachedMapComponent <VehicleMapping>().VehicleRegionGrid.allRooms.Remove(this); } }
public void AddRegion(VehicleRegion region) { if (Regions.Contains(region)) { Log.Error(string.Concat(new object[] { "Tried to add the same region twice to Room. region=", region, ", room=", this })); return; } Regions.Add(region); if (region.touchesMapEdge) { numRegionsTouchingMapEdge++; } if (Regions.Count == 1) { Map.GetCachedMapComponent <VehicleMapping>().VehicleRegionGrid.allRooms.Add(this); } }
private void Generate(WebBrowser browser) { if (SelectAllCustomers == false && SelectedCustomer == null) { return; } _browser = browser; var DataElementList = new List <DataElement>(); var list = _taskRepository.All(); foreach (var item in list) { if (item.ParkingLot.Address != null && item.DateTimeEnd != null && item.DateTimeStart != null || item.Customer?.Name != null) { bool region = true; if (SelectedRegion != null && item.ParkingLot.Address != null && item.ParkingLot.Address.Province != null) { if (!item.ParkingLot.Address.Province.Equals(SelectedRegion)) { region = false; } } if ((region || SelectAllRegions == true) && item.DateTimeStart > BeginDateTime && item.DateTimeStart < EndDateTime && (item.Customer.Name == SelectedCustomer?.Name || SelectAllCustomers == true)) { var inspections = item.Inspections; List <Employee> employees = (from i in inspections from ii in i.InspectionInspectors select ii.Employee).ToList(); if (employees.Contains(SelectedEmployee) || SelectAllEmployees == true) { List <TimeSpan> spans = new List <TimeSpan>(); foreach (var i in item.Inspections) { TimeSpan span; if (i.DateTimeDone != null) { TimeSpan?tempSpan = i.DateTimeDone - i.DateTimeStarted; span = tempSpan.Value; spans.Add(span); } } if (spans.Count > 0) { double duration = spans.Average(timeSpan => timeSpan.TotalMinutes); int finalDuration = (int)duration; DataElementList.Add(new DataElement { inspection = item.Customer.Name, duration = finalDuration.ToString() }); } } } } } var o = new DataSet { data = DataElementList, ChartType = SelectedChart }; var test = JsonConvert.SerializeObject(o); browser.InvokeScript("go", test); Regions.Clear(); foreach (var address in _addressRepository.All()) { if (!Regions.Contains(address.Province)) { Regions.Add(address.Province); } } Customers.Clear(); _customerRepository.All().ForEach(Customers.Add); _userRepository.All().ForEach(Inspectors.Add); }
private Expression <Func <GeographicData, bool> > SchoolsExpression() { return(x => Schools == null || !Schools.Any() || Regions.Contains(x.School.LaEstab)); }
private Expression <Func <GeographicData, bool> > LocalAuthoritiesExpression() { return(x => LocalAuthorities == null || !LocalAuthorities.Any() || Regions.Contains(x.LocalAuthority.Code)); }
private Expression <Func <GeographicData, bool> > RegionsExpression() { return(x => Regions == null || !Regions.Any() || Regions.Contains(x.Region.Code)); }
public void AddProperty( string propertyType, string propertyName, string accessLevel = "", string defaultValue = "", string region = "none", string getterBody = "", string setterBody = "", bool isAutoProperty = false) { var sb = new StringBuilder(); if (!IsInterface && !string.IsNullOrEmpty(accessLevel)) { sb.Append($"{accessLevel} "); } sb.Append($"{propertyType} {propertyName} {{ "); if (!string.IsNullOrEmpty(getterBody)) { sb.Append($"get {getterBody}"); } else if (isAutoProperty) { sb.Append($"get; "); } else { sb.Append($"get {{ return default; }}"); } if (!string.IsNullOrEmpty(getterBody)) { sb.Append($"set {setterBody} }}"); } else if (isAutoProperty) { sb.Append($"set; }}"); } else { sb.Append($"set {{ }} }}"); } if (!string.IsNullOrEmpty(defaultValue) && !IsInterface) { sb.Append($" = {defaultValue};"); } if (Regions.Contains(region)) { if (!regionVariables.ContainsKey(region)) { regionVariables[region] = new List <string>() { } } ; regionVariables[region].Add(sb.ToString()); } }