Exemple #1
0
        private void DbLog(double convertFromValue, string fromUnit, string toUnit, string convertedValue)
        {
            StatisticsObject statisticsObject = new StatisticsObject()
            {
                CL_Date      = DateTime.Now,
                CL_UnitType  = classType.Name,
                CL_UnitFrom  = fromUnit,
                CL_UnitTo    = toUnit,
                CL_ValueFrom = decimal.Parse(convertFromValue.ToString()),
                CL_ValueTo   = decimal.Parse(convertedValue),
            };

            this.repository.AddStatistic(statisticsObject);
        }
        public void AddStatistic(StatisticsObject statistic)
        {
            using (WwsiModel context = new WwsiModel())
            {
                context.CONVERSION_LOG.Add(new CONVERSION_LOG()
                {
                    CL_Date      = statistic.CL_Date,
                    CL_UnitType  = statistic.CL_UnitType,
                    CL_UnitFrom  = statistic.CL_UnitFrom,
                    CL_UnitTo    = statistic.CL_UnitTo,
                    CL_ValueFrom = statistic.CL_ValueFrom,
                    CL_ValueTo   = statistic.CL_ValueTo,
                });

                context.SaveChanges();
            }
        }