private Group Get(string name)
        {
            var record = DictionaryDataRecord.FromEntity(new Group()
            {
                Name = name
            });

            return(_groupAdapter.Read <Group>(record));
        }
        private Group Create(string name)
        {
            var group = new Group()
            {
                Name = name
            };
            var record = DictionaryDataRecord.FromEntity(group);

            _groupAdapter.Insert(record);
            return(group);
        }
 public override User Get(string userName)
 {
     return(Get(userName, (u) =>
     {
         var adapter = DbHelper.CreateAdapter(typeof(User));
         var user = new User()
         {
             UserName = "******"
         };
         return adapter.Read <User>(DictionaryDataRecord.FromEntity(user));
     }));
 }
Esempio n. 4
0
        public int InsertRates(IEnumerable <ExchangeRate> exchangeRates)
        {
            var entityAdapter = new SqlEntityAdapter(Database, typeof(ExchangeRate));
            var records       = new List <DataRecordAction>();

            foreach (var rate in exchangeRates)
            {
                records.Add(new DataRecordAction()
                {
                    Record = DictionaryDataRecord.FromEntity(rate), Action = DataAction.Insert
                });
            }
            entityAdapter.ExecuteInTransaction(records);
            return(records.Count);
        }
Esempio n. 5
0
        private Process GetProcess(string key)
        {
            var record = DictionaryDataRecord.FromEntity(new Process()
            {
                Name = key
            });
            var res = _processAdapter.Read <Process>(record);

            if (res == null)
            {
                return(res);
            }
            //res.GroupProcess = GetGroupProcess(res.ProcessId);
            return(res);
        }