public List <Agregation> GetAgregations(PeriodType periodType, DateTime from, AgregationBy agregationBy) { var data = _db.SimpleGet("Agregations", _reflectionHelper.GetPropNames(typeof(Agregation)), new Dictionary <string, object> { { nameof(Agregation.PeriodType), periodType }, { nameof(Agregation.AgregationBy), agregationBy }, { nameof(Agregation.PeriodStart), from } }, new Filter { Comparison = Comparison.Equal, Name = nameof(Agregation.PeriodType) }, new Filter { Comparison = Comparison.Equal, Name = nameof(Agregation.AgregationBy) }, new Filter { Comparison = Comparison.GreaterThan, Name = nameof(Agregation.PeriodStart) }); var agregations = new List <Agregation>(); foreach (var item in data.Rows.OfType <DataRow>()) { var agrr = this.getFromDbRow(item); agrr.PeriodStart = item.Field <DateTime>("PeriodStart"); agrr.PeriodType = item.Field <PeriodType>("PeriodType"); agrr.Tag = item.Field <string>("Tag"); agrr.AgregationBy = item.Field <AgregationBy>("AgregationBy"); agrr.Id = item.Field <int>("Id"); agregations.Add(agrr); } return(agregations); }
public Customer Get(int id) { var data = _db.SimpleGet("Customers", _reflectionHelper.GetPropNames(typeof(Customer)), new Dictionary <string, object> { { "Id", id } }, new Filter { Comparison = Comparison.Equal, Name = "Id" }); if (data.Rows.Count == 0) { return(null); } return(this.getFromDbRow(data.Rows[0])); }
public Account Get(string username) { var data = _db.SimpleGet(_accountTable, _reflectionHelper.GetPropNames(typeof(Account)), new Dictionary <string, object> { { nameof(Account.Username), username } }, new Filter { Comparison = Comparison.Equal, Name = nameof(Account.Username) }); if (data.Rows.Count == 0) { return(null); } return(this.getFromRow(data.Rows[0])); }
public ItemCategory GetCategory(int id) { var data = _db.SimpleGet("ItemCategories", _reflectionHelper.GetPropNames(typeof(ItemCategory)), new Dictionary <string, object> { { "Id", id } }, new Filter { Comparison = Comparison.Equal, Name = "Id" }); return(data.Rows.Count > 0 ? this.getFromDbRow(data.Rows[0]) : null); }