private DerValuesViewModel GetDerValuesPerSection(string date, int[] actualKpiIds, int[] targetKpiIds, int[] highlightTypeIds) { var theDate = DateTime.ParseExact(date, "MM/dd/yyyy", CultureInfo.InvariantCulture); var kpiInformationValuesRequest = new GetKpiInformationValuesRequest { Date = theDate, ActualKpiIds = actualKpiIds, TargetKpiIds = targetKpiIds }; var kpiInformationValuesResponse = _derTransactionService.GetKpiInformationValues(kpiInformationValuesRequest); var highlightValuesRequest = new GetHighlightValuesRequest { Date = theDate, HighlightTypeIds = highlightTypeIds }; var highlightValuesResponse = _derTransactionService.GetHighlightValues(highlightValuesRequest); var viewModel = new DerValuesViewModel(); viewModel.Highlights = highlightValuesResponse.Highlights.MapTo<DerValuesViewModel.DerHighlightValuesViewModel>(); viewModel.KpiInformations = kpiInformationValuesResponse.KpiInformations.MapTo<DerValuesViewModel.KpiInformationValuesViewModel>(); return viewModel; }
private static ValueObject GetValue(DerValuesViewModel.KpiValueViewModel kpiValue, string value, string defaultValueDefined, string valueType, string existValue) { if (valueType == "value") { //var valtoString = string.Empty; //if (kpiValue != null) {valtoString= kpiValue.Value == 0 ? kpiValue.Value.ToString() : kpiValue.Value.ToString("#,#.#########"); } value = kpiValue == null ? value : (defaultValueDefined == "prev" ? (kpiValue.Value == 0 ? kpiValue.Value.ToString() : kpiValue.Value.ToString("#,0.#########")) : (kpiValue.Type == "now" ? (kpiValue.Value == 0 ? kpiValue.Value.ToString() : kpiValue.Value.ToString("#,0.#########")) : value)); existValue = kpiValue == null ? existValue : kpiValue.Type; } else { value = kpiValue == null ? value : (defaultValueDefined == "prev" ? kpiValue.Remark : (kpiValue.Type == "now" ? kpiValue.Remark : value)); existValue = kpiValue == null ? existValue : kpiValue.Type; } return new ValueObject { Value = value, ExistValue = existValue, Id = kpiValue == null ? 0 : kpiValue.Id }; }