Example #1
0
        public bool WriteTotalProductionIntoDb(float totalProduction, float totalCost, DateTime dateTime)
        {
            bool retVal = false;

            try
            {
                TotalProduction total = new TotalProduction()
                {
                    TotalGeneration   = totalProduction,
                    CO2Reduction      = reductionCO2,
                    CO2Emission       = currentEmissionCO2,
                    TimeOfCalculation = dateTime,
                    TotalCost         = totalCost,
                    Profit            = profit
                };

                DbManager.Instance.AddTotalProduction(total);
                DbManager.Instance.SaveChanges();

                retVal = true;
            }
            catch (Exception e)
            {
                retVal = false;
                string message = string.Format("Failed to insert total production into database. {0}", e.Message);
                CommonTrace.WriteTrace(CommonTrace.TraceError, message);
                Console.WriteLine(message);
            }


            return(retVal);
        }
Example #2
0
 public void AddTotalProduction(TotalProduction tot)
 {
     emsContext.TotalProductions.Add(tot);
 }