Beispiel #1
0
        public ActionResult GetList(JQueryDataTableParamModel param)
        {
            ClientService clientService = new ClientService();

            var allClients = clientService.GetAllExposeDto();

            IEnumerable<ClientDto> filteredClients;

            if (!string.IsNullOrEmpty(param.sSearch))
            {
                //Used if particulare columns are filtered
                var clientIdFilter = Convert.ToString(Request["sSearch_1"]);

                //Optionally check whether the columns are searchable at all
                var isClientIdSearchable = Convert.ToBoolean(Request["bSearchable_1"]);

                filteredClients = allClients
                   .Where(c => isClientIdSearchable && c.Name != null && c.Name.ToLower().Contains(param.sSearch.ToLower()));
            }
            else
            {
                filteredClients = allClients;
            }

            var isClientIdSortable = Convert.ToBoolean(Request["bSortable_1"]);
            var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]);
            Func<ClientDto, string> orderingFunction = (c => sortColumnIndex == 1 && isClientIdSortable ? c.ClientId.ToString() :
                                                          "");

            var sortDirection = Request["sSortDir_0"]; // asc or desc
            if (sortDirection == "asc")
                filteredClients = filteredClients.OrderBy(orderingFunction);
            else
                filteredClients = filteredClients.OrderByDescending(orderingFunction);

            IEnumerable<ClientDto> displayedClients;

            if (param.iDisplayLength != -1)
                displayedClients = filteredClients.Skip(param.iDisplayStart).Take(param.iDisplayLength);
            else
                displayedClients = filteredClients;

            var result = from c in displayedClients
                         select new[]
                              {
                                  c.Id.ToString(),
                                  c.IsActive,
                                  c.ClientId,
                                  c.ClientName,
                                  c.ShortName,
                                  c.AddressLine1,
                                  c.AddressLine2,
                                  c.City,
                                  c.State,
                                  c.Postcode,
                                  c.EDINo,
                                  c.Mfrid,
                                  c.NextPack,
                                  c.EndPack,
                                  c.NextASN,
                                  c.SupplierNo,
                                  c.TaxNo,
                                  c.ABN,
                                  c.Phone,
                                  c.ClientContactEmail,
                                  c.AQRAMEmail,
                                  c.FreightforwarderEmail,
                                  c.Line.ToString(),
                                  c.EntryName,
                                  c.Import,
                                  c.ImportNote
                              };
            return Json(new
            {
                sEcho = param.sEcho,
                iTotalRecords = allClients.Count(),
                iTotalDisplayRecords = filteredClients.Count(),
                aaData = result
            },
                        JsonRequestBehavior.AllowGet);
        }
Beispiel #2
0
        public ActionResult GetListClients()
        {
            ClientService clientService = new ClientService();

            return Json(clientService.GetAllExposeDto().OrderBy(m => m.ClientName), JsonRequestBehavior.AllowGet);
        }
        public ActionResult Index()
        {
            ClientService clientService = new ClientService();
            PartnerService partnerService = new PartnerService();

            ClientPartnerModel model = new ClientPartnerModel();
            model.Clients = clientService.GetAllExposeDto().ToList();
            model.Partners = partnerService.GetAllExposeDto().ToList();
            return View(model);
        }