private void LoadTrafficCross() { var list = _client.GetAllTrafficCrossTimes(); if (list == null) { return; } foreach (var item in list) { TrafficCrossList.Add(item); } }
private void SetSelectedRuleDetails() { this.BusinessRuleName = _businessRulesDTO.BusinessName; if (!string.IsNullOrEmpty(_businessRulesDTO.VehicleType) && this.VehicleTypesList != null && this.VehicleTypesList.Count > 0) { foreach (var item in this.VehicleTypesList) { if (item.VehicleTypeID == _businessRulesDTO.VehicleTypeId && item.VehicleTypeEn == _businessRulesDTO.VehicleType) { this.VehicleType = item; break; } } } if (this.VehicleType == null) { this.VehicleType = VehicleTypesList.Where(a => a.VehicleTypeEn == "Any").FirstOrDefault(); } if (_businessRulesDTO.IsOverSpeedInsideCity) { this.SpeedInsideCityAdded = _businessRulesDTO.IsOverSpeedInsideCity; this.SpeedThshldInCity = OverSpeedList.Where(a => a.OverSpeedId == _businessRulesDTO.InsideCityOverSpeedId && a.OverSpeedValue == _businessRulesDTO.InsideCityOverSpeedValue).FirstOrDefault(); //foreach (var item in OverSpeedList) //{ // if (item.OverSpeedId == _businessRulesDTO.InsideCityOverSpeedId // && item.OverSpeedValue == _businessRulesDTO.InsideCityOverSpeedValue) // { // this.SpeedThshldInCity = item; // break; // } //} } if (_businessRulesDTO.IsOverSpeedOutsideCity) { this.SpeedOutsideCityAdded = _businessRulesDTO.IsOverSpeedOutsideCity; this.SpeedThshldOutCity = OverSpeedList.Where(a => a.OverSpeedId == _businessRulesDTO.OutsideCityOverSpeedId && a.OverSpeedValue == _businessRulesDTO.OutsideCityOverSpeedValue).FirstOrDefault(); } this.NumOfViolnsInCity = _businessRulesDTO.InsideCityOverSpeedQty; this.NumOfViolnsOutCity = _businessRulesDTO.OutsideCityOverSpeedQty; this.RedLgtCrosdAdded = _businessRulesDTO.IsTrafficCross; this.RedLgtCrosdValue = _businessRulesDTO.TrafficCrossQty; if (_businessRulesDTO.IsTrafficCross && _businessRulesDTO.TrafficCrossTimesId != null) { //this.RedLgtCrosngTimeAdded = true; this.RedLgtCrosngSecondsValue = TrafficCrossList.Where(a => a.TrafficCrossId == _businessRulesDTO.TrafficCrossTimesId && a.TrafficCrossValue == _businessRulesDTO.TrafficCrossTimesValue).FirstOrDefault(); //this.RedLgtCrosngSecondsValue = new TrafficCrossDTO(); //this.RedLgtCrosngSecondsValue.TrafficCrossValue = _businessRulesDTO.TrafficCrossTimesValue; //this.RedLgtCrosngSecondsValue.TrafficCrossId = (int)_businessRulesDTO.TrafficCrossTimesId; } this.RedLgtCrosngNumOfViolnsValue = _businessRulesDTO.TrafficCrossQty; this.RuleIntTimeValue = _businessRulesDTO.RuleInterval; this.IsRuleDisabled = _businessRulesDTO.IsDeleted; }