Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateVenueDetailsAsync(Guid id, [FromBody] VenueInventoryDTO ReplacementVenueDetail)
        {
            Guard.Against.NullItem <VenueInventoryDTO>(ReplacementVenueDetail);

            //===============Initialize Objects==================================================
            VenueDetail UpdatedVenueDetail = new VenueDetail
            {
                VenueName        = ReplacementVenueDetail.VenueName,
                VenueState       = ReplacementVenueDetail.VenueState,
                VenueCity        = ReplacementVenueDetail.VenueCity,
                ContactNumber    = ReplacementVenueDetail.ContactNumber,
                InventoryDetails = new InventoryDetail
                {
                    AirConditioningType             = ReplacementVenueDetail.AirConditioningType,
                    Description                     = ReplacementVenueDetail.Description,
                    HourlyRate                      = ReplacementVenueDetail.HourlyRate,
                    IsCoffeeVendingMachineAvailable = ReplacementVenueDetail.IsCoffeeVendingMachineAvailable,
                    IsFoodVendingMachineAvailable   = ReplacementVenueDetail.IsFoodVendingMachineAvailable,
                    IsWaterVendingMachineAvailable  = ReplacementVenueDetail.IsWaterVendingMachineAvailable,
                    NumberOfMicroPhones             = ReplacementVenueDetail.NumberOfMicroPhones,
                    NumberOfPhones                  = ReplacementVenueDetail.NumberOfPhones,
                    NumberOfProjectors              = ReplacementVenueDetail.NumberOfProjectors,
                    RoomType            = ReplacementVenueDetail.RoomType,
                    SeatCapacity        = ReplacementVenueDetail.SeatCapacity,
                    WirelessNetworkType = ReplacementVenueDetail.WirelessNetworkType,
                }
            };

            //====================Update now into the database=======================
            await _venueService.UpdateVenueDetailAsync(id, UpdatedVenueDetail);

            return(Ok(new { message = $"Venue {id} updated successfully" }));
        }
Ejemplo n.º 2
0
        public async Task UpdateVenueDetailAsync(Guid VenueID, VenueDetail ReplacementVenueDetail)
        {
            try
            {
                VenueDetail venueDetailTobeUpdated = await _venueInventoryRepository.GetByIdAsync(VenueID);

                Guard.Against.NullItem <VenueDetail>(venueDetailTobeUpdated);

                //==============================Setting all new and updated properties=====================================================
                venueDetailTobeUpdated.VenueName  = ReplacementVenueDetail.VenueName;
                venueDetailTobeUpdated.VenueCity  = ReplacementVenueDetail.VenueCity;
                venueDetailTobeUpdated.VenueState = ReplacementVenueDetail.VenueState;
                venueDetailTobeUpdated.InventoryDetails.AirConditioningType             = ReplacementVenueDetail.InventoryDetails.AirConditioningType;
                venueDetailTobeUpdated.InventoryDetails.Description                     = ReplacementVenueDetail.InventoryDetails.Description;
                venueDetailTobeUpdated.InventoryDetails.HourlyRate                      = ReplacementVenueDetail.InventoryDetails.HourlyRate;
                venueDetailTobeUpdated.InventoryDetails.IsCoffeeVendingMachineAvailable = ReplacementVenueDetail.InventoryDetails.IsCoffeeVendingMachineAvailable;
                venueDetailTobeUpdated.InventoryDetails.IsFoodVendingMachineAvailable   = ReplacementVenueDetail.InventoryDetails.IsFoodVendingMachineAvailable;
                venueDetailTobeUpdated.InventoryDetails.IsWaterVendingMachineAvailable  = ReplacementVenueDetail.InventoryDetails.IsWaterVendingMachineAvailable;
                venueDetailTobeUpdated.InventoryDetails.NumberOfMicroPhones             = ReplacementVenueDetail.InventoryDetails.NumberOfMicroPhones;
                venueDetailTobeUpdated.InventoryDetails.NumberOfPhones                  = ReplacementVenueDetail.InventoryDetails.NumberOfPhones;
                venueDetailTobeUpdated.InventoryDetails.RoomType            = ReplacementVenueDetail.InventoryDetails.RoomType;
                venueDetailTobeUpdated.InventoryDetails.SeatCapacity        = ReplacementVenueDetail.InventoryDetails.SeatCapacity;
                venueDetailTobeUpdated.InventoryDetails.NumberOfProjectors  = ReplacementVenueDetail.InventoryDetails.NumberOfProjectors;
                venueDetailTobeUpdated.InventoryDetails.WirelessNetworkType = ReplacementVenueDetail.InventoryDetails.WirelessNetworkType;

                await _venueInventoryRepository.UpdateAsync(venueDetailTobeUpdated);
            }
            catch (Exception)
            {
                throw;
            }
        }
 public static Venue ToVenue(this VenueDetail venueDetail)
 {
     return(new Venue(
                venueDetail.VenueID,
                venueDetail.VenueName,
                venueDetail.VenueAddress.ToAddess(),
                venueDetail.Website,
                0.0f));
 }
