public async Task <object> GetRPM(int mixingInfoID, string building, string startTime, string endTime) { var setting = await _repoSetting.FindAll().Include(x => x.Building).FirstOrDefaultAsync(x => x.Building.Name == building); var mixing = await _repoStir.FindAll(x => x.MixingInfoID == mixingInfoID).FirstOrDefaultAsync(); var machineID = setting.MachineCode.ToInt(); var start = mixing.StartTime; var end = mixing.EndTime; TimeSpan minutes = new TimeSpan(); var model = _rowDataRepository.FilterBy(x => x.MachineID == machineID && x.CreatedDateTime >= start && x.CreatedDateTime <= end).Select(x => new { x.RPM, x.CreatedDateTime }).OrderByDescending(x => x.CreatedDateTime).ToList(); if (model.Count() > 0) { var max = model.Select(x => x.CreatedDateTime).FirstOrDefault(); var min = model.Select(x => x.CreatedDateTime).LastOrDefault(); if (min != DateTime.MinValue && max != DateTime.MinValue) { minutes = max - min; } return(new { rpm = Math.Round(model.Select(x => x.RPM).Average()), totalMinutes = Math.Round(minutes.TotalMinutes, 2), minutes }); } return(new { rpm = 0, totalMinutes = 0, minutes }); }
public List <Setting> GetAllSettings() { if (allSettings == null) { allSettings = _settingRepository.FindAll().ToList(); } return(allSettings); }
public static void Initialize(ISettingRepository repository) { var dicSettings = repository.FindAll(); InitConstants(dicSettings); var lstAddressSetting = repository.FindAllControlTitlesByLanguage(SettingsData.Language); InitControls(lstAddressSetting); }
public ResponseMessageSetting FindAllSettings() { using (_repository) { return(new ResponseMessageSetting { DicSettings = _repository.FindAll(), IsSuccess = true, Message = String.Empty }); } }
public async Task <object> GetAllAsync() { return(await _repoSetting.FindAll().ToListAsync()); }
public IList <Setting> FindAll() { return(_settingRepository.FindAll().OrderBy(x => x.Id).ToList()); }