private async Task <GaugeValue> AddGaugeValue(
            DataValue value,
            RiverFlowSnapshotModel snapshot,
            GaugeReport report)
        {
            var exists = await this.riverDbContext
                         .GaugeValue
                         .AnyAsync(gv => gv.AsOf == value.AsOf &&
                                   gv.UsgsGaugeId == snapshot.Site.UsgsGaugeId &&
                                   gv.Code == value.Code);

            if (!exists)
            {
                var gaugeValue = new GaugeValue
                {
                    AsOf        = DateConversion.ForStorage(value.AsOf),
                    Code        = value.Code,
                    Report      = report,
                    UsgsGaugeId = snapshot.Site.UsgsGaugeId,
                    Value       = value.Value
                };
                await this.riverDbContext.GaugeValue.AddAsync(gaugeValue);

                return(gaugeValue);
            }

            return(null);
        }
示例#2
0
        private bool IsSpellValid(object obj)
        {
            SpellData spellData = obj as SpellData;

            if (spellData == null)
            {
                return(false);
            }
            bool    flag    = false;
            bool    flag2   = false;
            Element element = spellData.definition.element;

            flag = m_elementsEnableToggle.Contains(element);
            IReadOnlyList <GaugeValue> gaugeToModifyOnSpellPlay = spellData.definition.gaugeToModifyOnSpellPlay;
            int i = 0;

            for (int count = gaugeToModifyOnSpellPlay.Count; i < count; i++)
            {
                GaugeValue gaugeValue = gaugeToModifyOnSpellPlay[i];
                flag2 |= (gaugeValue != null && m_caracIdsEnableToggle.Contains(gaugeValue.element));
            }
            if (flag | flag2)
            {
                return(ValidateSearchText(spellData, spellData.definition));
            }
            return(false);
        }
        public static TooltipElementValues GetTooltipElementValues(SpellDefinition definition, DynamicValueContext context)
        {
            int num  = 0;
            int num2 = 0;
            int num3 = 0;
            int num4 = 0;
            int num5 = 0;
            IReadOnlyList <GaugeValue> gaugeToModifyOnSpellPlay = definition.gaugeToModifyOnSpellPlay;
            int count = gaugeToModifyOnSpellPlay.Count;

            for (int i = 0; i < count; i++)
            {
                GaugeValue gaugeValue = gaugeToModifyOnSpellPlay[i];
                if (gaugeValue.value.GetValue(context, out int value))
                {
                    switch (gaugeValue.element)
                    {
                    case CaracId.FirePoints:
                        num3 += value;
                        break;

                    case CaracId.WaterPoints:
                        num4 += value;
                        break;

                    case CaracId.EarthPoints:
                        num2 += value;
                        break;

                    case CaracId.AirPoints:
                        num += value;
                        break;

                    case CaracId.ReservePoints:
                        num5 += value;
                        break;
                    }
                }
            }
            return(new TooltipElementValues(num, num2, num3, num4, num5));
        }
示例#4
0
 public void SetGaugeValue(GaugeValue gauge)
 {
     StdLarge = gauge.MAX;
     StdMean  = gauge.AVG;
     StdSmall = gauge.MIN;
 }