118 lines
5.3 KiB
C#
118 lines
5.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
|
|
namespace OFBButte.Entities
|
|
{
|
|
public class MissionarySupport
|
|
{
|
|
public int Id { get; set; }
|
|
public string Name { get; set; }
|
|
public string HomePhone { get; set; }
|
|
public string CellPhone { get; set; }
|
|
public string FieldPhone { get; set; }
|
|
public string WifesName { get; set; }
|
|
public ICollection<MissionaryChild> Children { get; set; }
|
|
public string Testimony { get; set; }
|
|
public string CallToField { get; set; }
|
|
public string SendingChurch { get; set; }
|
|
public string FieldOfService { get; set; }
|
|
public string Plans { get; set; }
|
|
public string EvaluationOfNationals { get; set; }
|
|
public string TimeInCountry { get; set; }
|
|
public string CorrectWrongOfAnotherMissionary { get; set; }
|
|
public string FinancialStatementPrevYear { get; set; }
|
|
public string CurrentMonthlySupport { get; set; }
|
|
public string MonthlySupportNeeded { get; set; }
|
|
public string RestAndRelaxation { get; set; }
|
|
public string AloneOrTeam { get; set; }
|
|
public ChildrenSchool ChildrenSchool { get; set; }
|
|
public bool Dance { get; set; }
|
|
public bool WorldlyMusic { get; set; }
|
|
public bool MovieTheaters { get; set; }
|
|
public bool Alcohol { get; set; }
|
|
public bool Smoking { get; set; }
|
|
public bool MaleHair { get; set; }
|
|
public FemaleSlacks FemaleSlacks { get; set; }
|
|
public FemaleShorts FemaleShorts { get; set; }
|
|
public bool FemaleDressStandard { get; set; }
|
|
public string SwimmingClothing { get; set; }
|
|
public string Television { get; set; }
|
|
public BibleReading DailyBible { get; set; }
|
|
public double NumberLedToChrist { get; set; }
|
|
public double NumberWitnessedTo { get; set; }
|
|
public double NumberWeeklyTracts { get; set; }
|
|
public string RateOfSuccess { get; set; }
|
|
public string Predestination { get; set; }
|
|
public string FellowshipAssociation { get; set; }
|
|
public ICollection<MissionaryCollegeRecommendation> CollegeRecommendations { get; set; }
|
|
public string AdmittedWrong { get; set; }
|
|
public bool Divorced { get; set; }
|
|
public bool GroundsForRemarry { get; set; }
|
|
public bool MarryADivorcee { get; set; }
|
|
public bool MasonicLodge { get; set; }
|
|
public string BibleVersionsUsed { get; set; }
|
|
public string BibleVersionOpinion { get; set; }
|
|
public bool ContemporaryMusic { get; set; }
|
|
public string Charasmaticism { get; set; }
|
|
public bool Tongues { get; set; }
|
|
public bool RepentanceNecessary { get; set; }
|
|
public string RepentanceDefinition { get; set; }
|
|
public bool Fundamentalist { get; set; }
|
|
public bool BillsOnTime { get; set; }
|
|
public string LateBills { get; set; }
|
|
public string LateBillActionTaken { get; set; }
|
|
public string PotentialHarvest { get; set; }
|
|
|
|
public string HoneyPot { get; set; }
|
|
|
|
public Dictionary<string, string> ToDictionary()
|
|
{
|
|
var properties = GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public).ToDictionary(p => p.Name, p => p);
|
|
var props = properties.ToDictionary(p => p.Key, p => p.Value.GetValue(this)?.ToString() ?? "");
|
|
props.Add("ChildNames", string.Join("<br>", Children.Select(c => c.Name)));
|
|
StringBuilder colleges = new StringBuilder("<table class=\"border\"><tbody>");
|
|
foreach (var college in CollegeRecommendations)
|
|
{
|
|
colleges.Append($"<tr><td>{college.Name} </td><td>{college.City}, {college.State}</td></tr>");
|
|
}
|
|
colleges.Append("</tbody></table>");
|
|
props.Add("Colleges", colleges.ToString());
|
|
foreach(var prop in properties)
|
|
{
|
|
if (prop.Value.PropertyType == typeof(bool) && props.ContainsKey(prop.Key))
|
|
{
|
|
props[prop.Key] = (bool)prop.Value.GetValue(this) == true ? "Yes" : "No";
|
|
}
|
|
}
|
|
return props;
|
|
}
|
|
|
|
private void GenerateHtml()
|
|
{
|
|
var props = GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public).ToDictionary(p => p.Name, p => p.GetValue(this)?.ToString() ?? "");
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.AppendLine("<table>");
|
|
sb.AppendLine(" <tbody>");
|
|
foreach (var p in props)
|
|
{
|
|
if (p.Key == "Id" || p.Key == "HoneyPot")
|
|
continue;
|
|
|
|
sb.AppendLine(" <tr class=\"label\">");
|
|
sb.AppendLine($" <td colspan=\"2\" class=\"bold\"><span class=\"label\">{p.Key}</span></td>");
|
|
sb.AppendLine(" </tr>");
|
|
sb.AppendLine(" <tr class=\"value\">");
|
|
sb.AppendLine($" <td colspan=\"2\"><span class=\"value\">{{{{{p.Key}}}}}</span></td>");
|
|
sb.AppendLine(" </tr>");
|
|
}
|
|
sb.AppendLine(" </tbody>");
|
|
sb.AppendLine("</table>");
|
|
string str = sb.ToString();
|
|
}
|
|
|
|
}
|
|
}
|