public static SubEntity BuildSubEntity(RegistrationFormAdminDetailView parent, int templateId, string entityName)
        {
            var displayName = string.Empty;
            if (entityName == RegistrationFormAdminDetailView._registrationFormLeftColumn)
            {
                _columnId = 1;
                displayName = LeftColumn;
            }
            else
            {
                _columnId = 2;
                displayName = RightColumn;
            }

            _templateId = templateId;
            _subEntity = parent._viewModel.SubEntities.FirstOrDefault(s => s.EntityName == entityName);

            if (_subEntity == null)
                _subEntity = new SubEntity() { EntityName = entityName, DisplayName = displayName, CanAddExisting = true, CanCreateNew = true, CanDelete = true };
            else
                _subEntity.Records = new List<SubEntityRecord>();

            AddExistingRecords(parent, templateId);
            AddNewRecordTemplate(parent);

            return _subEntity;
        }
        internal static void Save(EventAdminDetailView parent, SubEntity subentity, int _eventId)
        {
            try
            {
                subentity.ErrorMessage = string.Empty;

                if (subentity.Records.Where(r => r.Action == null || r.Action == RecordActions.Added).Count() > 1)
                    throw new Exception("Only 1 Registration Form is allowed");

                foreach (var record in subentity.Records)
                {
                    int? formId;

                    if (record.Action == RecordActions.Deleted)
                        formId = null;
                    else
                        formId = record.Id;

                    var request = new UpdateEventDynamicFormRequest { EventId = _eventId, DynamicFormId = formId };
                    parent.ProcessRequest<UpdateEventDynamicFormResponse>(request);
                }
            }
            catch (Exception ex)
            {
                subentity.ErrorMessage = ex.Message;
                throw;
            }
        }
Пример #3
0
        public static List<int> GetEventTypesList(EventAdminDetailView parent, SubEntity subEntity)
        {
            var eventTypeIds = subEntity.Records.Where(e => e.Id > 0 && e.Action != RecordActions.Deleted).Select(e => e.Id).ToList();

            //Add any newly created topics
            var newTopics = subEntity.Records.Where(e => e.Action == RecordActions.New);
            foreach (var newTopic in newTopics)
            {
                var request = new AddEventTypeRequest()
                {
                    Name = CommonUtils.GetFieldValue(newTopic.Fields, _eventType),
                    IsEnabled = true
                };
                var response = parent.ProcessRequest<AddEventTypeResponse>(request);
                eventTypeIds.Add(response.Id);
            }

            if (eventTypeIds.Count <= 0)
            {
                const string errorMessage = "Event Type required";
                subEntity.ErrorMessage = errorMessage;
                throw new Exception(errorMessage);
            }

            return eventTypeIds;
        }
        public static SubEntity BuildLocationsSubEntity(ProviderAdminDetailView parent, int providerId)
        {
            _subEntity = parent._viewModel.SubEntities.FirstOrDefault(s => s.EntityName == ProviderAdminDetailView._providerOrgUnitSubEntity);

            if (_subEntity == null)
                _subEntity = new SubEntity() { EntityName = ProviderAdminDetailView._providerOrgUnitSubEntity, DisplayName = "Locations", CanAddExisting = true, CanDelete = true };
            else
                _subEntity.Records = new List<SubEntityRecord>();

            var providerOrgUnits = GetProviderLocations(parent, providerId);

            foreach (var providerOrgUnit in providerOrgUnits)
            {
                var record = new SubEntityRecord();

                record.Id = providerOrgUnit.Id;
                record.Fields.Add(new Field(_id, _id, FieldTypes.Hidden, providerOrgUnit.Id));
                record.Fields.Add(new Field(_providerId, _providerId, FieldTypes.Hidden, providerId));
                record.Fields.Add(new Field(_orgUntiId, _orgUntiId, FieldTypes.Hidden, providerOrgUnit.OrgUnitId));
                record.Fields.Add(new Field(_orgUnitName, "Location Name", FieldTypes.Label, providerOrgUnit.OrgUnitName));
                record.Fields.Add(new Field(_isPrimary, "Is Primary", FieldTypes.Checkbox, providerOrgUnit.IsPrimary));
                record.Fields.Add(new Field(_phone, "Phone Number", FieldTypes.Text, providerOrgUnit.DisplayPhone));
                record.Fields.Add(new Field(_fax, "Fax Number", FieldTypes.Text, providerOrgUnit.DisplayFax));
                record.Fields.Add(new Field(_isAcceptingNewPatients, "Is Accepting New Patients", FieldTypes.Checkbox, providerOrgUnit.IsAcceptingNewPatients));
                record.Fields.Add(new Field(_allowAppointmentRequests, "Allow Appointment Requests", FieldTypes.Checkbox, providerOrgUnit.AllowAppointmentRequests));

                record.SubEntities.Add(BuildInsurancesSubEntity(parent, providerOrgUnit));
                record.SubEntities.Add(BuildServicesSubEntity(parent, providerOrgUnit));
                record.SubEntities.Add(BuildHoursSubEntity(parent, providerOrgUnit));

                _subEntity.Records.Add(record);
            }

            return _subEntity;
        }
