public IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = ToData(txtCase, HighSchools.Cast <IObviate>().ToList()); var moreData = ToData(txtCase, Universities.Cast <IObviate>().ToList()); foreach (var k in moreData.Keys) { if (itemData.ContainsKey(k)) { itemData[k] = moreData[k]; } else { itemData.Add(k, moreData[k]); } } itemData.Add(textFormat(nameof(EduFlag)), EduFlag); var lvl = EduLevel; if (!string.IsNullOrWhiteSpace(lvl)) { itemData.Add(textFormat(nameof(EduLevel)), lvl); } return(itemData); }
public override IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x?.Replace(",", "").Replace(" ", ""), txtCase); var itemData = new Dictionary <string, object>(); var jobs = CurrentEmployment; foreach (var job in jobs) { AddOrReplace(itemData, job.ToData(txtCase)); } var coi = CurrentItems; foreach (var p in coi) { var v = p.Value; if (v == Pecuniam.Zero) { continue; } var expenseName = Division.ToString() + p.DueFrequency.ToInterval(); expenseName += p.Name; if (itemData.ContainsKey(textFormat(expenseName))) { continue; } itemData.Add(textFormat(expenseName), v.ToString()); } return(itemData); }
public void TestGetThisAsTraceId() { var data = new SortedSet <ITransaction>(new TransactionComparer()); var testSubjectId = Transaction.AddTransaction(data, DateTime.UtcNow, 8000M.ToPecuniam(), new VocaBase("Owner's Capital")); var testSubject = data.First(t => t.UniqueId == testSubjectId); var testResult = testSubject.GetThisAsTraceId(); Assert.IsNotNull(testResult); Assert.AreEqual(testSubject.AtTime, testResult.AtTime); Assert.AreEqual(testSubject.UniqueId, testResult.UniqueId); Assert.AreEqual(testSubject.Description, testResult.Description); testResult = testSubject.GetThisAsTraceId(DateTime.UtcNow.AddDays(1)); Assert.IsNotNull(testResult); Assert.AreNotEqual(testSubject.AtTime, testResult.AtTime); Assert.AreEqual(testSubject.UniqueId, testResult.UniqueId); Assert.AreEqual(testSubject.Description, testResult.Description); var journalName = new VocaBase("Journal J1"); testResult = testSubject.GetThisAsTraceId(DateTime.UtcNow.AddDays(1), journalName); Assert.IsNotNull(testResult); Assert.AreNotEqual(testSubject.AtTime, testResult.AtTime); Assert.AreEqual(testSubject.UniqueId, testResult.UniqueId); Assert.AreEqual(journalName, testResult.Description); var testResultTrace = testResult.Trace; Assert.IsNotNull(testResultTrace); Assert.AreEqual(testSubject.AtTime, testResultTrace.AtTime); Assert.AreEqual(testSubject.UniqueId, testResultTrace.UniqueId); Assert.AreEqual(testSubject.Description, testResultTrace.Description); }
protected internal virtual IDictionary <string, object> ToData(KindsOfTextCase txtCase, List <IObviate> students) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = new Dictionary <string, object>(); if (students.Count == 1) { var hsData = students[0]?.ToData(KindsOfTextCase.Pascel) ?? new Dictionary <string, object>(); foreach (var hsd in hsData.Keys) { itemData.Add(textFormat(hsd), hsData[hsd]); } } else { for (var i = 0; i < students.Count; i++) { var hsData = students[i]?.ToData(KindsOfTextCase.Pascel) ?? new Dictionary <string, object>(); foreach (var hsd in hsData.Keys) { itemData.Add(textFormat(hsd + i.ToString("00")), hsData[hsd]); } } } return(itemData); }
public IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = School.ToData(txtCase) ?? new Dictionary <string, object>(); var prefix = ""; if (School is IUniversity) { prefix = "University"; } else if (School is IHighSchool) { prefix = "HighSchool"; } if (Graduation != null) { itemData.Add(textFormat(prefix + nameof(Graduation)), Graduation.Value.ToString("s")); } if (GradePointsAverage != null) { itemData.Add(textFormat(prefix + nameof(GradePointsAverage)), GradePointsAverage); } return(itemData); }
public override IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = base.ToData(txtCase) ?? new Dictionary <string, object>(); itemData.Add(textFormat(nameof(MannerOfDeath)), Category); return(itemData); }
public void TestGetName() { var testSubject = new VocaBase(); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal, "TestCorporation")); Assert.AreEqual("TestCorporation", testSubject.GetName(KindsOfNames.Legal)); }
public virtual IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = new Dictionary <string, object> { { textFormat(nameof(DateOfBirth)), DateOfBirth.ToString("s") } }; return(itemData); }
/// <summary> /// Tries to parse a single item /// from the US Domus Opes data file /// </summary> /// <param name="xmlNode"></param> /// <param name="voca"></param> /// <returns></returns> internal static bool TryParseUsDomusOpesXml(XmlNode xmlNode, out IVoca voca) { voca = null; if (xmlNode == null) { return(false); } if (!(xmlNode is XmlElement xmlElem)) { return(false); } var egs = new List <string>(); var groupName = xmlElem.ParentNode is XmlElement groupElem && groupElem.HasAttributes ? groupElem.GetAttribute("name") : ""; var itemName = xmlElem.GetAttribute("name"); var abbrev = xmlElem.GetAttribute("abbrev"); if (xmlElem.HasChildNodes) { foreach (var cn in xmlElem.ChildNodes) { if (!(cn is XmlElement childElem)) { continue; } if (childElem.LocalName != "eg" || !childElem.HasAttributes) { continue; } var eg = childElem.GetAttribute("name"); if (String.IsNullOrWhiteSpace(eg)) { continue; } egs.Add(eg); } } voca = new VocaBase(itemName); if (!string.IsNullOrWhiteSpace(abbrev)) { voca.AddName(KindsOfNames.Abbrev, abbrev); } if (!string.IsNullOrWhiteSpace(groupName)) { voca.AddName(KindsOfNames.Group, groupName); } return(!string.IsNullOrWhiteSpace(itemName)); }
public override IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x?.Replace(",", "").Replace(" ", ""), txtCase); var acctName = Name + RoutingNumber + Id?.ValueLastFour(); var itemData = new Dictionary <string, object> { { textFormat(acctName + "Balance"), Value.ToString() } }; return(itemData); }
public IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = new Dictionary <string, object> { { textFormat(GetType().Name + "Id"), Value }, { textFormat(GetType().Name + nameof(Description)), Description } }; return(itemData); }
public void TestAnyOfKindOfName() { var testSubject = new VocaBase(); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Former | KindsOfNames.Technical, "TechnicalName")); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal, "TestCorporation")); Assert.IsTrue(testSubject.AnyNames(k => k == KindsOfNames.Legal)); Assert.IsTrue(testSubject.AnyNames(k => k == (KindsOfNames.Former | KindsOfNames.Technical))); Assert.IsFalse(testSubject.AnyNames(k => k == (KindsOfNames.Legal | KindsOfNames.Technical))); }
public virtual IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = new Dictionary <string, object>(); var v = Value; if (!string.IsNullOrWhiteSpace(v)) { itemData.Add(textFormat(GetType().Name), Value); } return(itemData); }
public void TestAnyOfNameAs() { var testSubject = new VocaBase(); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Former | KindsOfNames.Technical, "TechnicalName")); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal, "TestCorporation")); Assert.IsTrue(testSubject.AnyNames(n => n == "TechnicalName")); Assert.IsFalse(testSubject.AnyNames(n => n == "")); Assert.IsFalse(testSubject.AnyNames(n => n == "foijhdlkjae")); }
public override IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = new Dictionary <string, object>(); var line1 = ToString(); if (!string.IsNullOrWhiteSpace(line1)) { itemData.Add(textFormat("AddressLine1"), ToString()); } return(itemData); }
public IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = new Dictionary <string, object> { { textFormat(nameof(Openness)), Openness.Value.Zscore }, { textFormat(nameof(Conscientiousness)), Conscientiousness.Value.Zscore }, { textFormat(nameof(Extraversion)), Extraversion.Value.Zscore }, { textFormat(nameof(Agreeableness)), Agreeableness.Value.Zscore }, { textFormat(nameof(Neuroticism)), Neuroticism.Value.Zscore } }; return(itemData); }
public void TestPostBalance() { var testInput = new Balance("Journal-552"); var dt = DateTime.UtcNow; var assets = new VocaBase("Assets"); var liabilities = new VocaBase("Liabilities"); var ownersEquity = new VocaBase("Owner's Equity"); testInput.AddNegativeValue(dt.AddDays(-360), new Pecuniam(-450.0M), assets); testInput.AddNegativeValue(dt.AddDays(-30), new Pecuniam(-461.0M), liabilities); testInput.AddNegativeValue(dt.AddDays(-120), new Pecuniam(-458.0M), ownersEquity); testInput.AddNegativeValue(dt.AddDays(-150), new Pecuniam(-457.0M), assets); testInput.AddNegativeValue(dt.AddDays(-90), new Pecuniam(-459.0M), liabilities); testInput.AddNegativeValue(dt.AddDays(-240), new Pecuniam(-454.0M), ownersEquity); testInput.AddNegativeValue(dt.AddDays(-60), new Pecuniam(-460.0M), assets); testInput.AddNegativeValue(dt.AddDays(-300), new Pecuniam(-452.0M), liabilities); testInput.AddNegativeValue(dt.AddDays(-270), new Pecuniam(-453.0M), ownersEquity); testInput.AddNegativeValue(dt.AddDays(-180), new Pecuniam(-456.0M), assets); testInput.AddNegativeValue(dt.AddDays(-210), new Pecuniam(-455.0M), liabilities); testInput.AddNegativeValue(dt.AddDays(-330), new Pecuniam(-451.0M), assets); //charges testInput.AddPositiveValue(dt.AddDays(-365), new Pecuniam(8000.0M), assets); testInput.AddPositiveValue(dt.AddDays(-350), new Pecuniam(164.4M), liabilities); testInput.AddPositiveValue(dt.AddDays(-198), new Pecuniam(165.4M), ownersEquity); testInput.AddPositiveValue(dt.AddDays(-24), new Pecuniam(166.4M), assets); testInput.AddPositiveValue(dt.AddDays(-74), new Pecuniam(167.4M), liabilities); testInput.AddPositiveValue(dt.AddDays(-88), new Pecuniam(168.4M), ownersEquity); testInput.AddPositiveValue(dt.AddDays(-92), new Pecuniam(169.4M), assets); testInput.AddPositiveValue(dt.AddDays(-121), new Pecuniam(170.4M), liabilities); testInput.AddPositiveValue(dt.AddDays(-180), new Pecuniam(171.4M), ownersEquity); testInput.AddPositiveValue(dt.AddDays(-142), new Pecuniam(172.4M), assets); testInput.AddPositiveValue(dt.AddDays(-155), new Pecuniam(173.4M), liabilities); var testSubject = new Ledger(); testSubject.PostBalance(testInput); var testResult00 = testSubject.Get("Assets"); Assert.IsNotNull(testResult00); var testResult01 = testSubject.Get("Liabilities"); Assert.IsNotNull(testResult01); var testResult02 = testSubject.Get("Owner's Equity"); Assert.IsNotNull(testResult02); }
public void TestRemoveNameByKindAndValue() { var testSubject = new VocaBase(); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal | KindsOfNames.Technical, "TestCorporation")); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal, "TestCorporation")); var testResult = testSubject.RemoveName((k, v) => k == (KindsOfNames.Legal | KindsOfNames.Technical) && v == "TestCorporation"); Assert.IsTrue(testResult > 0); var testEntry = testSubject.Names.FirstOrDefault(x => x.Item1 == KindsOfNames.Legal); Assert.IsNotNull(testEntry); Assert.AreEqual("TestCorporation", testEntry.Item2); }
public override IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = base.ToData(txtCase) ?? new Dictionary <string, object>(); if (!string.IsNullOrWhiteSpace(State)) { itemData.Add(textFormat("BirthState"), State); } if (!string.IsNullOrWhiteSpace(City)) { itemData.Add(textFormat("BirthCity"), City); } return(itemData); }
public void TestRemoveNameByKind() { var testSubject = new VocaBase(); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal | KindsOfNames.Technical, "TechnicalName")); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal, "TestCorporation")); testSubject.RemoveName(k => k == KindsOfNames.Legal); var testResult = testSubject.Names.FirstOrDefault(x => x.Item1 == KindsOfNames.Legal); Assert.IsNull(testResult); testResult = testSubject.Names.FirstOrDefault(x => x.Item1 == (KindsOfNames.Legal | KindsOfNames.Technical)); Assert.IsNotNull(testResult); }
public void TestToData() { var testSubject = new VocaBase(); testSubject.AddName(KindsOfNames.Maiden, "Butler"); testSubject.AddName(KindsOfNames.First, "Judith"); testSubject.AddName(KindsOfNames.Surname, "Williamson"); testSubject.AddName(KindsOfNames.Colloquial | KindsOfNames.First, "Judy"); testSubject.AddName(KindsOfNames.Former | KindsOfNames.Surname | KindsOfNames.Spouse, "Cricket"); var testResult = testSubject.ToData(KindsOfTextCase.Kabab); var asJson = JsonConvert.SerializeObject(testResult, Formatting.Indented); Console.WriteLine(asJson); }
protected internal IAccount <Identifier> Get(IVoca name) { foreach (var acct in _dataStore) { var acctName = acct as IVoca; if (acctName == null) { continue; } if (VocaBase.Equals(acctName, name)) { return(acct); } } return(null); }
public void TestRemoveNameByValue() { var testSubject = new VocaBase(); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal | KindsOfNames.Technical, "TestCorporation")); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal, "TestCorporation")); var testResult = testSubject.RemoveName(n => n == "TestCorporation"); Assert.AreEqual(2, testResult); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal | KindsOfNames.Technical, "TestCorporation")); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal, "TestCorporation")); testResult = testSubject.RemoveName(n => n == "TechnicalName"); Assert.AreEqual(0, testResult); }
public override IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = new Dictionary <string, object>(); var value = Value; if (string.IsNullOrWhiteSpace(value)) { return(itemData); } var label = Descriptor?.ToString(); itemData.Add(textFormat(label + "Phone"), value); return(itemData); }
public void TestEquals() { var testSubject = new VocaBase(); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal | KindsOfNames.Technical, "TestCorporation")); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal, "TestCorporation")); var testSubject2 = new VocaBase(); testSubject2.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal | KindsOfNames.Technical, "TestCorporation")); testSubject2.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal, "TestCorporation")); Assert.IsTrue(testSubject.Equals(testSubject2)); testSubject2.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Former, "Machina")); Assert.IsFalse(testSubject.Equals(testSubject2)); }
public override IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = new Dictionary <string, object>(); if (!string.IsNullOrWhiteSpace(City)) { itemData.Add(textFormat(nameof(City)), City); } if (!string.IsNullOrWhiteSpace(ProvidenceAbbrv)) { itemData.Add(textFormat(nameof(Providence)), ProvidenceAbbrv); } if (!string.IsNullOrWhiteSpace(PostalCode)) { itemData.Add(textFormat(nameof(PostalCode)), PostalCode); } return(itemData); }
public override IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = new Dictionary <string, object>(); if (!String.IsNullOrWhiteSpace(City)) { itemData.Add(textFormat(nameof(City)), City); } if (!String.IsNullOrWhiteSpace(StateAbbrev)) { itemData.Add(textFormat("State"), StateAbbrev); } if (!String.IsNullOrWhiteSpace(ZipCode)) { itemData.Add(textFormat(nameof(ZipCode)), ZipCode); } return(itemData); }
public void TestAnyOfKindContaining() { var testSubject = new VocaBase(); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Former | KindsOfNames.Technical | KindsOfNames.Legal, "TechnicalName")); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Legal, "TestCorporation")); Assert.IsTrue(testSubject.AnyNames(k => k.ToDiscreteKindsOfNames().Any(v => v == KindsOfNames.Former))); Assert.IsTrue(testSubject.AnyNames(k => k.ToDiscreteKindsOfNames().Any(v => v == KindsOfNames.Technical))); Assert.IsTrue(testSubject.AnyNames(k => k.ToDiscreteKindsOfNames().Any(v => v == KindsOfNames.Legal))); Assert.IsFalse(testSubject.AnyNames(k => k == KindsOfNames.Former)); Assert.IsFalse(testSubject.AnyNames(k => k == KindsOfNames.Technical)); testSubject.Names.Add(new Tuple <KindsOfNames, string>(KindsOfNames.Abbrev | KindsOfNames.Group | KindsOfNames.Colloquial, "TestCorporation")); Assert.IsTrue(testSubject.AnyNames(k => k.ToDiscreteKindsOfNames().Any(v => v == KindsOfNames.Abbrev))); Assert.IsTrue(testSubject.AnyNames(k => k.ToDiscreteKindsOfNames().Any(v => v == KindsOfNames.Group))); Assert.IsTrue(testSubject.AnyNames(k => k.ToDiscreteKindsOfNames().Any(v => v == KindsOfNames.Colloquial))); }
public override IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = base.ToData(txtCase) ?? new Dictionary <string, object>(); if (Rssd != null) { itemData.Add(textFormat(nameof(Rssd)), Rssd.Value); } if (RoutingNumber != null) { itemData.Add(textFormat(nameof(RoutingNumber)), RoutingNumber.Value); } if (FdicNumber != null) { itemData.Add(textFormat(nameof(FdicNumber)), FdicNumber.Value); } itemData.Add(textFormat(nameof(TypeOfBank)), BankType.ToString()); itemData.Add(textFormat(nameof(IsInternational)), IsInternational); return(itemData); }
public override IDictionary <string, object> ToData(KindsOfTextCase txtCase) { Func <string, string> textFormat = (x) => VocaBase.TransformText(x, txtCase); var itemData = base.ToData(txtCase) ?? new Dictionary <string, object>(); if (!string.IsNullOrWhiteSpace(StateAbbrev)) { itemData.Add(textFormat(nameof(IssuingState)), StateAbbrev); } if (!string.IsNullOrWhiteSpace(FullLegalName)) { itemData.Add(textFormat(nameof(FullLegalName)), FullLegalName); } if (DateOfBirth != DateTime.MinValue) { itemData.Add(textFormat(nameof(DateOfBirth)), DateOfBirth.ToString("s")); } if (!string.IsNullOrWhiteSpace(Gender)) { itemData.Add(textFormat(nameof(Gender)), Gender); } if (!string.IsNullOrWhiteSpace(PrincipalResidence)) { itemData.Add(textFormat(nameof(PrincipalResidence)), PrincipalResidence); } if (FrontFacingPhoto != null && FrontFacingPhoto.Length > 0) { var photo = Convert.ToBase64String(FrontFacingPhoto); itemData.Add(textFormat(nameof(FrontFacingPhoto)), photo); } if (Signature != null && Signature.Length > 0) { var sig = Convert.ToBase64String(Signature); itemData.Add(textFormat(nameof(Signature)), sig); } return(itemData); }