Ejemplo n.º 1
0
        /// <summary>
        /// Inseire/Atualiza/Remove os registros da tabela verificando as diferenças entre o enum e  o
        /// banco de dados
        /// </summary>
        public new void UpdateValues()
        {
            RaiseBeforeLoadValues();

            var dblist = from obj in GetData().AsEnumerable()
                         select new
            {
                ID          = obj.Field <Int32>(KeyFields.First().Name),
                Description = obj.Field <string>(FieldsName.Description)
            };

            var newList = InicialValues
                          .Where(c => dblist.All(d => d.ID != c.Collumns[FieldsName.ID].GetInt32()))
                          .ToList();

            newList.SetState(eState.eAdd);

            var upList = InicialValues
                         .Where(c => newList.All(p => c.Collumns[FieldsName.ID].GetInt32() != p.Collumns[FieldsName.ID].GetInt32()) &&
                                dblist.All(d => d.Description != c.Collumns[FieldsName.Description].GetString())).ToList();

            upList.SetState(eState.eUpdate);
            newList.AddRange(upList);

            SaveLines(newList);

            RaiseAfterLoadValues();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Atualiza a lista de valores iniciais
        /// </summary>
        public void UpdateValues()
        {
            RaiseBeforeLoadValues();

            var fieldName = InicialFieldName ?? KeyFields.First().Name;

            CheckForNewsAditionalValues(fieldName);

            CheckForUpdateAditionalValues(fieldName);

            RaiseAfterLoadValues();
        }