Пример #5
0
        public static void Save(ProviderAdminDetailView parent, SubEntity providerTypes, int providerId)
        {
            try
            {
                providerTypes.ErrorMessage = string.Empty;

                //Existing Records Added
                foreach (var record in providerTypes.Records.Where(r => r.Action == RecordActions.Added))
                {
                    var request = new AddProviderProviderTypeRequest()
                    {
                        ProviderId = providerId,
                        ProviderTypeId = int.Parse(parent.GetFieldValue(record.Fields, _providerTypeId))
                    };

                    parent.ProcessRequest<AddProviderProviderTypeResponse>(request);
                }

                //New Records Created
                foreach (var record in providerTypes.Records.Where(r => r.Action == RecordActions.New))
                {
                    //Add New Provider Type
                    var addTypeRequest = new AddProviderTypeRequest()
                    {
                        Name = parent.GetFieldValue(record.Fields, _providerTypeName),
                        IsEnabled = true
                    };
                    var addedTypeId = parent.ProcessRequest<AddProviderTypeResponse>(addTypeRequest).Id;

                    //Add newly created type to provider
                    var request = new AddProviderProviderTypeRequest()
                    {
                        ProviderId = providerId,
                        ProviderTypeId = addedTypeId
                    };

                    parent.ProcessRequest<AddProviderProviderTypeResponse>(request);
                }

                //Deletes
                foreach (var record in providerTypes.Records.Where(r => r.Action == RecordActions.Deleted))
                {
                    var request = new DeleteProviderProviderTypeRequest()
                    {
                        ProviderId = providerId,
                        ProviderTypeId = int.Parse(parent.GetFieldValue(record.Fields, _providerTypeId))
                    };
                    parent.ProcessRequest<DeleteProviderProviderTypeResponse>(request);
                }
            }
            catch (Exception ex)
            {
                providerTypes.ErrorMessage = ex.Message;
                throw;
            }

            providerTypes = BuildProviderTypesSubEntity(parent, providerId);
        }
        public static void Save(EventAdminDetailView parent, SubEntity eventPrereqs, int eventId)
        {
            try
            {
                eventPrereqs.ErrorMessage = string.Empty;

                //Edits
                foreach (var record in eventPrereqs.Records.Where(r => r.Action == RecordActions.Edited))
                {
                    CheckRequiredFields(record);

                    var request = new UpdateEventPrerequisiteRequest
                    {
                        Id = int.Parse(parent.GetFieldValue(record.Fields, _id)),
                        EventId = eventId,
                        AssociatedEventId = int.Parse(parent.GetFieldValue(record.Fields, _associatedEventId)),
                        Description = parent.GetFieldValue(record.Fields, _prerequisiteDescription),
                        DisplayOrder = int.Parse(parent.GetFieldValue(record.Fields, _prerequisiteOrder))
                    };

                    parent.ProcessRequest<UpdateEventPrerequisiteResponse>(request);
                }

                //Existing Records Added
                foreach (var record in eventPrereqs.Records.Where(r => r.Action == RecordActions.Added))
                {
                    CheckRequiredFields(record);

                    var request = new AddEventPrerequisiteRequest
                        {
                            EventId = eventId,
                            AssociatedEventId = int.Parse(parent.GetFieldValue(record.Fields, _associatedEventId)),
                            Description = parent.GetFieldValue(record.Fields, _prerequisiteDescription),
                            DisplayOrder = int.Parse(parent.GetFieldValue(record.Fields, _prerequisiteOrder))
                        };
                    parent.ProcessRequest<AddEventPrerequisiteResponse>(request);
                }

                //Records Deleted
                foreach (var record in eventPrereqs.Records.Where(r => r.Action == RecordActions.Deleted))
                {
                    var request = new DeleteEventPrerequisiteRequest()
                    {
                        Id = int.Parse(parent.GetFieldValue(record.Fields, _id)),
                    };
                    parent.ProcessRequest<DeleteEventPrerequisiteResponse>(request);
                }
            }
            catch (Exception ex)
            {
                eventPrereqs.ErrorMessage = ex.Message;
                throw;
            }

            eventPrereqs = BuildSubEntity(parent, eventId);
        }
        public static void Save(ProviderAdminDetailView parent, SubEntity providerCertificationSpecialties, int providerId)
        {
            try
            {
                providerCertificationSpecialties.ErrorMessage = string.Empty;

                //Edits
                foreach (var record in providerCertificationSpecialties.Records.Where(r => r.Action == RecordActions.Edited))
                {
                    var yearOfIssuance = Validate(parent, record);

                    var request = new UpdateProviderCertificationSpecialtyRequest();

                    request.Id = int.Parse(parent.GetFieldValue(record.Fields, _id));
                    request.ProviderId = providerId;
                    request.CertificationSpecialtyId = int.Parse(parent.GetFieldValue(record.Fields, _certificationSpecialtyId));
                    request.YearOfIssuance = yearOfIssuance;

                    parent.ProcessRequest<UpdateProviderCertificationSpecialtyResponse>(request);
                }

                //Existing Records Added
                foreach (var record in providerCertificationSpecialties.Records.Where(r => r.Action == RecordActions.Added))
                {
                    var yearOfIssuance = Validate(parent, record);

                    var request = new AddProviderCertificationSpecialtyRequest()
                    {
                        ProviderId = providerId,
                        CertificationSpecialtyId = int.Parse(parent.GetFieldValue(record.Fields, _certificationSpecialtyId)),
                        YearOfIssuance = yearOfIssuance
                    };

                    parent.ProcessRequest<AddProviderCertificationSpecialtyResponse>(request);
                }

                //Deletes
                foreach (var record in providerCertificationSpecialties.Records.Where(r => r.Action == RecordActions.Deleted))
                {
                    var request = new DeleteProviderCertificationSpecialtyRequest()
                    {
                        ProviderId = providerId,
                        CertificationSpecialtyId = int.Parse(parent.GetFieldValue(record.Fields, _certificationSpecialtyId))
                    };
                    parent.ProcessRequest<DeleteProviderCertificationSpecialtyResponse>(request);
                }
            }
            catch (Exception ex)
            {
                providerCertificationSpecialties.ErrorMessage = ex.Message;
                throw;
            }

            providerCertificationSpecialties = BuildCertificationSubEntity(parent, providerId);
        }
        public static SubEntity BuildCertificationSubEntity(ProviderAdminDetailView parent, int providerId)
        {
            _subEntity = parent._viewModel.SubEntities.FirstOrDefault(s => s.EntityName == ProviderAdminDetailView._providerCertificationSubEntity);

            if (_subEntity == null)
                _subEntity = new SubEntity() { EntityName = ProviderAdminDetailView._providerCertificationSubEntity, DisplayName = "Board Certifications", CanAddExisting = true, CanDelete = true };
            else
                _subEntity.Records = new List<SubEntityRecord>();

            AddExistingRecords(parent, providerId);

            return _subEntity;
        }
        public static SubEntity BuildSubEntity(EventAdminDetailView parent, EventDto eventDto)
        {
            _subEntity = parent._viewModel.SubEntities.FirstOrDefault(s => s.EntityName == EventAdminDetailView._eventRegistrationFormSubEntity);

            if (_subEntity == null)
                _subEntity = new SubEntity() { EntityName = EventAdminDetailView._eventRegistrationFormSubEntity, DisplayName = "Registration Form", CanAddExisting = true, CanCreateNew = false, CanDelete = true };
            else
                _subEntity.Records = new List<SubEntityRecord>();

            AddExistingRecords(parent, eventDto);

            return _subEntity;
        }