Ejemplo n.º 4
0
        public async Task <IActionResult> AddVenueDetailsAsync([FromBody] VenueInventoryDTO VenueInventoryDTO)
        {
            Guard.Against.NullItem <VenueInventoryDTO>(VenueInventoryDTO);

            //===============Initialize Objects==================================================
            Guid venueID     = Guid.NewGuid();
            Guid inventoryID = Guid.NewGuid();

            VenueDetail venueDetail = new VenueDetail
            {
                VenueID          = venueID,
                VenueName        = VenueInventoryDTO.VenueName,
                VenueCity        = VenueInventoryDTO.VenueCity,
                VenueState       = VenueInventoryDTO.VenueState,
                ContactNumber    = VenueInventoryDTO.ContactNumber,
                IsActive         = true,
                InventoryDetails = new InventoryDetail
                {
                    VenueID                         = venueID,
                    InventoryID                     = inventoryID,
                    AirConditioningType             = VenueInventoryDTO.AirConditioningType,
                    Description                     = VenueInventoryDTO.Description,
                    HourlyRate                      = VenueInventoryDTO.HourlyRate,
                    IsCoffeeVendingMachineAvailable = VenueInventoryDTO.IsCoffeeVendingMachineAvailable,
                    IsFoodVendingMachineAvailable   = VenueInventoryDTO.IsFoodVendingMachineAvailable,
                    IsWaterVendingMachineAvailable  = VenueInventoryDTO.IsWaterVendingMachineAvailable,
                    NumberOfMicroPhones             = VenueInventoryDTO.NumberOfPhones,
                    NumberOfPhones                  = VenueInventoryDTO.NumberOfPhones,
                    NumberOfProjectors              = VenueInventoryDTO.NumberOfProjectors,
                    RoomType                        = VenueInventoryDTO.RoomType,
                    SeatCapacity                    = VenueInventoryDTO.SeatCapacity,
                    WirelessNetworkType             = VenueInventoryDTO.WirelessNetworkType
                }
            };

            //====================Insert now into the database=======================
            await _venueService.AddNewVenueAsync(venueDetail);

            return(StatusCode(201, new { message = $"Venue {venueDetail.VenueName} added successfully on {DateTime.Now.ToString("o")}." }));
        }
