/// <summary>
        /// Populates a Locations Object from a View Model Object's properties.
        /// </summary>
        ///
        ///
        /// <param name="newLocation"> A View Model Object from which to extract from </param>
        ///
        ///
        /// <returns> A Locations Object  </returns>
        public static Locations GetNewLocation(AllTablesViewModel newLocation)
        {
            if (newLocation is null)
            {
                return(null);
            }

            Locations location = new Locations();

            location.Address        = newLocation.Address;
            location.City           = newLocation.City;
            location.CoopLocationId = newLocation.CoopLocationId ?? null;
            location.Country        = newLocation.Country ?? null;
            location.County         = newLocation.County ?? null;
            location.Hours          = newLocation.Hours ?? null;
            location.Latitude       = newLocation.Latitude;
            location.LocationId     = newLocation.LocationId;
            location.LocationType   = ConvertLocationTypeEnumToString(newLocation.LocationType);
            location.Longitude      = newLocation.Longitude;
            location.Name           = newLocation.Name ?? null;
            location.PostalCode     = newLocation.PostalCode;
            location.RetailOutlet   = newLocation.RetailOutlet ?? null;
            location.SoftDelete     = string.Equals(BooleanEnumExtensions.GetDisplayName(newLocation.SoftDelete), "Yes") ? true : false;
            location.State          = newLocation.State.ToString();
            location.TakeCoopData   = string.Equals(BooleanEnumExtensions.GetDisplayName(newLocation.TakeCoopData), "Yes") ? true : false;
            return(location);
        }
        /// <summary>
        /// Populates a DailyHours Object from a View Model Object's properties.
        /// </summary>
        ///
        ///
        /// <param name="newLocation"> A View Model Object from which to extract from </param>
        ///
        ///
        /// <returns> A DailyHours Object or null if all properties are null </returns>
        public static DailyHours GetNewDailyHours(AllTablesViewModel newLocation)
        {
            if (newLocation is null)
            {
                return(null);
            }


            DailyHours dailyHours = new DailyHours();

            dailyHours.LocationId      = newLocation.LocationId;
            dailyHours.HoursDtfriClose = newLocation.HoursDtfriClose;
            dailyHours.HoursDtfriOpen  = newLocation.HoursDtfriOpen;
            dailyHours.HoursDtmonClose = newLocation.HoursDtmonClose;
            dailyHours.HoursDtmonOpen  = newLocation.HoursDtmonOpen;
            dailyHours.HoursDtsatClose = newLocation.HoursDtsatClose;
            dailyHours.HoursDtsatOpen  = newLocation.HoursDtsatOpen;
            dailyHours.HoursDtsunClose = newLocation.HoursDtsunClose;
            dailyHours.HoursDtsunOpen  = newLocation.HoursDtsunOpen;
            dailyHours.HoursDtthuClose = newLocation.HoursDtthuClose;
            dailyHours.HoursDtthuOpen  = newLocation.HoursDtthuOpen;
            dailyHours.HoursDttueClose = newLocation.HoursDttueClose;
            dailyHours.HoursDttueOpen  = newLocation.HoursDttueOpen;
            dailyHours.HoursDtwedClose = newLocation.HoursDtwedClose;
            dailyHours.HoursDtwedOpen  = newLocation.HoursDtwedOpen;
            dailyHours.HoursFriClose   = newLocation.HoursFriClose;
            dailyHours.HoursFriOpen    = newLocation.HoursFriOpen;
            dailyHours.HoursMonClose   = newLocation.HoursMonClose;
            dailyHours.HoursMonOpen    = newLocation.HoursMonOpen;
            dailyHours.HoursSatClose   = newLocation.HoursSatClose;
            dailyHours.HoursSatOpen    = newLocation.HoursSatOpen;
            dailyHours.HoursSunClose   = newLocation.HoursSunClose;
            dailyHours.HoursSunOpen    = newLocation.HoursSunOpen;
            dailyHours.HoursThuClose   = newLocation.HoursThuClose;
            dailyHours.HoursThuOpen    = newLocation.HoursThuOpen;
            dailyHours.HoursTueClose   = newLocation.HoursTueClose;
            dailyHours.HoursTueOpen    = newLocation.HoursTueOpen;
            dailyHours.HoursWedClose   = newLocation.HoursWedClose;
            dailyHours.HoursWedOpen    = newLocation.HoursWedOpen;


            if (dailyHours.AllPropertiesAreNull())
            {
                return(null);
            }


            return(dailyHours);
        }
        /// <summary>
        /// Populates a Contacts Object from a View Model Object's properties.
        /// </summary>
        ///
        ///
        /// <param name="newLocation"> A View Model Object from which to extract from </param>
        ///
        ///
        /// <returns> Null if all fields are null, otherwise returns a Contacts object </returns>
        public static Contacts GetNewContact(AllTablesViewModel newLocation)
        {
            if (newLocation is null)
            {
                return(null);
            }

            Contacts contact = new Contacts();

            contact.LocationId = newLocation.LocationId;
            contact.Phone      = newLocation.Phone;
            contact.Fax        = newLocation.Fax;
            contact.WebAddress = newLocation.WebAddress;


            if (contact.AllPropertiesAreNull())
            {
                return(null);
            }

            return(contact);
        }
        /// <summary>
        /// Populates a Special Qualities Object from a View Model Object's properties.
        /// </summary>
        ///
        ///
        /// <param name="newLocation"> A View Model Object from which to extract from </param>
        ///
        ///
        /// <returns> Null if all fields are empty, otherwise returns a Special Qualities Object  </returns>
        public static SpecialQualities GetNewSpecialQualities(AllTablesViewModel newLocation)
        {
            if (newLocation is null)
            {
                return(null);
            }

            SpecialQualities specialQuality = new SpecialQualities();

            specialQuality.AcceptCash          = ConvertBooleanEnumToString(newLocation.AcceptCash);
            specialQuality.AcceptDeposit       = ConvertBooleanEnumToString(newLocation.AcceptDeposit);
            specialQuality.Access              = ConvertBooleanEnumToString(newLocation.Access);
            specialQuality.AccessNotes         = newLocation.AccessNotes;
            specialQuality.Cashless            = ConvertBooleanEnumToString(newLocation.Cashless);
            specialQuality.DriveThruOnly       = ConvertBooleanEnumToString(newLocation.DriveThruOnly);
            specialQuality.EnvelopeRequired    = ConvertBooleanEnumToString(newLocation.EnvelopeRequired);
            specialQuality.HandicapAccess      = ConvertBooleanEnumToString(newLocation.HandicapAccess);
            specialQuality.InstallationType    = newLocation.InstallationType;
            specialQuality.LimitedTransactions = ConvertBooleanEnumToString(newLocation.LimitedTransactions);
            specialQuality.LocationId          = newLocation.LocationId;
            specialQuality.MilitaryIdRequired  = ConvertBooleanEnumToString(newLocation.MilitaryIdRequired);
            specialQuality.OnMilitaryBase      = ConvertBooleanEnumToString(newLocation.OnMilitaryBase);
            specialQuality.OnPremise           = ConvertBooleanEnumToString(newLocation.OnPremise);
            specialQuality.RestrictedAccess    = ConvertBooleanEnumToString(newLocation.RestrictedAccess);
            specialQuality.SelfServiceDevice   = ConvertBooleanEnumToString(newLocation.SelfServiceDevice);
            specialQuality.SelfServiceOnly     = ConvertBooleanEnumToString(newLocation.SelfServiceOnly);
            specialQuality.Surcharge           = ConvertBooleanEnumToString(newLocation.Surcharge);


            if (specialQuality.AllPropertiesAreNull())
            {
                return(null);
            }

            return(specialQuality);
        }