Пример #10
0
        public static SubEntity BuildLocationSitesSubEntity(LocationAdminDetailView parent, OrgUnitDto orgUnitDto, SubEntity locationTypeSubEntity)
        {
            _subEntity = parent._viewModel.SubEntities.FirstOrDefault(s => s.EntityName == LocationAdminDetailView._locationTypeSubEntity);

            if (_subEntity == null)
                _subEntity = new SubEntity() { EntityName = LocationAdminDetailView._locationSiteSubEntity, DisplayName = "Site Association", CanAddExisting = false, CanCreateNew = false, CanDelete = false };
            else
                _subEntity.Records = new List<SubEntityRecord>();

            AddExistingRecords(orgUnitDto, locationTypeSubEntity);

            return _subEntity;
        }
Пример #11
0
        public static SubEntity BuildDirectUrlHistorySubEntity(ProviderAdminDetailView parent, int providerId)
        {
            _subEntity = parent._viewModel.SubEntities.FirstOrDefault(s => s.EntityName == ProviderAdminDetailView._directUrlHistorySubEntity);

            if (_subEntity == null)
                _subEntity = new SubEntity() { EntityName = ProviderAdminDetailView._directUrlHistorySubEntity, DisplayName = "Direct URL History", CanAddExisting = false, CanCreateNew = false, CanDelete = true };
            else
                _subEntity.Records = new List<SubEntityRecord>();

            AddExistingRecords(parent, providerId);

            return _subEntity;
        }
