コード例 #1
0
        public List <CounterValue> GetAllCounterValuesByAccountId(int personalAccountId)
        {
            using (var context = new CountersEntities()) {
                var counterValues = (from p
                                     in context.CounterValue
                                     where p.AccountID == personalAccountId
                                     select p).ToList();

                return(counterValues);
            }
        }
コード例 #2
0
        public PersonalAccount GetPersonalAccount(int id)
        {
            using (var context = new CountersEntities()) {
                var personalAccount = (from p
                                       in context.PersonalAccount
                                       where p.AccountID == id
                                       select p).FirstOrDefault();

                return(personalAccount);
            }
        }
コード例 #3
0
        public CounterOptions GetCounterOptions(int id)
        {
            using (var context = new CountersEntities()) {
                var productEntity = (from p
                                     in context.CounterOptions
                                     where p.CounterID == id
                                     select p).FirstOrDefault();

                return(productEntity);
            }
        }
コード例 #4
0
 public void SetCounterValue(int personalAccountId, int counterId, float value)
 {
     using (var context = new CountersEntities()) {
         var counterValue = new CounterValue {
             CounterValudId   = context.CounterValue.Count(),
             Unit             = "Test",
             CounterID        = counterId,
             CounterValue1    = (int)value,
             DateOfEnterValue = DateTime.UtcNow,
             AccountID        = personalAccountId
         };
         context.CounterValue.Add(counterValue);
         context.SaveChanges();
     }
 }
コード例 #5
0
        public List <CounterValue> GetAllCounterValuesByTime(DateTime dateFrom, DateTime dateTo)
        {
            using (var context = new CountersEntities()) {
                List <CounterValue> counterValues = new List <CounterValue>();

                foreach (CounterValue counterValue in context.CounterValue.ToList())
                {
                    if (counterValue.DateOfEnterValue >= dateFrom &&
                        counterValue.DateOfEnterValue <= dateTo)
                    {
                        counterValues.Add(counterValue);
                    }
                }

                return(counterValues);
            }
        }
コード例 #6
0
 public List <CounterValue> GetAllCounterValuesByAccounts()
 {
     using (var context = new CountersEntities()) {
         return(context.CounterValue.ToList());
     }
 }
コード例 #7
0
 public List <PersonalAccount> GetAllPersonalAccounts()
 {
     using (var context = new CountersEntities()) {
         return(context.PersonalAccount.ToList());
     }
 }
コード例 #8
0
 public List <CounterOptions> GetAllCounterOptionses()
 {
     using (var context = new CountersEntities()) {
         return(context.CounterOptions.ToList());
     }
 }