Пример #1
0
 /// <summary>
 /// 初始化时间维度
 /// </summary>
 /// <param name="timeDimensionString"></param>
 private void InitTimeDimension(string timeDimensionString)
 {
     try
     {
         var timeDimensionTypeList = JsonConvert.DeserializeObject<List<TimeDimensionTypeModel>>(timeDimensionString);
         var dimensionItemsSource = new ObservableCollection<TimeDimensionTypeModel>();
         foreach (var timeDimensionx in timeDimensionTypeList)
         {
             var timeDimension = new TimeDimensionTypeModel
             {
                 Id = timeDimensionx.Id,
                 EnName = timeDimensionx.EnName,
                 CnName = timeDimensionx.CnName,
                 SystemTypeId = timeDimensionx.SystemTypeId,
                 IsEnabled = true
             };
             dimensionItemsSource.Add(timeDimension);
         }
         TimeDimensionTypeList = dimensionItemsSource;
     }
     catch (Exception ex)
     {
         ShowMessage.Show("初始化时间维度出错");
         LogHelper.LogMessage(MethodBase.GetCurrentMethod().DeclaringType, LogHelper.LogLevel, "Failed to InitTimeDimension", ex);
     }
     finally
     {
         if (LogHelper.LogLevel == LogLevelEnum.Debug || LogHelper.LogLevel == LogLevelEnum.Info)
         {
             LogHelper.LogMessage(MethodBase.GetCurrentMethod().DeclaringType, LogHelper.LogLevel, "InitTimeDimension", null);
         }
     }
 }
Пример #2
0
        /// <summary>
        /// 时间粒度点击事件
        /// </summary>
        public void TimeDimensionClick(TimeDimensionTypeModel timeDimension)
        {
            try
            {
                var timeDimensionx = TimeDimensionsCache.Find(t => t.EnName == timeDimension.EnName && t.SystemTypeId == SystemType.Id);


                if (timeDimension.IsChecked)
                {
                    _selectedTimeDimensions.Add(timeDimensionx);
                }
                else
                {
                    _selectedTimeDimensions.Remove(timeDimensionx);
                }

                SetDisplayType();

                RemoveUnUsedOrderItem();
            }
            catch (Exception ex)
            {
                ShowMessage.Show("时间粒度选择出错");
                LogHelper.LogMessage(MethodBase.GetCurrentMethod().DeclaringType, LogHelper.LogLevel, "Failed to TimeDimensionClick", ex);
            }
            finally
            {
                if (LogHelper.LogLevel == LogLevelEnum.Debug || LogHelper.LogLevel == LogLevelEnum.Info)
                {
                    LogHelper.LogMessage(MethodBase.GetCurrentMethod().DeclaringType, LogHelper.LogLevel, "TimeDimensionClick", null);
                }
            }
        }