Exemplo n.º 1
0
 // GET: Employee
 public ActionResult Index(int page = 1)
 {
     var data = dbContext.CatagoryBills.OrderBy(x => x.NameCatagory).Skip((page - 1)*PageSize).Take(PageSize).ToList();
     int totalPages = (int)Math.Ceiling((decimal)dbContext.CatagoryBills.Count() / PageSize);
     ListPersonViewModel<CatagoryBill> list = new ListPersonViewModel<CatagoryBill> { listPerson = data, TotalPages = totalPages };
     return Json(list, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 2
0
 // GET: Employee
 public ActionResult GetListCust(int page = 1)
 {
     var data = dbContext.Persons.OfType<Partner>().Where(x => ((Partner)x).Type == TypePartner.Customer)
         .OrderBy(x => x.Name).Skip((page - 1)*PageSize).Take(PageSize).ToList();
     int totalPages = (int)Math.Ceiling((decimal)dbContext.Persons.OfType<Partner>().Where(x => ((Partner)x).Type == TypePartner.Customer).Count() / PageSize);
     ListPersonViewModel<Partner> list = new ListPersonViewModel<Partner> { listPerson = data, TotalPages = totalPages };
     return Json(list, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 3
0
 public ActionResult List()
 {
     return(View(ListPersonViewModel.GetAll()));
 }
Exemplo n.º 4
0
 public ActionResult Index(int page = 1)
 {
     IEnumerable<Employee> empList = dbContext.Persons.OfType<Employee>().OrderBy(x => x.Name).Skip(PageSize*(page - 1)).Take(PageSize).ToList();
     int totalPages = (int)Math.Ceiling((decimal)dbContext.Persons.OfType<Employee>().Count() / PageSize);
     ListPersonViewModel<Employee> data = new ListPersonViewModel<Employee> { listPerson = empList, TotalPages = totalPages };
     return Json(data, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 5
0
 public ActionResult GetListRec(int page = 1)
 {
     var data = dbContext.Bills.Where(x => x.Type == TypeBill.Receipt).Include(x => x.Person).Include(x => x.CatagoryBill)
          .OrderBy(x => x.DateBill).Skip((page - 1) * PageSize).Take(PageSize).ToList();
     int totalPages = (int)Math.Ceiling((decimal)dbContext.Bills.Where(x => x.Type == TypeBill.Receipt).Count() / PageSize);
     foreach (var item in data)
     {
         if (item.CatagoryBill != null)
         {
             item.CatagoryBill.Bills = null;
         }
         if (item.Person != null)
         {
             item.Person.Bills = null;
         }
     }
     ListPersonViewModel<Bill> list = new ListPersonViewModel<Bill> { TotalPages = totalPages, listPerson = data };
     return Json(list, JsonRequestBehavior.AllowGet);
 }