Example #1
0
 // Functie actualizare a ultimului element la prima rulare in fiecare lista
 public void UpdateLastElements(RaportareDbContext context)
 {
     try
     {
         if (IndexCuptor == 0)
         {
             IndexModel lastElementCuptor = GetLastElementFromSql("PlcCuptor", context);
             IndexCuptor            = (uint)lastElementCuptor.IndexValue;
             ValoareConsumGazCuptor = lastElementCuptor.GazValue;
             DataOraRaportFacut     = lastElementCuptor.Data;
         }
         if (IndexGaddaF2 == 0)
         {
             IndexModel lastElementGaddaF2 = GetLastElementFromSql("PlcGaddaF2", context);
             IndexGaddaF2            = (uint)lastElementGaddaF2.IndexValue;
             ValoareConsumGazGaddaF2 = lastElementGaddaF2.GazValue;
             DataOraRaportFacut      = lastElementGaddaF2.Data;
         }
         if (IndexGaddaF4 == 0)
         {
             IndexModel lastElementGaddaF4 = GetLastElementFromSql("PlcGaddaF4", context);
             IndexGaddaF4            = (uint)lastElementGaddaF4.IndexValue;
             ValoareConsumGazGaddaF4 = lastElementGaddaF4.GazValue;
             DataOraRaportFacut      = lastElementGaddaF4.Data;
         }
         if (IndexElti == 0)
         {
             IndexModel lastElementElti = GetLastElementFromSql("PlcElti", context);
             IndexElti            = (uint)lastElementElti.IndexValue;
             ValoareConsumGazElti = lastElementElti.GazValue;
             DataOraRaportFacut   = lastElementElti.Data;
         }
     }
     catch (NullReferenceException ex)
     {
     }
 }
Example #2
0
 // Functie salvare in database SQL index gaz model
 public void AddToSqlIndex(RaportareDbContext context, IndexModel indexModel)
 {
     context.Add(AddToIndexModelGasValue(indexModel));
     context.SaveChanges();
     DataOraRaportFacut = DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss");
 }