private void btnSearch_Click(object sender, EventArgs e) { var uow = new EFUnitOfWork(); var repo = uow.GetLogRepository(); var sortings = new List <SortDescriptor>(); if (!string.IsNullOrWhiteSpace(this.txtSortAsc.Text)) { sortings.Add(new SortDescriptor { Direction = SortDescriptor.SortingDirection.Ascending, Field = this.txtSortAsc.Text.Trim() }); } if (!string.IsNullOrWhiteSpace(this.txtSortDesc.Text)) { sortings.Add(new SortDescriptor { Direction = SortDescriptor.SortingDirection.Descending, Field = this.txtSortDesc.Text.Trim() }); } var result = repo.Find(GetSpecification(), int.Parse(this.txtPageIndex.Text), int.Parse(this.txtPageSize.Text), sortings, l => l.Level); this.dgvData.DataSource = result.Item1; this.lTotalCountValue.Text = result.Item2.ToString(); }
private void btnSearch_Click(object sender, EventArgs e) { var uow = new EFUnitOfWork(); var repo = uow.GetLogRepository(); var result = repo.Find(GetSpecification(), int.Parse(this.txtPageIndex.Text), int.Parse(this.txtPageSize.Text), new[] { this.txtSortAsc.Text }, new string[] { this.txtSortDesc.Text }, l => l.Level); this.dgvData.DataSource = result.Item1; this.lTotalCountValue.Text = result.Item2.ToString(); }
private void btnCreateTest_Click(object sender, EventArgs e) { var uow = new EFUnitOfWork(); var repo = uow.GetLogRepository(); repo.Create(new Log { LevelId = 1, Thread = "", Location = "Manual Creation", Message = "This is manually created log.", CreateTime = DateTimeOffset.Now, Date = DateTime.Now }); uow.Commit(); MessageBox.Show("New log created using unit of work pattern."); }