Пример #1
0
 private void GetLocations(List<KeyValuePair<object, object>> records)
 {
     var locationRequest = new ListOrgUnitsRequest();
     var orgUnits = _view.ProcessRequest<ListOrgUnitsResponse>(locationRequest).OrgUnits;
     foreach (var orgUnit in orgUnits)
         records.Add(new KeyValuePair<object, object>(orgUnit.Name, orgUnit.Id));
 }
        public static List<SubEntityRecord> GetLocationDropdownValues(ProviderAdminDetailView parent, int providerId)
        {
            IEnumerable<ProviderOrgUnitDto> existingLocations = new List<ProviderOrgUnitDto>();
            if (providerId != 0)
                existingLocations = GetProviderLocations(parent, providerId);

            var request = new ListOrgUnitsRequest();
            var orgUnits = parent.ProcessRequest<ListOrgUnitsResponse>(request).OrgUnits;
            var records = new List<SubEntityRecord>();

            foreach (var orgUnit in orgUnits.Where(o => !existingLocations.Any(e => e.OrgUnitId == o.Id)))
            {
                var record = new SubEntityRecord();
                record.DisplayName = orgUnit.Name;
                record.Id = orgUnit.Id;
                record.Fields.Add(new Field(_providerId, _providerId, FieldTypes.Hidden, providerId));
                record.Fields.Add(new Field(_orgUntiId, _orgUntiId, FieldTypes.Hidden, orgUnit.Id));
                record.Fields.Add(new Field(_orgUnitName, "Location Name", FieldTypes.Label, orgUnit.Name));
                record.Fields.Add(new Field(_isPrimary, "Is Primary", FieldTypes.Checkbox, false));
                record.Fields.Add(new Field(_phone, "Phone Number", FieldTypes.Text, null));
                record.Fields.Add(new Field(_fax, "Fax Number", FieldTypes.Text, null));
                record.Fields.Add(new Field(_isAcceptingNewPatients, "Is Accepting New Patients", FieldTypes.Checkbox, true));
                record.Fields.Add(new Field(_allowAppointmentRequests, "Allow Appointment Requests", FieldTypes.Checkbox, true));

                records.Add(record);
            }

            return records;
        }