Пример #12
0
        public static SubEntity BuildSubEntity(EventAdminDetailView parent, int eventId)
        {
            _subEntity = parent._viewModel.SubEntities.FirstOrDefault(s => s.EntityName == EventAdminDetailView._eventOccurrencesSubEntity);

            if (_subEntity == null)
                _subEntity = new SubEntity() { EntityName = EventAdminDetailView._eventOccurrencesSubEntity, DisplayName = "Occurrences", CanAddExisting = false, CanCreateNew = false, CanDelete = false };
            else
                _subEntity.Records = new List<SubEntityRecord>();

            AddExistingRecords(parent, eventId);

            return _subEntity;
        }
Пример #13
0
        public static SubEntity BuildMemberBoardSubEntity(BoardCertificationsAdminDetailView parent, CertificationAgencyDto certificationAgencyDto)
        {
            _subEntity = parent._viewModel.SubEntities.FirstOrDefault(s => s.EntityName == BoardCertificationsAdminDetailView._memberBoardSubEntity);

            if (_subEntity == null)
                _subEntity = new SubEntity() { EntityName = BoardCertificationsAdminDetailView._memberBoardSubEntity, DisplayName = "Member Boards", CanCreateNew = true };
            else
                _subEntity.Records = new List<SubEntityRecord>();

            AddExistingRecords(parent, certificationAgencyDto);
            AddNewRecordTemplate(parent, certificationAgencyDto);

            return _subEntity;
        }
        public static SubEntity BuildSubEntity(OccurrencesAdminDetailView parent, int occurrenceId)
        {
            _subEntity = parent._viewModel.SubEntities.FirstOrDefault(s => s.EntityName == OccurrencesAdminDetailView._occurrenceManageDatesSubEntity);

            if (_subEntity == null)
                _subEntity = new SubEntity() { EntityName = OccurrencesAdminDetailView._occurrenceManageDatesSubEntity, DisplayName = "Manage Dates", CanAddExisting = false, CanCreateNew = true, CanDelete = true };
            else
                _subEntity.Records = new List<SubEntityRecord>();

            AddExistingRecords(parent, occurrenceId);
            AddNewRecordTemplate(parent, occurrenceId);

            return _subEntity;
        }
        public static SubEntity BuildLocationInsurancesSubEntity(LocationAdminDetailView parent, int orgUnitId)
        {
            _subEntity = parent._viewModel.SubEntities.FirstOrDefault(s => s.EntityName == LocationAdminDetailView._locationInsuranceSubEntity);

            if (_subEntity == null)
                _subEntity = new SubEntity() { EntityName = LocationAdminDetailView._locationInsuranceSubEntity, DisplayName = "Insurances", CanAddExisting = true, CanCreateNew = true, CanDelete = true };
            else
                _subEntity.Records = new List<SubEntityRecord>();

            AddExistingRecords(parent, orgUnitId);
            AddNewRecordTemplate(parent, orgUnitId);

            return _subEntity;
        }
        public static SubEntity BuildClinicalInterestSubEntity(ProviderAdminDetailView parent, int providerId)
        {
            _subEntity = parent._viewModel.SubEntities.FirstOrDefault(s => s.EntityName == ProviderAdminDetailView._providerClinicalInterestSubEntity);

            if (_subEntity == null)
                _subEntity = new SubEntity() { EntityName = ProviderAdminDetailView._providerClinicalInterestSubEntity, DisplayName = "Clinical Interests", CanAddExisting = true, CanCreateNew = true, CanDelete = true };
            else
                _subEntity.Records = new List<SubEntityRecord>();

            AddExistingRecords(parent, providerId);
            AddNewRecordTemplate(parent, providerId);

            return _subEntity;
        }
        public static void Save(OccurrencesAdminDetailView parent, SubEntity occurrenceDates, int occurrenceId)
        {
            try
            {
                occurrenceDates.ErrorMessage = string.Empty;

                //Existing Records Added
                foreach (var record in occurrenceDates.Records.Where(r => r.Action == RecordActions.New))
                {
                    var startDate = parent.GetFieldValue(record.Fields, _day);
                    var startTime = parent.GetFieldValue(record.Fields, _startTime);
                    var endTime = parent.GetFieldValue(record.Fields, _endTime);

                    var d = GetDateTime(startDate, "Date");
                    d = GetDateTime(d.ToShortDateString(), "Date");

                    var s = GetDateTime(startTime, "Start Time").TimeOfDay.TotalDays;
                    var e = GetDateTime(endTime, "End Time").TimeOfDay.TotalDays;

                    var requestStartDate = d.AddDays(s);
                    var requestEndDate = d.AddDays(e);

                    var request = new AddOccurrenceDateRequest
                    {
                        StartDate = requestStartDate,
                        EndDate = requestEndDate,
                        EventOccurrenceId = occurrenceId
                    };
                    parent.ProcessRequest<AddOccurrenceDateResponse>(request);
                }

                //Records Deleted
                foreach (var record in occurrenceDates.Records.Where(r => r.Action == RecordActions.Deleted))
                {
                    var request = new DeleteOccurrenceDateRequest
                    {
                        EventOccurrenceDateId = record.Id
                    };
                    parent.ProcessRequest<DeleteOccurrenceDateResponse>(request);
                }
            }
            catch (Exception ex)
            {
                occurrenceDates.ErrorMessage = ex.Message;
                throw;
            }
        }
