Ejemplo n.º 1
0
        public void SyncStats(List <Investment.Portable.TblStats> result)
        {
            for (int i = 0; i < result.Count; i++)
            {
                try{
                    String   id   = result[i].ID.ToUpper();
                    TblStats item = (from s in Table <TblStats>() where s.FieldID.ToUpper().Equals(id) select s).FirstOrDefault();
                    if (item == null)
                    {
                        AddStats(result[i].ID, result[i].StatsTypeID, result[i].CountryID, result[i].Year, result[i].Month, result[i].Value);
                    }
                    else
                    {
                        item.FieldID     = result[i].ID;
                        item.StatsTypeID = result[i].StatsTypeID;
                        item.CountryID   = result[i].CountryID;
                        item.Year        = result[i].Year;
                        item.Month       = result[i].Month;
                        item.Value       = result[i].Value;

                        Update(item);
                    }
                }
                catch (Exception e) {
                }
            }
        }
Ejemplo n.º 2
0
        public void AddStats(String fieldID, String statusTypeID, String countryID, int year, int month, float value)
        {
            TblStats newItem = new TblStats {
                FieldID = fieldID, StatsTypeID = statusTypeID, CountryID = countryID, Year = year, Month = month, Value = value, Deleted = 0
            };

            Insert(newItem);
        }