public override string ToString()
        {
            string accessibility, utilities;

            if (IsAccessible)
            {
                accessibility = "Yes";
            }
            else
            {
                accessibility = "No";
            }

            if (UtilitiesAreAvail)
            {
                utilities = "Yes";
            }
            else
            {
                utilities = "N/A";
            }

            return(SiteNumber.ToString().PadRight(15) + MaxOccupancy.ToString().PadRight(15) + accessibility.PadRight(15) +
                   MaxRVLength.ToString().PadRight(25) + utilities.PadRight(15));
        }
示例#2
0
        public string ToString(int lengthOfStay, bool parkwideSearch) //This ToString takes a boolean to determine if the search is parkwide or not.
        {
            string accessibleString = (Accessible == true) ? "Yes" : "No";

            string maxRvLength = (MaxRVLength > 0) ? MaxRVLength.ToString() : "N/A";

            string utilityString = (Utilities == true) ? "Yes" : "N/A";

            string baseString = $"{SiteID}".PadRight(10).PadLeft(5) + $"{MaxOccupancy}".PadRight(14) + $"{accessibleString}".PadRight(10) + $"{maxRvLength}".PadRight(12) + $"{utilityString}".PadRight(12) + $"{lengthOfStay * Cost:C}";

            string result;

            string shortenedCampgroundName;

            string parkwideAdditionString;

            if (parkwideSearch)
            {
                if (CampgroundName.ToString().Length > 22) //This statement adjusts the length of long campground names to protect formatting
                {
                    shortenedCampgroundName  = CampgroundName.ToString().Substring(0, 18);
                    shortenedCampgroundName += "...";
                    parkwideAdditionString   = $"{shortenedCampgroundName}".PadRight(25);
                }
                else
                {
                    parkwideAdditionString = $"{CampgroundName}".PadRight(25);
                }

                result = parkwideAdditionString + baseString;
            }

            else
            {
                result = baseString;
            }

            return(result);
        }
 public override string ToString()
 {
     return(SiteNumber.ToString().PadRight(10) + MaxOccupancy.ToString().PadRight(15) + Accessible.ToString().PadRight(15) + MaxRVLength.ToString().PadRight(15) + Utilities.ToString().PadRight(10));
 }
示例#4
0
文件: Site.cs 项目: MDMillen321/Mike
 public override string ToString()
 {
     return($"|{SiteNumber,8}|{MaxOccupancy,12}|{(IsAccessible? "Yes" : "No"),12}|{(MaxRVLength>0? MaxRVLength.ToString() : "N/A"),15}|{(Utilities?"Yes" : "No"),10}|");
 }
        //updates values of accessible, rv length, and utilities to be more user-friendly
        public override string ToString()
        {
            if (Accessible == "False")
            {
                Accessible = "No";
            }
            else if (Accessible == "True")
            {
                Accessible = "Yes";
            }

            if (Utilities == "False")
            {
                Utilities = "No";
            }
            else if (Utilities == "True")
            {
                Utilities = "Yes";
            }

            if (MaxRVLength == "0")
            {
                MaxRVLength = "N/A";
            }

            return(SiteId.ToString().PadRight(11) + MaxOccupancy.ToString().PadRight(13) + Accessible.PadRight(15) + MaxRVLength.PadRight(15) + Utilities.PadRight(11) + "$");
        }