Пример #18
0
        public static void Save(BoardCertificationsAdminDetailView parent, SubEntity memberBoards)
        {
            try
            {
                memberBoards.ErrorMessage = string.Empty;

                //Edits
                foreach (var record in memberBoards.Records.Where(r => r.Action == RecordActions.Edited))
                {
                    var request = new UpdateCertificationBoardRequest
                    {
                        Id = int.Parse(parent.GetFieldValue(record.Fields, _id)),
                        Name = parent.GetFieldValue(record.Fields, _boardName),
                        IsEnabled = bool.Parse(parent.GetFieldValue(record.Fields, _boardEnabled))
                    };
                    parent.ProcessRequest<UpdateCertificationBoardResponse>(request);
                }

                //New Records Created
                foreach (var record in memberBoards.Records.Where(r => r.Action == RecordActions.New))
                {
                    var addBoardRequest = new AddCertificationBoardRequest
                    {
                        Name = parent.GetFieldValue(record.Fields, _boardName),
                        IsEnabled = bool.Parse(parent.GetFieldValue(record.Fields, _boardEnabled)),
                        CertificationAgencyId = int.Parse(parent.GetFieldValue(record.Fields, _agencyId))
                    };
                    parent.ProcessRequest<AddCertificationBoardResponse>(addBoardRequest);
                }
            }
            catch (Exception ex)
            {
                memberBoards.ErrorMessage = ex.Message;
                throw;
            }

            foreach (var record in memberBoards.Records)
            {
                //Update Subentities for Record
                foreach (var subentity in record.SubEntities)
                {
                    if (subentity.EntityName == BoardCertificationsAdminDetailView._certificationSpecialtySubEntity)
                        SaveCertificationSpecialties(parent, subentity, int.Parse(parent.GetFieldValue(record.Fields, _id)));
                }
            }
        }
Пример #19
0
        public static void Save(LocationAdminDetailView parent, SubEntity hours, int orgUnitId)
        {
            var partiallySaved = false;

            try
            {
                hours.ErrorMessage = string.Empty;

                //New
                foreach (var record in hours.Records.Where(r => r.Action == RecordActions.New))
                {
                    var timeSpan = CommonUtils.CreateScheduleTimeSpan(parent.GetFieldValue(record.Fields, _dayField), parent.GetFieldValue(record.Fields, _openTime), parent.GetFieldValue(record.Fields, _closeTime));

                    var request = new AddOrgUnitScheduleRequest()
                    {
                        LocationId = int.Parse(parent.GetFieldValue(record.Fields, _orgUnitIdField)),
                        OpenTime = timeSpan.OpenTime,
                        OpenHours = timeSpan.OpenHours
                    };

                    parent.ProcessRequest<AddOrgUnitScheduleResponse>(request);
                    partiallySaved = true;
                }

                //Deletes
                foreach (var record in hours.Records.Where(r => r.Action == RecordActions.Deleted))
                {
                    var request = new DeleteOrgUnitScheduleRequest(int.Parse(parent.GetFieldValue(record.Fields, _idField)));
                    parent.ProcessRequest<DeleteOrgUnitScheduleResponse>(request);
                    partiallySaved = true;
                }
            }
            catch (Exception ex)
            {
                hours.ErrorMessage = ex.Message;

                if(!partiallySaved)
                    throw;
            }

            hours = BuildLocationHoursSubEntity(parent, orgUnitId);
        }
