public JsonResult UserList(Guid AccountId, string Type, int StartIndex, int Length, string Search, int ColumnSort, string Direction)
        {
            int count, filteredCount;

            var userList = DataAccess.Account.GetAllAccountsLightWeight(StartIndex, Length, Search, ColumnSort, Direction, out count, out filteredCount).Select(x =>
            {
                return(new
                {
                    Username = x.Username,
                    FirstName = x.FirstName,
                    LastName = x.LastName,
                    EmailAddress = x.EmailAddress,
                    Status = x.Status,
                    Permissions = string.Join("<br/>", x.Permissions.Distinct().Select(kvp => string.Concat(kvp.PermissionDescription))),
                    ID = x.ID,
                    Age = x.Age,
                    IsForCurrentClient = x.Permissions.FirstOrDefault(p => p.GetClientId() == UserHelper.SelectedClientId) != null
                });
            }).Where(x => Type == "SuperAdmin" || x.IsForCurrentClient).ToList();


            Utilities.DataTableRequest dataTableRequest = Utilities.DataTableRequest.Parse(Request.Form);

            dataTableRequest.OverrideSearch        = true;
            dataTableRequest.OverrideCount         = count;
            dataTableRequest.OverrideFilteredCount = filteredCount;


            return(Json(
                       Utilities.DataTableJson(
                           dataTableRequest,
                           userList,
                           null,
                           x => x.Username, x => x.FirstName, x => x.LastName, x => x.EmailAddress, x => x.Status, x => x.Permissions, x => x.ID, x => x.Age), JsonRequestBehavior.AllowGet));
        }
        public JsonResult ListItemList()
        {
            Utilities.DataTableRequest dataTableRequest = Utilities.DataTableRequest.Parse(Request.Form);
            string orderColumn = new string[] { "ListName", "Name", "Description", "Code", "Value", "SortOrder" }[dataTableRequest.orderColumn];
            int    count, filteredCount;
            List <Data.Models.ListItem> list = DataAccess.ListItem.GetMaintenanceList(dataTableRequest.search, dataTableRequest.start, dataTableRequest.length, orderColumn, dataTableRequest.orderAscending, out count, out filteredCount);

            dataTableRequest.OverrideSearch        = true;
            dataTableRequest.OverrideCount         = count;
            dataTableRequest.OverrideFilteredCount = filteredCount;
            return(Json(
                       Utilities.DataTableJson(
                           dataTableRequest,
                           list.Select(li => new
            {
                ListName = li.FullListName,
                Name = li.Name,
                Description = li.Description,
                Code = li.Code,
                Value = li.Value,
                SortOrder = li.SortOrder,
                ID = li.ID,
                Age = li.Age
            }).ToList(),
                           null,
                           x => x.ListName, x => x.Name, x => x.Description, x => x.Code, x => x.Value, x => x.SortOrder, x => x.ID, x => x.Age)));
        }
Esempio n. 3
0
        public JsonResult DeceasedList()
        {
            Utilities.DataTableRequest dataTableRequest = Utilities.DataTableRequest.Parse(Request.Form);
            int count;

            Data.Models.Account act = UserHelper.GetCurrentAccount();

            string query = dataTableRequest.search;

            var result = _patientService.ListDeceasedPatients(act.Username, out count, (dataTableRequest.start / dataTableRequest.length) + 1, dataTableRequest.length, query, "Firstname", true);

            dataTableRequest.OverrideSearch        = true;
            dataTableRequest.OverrideCount         = count;
            dataTableRequest.OverrideFilteredCount = count;
            return(Json(
                       Utilities.DataTableJson(
                           dataTableRequest,
                           result.Select(x => new
            {
                FirstName = x.Firstname,
                LastName = x.Lastname,
                BirthDate = x.DateOfBirth.HasValue ? string.Format("{0} ({1})", x.DateOfBirth.Value.ToString("dd MMM yyyy"), Convert.ToInt32(DateTime.Now.Subtract(x.DateOfBirth.Value).TotalDays / 365)) : string.Empty,
                Gender = x.Gender == null ? string.Empty : x.Gender.Name,
                Race = x.Race == null ? string.Empty : x.Race.Name,
                MedicalScheme = x.MedicalScheme == null ? string.Empty : x.MedicalScheme.Name,
                IDNumber = x.Details == null ? string.Empty : x.Details.IdentificationNumber,
                GenderID = x.Gender == null ? string.Empty : x.Gender.Id.ToString(),
                RaceID = x.Race == null ? string.Empty : x.Race.Id.ToString(),
                Age = string.Empty,
                ID = x.Id,
                PatientId = x.Id.ToString("N"),
                Providers = string.Join(", ", x.TeamMembers.GroupBy(y => y.Facility.Id).Select(y => y.First().Facility.Name))
            }).ToList(),
                           null,
                           x => x.FirstName, x => x.LastName, x => x.BirthDate, x => x.Gender, x => x.Race, x => x.Providers, x => x.MedicalScheme, x => x.ID, x => x.Age, x => x.GenderID, x => x.RaceID, x => x.PatientId)));
        }