ofbapi/OFBButte.Console/App.cs

162 lines
5.6 KiB
C#

using Microsoft.Extensions.Options;
using OFBButte.Application.Configuration;
using OFBButte.Application.Database;
using OFBButte.Application.Email;
using OFBButte.Application.Users;
using OFBButte.Application.Missionary;
using OFBButte.Infrastructure.Hashing;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using OFBButte.Entities;
namespace OFBButte.Console
{
public class App
{
private readonly AppSettings appSettings;
private readonly IEmailSender emailSender;
private readonly IOFBContext context;
private string user = "djabsher@gmail.com";
private string pass = "my password";
public App(IOptions<AppSettings> appSettings, IOFBContext context, IEmailSender emailSender)
{
this.appSettings = appSettings.Value;
this.emailSender = emailSender;
this.context = context;
}
public async Task Run()
{
var env = appSettings.Environment;
try
{
await SendMissionarySupportForm();
}
catch (Exception ex)
{
throw ex;
}
}
private void AddUser()
{
var adder = new AddUser(context, new PasswordHasher());
var result = adder.Handle(user, pass);
}
private async Task SendVerificationEmail()
{
var adder = new SendEmailValidation(context, emailSender, new Infrastructure.Codes.CodeGenerator());
await adder.Handle(user);
}
private async Task SendMissionarySupportForm()
{
var send = new SendMissionaryFormEmail(context, emailSender);
await send.Handle(1, "djabsher@gmail.com");
}
private void LoginUser()
{
var login = new LoginUser(context, new PasswordHasher());
var result = login.Handle(user, pass);
}
private void AddMissionarySupportForm()
{
var form = new MissionarySupport()
{
Name = "John Smith",
WifesName = "Sarah Smith",
AdmittedWrong = "Yesterday",
Alcohol = false,
AloneOrTeam = "Alone",
CorrectWrongOfAnotherMissionary = "Prayer and support",
FellowshipAssociation = "No fellowship",
LateBillActionTaken = "Never late",
MarryADivorcee = false,
RestAndRelaxation = "Rest all the time",
BibleVersionOpinion = "Only KJV",
BibleVersionsUsed = "KJV",
BillsOnTime = "very important",
CallToField = "Called by God",
CellPhone = "222-555-9899",
HomePhone = "111-555-3343",
FieldOfService = "Malaysia",
FieldPhone = "333-555-8787",
Charasmaticism = "Do not agree with it",
Children = new List<MissionaryChild>()
{
new MissionaryChild()
{
Name = "Katie Smith"
},
new MissionaryChild()
{
Name = "Brandon Smith"
}
},
ChildrenSchool = ChildrenSchool.Home,
CollegeRecommendations = new List<MissionaryCollegeRecommendation>()
{
new MissionaryCollegeRecommendation()
{
Name = "PCC",
City = "Somewhere",
State = "Florida"
},
new MissionaryCollegeRecommendation()
{
Name = "Bible School",
City = "Butte",
State = "Montana"
}
},
ContemporaryMusic = false,
CurrentMonthlySupport = "1000",
DailyBible = BibleReading.Always,
Dance = false,
Divorced = false,
EvaluationOfNationals = "They need Christ",
FemaleDressStandard = true,
FemaleShorts = FemaleShorts.Never,
FemaleSlacks = FemaleSlacks.Never,
FinancialStatementPrevYear = "Yes",
Fundamentalist = true,
GroundsForRemarry = false,
HoneyPot = ".",
Id = 0,
LateBills = "Never",
MaleHair = true,
MasonicLodge = false,
MonthlySupportNeeded = "2000",
MovieTheaters = false,
NumberLedToChrist = 100,
NumberWeeklyTracts = 1000,
NumberWitnessedTo = 10000,
Plans = "Start churches",
PotentialHarvest = "Great potential",
Predestination = "Everyone has a free will",
RateOfSuccess = "Fairly Successful",
RepentanceDefinition = "Agree with God",
RepentanceNecessary = true,
SendingChurch = "Old Fashion Baptist",
Smoking = false,
SwimmingClothing = "Do not swim",
Television = "Do not watch tv",
Testimony = "Saved by Grace",
TimeInCountry = "4 years",
Tongues = false,
WorldlyMusic = false
};
var adder = new AddMissionarySupportForm(context);
adder.Handle(form);
}
}
}