Пример #20
0
        public static void PopulateRequestFieldValues(LocationAdminDetailView parent, SubEntity sites, int orgUnitId, OrgUnitRequestBase request)
        {
            var record = sites.Records.SingleOrDefault(r => r.Action == RecordActions.Edited);

            if (record == null)
                return;

            request.CustomUrl = parent.GetFieldValue(record.Fields, _siteUrlField);
            request.CustomLiveUrl = parent.GetFieldValue(record.Fields, _siteUrlLiveField);
            request.CustomStageUrl = parent.GetFieldValue(record.Fields, _siteUrlStageField);
            request.CustomQaUrl = parent.GetFieldValue(record.Fields, _siteUrlQaField);
            request.CustomDevUrl = parent.GetFieldValue(record.Fields, _siteUrlDevField);

            // Determine if site association is enabled
            var associationEnabled = false;
            bool.TryParse(CommonUtils.GetFieldValue(record.Fields, _associationEnabledField), out associationEnabled);

            // Add/remove "Site" location type automatically if site association is enabled/disabled
            var locationTypeSubEntity = parent._viewModel.SubEntities.Single(s => s.EntityName == LocationAdminDetailView._locationTypeSubEntity);
            var hasSiteLocationType = HasSiteLocationType(locationTypeSubEntity);

            if (associationEnabled && !hasSiteLocationType)
            {
                var orgUnitType = new OrgUnitOrgUnitTypeDto
                {
                    OrgUnitTypeId = 1,
                    IsEnabled = true,
                    IsPrimaryOrgUnitType = false
                };

                var locationTypeRecord = LocationTypesHelper.CreateRecord(orgUnitType, orgUnitId);
                locationTypeRecord.Action = RecordActions.Added;
                locationTypeSubEntity.Records.Add(locationTypeRecord);
            }
            else if (!associationEnabled && hasSiteLocationType)
            {
                var siteLocationTypeRecord = locationTypeSubEntity.Records.SingleOrDefault(s => s.Fields.Any(f => f.FieldName == "Name" && (f.FieldValue as string == "Site")));

                if (siteLocationTypeRecord != null && siteLocationTypeRecord.Action != RecordActions.Added)
                    siteLocationTypeRecord.Action = RecordActions.Deleted;
            }
        }
Пример #21
0
        public static void Save(EventAdminDetailView parent, SubEntity eventContent, int eventId)
        {
            try
            {
                var record = eventContent.Records.FirstOrDefault(r => r.Action == RecordActions.Edited);

                if (record != null)
                {
                    var updateRequest = new UpdateEventContentRequest
                    {
                        EventId = eventId,
                        Content = parent.GetFieldValue(record.Fields, "Content")
                    };

                    parent.ProcessRequest<UpdateEventContentResponse>(updateRequest);
                }
            }
            catch (Exception ex)
            {
                eventContent.ErrorMessage = ex.Message;
                throw;
            }
        }
Пример #22
0
        public static void Save(ProviderAdminDetailView parent, SubEntity directUrls, int providerId)
        {
            try
            {
                directUrls.ErrorMessage = string.Empty;

                //Deletes
                foreach (var record in directUrls.Records.Where(r => r.Action == RecordActions.Deleted))
                {
                    var request = new DeleteDirectUrlHistoryRequest()
                    {
                        Id = int.Parse(parent.GetFieldValue(record.Fields, _id))
                    };
                    parent.ProcessRequest<DeleteDirectUrlHistoryResponse>(request);
                }
            }
            catch (Exception ex)
            {
                directUrls.ErrorMessage = ex.Message;
                throw;
            }

            directUrls = BuildDirectUrlHistorySubEntity(parent, providerId);
        }
Пример #23
0
        private static void SaveHours(ProviderAdminDetailView parent, SubEntity subentity)
        {
            try
            {
                //Deletes
                foreach (var record in subentity.Records.Where(r => r.Action == RecordActions.Deleted))
                {
                    var request = new DeleteProviderOrgUnitScheduleRequest()
                    {
                        ProviderOrgUnitScheduleId = int.Parse(parent.GetFieldValue(record.Fields, _id))
                    };
                    var response = parent.ProcessRequest<DeleteProviderOrgUnitScheduleResponse>(request);
                }

                //New
                foreach (var record in subentity.Records.Where(r => r.Action == RecordActions.New))
                {
                    var timeSpan = CommonUtils.CreateScheduleTimeSpan(parent.GetFieldValue(record.Fields, "Day"), parent.GetFieldValue(record.Fields, "OpenTime"), parent.GetFieldValue(record.Fields, "CloseTime"));

                    var request = new AddProviderOrgUnitScheduleRequest()
                    {
                        ProviderOrgUnitId = int.Parse(parent.GetFieldValue(record.Fields, _providerOrgUnitId)),
                        TimeSpan = timeSpan
                    };
                    var response = parent.ProcessRequest<AddProviderOrgUnitScheduleResponse>(request);
                }
            }
            catch (Exception ex)
            {
                subentity.ErrorMessage = ex.Message;
                throw;
            }
        }
Пример #24
0
 private static bool HasSiteLocationType(SubEntity locationTypeSubEntity)
 {
     return (locationTypeSubEntity.Records.Any(r => r.Fields.Any(f => f.FieldName.Equals("Name", StringComparison.OrdinalIgnoreCase) && (f.FieldValue as string) == "Site")));
 }
