//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// // Person.cs & Class v4.7.5.14 //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// // For when I get time to do the data // file and DBS right and everything. // Conceived 08 Jun 17 by -JpE- //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// // idkwtfiad! 26Jun17 Learning LoL! // v4.7.6.40 29Jun17 // Data Layer for MLBB in Design. // v4.7.6.38 28Jun17 Looking Better! // v4.7.6.41 30Jun17 Awesome and ready // to begin Beta Testing real hard next // week while it's hot. I'm looking at // some of this code lately and W0W! ;-) // v5.7.6.45 06Jul17 Tested and Brought // in the relevant InfoForm Class Stuff. // 11.Jul.17 Perfected & Formatted. // *** Now it's clean & integrated! *** // v5.7.7.77 11-Aug-2017 Back2 1Project. // protected internal properties now // for ShowMeEdit.cs // v5.7.7.87 20-Aug-2017 //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// // v5.7.7.95 24-Aug-2017 OverHaul Deluxe! //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// // NOTE: This File has parts of 3 Classes! //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// // InfoForm / PersonForm / and the entire // Person Class. All Related2The Analyzer. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// using System; using System.IO; using System.Linq; using System.Windows.Forms; using System.Globalization; using System.Collections.Generic; using System.Collections.ObjectModel; // Aliases using PP = WhoAreYou.Person; using IF = WhoAreYou.InfoForm; using AP = WhoAreYou.Properties.AppSettings; using OS = WhoAreYou.Properties.OptionsSettings; using PS = WhoAreYou.Properties.PersonSettings; using AS = WhoAreYou.Properties.AppUserSettings; using PR = WhoAreYou.Properties.PersonResources; namespace WhoAreYou { public partial class InfoForm { #region InfoForm link to PersonForm & Person Class Code. private void DataAnalyzerClick( object sender, EventArgs e) { // todo testcode if (!Testing) return; if (!OS.Default.Contributor || !OS.Default.Elite) return; if (!Testing && !OS.Default.MiniVerb) if (!AppStatic.YesNoDialog( "Run Data Analyzer Now?", "Are You Sure?")) return; bool save; using (var p = new PersonForm()) { p.Size = PS.Default.PF_Size; p.Location = PS.Default.PF_Local; p.ShowDialog(); // <-= /\/\/\/\/\/\/*** PS.Default.PF_Size = p.Size; PS.Default.PF_Local = p.Location; save = p.Changes; } PS.Default.Save(); _wasAtNum = CurrentRecord; if (save) SaveClick( "Analyzer Click", EventArgs.Empty); else ShowCurrentRecord(); } } #endregion InfoForm link to PersonForm & Person Class Code. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ #region Custom Person Class Object by -JpE- v5.7.6.45 06.Jul.17 public class Person { public string FirstName { get; protected internal set; } public string MiddleName { get; protected internal set; } public string LastName { get; protected internal set; } public DateTime Birthday { get; protected internal set; } public string Address1 { get; protected internal set; } public string Address2 { get; protected internal set; } public string City { get; protected internal set; } public string State { get; protected internal set; } public string Zip { get; protected internal set; } public string Title { get; protected internal set; } public string Home { get; protected internal set; } public string Cell { get; protected internal set; } public string Work { get; protected internal set; } public string Email1 { get; protected internal set; } public string Email2 { get; protected internal set; } public string W1 { get; protected internal set; } public string W2 { get; protected internal set; } public string W3 { get; protected internal set; } public string Note { get; protected internal set; } // Overloaded Class Constructors public Person() { } public Person(ICollection record) { if (record == null || record.Count != AP.Default.RL) { const string txt = "This record is not the right size."; MessageBox.Show(txt); return; } PopulatePerson(record); } public Person(Person current) { PopulatePerson(current); } // ^ End of Class Constructor Overloads. // v Internal Person-Class Method. (Overloaded) private void PopulatePerson(Person p) { var c = CultureInfo.InvariantCulture; var s = new Collection { p.FirstName, p.MiddleName, p.LastName, p.Birthday.ToString(c), p.Address1, p.Address2, p.City, p.State, p.Zip, p.Title, p.Home, p.Cell, p.Work, p.Email1, p.Email2, p.W1, p.W2, p.W3, p.Note }; PopulatePerson(s); } private void PopulatePerson( ICollection fields) { var rl = AP.Default.RL; if (fields == null || fields.Count != rl) throw new ArgumentException( "Problems with people in the fields" + " in Person >> Populate Person, etc."); var e = new string[rl]; fields.CopyTo(e, 0); // Now Populate The Class Object. var i = -1; FirstName = e[++i]; MiddleName = e[++i]; LastName = e[++i]; Birthday = Convert .ToDateTime(e[++i]); // NOTE: Can be any type ^ // or combination of types. Address1 = e[++i]; Address2 = e[++i]; City = e[++i]; State = e[++i]; Zip = e[++i]; Title = e[++i]; Home = e[++i]; Cell = e[++i]; Work = e[++i]; Email1 = e[++i]; Email2 = e[++i]; W1 = e[++i]; W2 = e[++i]; W3 = e[++i]; Note = e[++i] .Replace('~', '\n'); } } #endregion Custom Person Class Object v5.7.6.45 06.Jul.17 //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ #region PersonForm Extension Code brought from InfoForm. public partial class PersonForm // <-= NOTE! { /* NOTE: this Source Code File and Methods Test very Well! Including the Person-Class above. Implementation in MLBB may be unfeasable however as the early code was so entrenched around the 2 dimensional string array. But use it to experiment with RDBMS, DataSet and Maybe ADO.NET and some SQL Server idk? Pick a destination and get off there. LoL, But leaving this intact for now. BFD going back through all the code that involves the string[,] to do it this way, granted it's way better and how I should have done it in the first place, had I known much. But that was 2011, I was still screwing with their little demo thing. So until I can do a simple little DB App of some kind stand alone then I can maybe come back with what I know, or NOT. Otherwise leaving well enough alone here at a safe place, nice and solid and settled except for documentation. Help Files are incomplete. Work on that and clean up the About if yer done. Wait, done with MLBB? After 6 years? LoL jk do a side experiment, write an App or two. Come back home L8r on. * ";-O */ /// Multiple Overloads and such /// v5.7.6.45 11.Jul.17 /// All This Brought to PersonForm & Integrated /// v5.7.7.95 24-Aug-2017 /// private void CreatePeople() { if (!IF.Testing) // todo testcode { ShowPeople.Visible = false; return; } People = CreatePeople(IF.Listen()); } /// Developed as an Alternative /// to List[,] THIS: /// Effectively Loads (current List ^) into /// the newer Parallel Person Collection. /// The hard part was I couldn't get 'there' from 'here' /// and the way I was doing it. (to the way I should) /// So many of these are intermediary steps as I learn /// to get things converted while remaming parallel. /// (i.e. without screwing up what was working.) /// \\// /// v5.7.7.96 24-Aug-2017 /// Brought to PersonForm from InfoForm. /// /// People private static Collection // NOTE: Custom TYPE CreatePeople(string[,] list) { if (list == null || list.GetLength(0) < 1 || !list.GetLength(1).Equals(AP.Default.RL)) throw new InvalidDataException( "Create People in Person.cs"); var reclen = AP.Default.RL; var mmbers = list.GetLength(0); var people = new Collection(); for (var m = 0; m < mmbers; ++m) { var person = new Collection(); for (var r = 0; r < reclen; ++r) { var field = list[m, r]; if (string.IsNullOrEmpty(field)) field = "N/A"; person.Add(field); } people.Add(new Person(person)); // SuaWeeet! All-In-One Data Format. } return people; } /// ShowMe the entire Object. /// Sample Usages / Test Code (That Made It!) /// Integrated into PersonForm instead and made perm. /// v5.7.7.95 24-Aug-2017 by -JpE- for /// (c) 2011-2041 Global Access Software InTl. /// GASIT is a registered Trademark. 2011 /// /// private void ViewObject(object sender, EventArgs e) { var i = 0; const string title = "View-All Records:"; if (People == null || People.Count < 1) { MessageBox.Show(PR.IF_DataAnalyzer_Null); return; } var txt = People.Aggregate( "", (current, p) => current + string.Format( "\nRecord {0})\n {1} {2} {3} {4}\n" + "{5}\n{6}\n{7}\n{8}, {9} {10}\n\n" + "Home Phone: {11}, " + "Cell Phone: {12}, Work Phone: {13}\n" + "Email1: {14}, " + "Email2: {15}\n" + "Website1: {16}, Website2: {17} " + "Website3: {18}\n\n" + "Comments:\n{19}\n===========\n\n", ++i, p.Title, p.FirstName, p.MiddleName, p.LastName, p.Birthday, p.Address1, p.Address2, p.City, p.State, p.Zip, p.Home, p.Cell, p.Work, p.Email1, p.Email2, p.W1, p.W2, p.W3, p.Note)); using (var sm = new ShowMeForm(txt, title)) { sm.Size = AS.Default.MemReaderS; sm.Location = AS.Default.MemReaderL; sm.ShowDialog(); AS.Default.MemReaderS = sm.Size; AS.Default.MemReaderL = sm.Location; } } #endregion PersonForm Extension brought from InfoForm. // *** WAS: AppCode5 Part-5 v5.7.7.81 14.Aug.2017 ***/ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ } }