public override string ToString() { List <string> list = new List <string> { Name, EmployerName.ToString(), EmployerLocation.ToString(), JobType.ToString(), JobCoreCompetency.ToString() }; for (int i = 0; i < list.Count; i++) { if (list[i] == "") { list[i] = "Data not available"; } } if (list[0] == "Data not available" && list[1] == "Data not available" && list[2] == "Data not available" && list[3] == "Data not available" && list[4] == "Data not available") { return("OOPS! This job does not seem to exist."); } else { return("" + "\n" + "ID: " + Convert.ToString(Id) + "\n" + "Name: " + list[0] + "\n" + "Employer: " + list[1] + "\n" + "Location: " + list[2] + "\n" + "Position Type: " + list[3] + "\n" + "Core Competency: " + list[4] + "\n" + ""); } }
// TODO: Generate Equals() and GetHashCode() methods. public override string ToString() { string stringId = Id.ToString(); string combinedJobListing = ""; Dictionary <string, string> fields = new Dictionary <string, string> { { "ID", stringId }, { "Name", Name }, { "Employer", EmployerName.ToString() }, { "Location", EmployerLocation.ToString() }, { "Position Type", JobType.ToString() }, { "Core Competency", JobCoreCompetency.ToString() }, }; foreach (KeyValuePair <string, string> field in fields) { string isFieldNull; if (field.Value == "") { isFieldNull = "Data not available"; } else { isFieldNull = field.Value; } combinedJobListing += field.Key + ": " + isFieldNull + System.Environment.NewLine; } return(System.Environment.NewLine + combinedJobListing); }
public override string ToString() { //if (Name == "") //{ // Name = "Data not available!"; //} //if (EmployerName.Value == "") //{ // EmployerName.Value = "Data not available!"; //} //if (EmployerLocation.Value == "") //{ // EmployerLocation.Value = "Data not available!"; //} //if (JobType.Value == "") //{ // JobType.Value = "Data not available!"; //} //if (JobCoreCompetency.Value == "") //{ // JobCoreCompetency.Value = "Data not available!"; //} return($"\n ID: {Id} \n Name: {Name} \n Employer: {EmployerName.ToString()} \n Location: {EmployerLocation.ToString()} \n Position Type: {JobType.ToString()} \n Core Competency: {JobCoreCompetency.ToString()} \n"); }
public override string ToString() { string dataNotAvlb = "Data not available"; string jobToString = ""; if ((Name == null || Name.Trim() == "") && (EmployerName == null || EmployerName.ToString().Trim() == "") && (EmployerLocation == null || EmployerLocation.ToString().Trim() == "") && (JobType == null || JobType.ToString().Trim() == "") && (JobCoreCompetency == null || JobCoreCompetency.ToString().Trim() == "")) { return("OOPS! This job does not seem to exist."); } jobToString += "ID: " + Id + "\n"; if (Name == null || Name.Trim() == "") { jobToString += "Name: " + dataNotAvlb + "\n"; } else { jobToString += "Name: " + Name + "\n"; } if (EmployerName == null || EmployerName.ToString().Trim() == "") { jobToString += "Employer: " + dataNotAvlb + "\n"; } else { jobToString += "Employer: " + EmployerName.ToString() + "\n"; } if (EmployerLocation == null || EmployerLocation.ToString().Trim() == "") { jobToString += "Location: " + dataNotAvlb + "\n"; } else { jobToString += "Location: " + EmployerLocation.ToString() + "\n"; } if (JobType == null || JobType.ToString().Trim() == "") { jobToString += "Position Type: " + dataNotAvlb + "\n"; } else { jobToString += "Position Type: " + JobType.ToString() + "\n"; } if (JobCoreCompetency == null || JobCoreCompetency.ToString().Trim() == "") { jobToString += "Core Competency: " + dataNotAvlb; } else { jobToString += "Core Competency: " + JobCoreCompetency.ToString() + "\n"; } return(jobToString); }
public override string ToString() { return("\n" + "ID: " + this.Id + "\nName: " + StringValidator(Name) + "\nEmployer: " + StringValidator(EmployerName.ToString()) + "\nLocation: " + StringValidator(EmployerLocation.ToString()) + "\nPosition Type: " + StringValidator(JobType.ToString()) + "\nCore Competency: " + StringValidator(JobCoreCompetency.ToString()) + "\n"); }
public override string ToString() { if (!(Equals(Name, "") && Equals(EmployerName.ToString(), "") && Equals(EmployerLocation.ToString(), "") && Equals(JobType.ToString(), "") && Equals(JobCoreCompetency.ToString(), ""))) { return("\n" + "ID: " + Id + "\n" + "Name: " + (Name != "" ? Name : "Data not available") + "\n" + "Employer: " + (EmployerName.ToString() != "" ? EmployerName.ToString() : "Data not available") + "\n" + "Location: " + (EmployerLocation.ToString() != "" ? EmployerLocation.ToString() : "Data not available") + "\n" + "Postion Type: " + (JobType.ToString() != "" ? JobType.ToString() : "Data not available") + "\n" + "Core Competency: " + (JobCoreCompetency.ToString() != "" ? JobCoreCompetency.ToString() : "Data not available") + "\n"); } else { return($"\nOOPS! This job does not seem to exist.\n"); } }
public override string ToString() { string result = "\n"; result += $"ID: {Id}\n"; if (Name.ToString() == "") { result += $"Name: Data not available\n"; } else { result += $"Name: {Name}\n"; } if (EmployerName.ToString() == "") { result += $"Employer: Data not available\n"; } else { result += $"Employer: {EmployerName}\n"; } if (EmployerLocation.ToString() == "") { result += $"Location: Data not available\n"; } else { result += $"Location: {EmployerLocation}\n"; } if (JobType.ToString() == "") { result += $"JobType: Data not available\n"; } else { result += $"Position Type: {JobType} \n"; } if (JobCoreCompetency.ToString() == null) { result += $"Core Competency: Data not available\n"; } else { result += $"Core Competency: {JobCoreCompetency}\n"; } return(result); }
public override string ToString() { string desc = $"_____\n" + $"ID: {Id}\n" + $"Name: {(!String.IsNullOrEmpty(Name) ? Name : "Data is not available") }\n" + $"Employer: {(!String.IsNullOrEmpty(EmployerName.ToString()) ? EmployerName.ToString() : "Data is not available") }\n" + $"Location: {(!String.IsNullOrEmpty(EmployerLocation.ToString()) ? EmployerLocation.ToString() : "Data is not available") }\n" + $"Position Type: {(!String.IsNullOrEmpty(JobType.ToString()) ? JobType.ToString() : "Data is not available") }\n" + $"Core Competency: {(!String.IsNullOrEmpty(JobCoreCompetency.ToString()) ? JobCoreCompetency.ToString() : "Data is not available") }\n" + $"_____"; return(desc); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append(Environment.NewLine); sb.Append("ID: ").Append(Id).Append(Environment.NewLine); sb.Append("Name: ").Append(Name).Append(Environment.NewLine); sb.Append("Employer: ").Append(EmployerName.ToString()).Append(Environment.NewLine); sb.Append("Location: ").Append(EmployerLocation.ToString()); sb.Append("Position Type: ").Append(JobType.ToString()).Append(Environment.NewLine); sb.Append("Core Competency: ").Append(JobCoreCompetency.ToString()).Append(Environment.NewLine); return(sb.ToString()); }
public override string ToString() { string emptyMessage = "Data not available"; string retMessage = "\n"; retMessage += "Id: " + Id + "\n"; retMessage += "Name: " + (Name != "" ? Name.ToString() : emptyMessage) + "\n"; retMessage += "Employer: " + (EmployerName.ToString() != "" ? EmployerName.ToString() : emptyMessage) + "\n"; retMessage += "Location: " + (EmployerLocation.ToString() != "" ? EmployerLocation.ToString() : emptyMessage) + "\n"; retMessage += "Position Type: " + (JobType.ToString() != "" ? JobType.ToString() : emptyMessage) + "\n"; retMessage += "Core Competency: " + (JobCoreCompetency.ToString() != "" ? JobCoreCompetency.ToString() : emptyMessage) + "\n"; return(retMessage); }
public override string ToString() { string empty = "Data not available"; if (Name == "") { Name = empty; } if (Name == empty && EmployerName.ToString() == empty && EmployerLocation.ToString() == empty && JobType.ToString() == empty && JobCoreCompetency.ToString() == empty) { return("_\nID: " + Id + "\nName: " + Name + "\nEmployer: " + EmployerName + "\nLocation: " + EmployerLocation + "\nPosition Type: " + JobType + "\nCore Competency: " + JobCoreCompetency + "\nOOPS! This job does not seem to exist." + "\n_"); } else { return("_\nID: " + Id + "\nName: " + Name + "\nEmployer: " + EmployerName + "\nLocation: " + EmployerLocation + "\nPosition Type: " + JobType + "\nCore Competency: " + JobCoreCompetency + "\n_"); } }
// TODO: Generate Equals() and GetHashCode() methods. public override string ToString() { string jobsInfo = "\n"; if (Name == "" && EmployerName.ToString() == "" && EmployerLocation.ToString() == "" && JobType.ToString() == "" && JobCoreCompetency.ToString() == "") { jobsInfo += "OOPS! This job does not seem to exist."; return(jobsInfo); } jobsInfo += $"ID: {Id}\n"; jobsInfo += $"Name: {(Name == ""? "Data not available" : Name)}\n"; jobsInfo += $"Employer: {(EmployerName.ToString() == "" ? "Data not available" : EmployerName.ToString())}\n"; jobsInfo += $"Location: {(EmployerLocation.ToString() == "" ? "Data not available" : EmployerLocation.ToString())}\n"; jobsInfo += $"Position Type: {(JobType.ToString() == "" ? "Data not available" : JobType.ToString())}\n"; jobsInfo += $"Core Competency: {(JobCoreCompetency.ToString() == "" ? "Data not available": JobCoreCompetency.ToString())}\n"; jobsInfo += "\n"; return(jobsInfo); }
public override string ToString() { string result = "\n"; result += $"\nID: {Id}"; if (string.IsNullOrEmpty(Name)) { result += "\nName: Data not available"; } else { result += $"\nName: {Name}"; } if (EmployerName is null || string.IsNullOrEmpty(EmployerName.ToString())) { result += "\nEmployer: Data not available"; }
// TODO: Generate Equals() and GetHashCode() methods. public override string ToString() { string errorMessage = "Data Not Available"; if (Name == "" || Name == null && EmployerName.ToString() == "" && EmployerLocation.ToString() == "" && JobType.ToString() == "" && JobCoreCompetency.ToString() == "") { return("OOPS! This job does not seem to exist."); } if (Name == null) { Name = errorMessage; } if (EmployerName.ToString() == "") { EmployerName = new Employer(errorMessage); } if (EmployerLocation.ToString() == "") { EmployerLocation = new Location(errorMessage); } if (JobType.ToString() == "") { JobType = new PositionType(errorMessage); } if (JobCoreCompetency.ToString() == "") { JobCoreCompetency = new CoreCompetency(errorMessage); } return("\n ID: " + Id + "\n Name: " + Name + "\n Employer: " + EmployerName + "\n Location: " + EmployerLocation + "\n Position Type: " + JobType + "\n Core Competency: " + JobCoreCompetency + "\n"); }
public override string ToString() { string notAvailable = "Data not available"; string message; if (Name == null && EmployerName == null && EmployerLocation == null && JobType == null && JobCoreCompetency == null) { message = "OOPS! This job does not seem to exist."; } else { message = "\n" + $"ID: {Id}\n" + $"Name: {(String.IsNullOrEmpty(Name.ToString()) ? notAvailable : Name.ToString())}\n" + $"Employer: {(String.IsNullOrEmpty(EmployerName.ToString()) ? notAvailable : EmployerName.ToString())}\n" + $"Location: {(String.IsNullOrEmpty(EmployerLocation.ToString()) ? notAvailable : EmployerLocation.ToString())}\n" + $"Position Type: {(String.IsNullOrEmpty(JobType.ToString()) ? notAvailable : JobType.ToString())}\n" + $"Core Competency: {(String.IsNullOrEmpty(JobCoreCompetency.ToString()) ? notAvailable : JobCoreCompetency.ToString())}\n" + "\n"; } return(message); }
public override string ToString() { StringBuilder jobString = new StringBuilder(); jobString.Append("\n"); if (!(Equals(Name, "") && Equals(EmployerName.ToString(), "") && Equals(EmployerLocation.ToString(), "") && Equals(JobType.ToString(), "") && Equals(JobCoreCompetency.ToString(), ""))) { jobString.Append("ID: ").Append(Id).Append("\n"); jobString.Append("Name: ").Append(Name != "" ? Name : "Data not available").Append("\n"); jobString.Append("Employer: ").Append(EmployerName.ToString() != "" ? EmployerName.ToString() : "Data not available").Append("\n"); jobString.Append("Location: ").Append(EmployerLocation.ToString() != "" ? EmployerLocation.ToString() : "Data not available").Append("\n"); jobString.Append("Position Type: ").Append(JobType.ToString() != "" ? JobType.ToString() : "Data not available").Append("\n"); jobString.Append("Core Competency: ").Append(JobCoreCompetency.ToString() != "" ? JobCoreCompetency.ToString() : "Data not available").Append("\n"); } else { jobString.Append("OOPS! This job does not seem to exist.").Append("\n"); } jobString.Append("\n"); return(jobString.ToString()); }
public override string ToString() { string dNoAvailable = "Data not Avalaible"; string stringLineBlank = ""; if ((Name == null || Name.ToString().Trim() == "") && (EmployerName == null || EmployerName.ToString().Trim() == "") && (EmployerLocation == null || EmployerLocation.ToString().Trim() == "") && (JobType == null || JobType.ToString().Trim() == "") && (JobCoreCompetency == null || JobCoreCompetency.ToString().Trim() == "")) { return("OOPS! This job does not seem to exist."); } stringLineBlank += "\nID: " + Id + "\n"; if (Name == null || Name.Trim() == "") { stringLineBlank += "Name: " + dNoAvailable + "\n"; } else { stringLineBlank += "Name: " + Name + "\n"; } if (EmployerName == null || EmployerName.ToString().Trim() == "") { stringLineBlank += "Employer: " + dNoAvailable + "\n"; } else { stringLineBlank += "Employer: " + EmployerName.ToString().Trim() + "\n"; } if (EmployerLocation == null || EmployerLocation.ToString().Trim() == "") { stringLineBlank += "Location: " + dNoAvailable + "\n"; } else { stringLineBlank += "Location: " + EmployerLocation.ToString().Trim() + "\n"; } if (JobType == null || JobType.ToString().Trim() == "") { stringLineBlank += "Position Type: " + dNoAvailable + "\n"; } else { stringLineBlank += "Position Type: " + JobType.ToString().Trim() + "\n"; } if (JobCoreCompetency == null || JobCoreCompetency.ToString().Trim() == "") { stringLineBlank += "Core Competency: " + dNoAvailable + "\n"; } else { stringLineBlank += "Core Competency: " + JobCoreCompetency.ToString().Trim() + "\n"; } return(stringLineBlank); }
public override string ToString() { string jobData = "\n"; for (int i = 0; i < 6; i++) { if (i == 0) { if (!String.IsNullOrEmpty(Id.ToString())) { jobData = jobData + "ID: " + Id.ToString() + "\n"; } else { jobData = jobData + "ID: Data not available" + "\n"; } } else if (i == 1) { if (!String.IsNullOrEmpty(Name)) { jobData = jobData + "Name: " + Name + "\n"; } else { jobData = jobData + "Name: Data not available" + "\n"; } } else if (i == 2) { if (!String.IsNullOrEmpty(EmployerName.ToString())) { jobData = jobData + "Employer: " + EmployerName.ToString() + "\n"; } else { jobData = jobData + "Employer: Data not available" + "\n"; } } else if (i == 3) { if (!String.IsNullOrEmpty(EmployerLocation.ToString())) { jobData = jobData + "Location: " + EmployerLocation.ToString() + "\n"; } else { jobData = jobData + "Location: Data not available" + "\n"; } } else if (i == 4) { if (!String.IsNullOrEmpty(JobType.ToString())) { jobData = jobData + "Position Type: " + JobType.ToString() + "\n"; } else { jobData = jobData + "Position Type: Data not available" + "\n"; } } else if (i == 5) { if (!String.IsNullOrEmpty(JobCoreCompetency.ToString())) { jobData = jobData + "Core Competency: " + JobCoreCompetency.ToString() + "\n"; } else { jobData = jobData + "Core Competency: Data not available" + "\n"; } } } return(jobData); }
public override string ToString() { string s = "\n" + "Id: " + Id + "\nName: " + Name.ToString() + "\nEmployer: " + EmployerName.ToString() + "\nLocation: " + EmployerLocation.ToString() + "\nPosition Type: " + JobType.ToString() + "\nCore Competency: " + JobCoreCompetency.ToString() + "\n"; s = s.Replace(": \n", ": Data Not Available.\n"); return(s); }