Ejemplo n.º 5
0
        public async Task <VenueInventoryViewModel> GetVenueByIdAsync(Guid VenueID)
        {
            try
            {
                VenueDetail selectedVenue = await _venueInventoryRepository.GetByIdAsync(VenueID);

                VenueInventoryViewModel selectedVenueDetails = new VenueInventoryViewModel
                {
                    VenueID                         = selectedVenue.VenueID,
                    VenueName                       = selectedVenue.VenueName,
                    AirConditioningType             = selectedVenue.InventoryDetails.AirConditioningType,
                    VenueState                      = selectedVenue.VenueState,
                    VenueCity                       = selectedVenue.VenueCity,
                    ContactNumber                   = selectedVenue.ContactNumber,
                    Description                     = selectedVenue.InventoryDetails.Description,
                    IsCoffeeVendingMachineAvailable = selectedVenue.InventoryDetails.IsCoffeeVendingMachineAvailable,
                    IsWaterVendingMachineAvailable  = selectedVenue.InventoryDetails.IsWaterVendingMachineAvailable,
                    WirelessNetworkType             = selectedVenue.InventoryDetails.WirelessNetworkType,
                    HourlyRate                      = selectedVenue.InventoryDetails.HourlyRate,
                    IsActive                        = selectedVenue.IsActive,
                    IsFoodVendingMachineAvailable   = selectedVenue.InventoryDetails.IsFoodVendingMachineAvailable,
                    NumberOfMicroPhones             = selectedVenue.InventoryDetails.NumberOfMicroPhones,
                    NumberOfPhones                  = selectedVenue.InventoryDetails.NumberOfPhones,
                    NumberOfProjectors              = selectedVenue.InventoryDetails.NumberOfProjectors,
                    RoomType                        = selectedVenue.InventoryDetails.RoomType,
                    SeatCapacity                    = selectedVenue.InventoryDetails.SeatCapacity,
                    VenueImages                     = selectedVenue.VenueImages
                };


                Guard.Against.NullItem <VenueDetail>(selectedVenue);
                return(selectedVenueDetails);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 6
0
        public async Task <bool> CheckVenueContactNumberAsync(string ContactNumber)
        {
            VenueDetail venuDetail = await _venueInventoryRepository.GetSingleBySpecAsync(p => p.ContactNumber == ContactNumber);

            return(venuDetail == null);
        }
Ejemplo n.º 7
0
 public async Task AddNewVenueAsync(VenueDetail NewVenueDetail)
 {
     await _venueInventoryRepository.AddAsync(NewVenueDetail);
 }
        /// <summary>
        /// Build CourseDetailOutput object from collection of Courses and CourseDetailInput.
        /// </summary>
        /// <param name="courses">Courses collection.</param>
        /// <param name="courseDetailInput">Original CourseDetailInput.</param>
        /// <returns>Populated CourseDetailOutput object.</returns>
        private static CourseDetailOutput BuildCourseDetailOutput(List <Course> courses, CourseDetailInput courseDetailInput)
        {
            CourseDetailOutput           courseDetailOutput     = new CourseDetailOutput();
            List <CourseDetailStructure> courseDetailStructures = new List <CourseDetailStructure>();

            foreach (Course course in courses)
            {
                // Get Course detail
                CourseDetailStructure courseDetailStructure = new CourseDetailStructure();

                courseDetailStructure.Course = new CourseDetail();

                courseDetailStructure.Course.CourseID                = course.CourseId.ToString();
                courseDetailStructure.Course.CourseTitle             = course.CourseTitle;
                courseDetailStructure.Course.CourseSummary           = course.CourseSummary;
                courseDetailStructure.Course.NoOfOpps                = course.NumberOfOpportunities.ToString();
                courseDetailStructure.Course.QualificationLevel      = course.QualificationLevel;
                courseDetailStructure.Course.QualificationType       = course.QualificationType;
                courseDetailStructure.Course.AccreditationEndDate    = course.AccreditationEndDate;
                courseDetailStructure.Course.AccreditationStartDate  = course.AccreditationStartDate;
                courseDetailStructure.Course.AdultLRStatus           = GetAdultLRStatus(course.AdultLRStatus);
                courseDetailStructure.Course.AssessmentMethod        = course.AssessmentMethod;
                courseDetailStructure.Course.AwardingBody            = course.AwardingBody;
                courseDetailStructure.Course.BookingURL              = course.BookingUrl;
                courseDetailStructure.Course.CertificationEndDate    = course.CertificationEndDate;
                courseDetailStructure.Course.CreditValue             = course.CreditValue;
                courseDetailStructure.Course.DataType                = GetDataType(course.DataType);
                courseDetailStructure.Course.ERAppStatus             = GetERAppStatus(course.ERAppStatus);
                courseDetailStructure.Course.ERTTGStatus             = GetERTtgStatus(course.ERTtgStatus);
                courseDetailStructure.Course.EntryRequirements       = course.EntryRequirements;
                courseDetailStructure.Course.EquipmentRequired       = course.EquipmentRequired;
                courseDetailStructure.Course.IndependentLivingSkills =
                    GetIndependentLivingSkills(course.IndependentLivingSkills);
                courseDetailStructure.Course.LADID = course.LadId;
                courseDetailStructure.Course.Level2EntitlementCategoryDesc = course.Level2EntitlementDescription;
                courseDetailStructure.Course.Level3EntitlementCategoryDesc = course.Level3EntitlementDescription;
                courseDetailStructure.Course.OtherFundingNonFundedStatus   =
                    GetOtherFundingNonFundedStatus(course.OtherFundingNonFundedStatus);
                courseDetailStructure.Course.QCAGuidedLearningHours          = course.QcaGuidedLearningHours;
                courseDetailStructure.Course.QualificationReference          = course.QualificationReference;
                courseDetailStructure.Course.QualificationReferenceAuthority = course.QualificationReferenceAuthority;
                courseDetailStructure.Course.QualificationTitle    = course.QualificationTitle;
                courseDetailStructure.Course.SkillsForLifeFlag     = GetSkillsForLifeFlag(course.SkillsForLifeFlag);
                courseDetailStructure.Course.SkillsForLifeTypeDesc = course.SkillsForLifeTypeDescription;
                courseDetailStructure.Course.TariffRequired        = course.TariffRequired;
                courseDetailStructure.Course.URL = course.Url;

                courseDetailStructure.Course.LDCS          = new LDCSOutputType();
                courseDetailStructure.Course.LDCS.CatCode1 = BuildLdcsInfoType(course.LdcsCode1, course.LdcsDesc1);
                courseDetailStructure.Course.LDCS.CatCode2 = BuildLdcsInfoType(course.LdcsCode2, course.LdcsDesc2);
                courseDetailStructure.Course.LDCS.CatCode3 = BuildLdcsInfoType(course.LdcsCode3, course.LdcsDesc3);
                courseDetailStructure.Course.LDCS.CatCode4 = BuildLdcsInfoType(course.LdcsCode4, course.LdcsDesc4);
                courseDetailStructure.Course.LDCS.CatCode5 = BuildLdcsInfoType(course.LdcsCode5, course.LdcsDesc5);

                // Get Povider detail
                courseDetailStructure.Provider = new ProviderDetail();
                if (course.Provider != null)
                {
                    courseDetailStructure.Provider.ProviderID           = course.Provider.ProviderId;
                    courseDetailStructure.Provider.ProviderName         = course.Provider.ProviderName;
                    courseDetailStructure.Provider.Phone                = course.Provider.Phone;
                    courseDetailStructure.Provider.Fax                  = course.Provider.Fax;
                    courseDetailStructure.Provider.Email                = course.Provider.Email;
                    courseDetailStructure.Provider.Website              = course.Provider.Website;
                    courseDetailStructure.Provider.UKPRN                = course.Provider.Ukprn;
                    courseDetailStructure.Provider.UPIN                 = course.Provider.Upin;
                    courseDetailStructure.Provider.TFPlusLoans          = course.Provider.TFPlusLoans;
                    courseDetailStructure.Provider.TFPlusLoansSpecified = true;

                    if (course.Provider.FEChoices_EmployerSatisfaction.HasValue)
                    {
                        courseDetailStructure.Provider.FEChoices_EmployerSatisfaction = course.Provider.FEChoices_EmployerSatisfaction.Value;
                    }
                    courseDetailStructure.Provider.FEChoices_EmployerSatisfactionSpecified = course.Provider.FEChoices_EmployerSatisfaction.HasValue;
                    if (course.Provider.FEChoices_LearnerSatisfaction.HasValue)
                    {
                        courseDetailStructure.Provider.FEChoices_LearnerSatisfaction = course.Provider.FEChoices_LearnerSatisfaction.Value;
                    }
                    courseDetailStructure.Provider.FEChoices_LearnerSatisfactionSpecified = course.Provider.FEChoices_LearnerSatisfaction.HasValue;
                    if (course.Provider.FEChoices_LearnerDestination.HasValue)
                    {
                        courseDetailStructure.Provider.FEChoices_LearnerDestination = course.Provider.FEChoices_LearnerDestination.Value;
                    }
                    courseDetailStructure.Provider.FEChoices_LearnerDestinationSpecified = course.Provider.FEChoices_LearnerDestination.HasValue;

                    courseDetailStructure.Provider.ProviderAddress = BuildAddressType(course.Provider.AddressLine1,
                                                                                      course.Provider.AddressLine2, course.Provider.Town, course.Provider.County, course.Provider.Postcode);
                }

                // Get Opportunity detail
                List <OpportunityDetail> opportunityDetails = new List <OpportunityDetail>();
                foreach (Opportunity opportunity in course.Opportunities)
                {
                    OpportunityDetail opportunityDetail = new OpportunityDetail();

                    opportunityDetail.AttendanceMode    = opportunity.AttendanceMode;
                    opportunityDetail.AttendancePattern = opportunity.AttendancePattern;

                    opportunityDetail.Duration = new DurationType();
                    opportunityDetail.Duration.DurationDescription = opportunity.DurationDescription;
                    opportunityDetail.Duration.DurationUnit        = opportunity.DurationUnit;

                    if (opportunity.DurationValue != 0)
                    {
                        opportunityDetail.Duration.DurationValue = opportunity.DurationValue.ToString();
                    }

                    opportunityDetail.Price     = opportunity.Price;
                    opportunityDetail.PriceDesc = opportunity.PriceDescription;
                    opportunityDetail.StudyMode = opportunity.StudyMode;
                    opportunityDetail.Timetable = opportunity.Timetable;

                    opportunityDetail.StartDate = BuildStartDateType(opportunity);
                    //opportunityDetail.StartDate = new StartDateType();
                    //opportunityDetail.StartDate.ItemElementName = ItemChoiceType.Date;
                    //opportunityDetail.StartDate.Item = opportunity.StartDate;

                    //opportunityDetail.StartDate = new StartDateType();
                    //opportunityDetail.StartDate.ItemElementName = ItemChoiceType.DateDesc;
                    //opportunityDetail.StartDate.Item = opportunity.StartDateDescription;

                    opportunityDetail.ApplicationAcceptedThroughoutYear =
                        GetApplicationAcceptedThroughoutYear(opportunity.ApplicationAcceptedThroughoutYear);
                    opportunityDetail.ApplyFromDate         = opportunity.ApplyFromDate;
                    opportunityDetail.ApplyTo               = opportunity.ApplyTo;
                    opportunityDetail.ApplyUntilDate        = opportunity.ApplyUntilDate;
                    opportunityDetail.ApplyUntilDesc        = opportunity.ApplyUntilDescription;
                    opportunityDetail.EndDate               = opportunity.EndDate;
                    opportunityDetail.EnquireTo             = opportunity.EnquireTo;
                    opportunityDetail.LanguageOfAssessment  = opportunity.LanguageOfAssessment;
                    opportunityDetail.LanguageOfInstruction = opportunity.LanguageOfInstruction;
                    opportunityDetail.PlacesAvailable       = opportunity.PlacesAvailable.ToString();
                    opportunityDetail.ProviderOpportunityId = opportunity.ProviderOpportunityId;
                    opportunityDetail.URL = opportunity.Url;
                    opportunityDetail.A10 = opportunity.A10.ToArray();

                    List <String>          items     = new List <String>();
                    List <ItemsChoiceType> itemNames = new List <ItemsChoiceType>();

                    if (opportunity.VenueId != 0 && String.IsNullOrWhiteSpace(opportunity.RegionName))
                    {
                        items.Add(opportunity.VenueId.ToString());
                        itemNames.Add(ItemsChoiceType.VenueID);
                    }
                    if (!String.IsNullOrWhiteSpace(opportunity.RegionName))
                    {
                        items.Add(opportunity.RegionName);
                        itemNames.Add(ItemsChoiceType.RegionName);
                    }

                    opportunityDetail.Items            = items.ToArray();
                    opportunityDetail.ItemsElementName = itemNames.ToArray();

                    opportunityDetail.OpportunityId = opportunity.OpportunityId;

                    opportunityDetails.Add(opportunityDetail);
                }

                courseDetailStructure.Opportunity = opportunityDetails.ToArray();

                // Get Venue details
                List <VenueDetail> venueDetails = new List <VenueDetail>();

                foreach (Venue venue in course.Venues)
                {
                    VenueDetail venueDetail = new VenueDetail();

                    venueDetail.VenueID      = venue.VenueId.ToString();
                    venueDetail.VenueName    = venue.VenueName;
                    venueDetail.Phone        = venue.Phone;
                    venueDetail.Email        = venue.Email;
                    venueDetail.Facilities   = venue.Facilities;
                    venueDetail.Fax          = venue.Fax;
                    venueDetail.Website      = venue.Website;
                    venueDetail.VenueAddress =
                        BuildAddressType(venue.AddressLine1, venue.AddressLine2, venue.Town, venue.County, venue.Postcode, venue.Latitude, venue.Longitude);

                    venueDetails.Add(venueDetail);
                }

                courseDetailStructure.Venue = venueDetails.ToArray();

                courseDetailStructures.Add(courseDetailStructure);
            }

            courseDetailOutput.CourseDetails = courseDetailStructures.ToArray();

            // Get original Request details
            courseDetailOutput.RequestDetails = new CourseDetailRequestStructure
            {
                CourseID = courseDetailInput.CourseID,
                APIKey   = courseDetailInput.APIKey
            };

            return(courseDetailOutput);
        }