Пример #25
0
        private static void AddExistingRecords(OrgUnitDto orgUnitDto, SubEntity locationTypeSubEntity)
        {
            var record = new SubEntityRecord();
            var fields = new List<Field>();

            var hasSiteLocationType = HasSiteLocationType(locationTypeSubEntity);

            fields.Add(new Field("PublicDomainUrlHeader", "", FieldTypes.Html, BuildPublicDomainUrlHeader()));
            fields.Add(new Field(_associationEnabledField, "Enable Site Association", FieldTypes.Checkbox, hasSiteLocationType) { OnChangeCommand = "ToggleSiteAssociation" });
            fields.Add(new Field(_siteUrlField, "Public Domain URL", FieldTypes.Text, orgUnitDto.CustomUrl) { IsDisabled = !hasSiteLocationType });
            fields.Add(new Field(_siteUrlLiveField, "Internal Live URL", FieldTypes.Text, orgUnitDto.CustomLiveUrl) { IsDisabled = !hasSiteLocationType });
            fields.Add(new Field(_siteUrlStageField, "Internal Stage URL", FieldTypes.Text, orgUnitDto.CustomStageUrl) { IsDisabled = !hasSiteLocationType });
            fields.Add(new Field(_siteUrlQaField, "Internal QA URL", FieldTypes.Hidden, orgUnitDto.CustomQaUrl));
            fields.Add(new Field(_siteUrlDevField, "Internal Dev URL", FieldTypes.Hidden, orgUnitDto.CustomDevUrl));

            record.Fields = fields;

            _subEntity.Records.Add(record);
        }
Пример #26
0
        private static SubEntity BuildServicesSubEntity(ProviderAdminDetailView parent, ProviderOrgUnitDto providerOrgUnit)
        {
            var subEntity = new SubEntity() { EntityName = ProviderAdminDetailView._providerOrgUnitServicesSubEntity, DisplayName = "Services", CanAddExisting = true, CanCreateNew = true, CanDelete = true };

            foreach (var service in providerOrgUnit.Service)
            {
                var record = new SubEntityRecord();

                record.Fields.Add(new Field(_serviceId, _serviceId, FieldTypes.Hidden, service.Id));
                record.Fields.Add(new Field("ServiceName", "Service Name", FieldTypes.Label, service.ServiceName));

                subEntity.Records.Add(record);
            }

            subEntity.NewRecordTemplate.Fields.Add(new Field(_providerOrgUnitId, _providerOrgUnitId, FieldTypes.Hidden, providerOrgUnit.Id));
            subEntity.NewRecordTemplate.Fields.Add(new Field("ServiceName", "Service Name", FieldTypes.Text, null, true) { Focus = true });

            return subEntity;
        }
        private SubEntity BuildReceiptPageSubEntity(AuthorizeDotNetSettingsDto settings)
        {
            var newRecord = (_configurationId == 0);
            var subEntity = new SubEntity() { EntityName = "ReceiptPage", DisplayName = "Design Receipt Page", CanAddExisting = false, CanCreateNew = false, CanDelete = false };
            var record = new SubEntityRecord();
            var fields = new List<Field>();

            var approvalMessage = newRecord ? Constants.DefaultValues.ReceiptApprovalMessage : settings.ApprovalMessage;
            fields.Add(new Field(_approvalMessage, "Approval Message", FieldTypes.Text, approvalMessage, false, null, Constants.Tooltips.ApprovalMessage));

            var declineMessage = newRecord ? Constants.DefaultValues.ReceiptDeclineMessage : settings.DeclineMessage;
            fields.Add(new Field(_declineMessage, "Decline Message", FieldTypes.Text, declineMessage, false, null, Constants.Tooltips.DeclineMessage));

            var errorMessage = newRecord ? Constants.DefaultValues.ReceiptErrorMessage : settings.ErrorMessage;
            fields.Add(new Field(_errorMessage, "Error Message", FieldTypes.Text, errorMessage, false, null, Constants.Tooltips.ErrorMessage));

            var partialPaymentMessage = newRecord ? Constants.DefaultValues.ReceiptPartialPaymentMessage : settings.PartialPaymentMessage;
            fields.Add(new Field(_partialPaymentMessage, "Partial Payment Message", FieldTypes.Text, partialPaymentMessage, false, null, Constants.Tooltips.PartialPaymentMessage));

            fields.Add(new Field(_urlBackToSite, "URL Back to Site", FieldTypes.Text, settings.ReceiptReturnUrl, false, null, Constants.Tooltips.UrlBackToSite));
            fields.Add(new Field(_textForBackToUrlBackToSite, "Text for the URL Back to Site", FieldTypes.Text, settings.ReceiptReturnText, false, null, Constants.Tooltips.TextForBackToUrlBackToSite));

            var receiptHtml = newRecord ? Constants.DefaultValues.ReceiptPage : settings.ReceiptHtml;
            fields.Add(new Field(_receiptEditor, "Receipt Editor", FieldTypes.WYSIWYG, receiptHtml, false, true));

            record.Fields = fields;

            subEntity.Records.Add(record);
            return subEntity;
        }
        private SubEntity BuildPaymentFormSubEntity(AuthorizeDotNetSettingsDto settings)
        {
            var subEntity = new SubEntity() { EntityName = "PaymentForm", DisplayName = "Payment Form Options", CanAddExisting = false, CanCreateNew = false, CanDelete = false };

            var record = new SubEntityRecord();
            var fields = new List<Field>();

            fields.Add(new Field(_header1, "Header 1", FieldTypes.MultiLineText, settings.HeaderOne, false, null, Constants.Tooltips.Header1));
            fields.Add(new Field(_header2, "Header 2", FieldTypes.MultiLineText, settings.HeaderTwo, false, null, Constants.Tooltips.Header2));
            fields.Add(new Field(_footer1, "Footer 1", FieldTypes.MultiLineText, settings.FooterOne, false, null, Constants.Tooltips.Footer1));
            fields.Add(new Field(_footer2, "Footer 2", FieldTypes.MultiLineText, settings.FooterTwo, false, null, Constants.Tooltips.Footer2));
            fields.Add(new Field(_policyUrl, "Policy URL", FieldTypes.Text, settings.PolicyUrl, false, null, Constants.Tooltips.PolicyUrl));
            fields.Add(new Field(_cancelUrl, "Cancel URL", FieldTypes.Text, settings.CancelUrl, false, null, Constants.Tooltips.CancelUrl));
            fields.Add(new Field(_cancelUrlText, "Cancel URL Text", FieldTypes.Text, settings.CancelUrlText, false, null, Constants.Tooltips.CancelUrlText));

            record.Fields = fields;

            subEntity.Records.Add(record);
            return subEntity;
        }
        private SubEntity BuildEmailConfirmationSubEntity(AuthorizeDotNetSettingsDto settings)
        {
            var subEntity = new SubEntity() { EntityName = "EmailConfirmation", DisplayName = "Email Confirmation", CanAddExisting = false, CanCreateNew = false, CanDelete = false };
            var record = new SubEntityRecord();
            var fields = new List<Field>();

            fields.Add(new Field(_emailConfirmation, "Email Confirmation", FieldTypes.Checkbox, settings.EmailConfirmation, false, null, Constants.Tooltips.EmailConfirmation));
            fields.Add(new Field(_emailHeader, "Email Header", FieldTypes.WYSIWYG, settings.EmailHeader, false, true, Constants.Tooltips.EmailHeader));
            fields.Add(new Field(_emailFooter, "Email Footer", FieldTypes.WYSIWYG, settings.EmailFooter, false, true, Constants.Tooltips.EmailFooter));

            record.Fields = fields;
            subEntity.Records.Add(record);
            return subEntity;
        }
Пример #30
0
        private static void SaveServices(ProviderAdminDetailView parent, SubEntity subentity, int providerOrgUnitId)
        {
            try
            {
                //New Records
                foreach (var record in subentity.Records.Where(r => r.Action == RecordActions.New))
                {
                    var addServiceRequest = new AddServiceRequest()
                    {
                        Name = parent.GetFieldValue(record.Fields, "ServiceName"),
                        IsEnabled = true
                    };
                    var serviceResponseId = parent.ProcessRequest<AddServiceResponse>(addServiceRequest).Id;

                    var request = new AddProviderOrgUnitServiceRequest()
                    {
                        ProviderOrgUnitId = providerOrgUnitId,
                        ServiceId = serviceResponseId
                    };
                    parent.ProcessRequest<AddProviderOrgUnitServiceResponse>(request);
                }

                //Added Records
                foreach (var record in subentity.Records.Where(r => r.Action == RecordActions.Added))
                {
                    var request = new AddProviderOrgUnitServiceRequest()
                    {
                        ProviderOrgUnitId = providerOrgUnitId,
                        ServiceId = int.Parse(parent.GetFieldValue(record.Fields, _serviceId))
                    };
                    parent.ProcessRequest<AddProviderOrgUnitServiceResponse>(request);
                }

                //Deletes
                foreach (var record in subentity.Records.Where(r => r.Action == RecordActions.Deleted))
                {
                    var request = new DeleteProviderOrgUnitServiceRequest()
                    {
                        ProviderOrgUnitId = providerOrgUnitId,
                        ServiceId = int.Parse(parent.GetFieldValue(record.Fields, _serviceId))
                    };
                    parent.ProcessRequest<DeleteProviderOrgUnitServiceResponse>(request);
                }
            }
            catch (Exception ex)
            {
                subentity.ErrorMessage = ex.Message;
                throw;
            }
        }