2006-04-10, 03:23 PM | #1 |
Seņor Cheap Bastarde
Real Name: Dean Join Date: May 2003
Location: $99 Tire Store
Posts: 9,294
Car: $.04 STI
Class: Fast,Cheap & Reliable=STI
Deal, did somebody say Deal? Oh, Dean, yeah that's me.
|
Disable MikeK's account???
Hey Scott, can we just disable Mike's account until he finishes results?
He clearly is not spending his "work" time wisely, and needs guidance...
__________________
I am a Commodore PET --- Now get off my lawn you kids... |
2006-04-10, 03:24 PM | #2 |
The Doink
Real Name: Scott Join Date: Nov 2002
Location: Portland, OR
Posts: 20,335
Car: '09 OBXT, '02 WRX, '96 Miata
Class: PDX/TT-6
The way out is through
|
Actually, I'm pretty sure he's working on results... I talked to Nick and they were PMing back and forth about verifying the LGT's classification.
Plus, me and him are probably getting together tonight to work on some scoring software.
__________________
Is you is, or is you ain't, my con-stit-u-ints? |
2006-04-10, 03:36 PM | #3 | |
Captain Turbo
Join Date: Feb 2004
Location: Reno
Posts: 3,318
Car: 05 STi
|
Quote:
|
|
2006-04-10, 03:40 PM | #4 |
warehouse SECCS
Join Date: Mar 2003
Location: SoCal...
Posts: 6,253
Car: 04 Evo 99 Cadillac
Class: street de le mod
|
After you finish the software I hope you guys score.
that was a bad joke. thanks.
__________________
Anjali? Anjali? |
2006-04-10, 03:45 PM | #5 | |
EJ22T
Join Date: Sep 2003
Location: Reno
Posts: 9,445
Car: '93/'01 GF6, mostly red
Class: 19 FP
|
Quote:
__________________
FWD is the new AWD |
|
2006-04-11, 07:06 AM | #6 |
EJ207
Join Date: Apr 2005
Location: Reno/Sparks, Nevada
Posts: 3,482
Car: 2000 2.5RS
Class: RestNPeace
Master Slurper.
|
I browsed the entire interweb once. I got sweaty.
__________________
"Why do chicks tell you to call and then not answer....so gay." "Cuz girls are fags I dunno" |
2006-04-11, 08:52 AM | #7 | |
The Doink
Real Name: Scott Join Date: Nov 2002
Location: Portland, OR
Posts: 20,335
Car: '09 OBXT, '02 WRX, '96 Miata
Class: PDX/TT-6
The way out is through
|
Quote:
__________________
Is you is, or is you ain't, my con-stit-u-ints? |
|
2006-04-11, 09:59 PM | #8 |
EJ205
Real Name: Jeremiah Join Date: Jul 2005
Location: Dayton, NV
Posts: 1,888
Car: 2005 Impreza 2.5RS, 2000 Forester L
Class: RNP sometimes (see motto)
"Kids are ruining autocross."
|
Well, I found the end of the internet, and then discovered how to turn it off.
__________________
Small red text that looks curious at first glance but is ultimately inconsequential |
2006-04-12, 08:01 AM | #9 | |
The Doink
Real Name: Scott Join Date: Nov 2002
Location: Portland, OR
Posts: 20,335
Car: '09 OBXT, '02 WRX, '96 Miata
Class: PDX/TT-6
The way out is through
|
Quote:
__________________
Is you is, or is you ain't, my con-stit-u-ints? |
|
2006-04-12, 08:07 AM | #10 | |
EJ207
Join Date: Apr 2005
Location: Reno/Sparks, Nevada
Posts: 3,482
Car: 2000 2.5RS
Class: RestNPeace
Master Slurper.
|
Quote:
__________________
"Why do chicks tell you to call and then not answer....so gay." "Cuz girls are fags I dunno" |
|
2006-04-12, 08:41 AM | #11 | |
EJ22
Join Date: Mar 2005
Location: Elk Grove, CA
Posts: 450
Car: 2005 WRX STi
"I'm sideways and in control... I look good."
|
Quote:
|
|
2006-04-12, 09:50 AM | #12 |
EJ207
Join Date: Apr 2005
Location: Reno/Sparks, Nevada
Posts: 3,482
Car: 2000 2.5RS
Class: RestNPeace
Master Slurper.
|
nope.
__________________
"Why do chicks tell you to call and then not answer....so gay." "Cuz girls are fags I dunno" |
2006-04-12, 10:23 AM | #13 |
EJ205
Join Date: Jan 2006
Location: Reno, NV
Posts: 1,840
Car: Impreza and an Impreza
Class: AS / CRS PerfStock
"pedal on the right"
|
I could have written a program to do all the calculating by now. What does Dean have to work or something ? active social life? Kids ? come on no excuses! Just like load one array as a lookup table for each car class with the correct PAX modifer,
then import the raw data into a 2nd set of arrays (4 or 5 diminsonal, and on each line read populate the pax value as the result of the raw time X the referenced pax modifer [in the look up table] ) probably could be done in just a few lines of code (tricky lines) but a few lines . then just drop in a bubble sort (or your favorite sort) based upon the last dimenson of the array (PAx adjusted) and save back to csv, maybe have it save a 2nd copy directly to html with the tables written out ... course maybe you guys don't do programming as your 9 to 5 ... ? |
2006-04-12, 10:27 AM | #14 |
EJ205
Join Date: Jan 2006
Location: Reno, NV
Posts: 1,840
Car: Impreza and an Impreza
Class: AS / CRS PerfStock
"pedal on the right"
|
Course you could also just design 2 DB tables, import data, (write a Trigger to caculate PAX based upon raw and class, and a pax adjustor look up) and write a very simple db driven results display , with an Order By selected field, so they could then choose to list by pax, or by raw time, or by best time in class, only view a given car class. etc. etc... (probably takes about the same amount of time versus 1 tricked out data importer) violoa ? (viola ? ) arg. i can't spell english ...
|
2006-04-12, 10:30 AM | #15 | |
EJ22T
Join Date: Sep 2003
Location: Reno
Posts: 9,445
Car: '93/'01 GF6, mostly red
Class: 19 FP
|
Quote:
__________________
FWD is the new AWD |
|
2006-04-12, 11:30 AM | #16 | |
Seņor Cheap Bastarde
Real Name: Dean Join Date: May 2003
Location: $99 Tire Store
Posts: 9,294
Car: $.04 STI
Class: Fast,Cheap & Reliable=STI
Deal, did somebody say Deal? Oh, Dean, yeah that's me.
|
Quote:
You have no ide how shitty this software is, and due to our region's scoring choices, it is largely useless for that as well as sucking at the event...
__________________
I am a Commodore PET --- Now get off my lawn you kids... |
|
2006-04-12, 11:35 AM | #17 |
EJ205
Join Date: Jan 2006
Location: Reno, NV
Posts: 1,840
Car: Impreza and an Impreza
Class: AS / CRS PerfStock
"pedal on the right"
|
aaaah just half of them? how many Seccs members does it take to tabulate results ?
"I don't know, but your mother is a whore" - SNL lol I'm just eager to see all the results. I can't recall if i'm dead last or 2 places from it think i'm top 4 in Novice, and I'm either first & Last in STU (alone) or Just Last in BSP depending on what i choose in a month. |
2006-04-12, 12:08 PM | #18 |
The Doink
Real Name: Scott Join Date: Nov 2002
Location: Portland, OR
Posts: 20,335
Car: '09 OBXT, '02 WRX, '96 Miata
Class: PDX/TT-6
The way out is through
|
Yeah, results software is trivial.
Code:
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Xml; using System.Xml.Serialization; using System.IO; namespace SeasonManager { /// <summary> /// Summary description for Form1. /// </summary> public class MainForm : System.Windows.Forms.Form { private System.Windows.Forms.MainMenu MainMenu; private System.Windows.Forms.MenuItem FileMenu; private System.Windows.Forms.MenuItem OpenMenu; private System.Windows.Forms.MenuItem SaveMenu; private System.Windows.Forms.MenuItem SaveAsMenu; private System.Windows.Forms.MenuItem CloseMenu; private System.Windows.Forms.MenuItem SeperatorMenu; private System.Windows.Forms.MenuItem ExitMenu; private System.Windows.Forms.MenuItem ReportsMenu; private System.Windows.Forms.StatusBar StatusBar; private System.Windows.Forms.StatusBarPanel StatusPanel; private System.Windows.Forms.Timer StatusTimer; private System.ComponentModel.IContainer components; private System.Windows.Forms.OpenFileDialog OpenFile; private System.Windows.Forms.SaveFileDialog SaveFile; private System.Windows.Forms.MenuItem NewMenu; private System.Windows.Forms.StatusBarPanel FilenamePanel; private System.Windows.Forms.StatusBarPanel ModifiedPanel; private System.Windows.Forms.TabControl TabControl; private System.Windows.Forms.TabPage SettingsPage; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox ClassPointsText; private System.Windows.Forms.TextBox PaxPointsText; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.NumericUpDown EventCountUpDn; private System.Windows.Forms.NumericUpDown ReqEventCountUpDn; private System.Windows.Forms.Label label4; private System.Windows.Forms.NumericUpDown DropCountUpDn; private System.Windows.Forms.Label label5; private System.Windows.Forms.TabPage EventsPage; private System.Windows.Forms.GroupBox EventDetailsGroup; private System.Windows.Forms.Button DeleteEventButton; private System.Windows.Forms.Label label10; private System.Windows.Forms.VScrollBar EventMover; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label7; private System.Windows.Forms.GroupBox EventActionsGroup; private System.Windows.Forms.Button SyncSingleEvent; private System.Windows.Forms.Button SyncAllEvents; private System.Windows.Forms.ColumnHeader DriverCol; private System.Windows.Forms.ColumnHeader ClassCol; private System.Windows.Forms.ColumnHeader CarCol; private System.Windows.Forms.GroupBox ClassDetailsGroup; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label13; private System.Windows.Forms.ListBox ClassList; private System.Windows.Forms.Label label14; private System.Windows.Forms.Button DeleteClassButton; private System.Windows.Forms.TextBox ClassDescText; private System.Windows.Forms.TextBox ClassIdText; private System.Windows.Forms.GroupBox ClassActionsGroup; private System.Windows.Forms.Button AddClassButton; private System.Windows.Forms.CheckBox ClassNonPointsCheck; private System.Windows.Forms.Button ApplyClassButton; private System.Windows.Forms.ListBox EventList; private System.Windows.Forms.TextBox EventFilenameText; private System.Windows.Forms.TextBox EventDateText; private System.Windows.Forms.TextBox EventNameText; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox SeasonNameText; private System.Windows.Forms.TextBox ClubNameText; private System.Windows.Forms.MenuItem ClassReportMenu; private System.Windows.Forms.TabPage ClassPointsPage; private System.Windows.Forms.TabPage PaxPointsPage; private System.Windows.Forms.MenuItem PaxReportMenu; private System.Windows.Forms.ColumnHeader ClassPointsCol; private System.Windows.Forms.CheckBox ClassLadiesCheck; private System.Windows.Forms.Label label15; private System.Windows.Forms.Label label16; private System.Windows.Forms.TextBox SingleEntrantClassPointsText; private System.Windows.Forms.TextBox SingleEntrantPaxPointsText; private System.Windows.Forms.ListView ClassStandingsList; private System.Windows.Forms.ListView PaxStandingsList; private System.Windows.Forms.ColumnHeader PaxClassCol; private System.Windows.Forms.ColumnHeader PaxDriverCol; private System.Windows.Forms.ColumnHeader PaxCarCol; private System.Windows.Forms.ColumnHeader PaxPointsCol; private System.Windows.Forms.SaveFileDialog SaveReport; private System.Windows.Forms.MenuItem PerfectAttendanceMenu; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.MenuItem ExcludeMenu; private System.Windows.Forms.Button GenerateEventReportButton; private System.Windows.Forms.MenuItem menuItem5; private System.Windows.Forms.MenuItem EventReportMenu; private System.Windows.Forms.MenuItem GenerateAllEventReportsMenu; public SeasonWrapper season_data = null; public MainForm() { // // Required for Windows Form Designer support // InitializeComponent(); Utils.WriteToFlatLog(Utils.EXCEPTION_LOG, "Application started...", true, false); ClassStandingsList.ListViewItemSorter = new StandingsListSorter(); PaxStandingsList.ListViewItemSorter = new StandingsListSorter(); UpdateDisplay(); } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.MainMenu = new System.Windows.Forms.MainMenu(); this.FileMenu = new System.Windows.Forms.MenuItem(); this.NewMenu = new System.Windows.Forms.MenuItem(); this.OpenMenu = new System.Windows.Forms.MenuItem(); this.SaveMenu = new System.Windows.Forms.MenuItem(); this.SaveAsMenu = new System.Windows.Forms.MenuItem(); this.CloseMenu = new System.Windows.Forms.MenuItem(); this.SeperatorMenu = new System.Windows.Forms.MenuItem(); this.ExitMenu = new System.Windows.Forms.MenuItem(); this.ReportsMenu = new System.Windows.Forms.MenuItem(); this.EventReportMenu = new System.Windows.Forms.MenuItem(); this.GenerateAllEventReportsMenu = new System.Windows.Forms.MenuItem(); this.menuItem5 = new System.Windows.Forms.MenuItem(); this.ClassReportMenu = new System.Windows.Forms.MenuItem(); this.PaxReportMenu = new System.Windows.Forms.MenuItem(); this.PerfectAttendanceMenu = new System.Windows.Forms.MenuItem(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.menuItem2 = new System.Windows.Forms.MenuItem(); this.ExcludeMenu = new System.Windows.Forms.MenuItem(); this.StatusBar = new System.Windows.Forms.StatusBar(); this.StatusPanel = new System.Windows.Forms.StatusBarPanel(); this.FilenamePanel = new System.Windows.Forms.StatusBarPanel(); this.ModifiedPanel = new System.Windows.Forms.StatusBarPanel(); this.StatusTimer = new System.Windows.Forms.Timer(this.components); this.OpenFile = new System.Windows.Forms.OpenFileDialog(); this.SaveFile = new System.Windows.Forms.SaveFileDialog(); this.TabControl = new System.Windows.Forms.TabControl(); this.SettingsPage = new System.Windows.Forms.TabPage(); this.SingleEntrantPaxPointsText = new System.Windows.Forms.TextBox(); this.label16 = new System.Windows.Forms.Label(); this.SingleEntrantClassPointsText = new System.Windows.Forms.TextBox(); this.label15 = new System.Windows.Forms.Label(); this.ClubNameText = new System.Windows.Forms.TextBox(); this.label11 = new System.Windows.Forms.Label(); this.SeasonNameText = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.ClassActionsGroup = new System.Windows.Forms.GroupBox(); this.AddClassButton = new System.Windows.Forms.Button(); this.label14 = new System.Windows.Forms.Label(); this.ClassDetailsGroup = new System.Windows.Forms.GroupBox(); this.ClassLadiesCheck = new System.Windows.Forms.CheckBox(); this.ApplyClassButton = new System.Windows.Forms.Button(); this.ClassNonPointsCheck = new System.Windows.Forms.CheckBox(); this.DeleteClassButton = new System.Windows.Forms.Button(); this.ClassDescText = new System.Windows.Forms.TextBox(); this.label12 = new System.Windows.Forms.Label(); this.ClassIdText = new System.Windows.Forms.TextBox(); this.label13 = new System.Windows.Forms.Label(); this.ClassList = new System.Windows.Forms.ListBox(); this.DropCountUpDn = new System.Windows.Forms.NumericUpDown(); this.label5 = new System.Windows.Forms.Label(); this.ReqEventCountUpDn = new System.Windows.Forms.NumericUpDown(); this.label4 = new System.Windows.Forms.Label(); this.EventCountUpDn = new System.Windows.Forms.NumericUpDown(); this.label3 = new System.Windows.Forms.Label(); this.PaxPointsText = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.ClassPointsText = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.EventsPage = new System.Windows.Forms.TabPage(); this.EventActionsGroup = new System.Windows.Forms.GroupBox(); this.GenerateEventReportButton = new System.Windows.Forms.Button(); this.SyncAllEvents = new System.Windows.Forms.Button(); this.SyncSingleEvent = new System.Windows.Forms.Button(); this.EventDetailsGroup = new System.Windows.Forms.GroupBox(); this.DeleteEventButton = new System.Windows.Forms.Button(); this.label10 = new System.Windows.Forms.Label(); this.EventMover = new System.Windows.Forms.VScrollBar(); this.EventFilenameText = new System.Windows.Forms.TextBox(); this.label9 = new System.Windows.Forms.Label(); this.EventDateText = new System.Windows.Forms.TextBox(); this.label8 = new System.Windows.Forms.Label(); this.EventNameText = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); this.EventList = new System.Windows.Forms.ListBox(); this.ClassPointsPage = new System.Windows.Forms.TabPage(); this.ClassStandingsList = new System.Windows.Forms.ListView(); this.ClassCol = new System.Windows.Forms.ColumnHeader(); this.DriverCol = new System.Windows.Forms.ColumnHeader(); this.CarCol = new System.Windows.Forms.ColumnHeader(); this.ClassPointsCol = new System.Windows.Forms.ColumnHeader(); this.PaxPointsPage = new System.Windows.Forms.TabPage(); this.PaxStandingsList = new System.Windows.Forms.ListView(); this.PaxClassCol = new System.Windows.Forms.ColumnHeader(); this.PaxDriverCol = new System.Windows.Forms.ColumnHeader(); this.PaxCarCol = new System.Windows.Forms.ColumnHeader(); this.PaxPointsCol = new System.Windows.Forms.ColumnHeader(); this.SaveReport = new System.Windows.Forms.SaveFileDialog(); ((System.ComponentModel.ISupportInitialize)(this.StatusPanel)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.FilenamePanel)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ModifiedPanel)).BeginInit(); this.TabControl.SuspendLayout(); this.SettingsPage.SuspendLayout(); this.ClassActionsGroup.SuspendLayout(); this.ClassDetailsGroup.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.DropCountUpDn)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ReqEventCountUpDn)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.EventCountUpDn)).BeginInit(); this.EventsPage.SuspendLayout(); this.EventActionsGroup.SuspendLayout(); this.EventDetailsGroup.SuspendLayout(); this.ClassPointsPage.SuspendLayout(); this.PaxPointsPage.SuspendLayout(); this.SuspendLayout(); // // MainMenu // this.MainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.FileMenu, this.ReportsMenu}); // // FileMenu // this.FileMenu.Index = 0; this.FileMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.NewMenu, this.OpenMenu, this.SaveMenu, this.SaveAsMenu, this.CloseMenu, this.SeperatorMenu, this.ExitMenu}); this.FileMenu.Text = "&File"; // // NewMenu // this.NewMenu.Index = 0; this.NewMenu.Text = "&New"; this.NewMenu.Click += new System.EventHandler(this.NewMenu_Click); // // OpenMenu // this.OpenMenu.Index = 1; this.OpenMenu.Text = "&Open..."; this.OpenMenu.Click += new System.EventHandler(this.OpenMenu_Click); // // SaveMenu // this.SaveMenu.Index = 2; this.SaveMenu.Text = "&Save"; this.SaveMenu.Click += new System.EventHandler(this.SaveMenu_Click); // // SaveAsMenu // this.SaveAsMenu.Index = 3; this.SaveAsMenu.Text = "Save &As..."; this.SaveAsMenu.Click += new System.EventHandler(this.SaveAsMenu_Click); // // CloseMenu // this.CloseMenu.Index = 4; this.CloseMenu.Text = "&Close"; this.CloseMenu.Click += new System.EventHandler(this.CloseMenu_Click); // // SeperatorMenu // this.SeperatorMenu.Index = 5; this.SeperatorMenu.Text = "-"; // // ExitMenu // this.ExitMenu.Index = 6; this.ExitMenu.Text = "E&xit"; this.ExitMenu.Click += new System.EventHandler(this.ExitMenu_Click); // // ReportsMenu // this.ReportsMenu.Index = 1; this.ReportsMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.EventReportMenu, this.ClassReportMenu, this.PaxReportMenu, this.PerfectAttendanceMenu, this.menuItem1, this.menuItem2}); this.ReportsMenu.Text = "&Reports"; // // EventReportMenu // this.EventReportMenu.Index = 0; this.EventReportMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.GenerateAllEventReportsMenu, this.menuItem5}); this.EventReportMenu.Text = "&Event Reports"; this.EventReportMenu.Popup += new System.EventHandler(this.EventReportMenu_Popup); // // GenerateAllEventReportsMenu // this.GenerateAllEventReportsMenu.Index = 0; this.GenerateAllEventReportsMenu.Text = "&All Events"; this.GenerateAllEventReportsMenu.Click += new System.EventHandler(this.GenerateAllEventReportsMenu_Click); // // menuItem5 // this.menuItem5.Index = 1; this.menuItem5.Text = "-"; // // ClassReportMenu // this.ClassReportMenu.Index = 1; this.ClassReportMenu.Text = "&Class Standings..."; this.ClassReportMenu.Click += new System.EventHandler(this.GenerateReport); // // PaxReportMenu // this.PaxReportMenu.Index = 2; this.PaxReportMenu.Text = "&PAX Standings..."; this.PaxReportMenu.Click += new System.EventHandler(this.GenerateReport); // // PerfectAttendanceMenu // this.PerfectAttendanceMenu.Index = 3; this.PerfectAttendanceMenu.Text = "Perfect &Attendance..."; this.PerfectAttendanceMenu.Click += new System.EventHandler(this.PerfectAttendanceMenu_Click); // // menuItem1 // this.menuItem1.Index = 4; this.menuItem1.Text = "-"; // // menuItem2 // this.menuItem2.Index = 5; this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.ExcludeMenu}); this.menuItem2.Text = "Report &Options"; // // ExcludeMenu // this.ExcludeMenu.Checked = true; this.ExcludeMenu.Index = 0; this.ExcludeMenu.Text = "E&xclude non-Qualified Drivers"; this.ExcludeMenu.Click += new System.EventHandler(this.ExcludeMenu_Click); // // StatusBar // this.StatusBar.Location = new System.Drawing.Point(0, 449); this.StatusBar.Name = "StatusBar"; this.StatusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { this.StatusPanel, this.FilenamePanel, this.ModifiedPanel}); this.StatusBar.ShowPanels = true; this.StatusBar.Size = new System.Drawing.Size(864, 24); this.StatusBar.TabIndex = 0; // // StatusPanel // this.StatusPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; this.StatusPanel.Width = 680; // // FilenamePanel // this.FilenamePanel.Alignment = System.Windows.Forms.HorizontalAlignment.Center; this.FilenamePanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents; this.FilenamePanel.Text = "No season open"; this.FilenamePanel.Width = 96; // // ModifiedPanel // this.ModifiedPanel.Alignment = System.Windows.Forms.HorizontalAlignment.Center; this.ModifiedPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents; this.ModifiedPanel.Text = "Unmodified"; this.ModifiedPanel.Width = 72; // // StatusTimer // this.StatusTimer.Interval = 8000; this.StatusTimer.Tick += new System.EventHandler(this.StatusTimer_Tick); // // OpenFile // this.OpenFile.DefaultExt = "season"; this.OpenFile.Filter = "Season Files (*.season)|*.season|All File (*.*)|*.*"; this.OpenFile.Title = "Open Season File"; // // SaveFile // this.SaveFile.DefaultExt = "season"; this.SaveFile.Filter = "Season Files (*.season)|*.season|All File (*.*)|*.*"; this.SaveFile.Title = "Save Season File"; // // TabControl // this.TabControl.Controls.Add(this.SettingsPage); this.TabControl.Controls.Add(this.EventsPage); this.TabControl.Controls.Add(this.ClassPointsPage); this.TabControl.Controls.Add(this.PaxPointsPage); this.TabControl.Dock = System.Windows.Forms.DockStyle.Fill; this.TabControl.Location = new System.Drawing.Point(0, 0); this.TabControl.Name = "TabControl"; this.TabControl.SelectedIndex = 0; this.TabControl.Size = new System.Drawing.Size(864, 449); this.TabControl.TabIndex = 1; // // SettingsPage // this.SettingsPage.Controls.Add(this.SingleEntrantPaxPointsText); this.SettingsPage.Controls.Add(this.label16); this.SettingsPage.Controls.Add(this.SingleEntrantClassPointsText); this.SettingsPage.Controls.Add(this.label15); this.SettingsPage.Controls.Add(this.ClubNameText); this.SettingsPage.Controls.Add(this.label11); this.SettingsPage.Controls.Add(this.SeasonNameText); this.SettingsPage.Controls.Add(this.label6); this.SettingsPage.Controls.Add(this.ClassActionsGroup); this.SettingsPage.Controls.Add(this.label14); this.SettingsPage.Controls.Add(this.ClassDetailsGroup); this.SettingsPage.Controls.Add(this.ClassList); this.SettingsPage.Controls.Add(this.DropCountUpDn); this.SettingsPage.Controls.Add(this.label5); this.SettingsPage.Controls.Add(this.ReqEventCountUpDn); this.SettingsPage.Controls.Add(this.label4); this.SettingsPage.Controls.Add(this.EventCountUpDn); this.SettingsPage.Controls.Add(this.label3); this.SettingsPage.Controls.Add(this.PaxPointsText); this.SettingsPage.Controls.Add(this.label2); this.SettingsPage.Controls.Add(this.ClassPointsText); this.SettingsPage.Controls.Add(this.label1); this.SettingsPage.Location = new System.Drawing.Point(4, 22); this.SettingsPage.Name = "SettingsPage"; this.SettingsPage.Size = new System.Drawing.Size(856, 423); this.SettingsPage.TabIndex = 0; this.SettingsPage.Text = "Settings"; // // SingleEntrantPaxPointsText // this.SingleEntrantPaxPointsText.Location = new System.Drawing.Point(520, 80); this.SingleEntrantPaxPointsText.Name = "SingleEntrantPaxPointsText"; this.SingleEntrantPaxPointsText.Size = new System.Drawing.Size(48, 20); this.SingleEntrantPaxPointsText.TabIndex = 34; this.SingleEntrantPaxPointsText.Text = ""; // // label16 // this.label16.Location = new System.Drawing.Point(392, 80); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(120, 20); this.label16.TabIndex = 33; this.label16.Text = "Single Entrant Points:"; this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // SingleEntrantClassPointsText // this.SingleEntrantClassPointsText.Location = new System.Drawing.Point(520, 56); this.SingleEntrantClassPointsText.Name = "SingleEntrantClassPointsText"; this.SingleEntrantClassPointsText.Size = new System.Drawing.Size(48, 20); this.SingleEntrantClassPointsText.TabIndex = 32; this.SingleEntrantClassPointsText.Text = ""; // // label15 // this.label15.Location = new System.Drawing.Point(392, 56); this.label15.Name = "label15"; this.label15.Size = new System.Drawing.Size(120, 20); this.label15.TabIndex = 31; this.label15.Text = "Single Entrant Points:"; this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // ClubNameText // this.ClubNameText.Location = new System.Drawing.Point(144, 32); this.ClubNameText.Name = "ClubNameText"; this.ClubNameText.Size = new System.Drawing.Size(248, 20); this.ClubNameText.TabIndex = 30; this.ClubNameText.Text = ""; // // label11 // this.label11.Location = new System.Drawing.Point(72, 32); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(64, 20); this.label11.TabIndex = 29; this.label11.Text = "Club Name:"; this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // SeasonNameText // this.SeasonNameText.Location = new System.Drawing.Point(144, 8); this.SeasonNameText.Name = "SeasonNameText"; this.SeasonNameText.Size = new System.Drawing.Size(248, 20); this.SeasonNameText.TabIndex = 28; this.SeasonNameText.Text = ""; // // label6 // this.label6.Location = new System.Drawing.Point(8, 8); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(128, 20); this.label6.TabIndex = 27; this.label6.Text = "Season Name:"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // ClassActionsGroup // this.ClassActionsGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.ClassActionsGroup.Controls.Add(this.AddClassButton); this.ClassActionsGroup.Location = new System.Drawing.Point(608, 280); this.ClassActionsGroup.Name = "ClassActionsGroup"; this.ClassActionsGroup.Size = new System.Drawing.Size(232, 56); this.ClassActionsGroup.TabIndex = 26; this.ClassActionsGroup.TabStop = false; this.ClassActionsGroup.Text = "Class Actions"; // // AddClassButton // this.AddClassButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.AddClassButton.Enabled = false; this.AddClassButton.Location = new System.Drawing.Point(16, 24); this.AddClassButton.Name = "AddClassButton"; this.AddClassButton.Size = new System.Drawing.Size(88, 23); this.AddClassButton.TabIndex = 20; this.AddClassButton.Text = "Add Class"; // // label14 // this.label14.Location = new System.Drawing.Point(8, 128); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(128, 16); this.label14.TabIndex = 25; this.label14.Text = "Classes:"; this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // ClassDetailsGroup // this.ClassDetailsGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.ClassDetailsGroup.Controls.Add(this.ClassLadiesCheck); this.ClassDetailsGroup.Controls.Add(this.ApplyClassButton); this.ClassDetailsGroup.Controls.Add(this.ClassNonPointsCheck); this.ClassDetailsGroup.Controls.Add(this.DeleteClassButton); this.ClassDetailsGroup.Controls.Add(this.ClassDescText); this.ClassDetailsGroup.Controls.Add(this.label12); this.ClassDetailsGroup.Controls.Add(this.ClassIdText); this.ClassDetailsGroup.Controls.Add(this.label13); this.ClassDetailsGroup.Enabled = false; this.ClassDetailsGroup.Location = new System.Drawing.Point(608, 128); this.ClassDetailsGroup.Name = "ClassDetailsGroup"; this.ClassDetailsGroup.Size = new System.Drawing.Size(232, 152); this.ClassDetailsGroup.TabIndex = 24; this.ClassDetailsGroup.TabStop = false; this.ClassDetailsGroup.Text = "Selected Class Details"; // // ClassLadiesCheck // this.ClassLadiesCheck.Location = new System.Drawing.Point(72, 64); this.ClassLadiesCheck.Name = "ClassLadiesCheck"; this.ClassLadiesCheck.Size = new System.Drawing.Size(152, 20); this.ClassLadiesCheck.TabIndex = 22; this.ClassLadiesCheck.Text = "Ladies Class?"; this.ClassLadiesCheck.CheckedChanged += new System.EventHandler(this.ClassDetailsChanged); // // ApplyClassButton // this.ApplyClassButton.Location = new System.Drawing.Point(16, 120); this.ApplyClassButton.Name = "ApplyClassButton"; this.ApplyClassButton.Size = new System.Drawing.Size(96, 23); this.ApplyClassButton.TabIndex = 21; this.ApplyClassButton.Text = "Apply Changes"; this.ApplyClassButton.Click += new System.EventHandler(this.ApplyClassButton_Click); // // ClassNonPointsCheck // this.ClassNonPointsCheck.Location = new System.Drawing.Point(72, 88); this.ClassNonPointsCheck.Name = "ClassNonPointsCheck"; this.ClassNonPointsCheck.Size = new System.Drawing.Size(152, 20); this.ClassNonPointsCheck.TabIndex = 20; this.ClassNonPointsCheck.Text = "Non-Points Class?"; this.ClassNonPointsCheck.CheckedChanged += new System.EventHandler(this.ClassDetailsChanged); // // DeleteClassButton // this.DeleteClassButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.DeleteClassButton.Enabled = false; this.DeleteClassButton.Location = new System.Drawing.Point(120, 120); this.DeleteClassButton.Name = "DeleteClassButton"; this.DeleteClassButton.Size = new System.Drawing.Size(96, 23); this.DeleteClassButton.TabIndex = 19; this.DeleteClassButton.Text = "Delete Class"; // // ClassDescText // this.ClassDescText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ClassDescText.Location = new System.Drawing.Point(72, 40); this.ClassDescText.Name = "ClassDescText"; this.ClassDescText.Size = new System.Drawing.Size(152, 20); this.ClassDescText.TabIndex = 5; this.ClassDescText.Text = ""; this.ClassDescText.TextChanged += new System.EventHandler(this.ClassDetailsChanged); // // label12 // this.label12.Location = new System.Drawing.Point(8, 40); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(56, 20); this.label12.TabIndex = 4; this.label12.Text = "Desc:"; this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // ClassIdText // this.ClassIdText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ClassIdText.Location = new System.Drawing.Point(72, 16); this.ClassIdText.Name = "ClassIdText"; this.ClassIdText.Size = new System.Drawing.Size(152, 20); this.ClassIdText.TabIndex = 3; this.ClassIdText.Text = ""; this.ClassIdText.TextChanged += new System.EventHandler(this.ClassDetailsChanged); // // label13 // this.label13.Location = new System.Drawing.Point(8, 16); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(56, 20); this.label13.TabIndex = 2; this.label13.Text = "Class ID:"; this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // ClassList // this.ClassList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ClassList.IntegralHeight = false; this.ClassList.Location = new System.Drawing.Point(144, 128); this.ClassList.Name = "ClassList"; this.ClassList.Size = new System.Drawing.Size(456, 288); this.ClassList.TabIndex = 23; this.ClassList.SelectedIndexChanged += new System.EventHandler(this.ClassList_SelectedIndexChanged); // // DropCountUpDn // this.DropCountUpDn.Location = new System.Drawing.Point(520, 104); this.DropCountUpDn.Name = "DropCountUpDn"; this.DropCountUpDn.Size = new System.Drawing.Size(48, 20); this.DropCountUpDn.TabIndex = 9; // // label5 // this.label5.Location = new System.Drawing.Point(376, 104); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(136, 20); this.label5.TabIndex = 8; this.label5.Text = "Number of Drops:"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // ReqEventCountUpDn // this.ReqEventCountUpDn.Location = new System.Drawing.Point(328, 104); this.ReqEventCountUpDn.Name = "ReqEventCountUpDn"; this.ReqEventCountUpDn.Size = new System.Drawing.Size(48, 20); this.ReqEventCountUpDn.TabIndex = 7; // // label4 // this.label4.Location = new System.Drawing.Point(192, 104); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(128, 20); this.label4.TabIndex = 6; this.label4.Text = "Events to Qualify:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // EventCountUpDn // this.EventCountUpDn.Location = new System.Drawing.Point(144, 104); this.EventCountUpDn.Name = "EventCountUpDn"; this.EventCountUpDn.Size = new System.Drawing.Size(48, 20); this.EventCountUpDn.TabIndex = 5; // // label3 // this.label3.Location = new System.Drawing.Point(8, 104); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(128, 20); this.label3.TabIndex = 4; this.label3.Text = "Number of Events:"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // PaxPointsText // this.PaxPointsText.Location = new System.Drawing.Point(144, 80); this.PaxPointsText.Name = "PaxPointsText"; this.PaxPointsText.Size = new System.Drawing.Size(248, 20); this.PaxPointsText.TabIndex = 3; this.PaxPointsText.Text = ""; // // label2 // this.label2.Location = new System.Drawing.Point(8, 80); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(128, 20); this.label2.TabIndex = 2; this.label2.Text = "PAX Points Sequence:"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // ClassPointsText // this.ClassPointsText.Location = new System.Drawing.Point(144, 56); this.ClassPointsText.Name = "ClassPointsText"; this.ClassPointsText.Size = new System.Drawing.Size(248, 20); this.ClassPointsText.TabIndex = 1; this.ClassPointsText.Text = ""; // // label1 // this.label1.Location = new System.Drawing.Point(8, 56); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(128, 20); this.label1.TabIndex = 0; this.label1.Text = "Class Points Sequence:"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // EventsPage // this.EventsPage.Controls.Add(this.EventActionsGroup); this.EventsPage.Controls.Add(this.EventDetailsGroup); this.EventsPage.Controls.Add(this.EventList); this.EventsPage.Location = new System.Drawing.Point(4, 22); this.EventsPage.Name = "EventsPage"; this.EventsPage.Size = new System.Drawing.Size(856, 423); this.EventsPage.TabIndex = 2; this.EventsPage.Text = "Events"; // // EventActionsGroup // this.EventActionsGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.EventActionsGroup.Controls.Add(this.GenerateEventReportButton); this.EventActionsGroup.Controls.Add(this.SyncAllEvents); this.EventActionsGroup.Controls.Add(this.SyncSingleEvent); this.EventActionsGroup.Location = new System.Drawing.Point(568, 152); this.EventActionsGroup.Name = "EventActionsGroup"; this.EventActionsGroup.Size = new System.Drawing.Size(280, 128); this.EventActionsGroup.TabIndex = 24; this.EventActionsGroup.TabStop = false; this.EventActionsGroup.Text = "Event Actions"; // // GenerateEventReportButton // this.GenerateEventReportButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.GenerateEventReportButton.Location = new System.Drawing.Point(16, 88); this.GenerateEventReportButton.Name = "GenerateEventReportButton"; this.GenerateEventReportButton.Size = new System.Drawing.Size(248, 23); this.GenerateEventReportButton.TabIndex = 22; this.GenerateEventReportButton.Text = "Generate event report..."; this.GenerateEventReportButton.Click += new System.EventHandler(this.GenerateEventReportButton_Click); // // SyncAllEvents // this.SyncAllEvents.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.SyncAllEvents.Location = new System.Drawing.Point(16, 53); this.SyncAllEvents.Name = "SyncAllEvents"; this.SyncAllEvents.Size = new System.Drawing.Size(248, 23); this.SyncAllEvents.TabIndex = 21; this.SyncAllEvents.Text = "Sync all events with championship..."; // // SyncSingleEvent // this.SyncSingleEvent.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.SyncSingleEvent.Location = new System.Drawing.Point(16, 24); this.SyncSingleEvent.Name = "SyncSingleEvent"; this.SyncSingleEvent.Size = new System.Drawing.Size(248, 23); this.SyncSingleEvent.TabIndex = 20; this.SyncSingleEvent.Text = "Sync selected event with championship..."; this.SyncSingleEvent.Click += new System.EventHandler(this.SyncSingleEvent_Click); // // EventDetailsGroup // this.EventDetailsGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.EventDetailsGroup.Controls.Add(this.DeleteEventButton); this.EventDetailsGroup.Controls.Add(this.label10); this.EventDetailsGroup.Controls.Add(this.EventMover); this.EventDetailsGroup.Controls.Add(this.EventFilenameText); this.EventDetailsGroup.Controls.Add(this.label9); this.EventDetailsGroup.Controls.Add(this.EventDateText); this.EventDetailsGroup.Controls.Add(this.label8); this.EventDetailsGroup.Controls.Add(this.EventNameText); this.EventDetailsGroup.Controls.Add(this.label7); this.EventDetailsGroup.Enabled = false; this.EventDetailsGroup.Location = new System.Drawing.Point(568, 8); this.EventDetailsGroup.Name = "EventDetailsGroup"; this.EventDetailsGroup.Size = new System.Drawing.Size(280, 128); this.EventDetailsGroup.TabIndex = 22; this.EventDetailsGroup.TabStop = false; this.EventDetailsGroup.Text = "Selected Event Details"; // // DeleteEventButton // this.DeleteEventButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.DeleteEventButton.Location = new System.Drawing.Point(104, 96); this.DeleteEventButton.Name = "DeleteEventButton"; this.DeleteEventButton.Size = new System.Drawing.Size(168, 23); this.DeleteEventButton.TabIndex = 19; this.DeleteEventButton.Text = "Delete Event"; // // label10 // this.label10.Location = new System.Drawing.Point(8, 88); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(56, 32); this.label10.TabIndex = 17; this.label10.Text = "Move:"; this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // EventMover // this.EventMover.LargeChange = 1; this.EventMover.Location = new System.Drawing.Point(72, 88); this.EventMover.Maximum = 1; this.EventMover.Minimum = -1; this.EventMover.Name = "EventMover"; this.EventMover.Size = new System.Drawing.Size(24, 32); this.EventMover.TabIndex = 16; this.EventMover.TabStop = true; // // EventFilenameText // this.EventFilenameText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.EventFilenameText.Location = new System.Drawing.Point(72, 64); this.EventFilenameText.Name = "EventFilenameText"; this.EventFilenameText.Size = new System.Drawing.Size(200, 20); this.EventFilenameText.TabIndex = 7; this.EventFilenameText.Text = ""; // // label9 // this.label9.Location = new System.Drawing.Point(8, 64); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(56, 20); this.label9.TabIndex = 6; this.label9.Text = "Filename:"; this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // EventDateText // this.EventDateText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.EventDateText.Location = new System.Drawing.Point(72, 40); this.EventDateText.Name = "EventDateText"; this.EventDateText.Size = new System.Drawing.Size(200, 20); this.EventDateText.TabIndex = 5; this.EventDateText.Text = ""; // // label8 // this.label8.Location = new System.Drawing.Point(8, 40); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(56, 20); this.label8.TabIndex = 4; this.label8.Text = "Date:"; this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // EventNameText // this.EventNameText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.EventNameText.Location = new System.Drawing.Point(72, 16); this.EventNameText.Name = "EventNameText"; this.EventNameText.Size = new System.Drawing.Size(200, 20); this.EventNameText.TabIndex = 3; this.EventNameText.Text = ""; // // label7 // this.label7.Location = new System.Drawing.Point(8, 16); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(56, 20); this.label7.TabIndex = 2; this.label7.Text = "Name:"; this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // EventList // this.EventList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.EventList.IntegralHeight = false; this.EventList.Location = new System.Drawing.Point(8, 8); this.EventList.Name = "EventList"; this.EventList.Size = new System.Drawing.Size(552, 403); this.EventList.TabIndex = 21; this.EventList.SelectedIndexChanged += new System.EventHandler(this.EventList_SelectedIndexChanged); // // ClassPointsPage // this.ClassPointsPage.Controls.Add(this.ClassStandingsList); this.ClassPointsPage.Location = new System.Drawing.Point(4, 22); this.ClassPointsPage.Name = "ClassPointsPage"; this.ClassPointsPage.Size = new System.Drawing.Size(856, 423); this.ClassPointsPage.TabIndex = 1; this.ClassPointsPage.Text = "Class Championship Points"; // // ClassStandingsList // this.ClassStandingsList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.ClassCol, this.DriverCol, this.CarCol, this.ClassPointsCol}); this.ClassStandingsList.Dock = System.Windows.Forms.DockStyle.Fill; this.ClassStandingsList.FullRowSelect = true; this.ClassStandingsList.GridLines = true; this.ClassStandingsList.Location = new System.Drawing.Point(0, 0); this.ClassStandingsList.MultiSelect = false; this.ClassStandingsList.Name = "ClassStandingsList"; this.ClassStandingsList.Size = new System.Drawing.Size(856, 423); this.ClassStandingsList.TabIndex = 2; this.ClassStandingsList.View = System.Windows.Forms.View.Details; // // ClassCol // this.ClassCol.Text = "Class"; // // DriverCol // this.DriverCol.Text = "Driver"; this.DriverCol.Width = 150; // // CarCol // this.CarCol.Text = "Car"; this.CarCol.Width = 150; // // ClassPointsCol // this.ClassPointsCol.Text = "Pos (Pts/Drops)"; this.ClassPointsCol.Width = 100; // // PaxPointsPage // this.PaxPointsPage.Controls.Add(this.PaxStandingsList); this.PaxPointsPage.Location = new System.Drawing.Point(4, 22); this.PaxPointsPage.Name = "PaxPointsPage"; this.PaxPointsPage.Size = new System.Drawing.Size(856, 423); this.PaxPointsPage.TabIndex = 3; this.PaxPointsPage.Text = "PAX Championship Points"; // // PaxStandingsList // this.PaxStandingsList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.PaxClassCol, this.PaxDriverCol, this.PaxCarCol, this.PaxPointsCol}); this.PaxStandingsList.Dock = System.Windows.Forms.DockStyle.Fill; this.PaxStandingsList.FullRowSelect = true; this.PaxStandingsList.GridLines = true; this.PaxStandingsList.Location = new System.Drawing.Point(0, 0); this.PaxStandingsList.MultiSelect = false; this.PaxStandingsList.Name = "PaxStandingsList"; this.PaxStandingsList.Size = new System.Drawing.Size(856, 423); this.PaxStandingsList.TabIndex = 3; this.PaxStandingsList.View = System.Windows.Forms.View.Details; // // PaxClassCol // this.PaxClassCol.Text = "Class"; // // PaxDriverCol // this.PaxDriverCol.Text = "Driver"; this.PaxDriverCol.Width = 150; // // PaxCarCol // this.PaxCarCol.Text = "Car"; this.PaxCarCol.Width = 150; // // PaxPointsCol // this.PaxPointsCol.Text = "Pos (Pts/Drops)"; this.PaxPointsCol.Width = 100; // // SaveReport // this.SaveReport.DefaultExt = "html"; this.SaveReport.Filter = "HTML Reports (*.html)|*.html|All Files (*.*)|*.*"; this.SaveReport.Title = "Save Report"; // // MainForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(864, 473); this.Controls.Add(this.TabControl); this.Controls.Add(this.StatusBar); this.Menu = this.MainMenu; this.MinimumSize = new System.Drawing.Size(600, 448); this.Name = "MainForm"; this.Text = "Season Manager"; this.Closing += new System.ComponentModel.CancelEventHandler(this.MainForm_Closing); ((System.ComponentModel.ISupportInitialize)(this.StatusPanel)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.FilenamePanel)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ModifiedPanel)).EndInit(); this.TabControl.ResumeLayout(false); this.SettingsPage.ResumeLayout(false); this.ClassActionsGroup.ResumeLayout(false); this.ClassDetailsGroup.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.DropCountUpDn)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ReqEventCountUpDn)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.EventCountUpDn)).EndInit(); this.EventsPage.ResumeLayout(false); this.EventActionsGroup.ResumeLayout(false); this.EventDetailsGroup.ResumeLayout(false); this.ClassPointsPage.ResumeLayout(false); this.PaxPointsPage.ResumeLayout(false); this.ResumeLayout(false); } #endregion /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new MainForm()); } public ulong GetNextID() { ulong rval = 0; if (season_data != null) { rval = season_data.Payload.DocState.next_id++; } return rval; } public void StatusMessage(string message) { StatusTimer.Enabled = false; StatusPanel.Text = message; StatusTimer.Enabled = true; } private void StatusTimer_Tick(object sender, System.EventArgs e) { StatusTimer.Enabled = false; StatusPanel.Text = ""; } private void ExitMenu_Click(object sender, System.EventArgs e) { Close(); } private void NewMenu_Click(object sender, System.EventArgs e) { CloseMenu_Click(this, e); if (season_data == null) { season_data = new SeasonWrapper(); season_data.LoadDefaults(); UpdateDisplay(); StatusMessage("New season created."); } } private void OpenMenu_Click(object sender, System.EventArgs e) { CloseMenu_Click(this, e); if (season_data == null) { if (OpenFile.ShowDialog(this) == DialogResult.OK) { season_data = new SeasonWrapper(); if (season_data.LoadFromFile(OpenFile.FileName)) { UpdateDisplay(); StatusMessage("Opened file '" + OpenFile.FileName + "'."); } else { season_data = null; GC.Collect(); StatusMessage("Error opening file '" + OpenFile.FileName + "'."); } } } } private void SaveMenu_Click(object sender, System.EventArgs e) { if (season_data != null) { if (season_data.Payload.DocState.filename == "") { SaveAsMenu_Click(this, e); } else { season_data.Payload.DocState.modified = false; if (season_data.SaveToFile(season_data.Payload.DocState.filename)) { StatusMessage("Season saved to file '" + season_data.Payload.DocState.filename + "'."); } else { season_data.Payload.DocState.modified = true; StatusMessage("Error saving to file '" + season_data.Payload.DocState.filename + "'."); } } } } private void SaveAsMenu_Click(object sender, System.EventArgs e) { if (season_data != null) { if (SaveFile.ShowDialog(this) == DialogResult.OK) { season_data.Payload.DocState.filename = SaveFile.FileName; UpdateDisplay(); SaveMenu_Click(this, e); } } } private void CloseMenu_Click(object sender, System.EventArgs e) { if (season_data != null) { DialogResult result = DialogResult.No; if (season_data.Payload.DocState.modified) { result = MessageBox.Show(this, "The current season is modified, save before closing?", "Save Season?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); } switch (result) { case DialogResult.Yes: SaveMenu_Click(this, e); if (season_data.Payload.DocState.modified) { return; // user cancelled the save operation } goto case DialogResult.No; case DialogResult.No: season_data = null; GC.Collect(); UpdateDisplay(); StatusMessage("Season file closed."); break; default: // do nothing break; } } } public void UpdateDisplay() { if (season_data == null) { // Update StatusBar FilenamePanel.Text = "No season open"; ModifiedPanel.Text = "Unmodified"; // Update Season Info SeasonNameText.Text = ""; ClubNameText.Text = ""; // Update Settings ClassPointsText.Text = ""; SingleEntrantClassPointsText.Text = ""; PaxPointsText.Text = ""; SingleEntrantPaxPointsText.Text = ""; EventCountUpDn.Value = 0; ReqEventCountUpDn.Value = 0; DropCountUpDn.Value = 0; // Update Class List ClassList.Items.Clear(); // Update Event List EventList.Items.Clear(); // Update Class Standing List ClassStandingsList.Items.Clear(); } else { #region Update StatusBar if (season_data.Payload.DocState.filename == "") { FilenamePanel.Text = "New file"; } else { FilenamePanel.Text = season_data.Payload.DocState.filename; } if (season_data.Payload.DocState.modified) { ModifiedPanel.Text = "Modified"; } else { ModifiedPanel.Text = "Unmodified"; } #endregion #region Update Season Info SeasonNameText.Text = season_data.Payload.name; ClubNameText.Text = season_data.Payload.club; #endregion #region Update Settings ClassPointsText.Text = season_data.Payload.Settings.class_points; SingleEntrantClassPointsText.Text = season_data.Payload.Settings.single_entrant_class_points.ToString(); PaxPointsText.Text = season_data.Payload.Settings.pax_points; SingleEntrantPaxPointsText.Text = season_data.Payload.Settings.single_entrant_pax_points.ToString(); EventCountUpDn.Value = season_data.Payload.Settings.event_count; ReqEventCountUpDn.Value = season_data.Payload.Settings.min_event_count; DropCountUpDn.Value = season_data.Payload.Settings.drop_count; #endregion #region Update Class List ClassList.BeginUpdate(); { ClassList.Items.Clear(); for (int i=0; i<season_data.Payload.Classes.Length; i++) { ClassList.Items.Add(new ClassWrapper(ref season_data.Payload.Classes[i])); } } ClassList.EndUpdate(); #endregion #region Update Event List EventList.BeginUpdate(); { EventList.Items.Clear(); for (int i=0; i<season_data.Payload.Events.Length; i++) { EventList.Items.Add(new EventWrapper(ref season_data.Payload.Events[i])); } } EventList.EndUpdate(); #endregion #region Update Class Standing List ClassStandingsList.BeginUpdate(); ClassStandingsList.Items.Clear(); // update the events columns while (ClassStandingsList.Columns.Count > 4) { ClassStandingsList.Columns.RemoveAt(4); } for (uint i=0; i<season_data.Payload.Settings.event_count; i++) { ColumnHeader event_col = new ColumnHeader(); event_col.Text = "Round " + (i+1).ToString(); event_col.Width = 60; event_col.TextAlign = HorizontalAlignment.Center; ClassStandingsList.Columns.Add(event_col); } // loop through the drivers adding results for (int i=0; i<season_data.Payload.Drivers.Length; i++) { DriverWrapper curr_driver = new DriverWrapper(ref season_data.Payload.Drivers[i]); for (int j=0; j<season_data.Payload.Classes.Length; j++) { ClassWrapper curr_class = new ClassWrapper(ref season_data.Payload.Classes[j]); ListViewItem item = null; for (int k=0; k<curr_driver.Payload.Points.Length; k++) { if (curr_driver.Payload.Points[k].class_id == curr_class.Payload.id) { if (item == null) { item = new ListViewItem(); item.Tag = curr_driver; item.Text = curr_class.Payload.id; item.SubItems.Add(curr_driver.ToString()); item.SubItems.Add(curr_driver.Payload.car); int pos; int pts; int pts_d; bool qual; season_data.GetClassStandings(curr_driver, curr_class.Payload.id, ExcludeMenu.Checked, out pos, out pts, out pts_d, out qual); if (pos == 0) { item.SubItems.Add("-"); } else { item.SubItems.Add(pos.ToString() + " (" + pts.ToString() + "/" + pts_d.ToString() + ")"); } for (uint c=0; c<season_data.Payload.Settings.event_count; c++) { item.SubItems.Add("-"); } if (qual) { item.ForeColor = Color.Black; } else { item.ForeColor = Color.DarkGray; } ClassStandingsList.Items.Add(item); } item.SubItems[(int)curr_driver.Payload.Points[k].event_number + 3].Text = curr_driver.Payload.Points[k].class_amount.ToString(); } } } } ClassStandingsList.EndUpdate(); #endregion #region Update Pax Standing List PaxStandingsList.BeginUpdate(); PaxStandingsList.Items.Clear(); // update the events columns while (PaxStandingsList.Columns.Count > 4) { PaxStandingsList.Columns.RemoveAt(4); } for (uint i=0; i<season_data.Payload.Settings.event_count; i++) { ColumnHeader event_col = new ColumnHeader(); event_col.Text = "Round " + (i+1).ToString(); event_col.Width = 60; event_col.TextAlign = HorizontalAlignment.Center; PaxStandingsList.Columns.Add(event_col); } // loop through the drivers adding results for (int i=0; i<season_data.Payload.Drivers.Length; i++) { DriverWrapper curr_driver = new DriverWrapper(ref season_data.Payload.Drivers[i]); for (int j=0; j<2; j++) { bool ladies = (j == 1); ListViewItem item = null; for (int k=0; k<curr_driver.Payload.Points.Length; k++) { if (season_data.GetClass(curr_driver.Payload.Points[k].class_id).Payload.ladies == ladies) { if (item == null) { item = new ListViewItem(); item.Tag = curr_driver; item.Text = ladies ? "Ladies" : "Open"; item.SubItems.Add(curr_driver.ToString()); item.SubItems.Add(curr_driver.Payload.car); int pos; int pts; int pts_d; bool qual; season_data.GetPaxStandings(curr_driver, ladies, ExcludeMenu.Checked, out pos, out pts, out pts_d, out qual); if (pos == 0) { item.SubItems.Add("-"); } else { item.SubItems.Add(pos.ToString() + " (" + pts.ToString() + "/" + pts_d.ToString() + ")"); } for (uint c=0; c<season_data.Payload.Settings.event_count; c++) { item.SubItems.Add("-"); } if (qual) { item.ForeColor = Color.Black; } else { item.ForeColor = Color.DarkGray; } PaxStandingsList.Items.Add(item); } item.SubItems[(int)curr_driver.Payload.Points[k].event_number + 3].Text = curr_driver.Payload.Points[k].pax_amount.ToString(); } } } } PaxStandingsList.EndUpdate(); #endregion } } private void ClassList_SelectedIndexChanged(object sender, System.EventArgs e) { ignore_class_details_change = true; if (ClassList.SelectedItem == null) { ClassDetailsGroup.Enabled = false; ClassIdText.Text = ""; ClassDescText.Text = ""; ClassLadiesCheck.Checked = false; ClassNonPointsCheck.Checked = false; ApplyClassButton.Enabled = false; } else { ClassWrapper c = (ClassWrapper)ClassList.SelectedItem; ClassIdText.Text = c.Payload.id; ClassDescText.Text = c.Payload.description; ClassLadiesCheck.Checked = c.Payload.ladies; ClassNonPointsCheck.Checked = c.Payload.non_points; ClassDetailsGroup.Enabled = true; ApplyClassButton.Enabled = false; } ignore_class_details_change = false; } private void ApplyClassButton_Click(object sender, System.EventArgs e) { if (ClassList.SelectedItem != null) { ClassWrapper c = (ClassWrapper)ClassList.SelectedItem; c.Payload.id = ClassIdText.Text; c.Payload.description = ClassDescText.Text; c.Payload.ladies = ClassLadiesCheck.Checked; c.Payload.non_points = ClassNonPointsCheck.Checked; ApplyClassButton.Enabled = false; season_data.Payload.DocState.modified = true; UpdateDisplay(); } } private bool ignore_class_details_change = false; private void ClassDetailsChanged(object sender, System.EventArgs e) { if (ignore_class_details_change) return; ApplyClassButton.Enabled = true; } private void EventList_SelectedIndexChanged(object sender, System.EventArgs e) { if (EventList.SelectedItem == null) { //EventDetailsGroup.Enabled = false; EventNameText.Text = ""; EventDateText.Text = ""; EventFilenameText.Text = ""; } else { EventWrapper ev = (EventWrapper)EventList.SelectedItem; EventNameText.Text = ev.Payload.name; EventDateText.Text = ev.Payload.date; EventFilenameText.Text = ev.Payload.data_file; //EventDetailsGroup.Enabled = true; } } private void SyncSingleEvent_Click(object sender, System.EventArgs e) { if (EventList.SelectedItem != null) { EventWrapper curr_event = (EventWrapper)EventList.SelectedItem; new ImportEventForm(ref curr_event, ref season_data).ShowDialog(); UpdateDisplay(); } } private void MainForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { CloseMenu_Click(this, null); if (season_data != null) { e.Cancel = true; } } private void ExcludeMenu_Click(object sender, System.EventArgs e) { ExcludeMenu.Checked = !ExcludeMenu.Checked; UpdateDisplay(); } private void GenerateEventReportButton_Click(object sender, System.EventArgs e) { } private void GenerateAllEventReportsMenu_Click(object sender, System.EventArgs e) { if (season_data != null) { MenuItem menuitem = (MenuItem)sender; if (menuitem.Index == 0) { for (int i=0; i<season_data.Payload.Events.Length; i++) { if (GenerateEventReport(i, EventReportType.CLASS) == false) { break; // out of for(i) } if (GenerateEventReport(i, EventReportType.PAX) == false) { break; // out of for(i) } if (GenerateEventReport(i, EventReportType.RAW) == false) { break; // out of for(i) } } } else { GenerateEventReport(menuitem.Index - 2, EventReportType.CLASS); GenerateEventReport(menuitem.Index - 2, EventReportType.PAX); GenerateEventReport(menuitem.Index - 2, EventReportType.RAW); } } } private void EventReportMenu_Popup(object sender, System.EventArgs e) { // blank the old menu items while (EventReportMenu.MenuItems.Count > 2) { EventReportMenu.MenuItems.RemoveAt(2); } // add the per-report menu items if (season_data != null) { for (int i=0; i<season_data.Payload.Events.Length; i++) { MenuItem menuitem = new MenuItem(MenuMerge.Add, 0, Shortcut.None, season_data.Payload.Events[i].number.ToString() + " - " + season_data.Payload.Events[i].name, new EventHandler(GenerateAllEventReportsMenu_Click), null, null, null); EventReportMenu.MenuItems.Add(menuitem); } } } private void GenerateReport(object sender, System.EventArgs e) { if (season_data == null) return; ListView list; string standings_type_text; bool class_report = true; if (sender == ClassReportMenu) { list = ClassStandingsList; standings_type_text = "Class Standings"; } else { list = PaxStandingsList; standings_type_text = "PAX Standings"; class_report = false; } if (ExcludeMenu.Checked) { standings_type_text += " [Qualified]"; } SaveReport.FileName = season_data.Payload.name + " " + standings_type_text + ".html"; if (SaveReport.ShowDialog() == DialogResult.OK) { string css_styles_block = "h1 { font-family: Arial; font-size: 16pt; font-weight: bold; text-align: center }" + Environment.NewLine + "table { border-collapse: collapse }" + Environment.NewLine + "tr.main_header { background-color: #AAAAAA; }" + Environment.NewLine + "tr.sub_header { background-color: #DDDDDD; font-weight: bold }" + Environment.NewLine + "tr.q { background-color: #AAFFAA }" + Environment.NewLine + "tr.nq { background-color: #FFFFFF }" + Environment.NewLine + "th { font-family: Arial; font-size: 10pt; text-align: center; border: 1px solid black }" + Environment.NewLine + "td { font-family: Arial; font-size: 8pt; text-align: center; border: 1px solid black }" + Environment.NewLine + "td.left { font-family: Arial; font-size: 8pt; text-align: left; border: 1px solid black }"; XmlTextWriter w = new XmlTextWriter(SaveReport.FileName, null); w.Formatting = Formatting.Indented; // start the html w.WriteStartElement("html"); // output the html header w.WriteStartElement("head"); w.WriteElementString("title", season_data.Payload.club + " - " + season_data.Payload.name + " - " + standings_type_text); w.WriteStartElement("style"); w.WriteAttributeString("type", "text/css"); w.WriteString(css_styles_block); w.WriteEndElement(); w.WriteEndElement(); // start the body w.WriteStartElement("body"); // write the title info w.WriteElementString("h1", season_data.Payload.club + " - " + season_data.Payload.name + " - " + standings_type_text); // start the table w.WriteStartElement("table"); // write the main table header #region main header w.WriteStartElement("tr"); w.WriteAttributeString("class", "main_header"); w.WriteStartElement("th"); w.WriteAttributeString("rowspan", "2"); w.WriteAttributeString("width", "5%"); w.WriteString("Class"); w.WriteEndElement(); w.WriteStartElement("th"); w.WriteAttributeString("rowspan", "2"); w.WriteAttributeString("width", "5%"); w.WriteString("Position"); w.WriteEndElement(); w.WriteStartElement("th"); w.WriteAttributeString("rowspan", "2"); w.WriteAttributeString("width", "10%"); w.WriteString("Driver"); w.WriteEndElement(); w.WriteStartElement("th"); w.WriteAttributeString("rowspan", "2"); w.WriteAttributeString("width", "10%"); w.WriteString("Car"); w.WriteEndElement(); w.WriteStartElement("th"); w.WriteAttributeString("rowspan", "2"); w.WriteAttributeString("width", "5%"); w.WriteString("Points"); w.WriteEndElement(); w.WriteStartElement("th"); w.WriteAttributeString("rowspan", "2"); w.WriteAttributeString("width", "5%"); w.WriteString("Points w/ " + season_data.Payload.Settings.drop_count.ToString() + " Drop(s)"); w.WriteEndElement(); w.WriteStartElement("th"); w.WriteAttributeString("colspan", season_data.Payload.Settings.event_count.ToString()); w.WriteElementString("center", "Round"); w.WriteEndElement(); w.WriteEndElement(); w.WriteStartElement("tr"); w.WriteAttributeString("class", "main_header"); for (int i=0; i<season_data.Payload.Settings.event_count; i++) { w.WriteStartElement("th"); w.WriteAttributeString("width", Convert.ToString((int)50 / season_data.Payload.Settings.event_count) + "%"); w.WriteString((i+1).ToString()); w.WriteEndElement(); } w.WriteEndElement(); #endregion // loop through all the rows ArrayList items = new ArrayList(); items.AddRange(list.Items); items.Sort(new StandingsListSorter()); string last_class_name = ""; foreach (ListViewItem item in items) { DriverWrapper driver = (DriverWrapper)item.Tag; // skip unqualified drivers if allowed //if (ExcludeMenu.Checked && (driver.Payload.Points.Length + (season_data.Payload.Settings.event_count - season_data.Payload.Events.Length) < season_data.Payload.Settings.min_event_count)) if (ExcludeMenu.Checked && ((class_report && !driver.GetClassQualifiedStatus(item.Text, season_data.Payload.Settings.min_event_count)) || (!class_report && !driver.GetPaxQualifiedStatus((item.Text == "Ladies"), season_data.Payload.Settings.min_event_count, season_data)))) { continue; } // write the sub table header (if necessary) #region sub header if (last_class_name != item.Text) { last_class_name = item.Text; string class_desc; if (sender == ClassReportMenu) { class_desc = season_data.GetClass(item.Text).Payload.description; } else { class_desc = item.Text + " PAX Championship"; } w.WriteStartElement("tr"); w.WriteAttributeString("class", "sub_header"); w.WriteStartElement("td"); w.WriteAttributeString("colspan", "4"); w.WriteAttributeString("class", "left"); w.WriteString(class_desc); w.WriteEndElement(); w.WriteElementString("td", "Points"); w.WriteElementString("td", "w/ Drops"); for (int i=0; i<season_data.Payload.Settings.event_count; i++) { w.WriteElementString("td", (i+1).ToString()); } w.WriteEndElement(); } #endregion // write the current row string[] standings = item.SubItems[3].Text.Split(" (/)".ToCharArray(), 10); string position = standings[0]; string points = standings[2]; string points_w_drops = standings[3]; w.WriteStartElement("tr"); w.WriteAttributeString("class", (item.ForeColor == Color.Black) ? "q" : "nq"); w.WriteStartElement("td"); w.WriteAttributeString("class", "left"); w.WriteString(item.Text); w.WriteEndElement(); w.WriteStartElement("td"); w.WriteAttributeString("class", "left"); w.WriteString(position); w.WriteEndElement(); w.WriteStartElement("td"); w.WriteAttributeString("class", "left"); w.WriteString(driver.Payload.first_name + " " + driver.Payload.last_name.Substring(0,1)); w.WriteEndElement(); w.WriteStartElement("td"); w.WriteAttributeString("class", "left"); w.WriteString(driver.Payload.car); w.WriteEndElement(); w.WriteElementString("td", points); w.WriteElementString("td", points_w_drops); for (int i=0; i<season_data.Payload.Settings.event_count; i++) { w.WriteElementString("td", item.SubItems[i+4].Text); } w.WriteEndElement(); } // stop the table w.WriteEndElement(); // stop the body w.WriteEndElement(); // stop the html w.WriteEndElement(); // close the file w.Close(); } } private void PerfectAttendanceMenu_Click(object sender, System.EventArgs e) { if (season_data == null) return; SaveReport.FileName = season_data.Payload.name + " Perfect Attendance.html"; if (SaveReport.ShowDialog() == DialogResult.OK) { XmlTextWriter w = new XmlTextWriter(SaveReport.FileName, null); w.Formatting = Formatting.Indented; w.WriteStartElement("html"); w.WriteStartElement("head"); w.WriteElementString("title", season_data.Payload.club + " - " + season_data.Payload.name + " - Perfect Attendance"); w.WriteEndElement(); w.WriteStartElement("body"); w.WriteStartElement("center"); w.WriteStartElement("h2"); w.WriteString(season_data.Payload.club + " - " + season_data.Payload.name + " - Perfect Attendance"); w.WriteEndElement(); w.WriteEndElement(); w.WriteStartElement("table"); w.WriteAttributeString("align", "center"); w.WriteAttributeString("border", "0"); w.WriteAttributeString("width", "60%"); foreach (DriverType driver in season_data.Payload.Drivers) { int event_count = 0; for (ulong i=0; i<season_data.Payload.Settings.event_count; i++) { foreach (PointsType points in driver.Points) { if (points.event_number == i) { event_count++; break; // out of foreach(points) } } } if (event_count >= season_data.Payload.Events.Length) { w.WriteStartElement("tr"); w.WriteStartElement("td"); w.WriteElementString("p", driver.first_name + " " + driver.last_name); w.WriteEndElement(); w.WriteEndElement(); } } w.WriteEndElement(); w.WriteEndElement(); w.WriteEndElement(); w.Close(); } } private enum EventReportType { CLASS, PAX, RAW } private bool GenerateEventReport(int event_number, EventReportType report_type) { // make sure there's season data if (season_data == null) return false; // make sure we're trying to report on a valid event EventType event_data = null; if ((event_number >= 0) && (event_number < season_data.Payload.Events.Length)) { event_data = season_data.Payload.Events[event_number]; } if (event_data == null) return false; // parse the results file ArrayList results_array = Utils.ParseResultsFile(event_data); if (results_array.Count == 0) return false; // generate the title for this report string standings_type_text = ""; switch (report_type) { case EventReportType.CLASS: standings_type_text = "Class Results"; break; case EventReportType.PAX: standings_type_text = "PAX Results"; break; case EventReportType.RAW: standings_type_text = "Raw Results"; break; } string standings_title_text = "Round " + event_data.number.ToString() + " - " + event_data.date + " - " + event_data.name + " - " + standings_type_text; SaveReport.FileName = season_data.Payload.name + " " + standings_type_text + ".html"; if (SaveReport.ShowDialog() == DialogResult.OK) { /* string css_styles_block = "h1 { font-family: Arial; font-size: 16pt; font-weight: bold; text-align: center }" + Environment.NewLine + "table { border-collapse: collapse }" + Environment.NewLine + "tr.main_header { background-color: #AAAAAA; }" + Environment.NewLine + "tr.sub_header { background-color: #DDDDDD; font-weight: bold }" + Environment.NewLine + "tr.q { background-color: #AAFFAA }" + Environment.NewLine + "tr.nq { background-color: #FFFFFF }" + Environment.NewLine + "th { font-family: Arial; font-size: 10pt; text-align: center; border: 1px solid black }" + Environment.NewLine + "td { font-family: Arial; font-size: 8pt; text-align: center; border: 1px solid black }" + Environment.NewLine + "td.left { font-family: Arial; font-size: 8pt; text-align: left; border: 1px solid black }"; XmlTextWriter w = new XmlTextWriter(SaveReport.FileName, null); w.Formatting = Formatting.Indented; // start the html w.WriteStartElement("html"); // output the html header w.WriteStartElement("head"); w.WriteElementString("title", season_data.Payload.club + " - " + season_data.Payload.name + " - " + standings_title_text); w.WriteStartElement("style"); w.WriteAttributeString("type", "text/css"); w.WriteString(css_styles_block); w.WriteEndElement(); w.WriteEndElement(); // start the body w.WriteStartElement("body"); // write the title info w.WriteElementString("h1", season_data.Payload.club + " - " + season_data.Payload.name + " - " + standings_title_text); // start the table w.WriteStartElement("table"); // write the main table header #region main header w.WriteStartElement("tr"); w.WriteAttributeString("class", "main_header"); w.WriteStartElement("th"); w.WriteAttributeString("rowspan", "2"); w.WriteAttributeString("width", "5%"); w.WriteString("Class"); w.WriteEndElement(); w.WriteStartElement("th"); w.WriteAttributeString("rowspan", "2"); w.WriteAttributeString("width", "5%"); w.WriteString("Position"); w.WriteEndElement(); w.WriteStartElement("th"); w.WriteAttributeString("rowspan", "2"); w.WriteAttributeString("width", "10%"); w.WriteString("Driver"); w.WriteEndElement(); w.WriteStartElement("th"); w.WriteAttributeString("rowspan", "2"); w.WriteAttributeString("width", "10%"); w.WriteString("Car"); w.WriteEndElement(); w.WriteStartElement("th"); w.WriteAttributeString("rowspan", "2"); w.WriteAttributeString("width", "5%"); w.WriteString("Points"); w.WriteEndElement(); w.WriteStartElement("th"); w.WriteAttributeString("rowspan", "2"); w.WriteAttributeString("width", "5%"); w.WriteString("Points w/ " + season_data.Payload.Settings.drop_count.ToString() + " Drop(s)"); w.WriteEndElement(); w.WriteStartElement("th"); w.WriteAttributeString("colspan", season_data.Payload.Settings.event_count.ToString()); w.WriteElementString("center", "Round"); w.WriteEndElement(); w.WriteEndElement(); w.WriteStartElement("tr"); w.WriteAttributeString("class", "main_header"); for (int i=0; i<season_data.Payload.Settings.event_count; i++) { w.WriteStartElement("th"); w.WriteAttributeString("width", Convert.ToString((int)50 / season_data.Payload.Settings.event_count) + "%"); w.WriteString((i+1).ToString()); w.WriteEndElement(); } w.WriteEndElement(); #endregion // loop through all the rows ArrayList items = new ArrayList(); items.AddRange(list.Items); items.Sort(new StandingsListSorter()); string last_class_name = ""; foreach (ListViewItem item in items) { DriverWrapper driver = (DriverWrapper)item.Tag; // skip unqualified drivers if allowed //if (ExcludeMenu.Checked && (driver.Payload.Points.Length + (season_data.Payload.Settings.event_count - season_data.Payload.Events.Length) < season_data.Payload.Settings.min_event_count)) if (ExcludeMenu.Checked && ((class_report && !driver.GetClassQualifiedStatus(item.Text, season_data.Payload.Settings.min_event_count)) || (!class_report && !driver.GetPaxQualifiedStatus((item.Text == "Ladies"), season_data.Payload.Settings.min_event_count, season_data)))) { continue; } // write the sub table header (if necessary) #region sub header if (last_class_name != item.Text) { last_class_name = item.Text; string class_desc; if (sender == ClassReportMenu) { class_desc = season_data.GetClass(item.Text).Payload.description; } else { class_desc = item.Text + " PAX Championship"; } w.WriteStartElement("tr"); w.WriteAttributeString("class", "sub_header"); w.WriteStartElement("td"); w.WriteAttributeString("colspan", "4"); w.WriteAttributeString("class", "left"); w.WriteString(class_desc); w.WriteEndElement(); w.WriteElementString("td", "Points"); w.WriteElementString("td", "w/ Drops"); for (int i=0; i<season_data.Payload.Settings.event_count; i++) { w.WriteElementString("td", (i+1).ToString()); } w.WriteEndElement(); } #endregion // write the current row string[] standings = item.SubItems[3].Text.Split(" (/)".ToCharArray(), 10); string position = standings[0]; string points = standings[2]; string points_w_drops = standings[3]; w.WriteStartElement("tr"); w.WriteAttributeString("class", (item.ForeColor == Color.Black) ? "q" : "nq"); w.WriteStartElement("td"); w.WriteAttributeString("class", "left"); w.WriteString(item.Text); w.WriteEndElement(); w.WriteStartElement("td"); w.WriteAttributeString("class", "left"); w.WriteString(position); w.WriteEndElement(); w.WriteStartElement("td"); w.WriteAttributeString("class", "left"); w.WriteString(driver.Payload.first_name + " " + driver.Payload.last_name.Substring(0,1)); w.WriteEndElement(); w.WriteStartElement("td"); w.WriteAttributeString("class", "left"); w.WriteString(driver.Payload.car); w.WriteEndElement(); w.WriteElementString("td", points); w.WriteElementString("td", points_w_drops); for (int i=0; i<season_data.Payload.Settings.event_count; i++) { w.WriteElementString("td", item.SubItems[i+4].Text); } w.WriteEndElement(); } // stop the table w.WriteEndElement(); // stop the body w.WriteEndElement(); // stop the html w.WriteEndElement(); // close the file w.Close(); */ } else { return false; } return true; } } } using System; using System.IO; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; namespace SeasonManager { /// <summary> /// Summary description for ImportEventForm. /// </summary> public class ImportEventForm : System.Windows.Forms.Form { private System.Windows.Forms.ListView ResultsList; private System.Windows.Forms.Button Accept; private System.Windows.Forms.Button Cancel; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; private System.Windows.Forms.GroupBox ResultDetailsGroup; private System.Windows.Forms.ComboBox DriverList; private System.Windows.Forms.RadioButton LinkDriverRadio; private System.Windows.Forms.StatusBar StatusBar; private System.Windows.Forms.RadioButton IgnoreDriverRadio; private System.Windows.Forms.RadioButton AddDriverRadio; private System.Windows.Forms.ColumnHeader MatchedDriverCol; private System.Windows.Forms.ColumnHeader MatchedClassCol; private System.Windows.Forms.ColumnHeader ClassCol; private System.Windows.Forms.ColumnHeader FirstNameCol; private System.Windows.Forms.ColumnHeader LastNameCol; private System.Windows.Forms.ColumnHeader CarCol; private System.Windows.Forms.ColumnHeader TotalCol; private System.Windows.Forms.ColumnHeader PaxCol; private System.Windows.Forms.ColumnHeader ClassPosCol; private System.Windows.Forms.ColumnHeader PaxPosCol; private EventWrapper event_data = null; private ArrayList results_array = null; private SeasonWrapper season_data = null; public ImportEventForm(ref EventWrapper event_to_import, ref SeasonWrapper sw) { // // Required for Windows Form Designer support // InitializeComponent(); event_data = event_to_import; results_array = new ArrayList(); season_data = sw; } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.ResultsList = new System.Windows.Forms.ListView(); this.MatchedClassCol = new System.Windows.Forms.ColumnHeader(); this.MatchedDriverCol = new System.Windows.Forms.ColumnHeader(); this.ClassPosCol = new System.Windows.Forms.ColumnHeader(); this.PaxPosCol = new System.Windows.Forms.ColumnHeader(); this.ClassCol = new System.Windows.Forms.ColumnHeader(); this.FirstNameCol = new System.Windows.Forms.ColumnHeader(); this.LastNameCol = new System.Windows.Forms.ColumnHeader(); this.CarCol = new System.Windows.Forms.ColumnHeader(); this.TotalCol = new System.Windows.Forms.ColumnHeader(); this.PaxCol = new System.Windows.Forms.ColumnHeader(); this.ResultDetailsGroup = new System.Windows.Forms.GroupBox(); this.IgnoreDriverRadio = new System.Windows.Forms.RadioButton(); this.AddDriverRadio = new System.Windows.Forms.RadioButton(); this.LinkDriverRadio = new System.Windows.Forms.RadioButton(); this.DriverList = new System.Windows.Forms.ComboBox(); this.Cancel = new System.Windows.Forms.Button(); this.Accept = new System.Windows.Forms.Button(); this.StatusBar = new System.Windows.Forms.StatusBar(); this.ResultDetailsGroup.SuspendLayout(); this.SuspendLayout(); // // ResultsList // this.ResultsList.CheckBoxes = true; this.ResultsList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.MatchedClassCol, this.MatchedDriverCol, this.ClassPosCol, this.PaxPosCol, this.ClassCol, this.FirstNameCol, this.LastNameCol, this.CarCol, this.TotalCol, this.PaxCol}); this.ResultsList.Dock = System.Windows.Forms.DockStyle.Fill; this.ResultsList.FullRowSelect = true; this.ResultsList.GridLines = true; this.ResultsList.HideSelection = false; this.ResultsList.Location = new System.Drawing.Point(0, 0); this.ResultsList.MultiSelect = false; this.ResultsList.Name = "ResultsList"; this.ResultsList.Size = new System.Drawing.Size(552, 494); this.ResultsList.TabIndex = 0; this.ResultsList.View = System.Windows.Forms.View.Details; this.ResultsList.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.ResultsList_ColumnClick); this.ResultsList.SelectedIndexChanged += new System.EventHandler(this.ResultsList_SelectedIndexChanged); this.ResultsList.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.ResultsList_ItemCheck); // // MatchedClassCol // this.MatchedClassCol.Text = "Matched Class"; this.MatchedClassCol.Width = 85; // // MatchedDriverCol // this.MatchedDriverCol.Text = "Matched Driver"; this.MatchedDriverCol.Width = 100; // // ClassPosCol // this.ClassPosCol.Text = "Class Pos (Points)"; this.ClassPosCol.Width = 100; // // PaxPosCol // this.PaxPosCol.Text = "PAX Pos (Points)"; this.PaxPosCol.Width = 100; // // ClassCol // this.ClassCol.Text = "Class"; this.ClassCol.Width = 85; // // FirstNameCol // this.FirstNameCol.Text = "First Name"; this.FirstNameCol.Width = 85; // // LastNameCol // this.LastNameCol.Text = "Last Name"; this.LastNameCol.Width = 85; // // CarCol // this.CarCol.Text = "Car"; this.CarCol.Width = 100; // // TotalCol // this.TotalCol.Text = "Total Time"; this.TotalCol.Width = 75; // // PaxCol // this.PaxCol.Text = "PAX Time"; this.PaxCol.Width = 75; // // ResultDetailsGroup // this.ResultDetailsGroup.Controls.Add(this.IgnoreDriverRadio); this.ResultDetailsGroup.Controls.Add(this.AddDriverRadio); this.ResultDetailsGroup.Controls.Add(this.LinkDriverRadio); this.ResultDetailsGroup.Controls.Add(this.DriverList); this.ResultDetailsGroup.Controls.Add(this.Cancel); this.ResultDetailsGroup.Controls.Add(this.Accept); this.ResultDetailsGroup.Dock = System.Windows.Forms.DockStyle.Right; this.ResultDetailsGroup.Location = new System.Drawing.Point(552, 0); this.ResultDetailsGroup.Name = "ResultDetailsGroup"; this.ResultDetailsGroup.Size = new System.Drawing.Size(216, 494); this.ResultDetailsGroup.TabIndex = 4; this.ResultDetailsGroup.TabStop = false; this.ResultDetailsGroup.Text = "Selected Result Import Options"; // // IgnoreDriverRadio // this.IgnoreDriverRadio.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.IgnoreDriverRadio.Checked = true; this.IgnoreDriverRadio.Location = new System.Drawing.Point(8, 16); this.IgnoreDriverRadio.Name = "IgnoreDriverRadio"; this.IgnoreDriverRadio.Size = new System.Drawing.Size(200, 24); this.IgnoreDriverRadio.TabIndex = 5; this.IgnoreDriverRadio.TabStop = true; this.IgnoreDriverRadio.Text = "Ignore Result"; this.IgnoreDriverRadio.CheckedChanged += new System.EventHandler(this.ResultStatusChanged); // // AddDriverRadio // this.AddDriverRadio.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.AddDriverRadio.Location = new System.Drawing.Point(8, 40); this.AddDriverRadio.Name = "AddDriverRadio"; this.AddDriverRadio.Size = new System.Drawing.Size(200, 24); this.AddDriverRadio.TabIndex = 4; this.AddDriverRadio.Text = "Create New Driver"; this.AddDriverRadio.CheckedChanged += new System.EventHandler(this.ResultStatusChanged); // // LinkDriverRadio // this.LinkDriverRadio.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.LinkDriverRadio.Location = new System.Drawing.Point(8, 64); this.LinkDriverRadio.Name = "LinkDriverRadio"; this.LinkDriverRadio.Size = new System.Drawing.Size(200, 24); this.LinkDriverRadio.TabIndex = 3; this.LinkDriverRadio.Text = "Link to Existing Driver"; this.LinkDriverRadio.CheckedChanged += new System.EventHandler(this.ResultStatusChanged); // // DriverList // this.DriverList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.DriverList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.DriverList.Location = new System.Drawing.Point(24, 88); this.DriverList.MaxDropDownItems = 25; this.DriverList.Name = "DriverList"; this.DriverList.Size = new System.Drawing.Size(184, 21); this.DriverList.Sorted = true; this.DriverList.TabIndex = 2; this.DriverList.SelectedIndexChanged += new System.EventHandler(this.DriverList_SelectedIndexChanged); // // Cancel // this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.Cancel.Location = new System.Drawing.Point(112, 464); this.Cancel.Name = "Cancel"; this.Cancel.TabIndex = 1; this.Cancel.Text = "Cancel"; this.Cancel.Click += new System.EventHandler(this.CancelButton_Click); // // Accept // this.Accept.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.Accept.Location = new System.Drawing.Point(32, 464); this.Accept.Name = "Accept"; this.Accept.TabIndex = 0; this.Accept.Text = "Accept"; this.Accept.Click += new System.EventHandler(this.Accept_Click); // // StatusBar // this.StatusBar.Location = new System.Drawing.Point(0, 494); this.StatusBar.Name = "StatusBar"; this.StatusBar.Size = new System.Drawing.Size(768, 16); this.StatusBar.TabIndex = 5; // // ImportEventForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(768, 510); this.Controls.Add(this.ResultsList); this.Controls.Add(this.ResultDetailsGroup); this.Controls.Add(this.StatusBar); this.Name = "ImportEventForm"; this.Text = "Import Event Results"; this.Load += new System.EventHandler(this.ImportEventForm_Load); this.ResultDetailsGroup.ResumeLayout(false); this.ResumeLayout(false); } #endregion private void CancelButton_Click(object sender, System.EventArgs e) { Close(); } private void ImportEventForm_Load(object sender, System.EventArgs e) { // load the list of drivers into the drop down if (season_data != null) { DriverList.BeginUpdate(); DriverList.Items.Clear(); for (int i=0; i<season_data.Payload.Drivers.Length; i++) { DriverList.Items.Add(new DriverWrapper(ref season_data.Payload.Drivers[i]).ToString()); } DriverList.EndUpdate(); } // load the data from the event file results_array = Utils.ParseResultsFile(event_data.Payload); if (results_array.Count == 0) { Close(); return; } // match the results to the current roster try { foreach (ResultWrapper result in results_array) { string proposed_alias = result.Payload.ImportedData.First_Name + " " + result.Payload.ImportedData.Last_Name; DriverWrapper curr_driver = season_data.FindDriverByAlias(proposed_alias); ClassWrapper curr_class = season_data.FindClassByImportedID(result.Payload.ImportedData.Class); if (curr_class == null) { result.Payload.MatchedData.ignored = true; result.Payload.MatchedData.alias = ""; result.Payload.MatchedData.class_id = ""; result.Payload.MatchedData.mode = ResultTypeMatchedDataMode.INVALID; } else if (curr_driver == null) { result.Payload.MatchedData.ignored = season_data.GetClass(curr_class.Payload.id).Payload.non_points; result.Payload.MatchedData.alias = ""; result.Payload.MatchedData.class_id = curr_class.Payload.id; result.Payload.MatchedData.mode = ResultTypeMatchedDataMode.ADD_DRIVER; } else { result.Payload.MatchedData.ignored = season_data.GetClass(curr_class.Payload.id).Payload.non_points; result.Payload.MatchedData.alias = proposed_alias; result.Payload.MatchedData.class_id = curr_class.Payload.id; result.Payload.MatchedData.mode = ResultTypeMatchedDataMode.EXISTING_LINK; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error Matching To Roster"); Close(); } ResultsList.ListViewItemSorter = new ResultsListSorter(); UpdateResultsList(); if (ResultsList.Items.Count > 0) { ResultsList.Items[0].Selected = true; } } private bool UpdateResultsList_reentry_blocked = false; public void UpdateResultsList() { if (UpdateResultsList_reentry_blocked) return; UpdateResultsList_reentry_blocked = true; ListViewItem LastSelected = null; if (ResultsList.SelectedItems.Count > 0) { LastSelected = ResultsList.SelectedItems[0]; } ResultsList.BeginUpdate(); ResultsList.Items.Clear(); for (int i=0; i<results_array.Count; i++) { ResultWrapper result = (ResultWrapper)results_array[i]; ListViewItem item = new ListViewItem(); UpdateResultListItem(ref item, ref result); ResultsList.Items.Add(item); } ResultsList.Sort(); ResultsList.EndUpdate(); if (LastSelected != null) { LastSelected.Selected = true; } //ResultsList_SelectedIndexChanged(this, null); UpdateResultsList_reentry_blocked = false; } private void UpdateResultListItem(ref ListViewItem item, ref ResultWrapper result) { CalculatePointsFromEventResult(ref result); item.Tag = result; item.Checked = !result.Payload.MatchedData.ignored; item.Text = result.Payload.MatchedData.class_id; if (result.Payload.MatchedData.mode == ResultTypeMatchedDataMode.EXISTING_LINK) { item.SubItems.Add(season_data.FindDriverByAlias(result.Payload.MatchedData.alias).ToString()); } else { item.SubItems.Add(result.Payload.MatchedData.alias); } ulong class_position = result.Payload.StandingsData.class_position; int class_points = result.Payload.StandingsData.class_points; ulong pax_position = result.Payload.StandingsData.pax_position; int pax_points = result.Payload.StandingsData.pax_points; if (class_position == 0) { item.SubItems.Add("-"); } else { item.SubItems.Add(class_position.ToString() + " (" + class_points.ToString() + ")"); } if (pax_position == 0) { item.SubItems.Add("-"); } else { item.SubItems.Add(pax_position.ToString() + " (" + pax_points.ToString() + ")"); } item.SubItems.Add(result.Payload.ImportedData.Class); item.SubItems.Add(result.Payload.ImportedData.First_Name); item.SubItems.Add(result.Payload.ImportedData.Last_Name); item.SubItems.Add(result.Payload.ImportedData.Car); item.SubItems.Add(result.Payload.ImportedData.Total.ToString()); item.SubItems.Add(result.Payload.ImportedData.Pax_Time.ToString()); if (result.Payload.MatchedData.ignored) { item.ForeColor = Color.LightGray; item.BackColor = Color.White; } else { item.ForeColor = Color.Black; switch (result.Payload.MatchedData.mode) { case ResultTypeMatchedDataMode.INVALID: item.BackColor = Color.Red; break; case ResultTypeMatchedDataMode.ADD_DRIVER: item.BackColor = Color.Yellow; break; case ResultTypeMatchedDataMode.NEW_LINK: item.BackColor = Color.LightGreen; break; case ResultTypeMatchedDataMode.EXISTING_LINK: item.BackColor = Color.White; break; } } } private void CalculatePointsFromEventResult(ref ResultWrapper curr_result) { ulong class_position = 0; int class_points = 0; ulong pax_position = 0; int pax_points = 0; if (!curr_result.Payload.MatchedData.ignored) { // calculate class finishing position class_position = 1; int class_count = 0; foreach (ResultWrapper opponent in results_array) { if ((!opponent.Payload.MatchedData.ignored) && (opponent.Payload.MatchedData.class_id == curr_result.Payload.MatchedData.class_id)) { class_count++; if (Convert.ToSingle(opponent.Payload.ImportedData.Total) < Convert.ToSingle(curr_result.Payload.ImportedData.Total)) { class_position++; } } } // calculate class points if (season_data.GetClass(curr_result.Payload.MatchedData.class_id).Payload.non_points) { class_points = 0; } else { if (class_count == 1) { class_points = season_data.Payload.Settings.single_entrant_class_points; } else { string[] class_points_list = season_data.Payload.Settings.class_points.Split(','); if (class_position >= (ulong)class_points_list.LongLength) { class_points = Convert.ToInt32(class_points_list[class_points_list.Length-1]); } else { class_points = Convert.ToInt32(class_points_list[class_position-1]); } } } // calculate pax finishing position pax_position = 1; int pax_count = 0; foreach (ResultWrapper opponent in results_array) { if ((!opponent.Payload.MatchedData.ignored) && (season_data.GetClass(opponent.Payload.MatchedData.class_id).Payload.ladies == season_data.GetClass(curr_result.Payload.MatchedData.class_id).Payload.ladies)) { pax_count++; if (Convert.ToSingle(opponent.Payload.ImportedData.Pax_Time) < Convert.ToSingle(curr_result.Payload.ImportedData.Pax_Time)) { pax_position++; } } } // calculate pax points if (season_data.GetClass(curr_result.Payload.MatchedData.class_id).Payload.non_points) { pax_points = 0; } else { if (pax_count == 1) { pax_points = season_data.Payload.Settings.single_entrant_pax_points; } else { string[] pax_points_list = season_data.Payload.Settings.pax_points.Split(','); if (pax_position >= (ulong)pax_points_list.LongLength) { pax_points = Convert.ToInt32(pax_points_list[pax_points_list.Length-1]); } else { pax_points = Convert.ToInt32(pax_points_list[pax_position-1]); } } } } curr_result.Payload.StandingsData.class_position = class_position; curr_result.Payload.StandingsData.class_points = class_points; curr_result.Payload.StandingsData.pax_position = pax_position; curr_result.Payload.StandingsData.pax_points = pax_points; } //private bool MatchResultDetailsInterfaceToData_reentry_blocked = false; private void MatchResultDetailsInterfaceToData(ref ResultWrapper curr_result) { //if (MatchResultDetailsInterfaceToData_reentry_blocked) return; //MatchResultDetailsInterfaceToData_reentry_blocked = true; abort_status_change_handler = true; if (curr_result != null) { switch (curr_result.Payload.MatchedData.mode) { case ResultTypeMatchedDataMode.INVALID: IgnoreDriverRadio.Enabled = true; IgnoreDriverRadio.Checked = true; AddDriverRadio.Enabled = false; AddDriverRadio.Checked = false; LinkDriverRadio.Enabled = false; LinkDriverRadio.Checked = false; DriverList.Enabled = false; DriverList.SelectedIndex = -1; break; case ResultTypeMatchedDataMode.ADD_DRIVER: IgnoreDriverRadio.Enabled = true; IgnoreDriverRadio.Checked = curr_result.Payload.MatchedData.ignored; AddDriverRadio.Enabled = true; AddDriverRadio.Checked = !curr_result.Payload.MatchedData.ignored; LinkDriverRadio.Enabled = (DriverList.Items.Count > 0); LinkDriverRadio.Checked = false; DriverList.Enabled = (DriverList.Items.Count > 0); DriverList.SelectedIndex = -1; break; case ResultTypeMatchedDataMode.NEW_LINK: IgnoreDriverRadio.Enabled = true; IgnoreDriverRadio.Checked = curr_result.Payload.MatchedData.ignored; AddDriverRadio.Enabled = true; AddDriverRadio.Checked = false; LinkDriverRadio.Enabled = (DriverList.Items.Count > 0); LinkDriverRadio.Checked = !curr_result.Payload.MatchedData.ignored; DriverList.Enabled = (DriverList.Items.Count > 0); if (curr_result.Payload.MatchedData.alias != null) { DriverList.SelectedIndex = DriverList.Items.IndexOf(curr_result.Payload.MatchedData.alias); } else { DriverList.SelectedIndex = -1; } break; case ResultTypeMatchedDataMode.EXISTING_LINK: IgnoreDriverRadio.Enabled = true; IgnoreDriverRadio.Checked = curr_result.Payload.MatchedData.ignored; AddDriverRadio.Enabled = false; AddDriverRadio.Checked = false; LinkDriverRadio.Enabled = (DriverList.Items.Count > 0); LinkDriverRadio.Checked = !curr_result.Payload.MatchedData.ignored; DriverList.Enabled = false; if (curr_result.Payload.MatchedData.alias != null) { DriverList.SelectedIndex = DriverList.Items.IndexOf(season_data.FindDriverByAlias(curr_result.Payload.MatchedData.alias).ToString()); } else { DriverList.SelectedIndex = -1; } break; } } abort_status_change_handler = false; //MatchResultDetailsInterfaceToData_reentry_blocked = false; } //private bool MatchResultDetailsDataToInterface_reentry_blocked = false; private void MatchResultDetailsDataToInterface(ref ResultWrapper curr_result) { //if (MatchResultDetailsDataToInterface_reentry_blocked) return; //MatchResultDetailsDataToInterface_reentry_blocked = true; if (curr_result != null) { if (IgnoreDriverRadio.Checked) { curr_result.Payload.MatchedData.ignored = true; if (curr_result.Payload.MatchedData.mode != ResultTypeMatchedDataMode.EXISTING_LINK) { curr_result.Payload.MatchedData.alias = ""; } } else { curr_result.Payload.MatchedData.ignored = false; if (AddDriverRadio.Checked) { curr_result.Payload.MatchedData.mode = ResultTypeMatchedDataMode.ADD_DRIVER; curr_result.Payload.MatchedData.alias = ""; } if (LinkDriverRadio.Checked) { if (curr_result.Payload.MatchedData.mode != ResultTypeMatchedDataMode.EXISTING_LINK) { curr_result.Payload.MatchedData.mode = ResultTypeMatchedDataMode.NEW_LINK; curr_result.Payload.MatchedData.alias = (string)DriverList.SelectedItem; } } } } //MatchResultDetailsDataToInterface_reentry_blocked = false; } private void ResultsList_SelectedIndexChanged(object sender, System.EventArgs e) { ResultWrapper curr_result = null; if (ResultsList.SelectedItems.Count > 0) { curr_result = (ResultWrapper)(ResultsList.SelectedItems[0].Tag); } MatchResultDetailsInterfaceToData(ref curr_result); } private bool abort_status_change_handler = false; private void ResultStatusChanged(object sender, System.EventArgs e) { if (abort_status_change_handler) return; ResultWrapper curr_result = null; if (ResultsList.SelectedItems.Count > 0) { curr_result = (ResultWrapper)(ResultsList.SelectedItems[0].Tag); } MatchResultDetailsDataToInterface(ref curr_result); UpdateResultsList(); } private void DriverList_SelectedIndexChanged(object sender, System.EventArgs e) { if (abort_status_change_handler) return; LinkDriverRadio.Checked = true; } private bool ResultsList_ItemCheck_reentry_block = false; private void ResultsList_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e) { if (ResultsList_ItemCheck_reentry_block) return; ResultsList_ItemCheck_reentry_block = true; ListViewItem item = ResultsList.Items[e.Index]; ResultWrapper curr_result = (ResultWrapper)(item.Tag); if (curr_result.Payload.MatchedData.mode == ResultTypeMatchedDataMode.INVALID) { e.NewValue = e.CurrentValue; } curr_result.Payload.MatchedData.ignored = (e.NewValue != CheckState.Checked); UpdateResultsList(); ResultsList_ItemCheck_reentry_block = false; } private void ResultsList_ColumnClick(object sender, System.Windows.Forms.ColumnClickEventArgs e) { ResultsList.ListViewItemSorter = new ResultsListSorter(e.Column, ref season_data); } private void Accept_Click(object sender, System.EventArgs e) { ResultWrapper curr_result; for (int i=0; i<results_array.Count; i++) { curr_result = (ResultWrapper)results_array[i]; if (curr_result.Payload.MatchedData.ignored) continue; switch (curr_result.Payload.MatchedData.mode) { case ResultTypeMatchedDataMode.ADD_DRIVER: { string alias = curr_result.Payload.ImportedData.First_Name + " " + curr_result.Payload.ImportedData.Last_Name; season_data.AddNewDriver(curr_result.Payload.ImportedData.First_Name, curr_result.Payload.ImportedData.Last_Name, curr_result.Payload.ImportedData.Car, alias); season_data.FindDriverByAlias(alias).UpdatePoints(event_data.Payload.number, curr_result.Payload.MatchedData.class_id, curr_result.Payload.StandingsData.class_points, curr_result.Payload.StandingsData.pax_points); } break; case ResultTypeMatchedDataMode.NEW_LINK: { string alias = curr_result.Payload.ImportedData.First_Name + " " + curr_result.Payload.ImportedData.Last_Name; DriverWrapper found_driver = season_data.FindDriverByCombinedName(curr_result.Payload.MatchedData.alias); if (found_driver != null) { found_driver.AddAlias(alias); found_driver.UpdatePoints(event_data.Payload.number, curr_result.Payload.MatchedData.class_id, curr_result.Payload.StandingsData.class_points, curr_result.Payload.StandingsData.pax_points); } } break; case ResultTypeMatchedDataMode.EXISTING_LINK: { season_data.FindDriverByAlias(curr_result.Payload.MatchedData.alias).UpdatePoints(event_data.Payload.number, curr_result.Payload.MatchedData.class_id, curr_result.Payload.StandingsData.class_points, curr_result.Payload.StandingsData.pax_points); } break; } } season_data.Payload.DocState.modified = true; Close(); } } } using System; using System.Xml; using System.Xml.Serialization; using System.IO; using System.Collections; using System.Windows.Forms; namespace SeasonManager { /// <summary> /// Summary description for Utils. /// </summary> public class Utils { public const string EXCEPTION_LOG = "exception.log"; private static XmlDocument m_xmldoc = new XmlDocument(); public Utils() { } public static bool WriteToFlatLog(string filename, string message, bool timestamp, bool append) { bool result = true; try { System.IO.StreamWriter sw = new System.IO.StreamWriter(filename, append); if (timestamp) { sw.WriteLine(DateTime.Now.ToLongTimeString()); } sw.WriteLine(message); sw.WriteLine(""); sw.Close(); } catch (Exception ex) { result = false; WriteToFlatLog("exception.log", ex.ToString(), true, true); } return result; } public static bool ParseXML(string xml, out XmlElement xmlel) { bool result; xmlel = null; try { XmlDocument parse_doc = new XmlDocument(); parse_doc.LoadXml(xml); xmlel = (XmlElement)m_xmldoc.ImportNode((XmlNode)parse_doc.DocumentElement, true); result = true; } catch (Exception e) { Utils.WriteToFlatLog(EXCEPTION_LOG, e.ToString(), true, true); result = false; } return result; } public static bool SerializeObject(object o, out string xml) { bool result = false; xml = ""; if (o != null) { try { XmlSerializer s = new XmlSerializer(o.GetType()); StringWriter w = new StringWriter(); s.Serialize(w, o); xml = w.ToString(); w.Close(); result = true; } catch (Exception e) { Utils.WriteToFlatLog(Utils.EXCEPTION_LOG, e.ToString(), true, true); result = false; } } return result; } public static bool DeserializeObject(string xml, ref object o) { bool result = false; if (o != null) { try { XmlSerializer s = new XmlSerializer(o.GetType()); StringReader r = new StringReader(xml); o = Convert.ChangeType(s.Deserialize(r), o.GetType()); r.Close(); result = true; } catch (Exception e) { Utils.WriteToFlatLog(Utils.EXCEPTION_LOG, e.ToString(), true, true); o = null; result = false; } } return result; } public static bool ElementizeObject(object o, out XmlElement xmlel) { bool result = false; xmlel = null; if (o != null) { try { string xml; if (SerializeObject(o, out xml)) { if (ParseXML(xml, out xmlel)) { result = true; } else { result = false; } } else { result = false; } } catch (Exception e) { Utils.WriteToFlatLog(Utils.EXCEPTION_LOG, e.ToString(), true, true); result = false; } } return result; } public static bool DeelementizeObject(XmlElement xmlel, ref object o) { bool result = false; if (xmlel != null) { result = DeserializeObject(xmlel.OuterXml, ref o); } return result; } public static Array AppendElement(Array array, object element) { ArrayList new_array = new ArrayList(); new_array.AddRange(array); new_array.Add(element); return new_array.ToArray(element.GetType()); /* Array new_array = Array.CreateInstance(element.GetType(), array.Length + 1); array.CopyTo(new_array, 0); new_array.SetValue(element, new_array.Length-1); array = new_array; */ } public static ArrayList ParseResultsFile(EventType event_data) { ArrayList results_array = new ArrayList(); try { StreamReader sr = new StreamReader(event_data.data_file); ArrayList column_headers = new ArrayList(); column_headers.AddRange(sr.ReadLine().Split('\t')); string curr_line = sr.ReadLine(); while (curr_line != null) { string[] curr_data_fields = curr_line.Split('\t'); ResultWrapper curr_result = new ResultWrapper(); curr_result.Payload.ImportedData.Car = curr_data_fields[column_headers.IndexOf("Car Model")]; curr_result.Payload.ImportedData.Class = curr_data_fields[column_headers.IndexOf("Class")]; curr_result.Payload.ImportedData.First_Name = curr_data_fields[column_headers.IndexOf("First Name")]; curr_result.Payload.ImportedData.Last_Name = curr_data_fields[column_headers.IndexOf("Last Name")]; try { curr_result.Payload.ImportedData.Pax_Time = Convert.ToSingle(curr_data_fields[column_headers.IndexOf("Pax Time")]); } catch (FormatException) { curr_result.Payload.ImportedData.Pax_Time = 999.999f; } try { curr_result.Payload.ImportedData.Total = Convert.ToSingle(curr_data_fields[column_headers.IndexOf("Total")]); } catch (FormatException) { curr_result.Payload.ImportedData.Pax_Time = 999.999f; } int run_index = 1; string run_header_string = "Run 1"; string pen_header_string = "Pen 1"; while (column_headers.IndexOf(run_header_string) != -1) { RunType curr_run = new RunType(); try { curr_run.time = Convert.ToSingle(curr_data_fields[column_headers.IndexOf(run_header_string)]); } catch (FormatException) { curr_run.time = 999.999f; } try { curr_run.cone_count = Convert.ToInt32(curr_data_fields[column_headers.IndexOf(pen_header_string)]); curr_run.penalty = ""; } catch (FormatException) { curr_run.cone_count = 0; curr_run.penalty = curr_data_fields[column_headers.IndexOf(pen_header_string)]; } curr_result.Payload.ImportedData.Runs = (RunType[])Utils.AppendElement(curr_result.Payload.ImportedData.Runs, curr_run); } results_array.Add(curr_result); curr_line = sr.ReadLine(); } sr.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error Parsing Results File"); } return results_array; } } public class ResultsListSorter : IComparer { private int col; private SeasonWrapper season_data; public ResultsListSorter() { col = 0; season_data = null; } public ResultsListSorter(int column, ref SeasonWrapper sw) { col = column; season_data = sw; } public int Compare(object x, object y) { int rval = 0; ResultWrapper res_x = (ResultWrapper)((ListViewItem)x).Tag; ResultWrapper res_y = (ResultWrapper)((ListViewItem)y).Tag; switch (col) { case 0: // by class then by class position case 2: rval = String.Compare(res_x.Payload.MatchedData.class_id, res_y.Payload.MatchedData.class_id); if (rval == 0) { rval = res_y.Payload.StandingsData.class_points - res_x.Payload.StandingsData.class_points; } break; case 3: // by pax position if (season_data.GetClass(res_x.Payload.MatchedData.class_id).Payload.ladies == season_data.GetClass(res_y.Payload.MatchedData.class_id).Payload.ladies) { rval = ((ResultWrapper)((ListViewItem)y).Tag).Payload.StandingsData.pax_points - ((ResultWrapper)((ListViewItem)x).Tag).Payload.StandingsData.pax_points; } else { rval = season_data.GetClass(res_x.Payload.MatchedData.class_id).Payload.ladies ? 1 : -1; } break; case 8: // by time case 9: rval = (int)((Convert.ToSingle(((ListViewItem)x).SubItems[col].Text) - Convert.ToSingle(((ListViewItem)y).SubItems[col].Text)) * 1000); break; default: rval = String.Compare(((ListViewItem)x).SubItems[col].Text, ((ListViewItem)y).SubItems[col].Text); break; } return rval; } } public class StandingsListSorter : IComparer { private int col; private SeasonWrapper season_data; public StandingsListSorter() { col = 0; season_data = null; } public StandingsListSorter(int column, ref SeasonWrapper sw) { col = column; season_data = sw; } public int Compare(object x, object y) { int rval = 0; string text_x = ((ListViewItem)x).SubItems[col].Text; string text_y = ((ListViewItem)y).SubItems[col].Text; DriverWrapper driver_x = (DriverWrapper)((ListViewItem)x).Tag; DriverWrapper driver_y = (DriverWrapper)((ListViewItem)y).Tag; switch (col) { case 0: // by class then by class position case 3: char[] delimiters = " (/)".ToCharArray(); string[] standings_x = ((ListViewItem)x).SubItems[3].Text.Split(delimiters, 10); string[] standings_y = ((ListViewItem)y).SubItems[3].Text.Split(delimiters, 10); rval = String.Compare(((ListViewItem)x).SubItems[0].Text, ((ListViewItem)y).SubItems[0].Text); if (rval == 0) { rval = Convert.ToInt32(standings_y[3]) - Convert.ToInt32(standings_x[3]); } if (rval == 0) { rval = Convert.ToInt32(standings_y[2]) - Convert.ToInt32(standings_x[2]); } break; default: rval = String.Compare(text_x, text_y); break; } return rval; } } } using System; using System.IO; using System.Xml; using System.Collections; namespace SeasonManager { public class SeasonWrapper { public const string DEFAULT_SEASON_NAME = "New Solo2 Season"; public const string DEFAULT_CLUB_NAME = "Reno SCCA"; public const string DEFAULT_CLASS_POINTS = "21,16,14,12,11,10,9,8,7,6,5,4,3,2,1,0"; public const string DEFAULT_PAX_POINTS = "21,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1"; public const uint DEFAULT_EVENT_COUNT = 15; public const uint DEFAULT_MIN_EVENT_COUNT = 8; public const uint DEFAULT_DROP_COUNT = 4; public SeasonType Payload = null; public SeasonWrapper() { Payload = new SeasonType(); Payload.DocState = new DocStateType(); Payload.Settings = new SettingsType(); Payload.Classes = new ClassType[] {}; Payload.Events = new EventType[] {}; Payload.Drivers = new DriverType[] {}; } public bool LoadDefaults() { bool result; try { Payload = new SeasonType(); Payload.DocState = new DocStateType(); Payload.Settings = new SettingsType(); Payload.Classes = new ClassType[] {}; Payload.Events = new EventType[] {}; Payload.Drivers = new DriverType[] {}; Payload.name = DEFAULT_SEASON_NAME; Payload.club = DEFAULT_CLUB_NAME; Payload.Settings.class_points = DEFAULT_CLASS_POINTS; Payload.Settings.pax_points = DEFAULT_PAX_POINTS; Payload.Settings.event_count = DEFAULT_EVENT_COUNT; Payload.Settings.min_event_count = DEFAULT_MIN_EVENT_COUNT; Payload.Settings.drop_count = DEFAULT_DROP_COUNT; result = true; } catch (Exception e) { Utils.WriteToFlatLog(Utils.EXCEPTION_LOG, e.ToString(), true, true); result = false; } return result; } public bool SaveToFile(string filename) { bool result; try { string xml; if (Utils.SerializeObject(Payload, out xml)) { StreamWriter w = new StreamWriter(filename, false); w.Write(xml); w.Close(); Payload.DocState.filename = filename; result = true; } else { result = false; } } catch (Exception e) { Utils.WriteToFlatLog(Utils.EXCEPTION_LOG, e.ToString(), true, true); result = false; } return result; } public bool LoadFromFile(string filename) { bool result; try { StreamReader r = new StreamReader(filename); string xml = r.ReadToEnd(); r.Close(); object new_payload = new SeasonType(); if (Utils.DeserializeObject(xml, ref new_payload)) { Payload = (SeasonType)new_payload; Payload.DocState.filename = filename; result = true; } else { result = false; } } catch (Exception e) { Utils.WriteToFlatLog(Utils.EXCEPTION_LOG, e.ToString(), true, true); result = false; } return result; } public override string ToString() { return Payload.name; } public void AddNewDriver(string first_name, string last_name, string car, string alias) { DriverWrapper new_driver = new DriverWrapper(); new_driver.Payload.first_name = first_name; new_driver.Payload.last_name = last_name; new_driver.Payload.car = car; new_driver.AddAlias(alias); DriverType[] new_drivers = new DriverType[Payload.Drivers.Length + 1]; Payload.Drivers.CopyTo(new_drivers, 0); Payload.Drivers = new_drivers; Payload.Drivers.SetValue(new_driver.Payload, Payload.Drivers.Length-1); /* XmlElement season_xmlel; XmlElement driver_xmlel; if (Utils.ElementizeObject(Payload, out season_xmlel)) { string xml = "<Driver>" + " <first_name>" + first_name + "</first_name>" + " <last_name>" + last_name + "</last_name>" + " <car>" + car + "</car>" + " <Aliases>" + " <alias>" + alias + "</Alias>" + " </Aliases>" + " </Points>" + "</Driver>"; Utils.ParseXML(xml, out driver_xmlel); season_xmlel.SelectSingleNode("./Drivers").AppendChild(driver_xmlel); object out_payload = null; Utils.DeelementizeObject(season_xmlel, out out_payload); Payload = (SeasonType)out_payload; } */ } public DriverWrapper FindDriverByAlias(string alias) { DriverWrapper rval = null; for (int i=0; i<Payload.Drivers.Length; i++) { DriverType curr_driver = Payload.Drivers[i]; foreach (string curr_alias in curr_driver.Aliases) { if (curr_alias.ToUpper() == alias.ToUpper()) { rval = new DriverWrapper(ref curr_driver); break; // out of foreach(alias) } } if (rval != null) { break; // out of for(i) } } return rval; } public DriverWrapper FindDriverByName(string first_name, string last_name) { DriverWrapper rval = null; for (int i=0; i<Payload.Drivers.Length; i++) { DriverType curr_driver = Payload.Drivers[i]; if ((curr_driver.first_name.ToUpper() == first_name.ToUpper()) && (curr_driver.last_name.ToUpper() == last_name.ToUpper())) { rval = new DriverWrapper(ref curr_driver); break; // out of for(i) } } return rval; } public DriverWrapper FindDriverByCombinedName(string name) { DriverWrapper rval = null; for (int i=0; i<Payload.Drivers.Length; i++) { DriverType curr_driver = Payload.Drivers[i]; if (curr_driver.first_name.ToUpper() + " " + curr_driver.last_name.ToUpper() == name.ToUpper()) { rval = new DriverWrapper(ref curr_driver); break; // out of for(i) } } return rval; } public ClassWrapper FindClassByImportedID(string imported_id) { ClassWrapper rval = null; // do a simple check if (rval == null) { for (int i=0; i<Payload.Classes.Length; i++) { ClassType curr_class = Payload.Classes[i]; if (imported_id.ToUpper() == curr_class.id.ToUpper()) { rval = new ClassWrapper(ref curr_class); break; // out of for(i) } } } // do a starts-with check (to find PAX classes) if (rval == null) { int matched_length = 0; for (int i=0; i<Payload.Classes.Length; i++) { ClassType curr_class = Payload.Classes[i]; if ((imported_id.ToUpper().StartsWith(curr_class.id.ToUpper()) && (curr_class.id.ToUpper().Length > matched_length))) { rval = new ClassWrapper(ref curr_class); matched_length = curr_class.id.ToUpper().Length; } } } return rval; } public ClassWrapper GetClass(string class_id) { ClassWrapper rval = null; for (int i=0; i<Payload.Classes.Length; i++) { if (Payload.Classes[i].id == class_id) { rval = new ClassWrapper(ref Payload.Classes[i]); break; // out of for(i) } } return rval; } public void GetClassStandings(DriverWrapper driver, string class_id, bool exclude_nonqualified, out int position_with_drops, out int point_total, out int point_total_with_drops, out bool qualified) { position_with_drops = 0; point_total = 0; point_total_with_drops = 0; qualified = false; if (driver != null) { position_with_drops = 1; point_total = driver.GetClassPointsTotal(class_id, 0, Payload.Settings.event_count); point_total_with_drops = driver.GetClassPointsTotal(class_id, Payload.Settings.drop_count, Payload.Settings.event_count); qualified = driver.GetClassQualifiedStatus(class_id, Payload.Settings.min_event_count); for (int i=0; i<Payload.Drivers.Length; i++) { DriverWrapper opponent = new DriverWrapper(ref Payload.Drivers[i]); if ((point_total_with_drops < opponent.GetClassPointsTotal(class_id, Payload.Settings.drop_count, Payload.Settings.event_count)) && (opponent.GetClassQualifiedStatus(class_id, Payload.Settings.min_event_count) || !exclude_nonqualified)) { position_with_drops++; } } } } public void GetPaxStandings(DriverWrapper driver, bool ladies, bool exclude_nonqualified, out int position_with_drops, out int point_total, out int point_total_with_drops, out bool qualified) { position_with_drops = 0; point_total = 0; point_total_with_drops = 0; qualified = false; if (driver != null) { position_with_drops = 1; point_total = driver.GetPaxPointsTotal(ladies, 0, Payload.Settings.event_count, this); point_total_with_drops = driver.GetPaxPointsTotal(ladies, Payload.Settings.drop_count, Payload.Settings.event_count, this); qualified = driver.GetPaxQualifiedStatus(ladies, Payload.Settings.min_event_count, this); for (int i=0; i<Payload.Drivers.Length; i++) { DriverWrapper opponent = new DriverWrapper(ref Payload.Drivers[i]); if ((point_total_with_drops < opponent.GetPaxPointsTotal(ladies, Payload.Settings.drop_count, Payload.Settings.event_count, this)) && (opponent.GetPaxQualifiedStatus(ladies, Payload.Settings.min_event_count, this) || !exclude_nonqualified)) { position_with_drops++; } } } } } public class ClassWrapper { public ClassType Payload = new ClassType(); public ClassWrapper(ref ClassType payload) { Payload = payload; } public override string ToString() { return Payload.id; } } public class EventWrapper { public EventType Payload = new EventType(); public EventWrapper(ref EventType payload) { Payload = payload; } public override string ToString() { return Payload.data_file; } } public class DriverWrapper { public DriverType Payload; public DriverWrapper() { Payload = new DriverType(); Payload.Aliases = new string[] {}; Payload.Points = new PointsType[] {}; } public DriverWrapper(ref DriverType payload) { Payload = payload; } public override string ToString() { return Payload.first_name + " " + Payload.last_name; } public void UpdatePoints(ulong event_number, string class_id, int class_amount, int pax_amount) { PointsType points = null; for (int i=0; i<Payload.Points.Length; i++) { if (Payload.Points[i].event_number == event_number) { points = Payload.Points[i]; break; // out of for(i) } } if (points == null) { points = new PointsType(); points.event_number = event_number; Payload.Points = (PointsType[])Utils.AppendElement(Payload.Points, points); } points.class_id = class_id; points.class_amount = class_amount; points.pax_amount = pax_amount; } public void AddAlias(string alias) { string[] new_aliases = new string[Payload.Aliases.Length + 1]; Payload.Aliases.CopyTo(new_aliases, 0); Payload.Aliases = new_aliases; Payload.Aliases.SetValue(alias, Payload.Aliases.Length - 1); } public int GetClassPointsTotal(string class_id, uint drops, uint season_event_count) { int rval = 0; int drops_taken = 0; int[] drops_array = new int[drops]; Array.Clear(drops_array, 0, (int)drops); uint event_count = 0; PointsType points = null; for (int i=0; i<Payload.Points.Length; i++) { points = Payload.Points[i]; if (points.class_id.ToUpper() == class_id.ToUpper()) { event_count++; if (drops_taken < drops) { drops_array[drops_taken] = points.class_amount; drops_taken++; } else { Array.Sort(drops_array); Array.Reverse(drops_array); for (int j=0; j<drops; j++) { if (points.class_amount < drops_array[j]) { drops_array[j] = points.class_amount; break; } } } rval += points.class_amount; } } drops_taken -= (int)(season_event_count - event_count); Array.Sort(drops_array); for (int i=0; i<drops_taken; i++) { rval -= drops_array[i]; } return rval; } public int GetPaxPointsTotal(bool ladies, uint drops, uint season_event_count, SeasonWrapper season_data) { int rval = 0; int drops_taken = 0; int[] drops_array = new int[drops]; Array.Clear(drops_array, 0, (int)drops); uint event_count = 0; PointsType points = null; for (int i=0; i<Payload.Points.Length; i++) { points = Payload.Points[i]; if (season_data.GetClass(points.class_id).Payload.ladies == ladies) { event_count++; if (drops_taken < drops) { drops_array[drops_taken] = points.pax_amount; drops_taken++; } else { Array.Sort(drops_array); Array.Reverse(drops_array); for (int j=0; j<drops; j++) { if (points.class_amount < drops_array[j]) { drops_array[j] = points.pax_amount; break; } } } rval += points.pax_amount; } } drops_taken -= (int)(season_event_count - event_count); Array.Sort(drops_array); for (int i=0; i<drops_taken; i++) { rval -= drops_array[i]; } return rval; } public bool GetClassQualifiedStatus(string class_id, uint required_events) { uint event_count = 0; PointsType points = null; for (int i=0; i<Payload.Points.Length; i++) { points = Payload.Points[i]; if (points.class_id.ToUpper() == class_id.ToUpper()) { event_count++; } } return (event_count >= required_events); } public bool GetPaxQualifiedStatus(bool ladies, uint required_events, SeasonWrapper season_data) { uint event_count = 0; PointsType points = null; for (int i=0; i<Payload.Points.Length; i++) { points = Payload.Points[i]; if (season_data.GetClass(points.class_id).Payload.ladies == ladies) { event_count++; } } return (event_count >= required_events); } } public class ResultWrapper { public ResultType Payload = new ResultType(); public ResultWrapper() { Payload = new ResultType(); Payload.ImportedData = new ResultTypeImportedData(); Payload.MatchedData = new ResultTypeMatchedData(); Payload.StandingsData = new ResultTypeStandingsData(); } public ResultWrapper(ref ResultType payload) { Payload = payload; } } } //------------------------------------------------------------------------------ // <autogenerated> // This code was generated by a tool. // Runtime Version: 1.1.4322.2032 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </autogenerated> //------------------------------------------------------------------------------ // // This source code was auto-generated by xsd, Version=1.1.4322.2032. // namespace SeasonManager { using System.Xml.Serialization; /// <remarks/> [System.Xml.Serialization.XmlRootAttribute("Season", Namespace="", IsNullable=false)] public class SeasonType { /// <remarks/> [System.ComponentModel.DefaultValueAttribute("New Season")] public string name = "New Season"; /// <remarks/> [System.ComponentModel.DefaultValueAttribute("")] public string club = ""; /// <remarks/> public DocStateType DocState; /// <remarks/> public SettingsType Settings; /// <remarks/> [System.Xml.Serialization.XmlArrayItemAttribute("Class", IsNullable=false)] public ClassType[] Classes; /// <remarks/> [System.Xml.Serialization.XmlArrayItemAttribute("Event", IsNullable=false)] public EventType[] Events; /// <remarks/> [System.Xml.Serialization.XmlArrayItemAttribute("Driver", IsNullable=false)] public DriverType[] Drivers; } /// <remarks/> public class DocStateType { /// <remarks/> [System.ComponentModel.DefaultValueAttribute(false)] public bool modified = false; /// <remarks/> [System.ComponentModel.DefaultValueAttribute("")] public string filename = ""; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(typeof(System.UInt64), "0")] public System.UInt64 next_id = ((System.UInt64)(0m)); } /// <remarks/> public class PointsType { /// <remarks/> [System.ComponentModel.DefaultValueAttribute("")] public string class_id = ""; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(typeof(System.UInt64), "0")] public System.UInt64 event_number = ((System.UInt64)(0m)); /// <remarks/> [System.ComponentModel.DefaultValueAttribute(0)] public int class_amount = 0; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(0)] public int pax_amount = 0; } /// <remarks/> public class DriverType { /// <remarks/> [System.ComponentModel.DefaultValueAttribute("New")] public string first_name = "New"; /// <remarks/> [System.ComponentModel.DefaultValueAttribute("Driver")] public string last_name = "Driver"; /// <remarks/> [System.Xml.Serialization.XmlArrayItemAttribute("alias", IsNullable=false)] public string[] Aliases; /// <remarks/> [System.ComponentModel.DefaultValueAttribute("")] public string car = ""; /// <remarks/> [System.Xml.Serialization.XmlArrayItemAttribute("Points", IsNullable=false)] public PointsType[] Points; } /// <remarks/> public class EventType { /// <remarks/> [System.ComponentModel.DefaultValueAttribute("New Event")] public string name = "New Event"; /// <remarks/> [System.ComponentModel.DefaultValueAttribute("")] public string date = ""; /// <remarks/> public System.UInt64 number; /// <remarks/> [System.ComponentModel.DefaultValueAttribute("")] public string data_file = ""; } /// <remarks/> public class PrefixModifierType { /// <remarks/> public string prefix; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(typeof(System.Single), "1")] public System.Single modifier = ((System.Single)(1F)); } /// <remarks/> public class ClassType { /// <remarks/> [System.ComponentModel.DefaultValueAttribute("NEW")] public string id = "NEW"; /// <remarks/> [System.ComponentModel.DefaultValueAttribute("New Class")] public string description = "New Class"; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(false)] public bool ladies = false; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(false)] public bool non_points = false; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(false)] public bool pax_class = false; /// <remarks/> [System.Xml.Serialization.XmlArrayItemAttribute("PrefixModifier", IsNullable=false)] public PrefixModifierType[] PrefixModifiers; } /// <remarks/> public class SettingsType { /// <remarks/> [System.ComponentModel.DefaultValueAttribute("10,8,6,5,4,3,2,1,0")] public string class_points = "10,8,6,5,4,3,2,1,0"; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(5)] public int single_entrant_class_points = 5; /// <remarks/> [System.ComponentModel.DefaultValueAttribute("10,8,6,5,4,3,2,1")] public string pax_points = "10,8,6,5,4,3,2,1"; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(10)] public int single_entrant_pax_points = 10; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(typeof(System.UInt32), "0")] public System.UInt32 event_count = ((System.UInt32)(0)); /// <remarks/> [System.ComponentModel.DefaultValueAttribute(typeof(System.UInt32), "0")] public System.UInt32 min_event_count = ((System.UInt32)(0)); /// <remarks/> [System.ComponentModel.DefaultValueAttribute(typeof(System.UInt32), "0")] public System.UInt32 drop_count = ((System.UInt32)(0)); } /// <remarks/> [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)] public class ImportedResults { /// <remarks/> [System.Xml.Serialization.XmlElementAttribute("Result")] public ResultType[] Result; } /// <remarks/> public class ResultType { /// <remarks/> public ResultTypeImportedData ImportedData; /// <remarks/> public ResultTypeMatchedData MatchedData; /// <remarks/> public ResultTypeStandingsData StandingsData; } /// <remarks/> public class ResultTypeImportedData { /// <remarks/> [System.ComponentModel.DefaultValueAttribute("")] public string Class = ""; /// <remarks/> [System.ComponentModel.DefaultValueAttribute("Unknown")] public string First_Name = "Unknown"; /// <remarks/> [System.ComponentModel.DefaultValueAttribute("Driver")] public string Last_Name = "Driver"; /// <remarks/> [System.ComponentModel.DefaultValueAttribute("")] public string Car = ""; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(typeof(System.Single), "999.999")] public System.Single Total = ((System.Single)(999.999F)); /// <remarks/> [System.ComponentModel.DefaultValueAttribute(typeof(System.Single), "999.999")] public System.Single Pax_Time = ((System.Single)(999.999F)); /// <remarks/> [System.Xml.Serialization.XmlArrayItemAttribute("Run", IsNullable=false)] public RunType[] Runs; } /// <remarks/> public class RunType { /// <remarks/> [System.ComponentModel.DefaultValueAttribute(typeof(System.Single), "999.999")] public System.Single time = ((System.Single)(999.999F)); /// <remarks/> public string penalty; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(0)] public int cone_count = 0; } /// <remarks/> public class ResultTypeMatchedData { /// <remarks/> [System.ComponentModel.DefaultValueAttribute("")] public string class_id = ""; /// <remarks/> public string alias; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(ResultTypeMatchedDataMode.INVALID)] public ResultTypeMatchedDataMode mode = ResultTypeMatchedDataMode.INVALID; /// <remarks/> public bool ignored; } /// <remarks/> public enum ResultTypeMatchedDataMode { /// <remarks/> INVALID, /// <remarks/> ADD_DRIVER, /// <remarks/> NEW_LINK, /// <remarks/> EXISTING_LINK, } /// <remarks/> public class ResultTypeStandingsData { /// <remarks/> [System.ComponentModel.DefaultValueAttribute(typeof(System.UInt64), "0")] public System.UInt64 class_position = ((System.UInt64)(0m)); /// <remarks/> [System.ComponentModel.DefaultValueAttribute(0)] public int class_points = 0; /// <remarks/> [System.ComponentModel.DefaultValueAttribute(typeof(System.UInt64), "0")] public System.UInt64 pax_position = ((System.UInt64)(0m)); /// <remarks/> [System.ComponentModel.DefaultValueAttribute(0)] public int pax_points = 0; } }
__________________
Is you is, or is you ain't, my con-stit-u-ints? |
2006-04-12, 12:14 PM | #19 |
JDM Cowboy
Real Name: Nick Join Date: Oct 2003
Location: Somewhere
Posts: 8,642
Car: 2015 Mazda 3
|
I am so pirating that code.
__________________
While a standard engine is powered by a belt connected to the crankshaft, a turbo engine runs on its own exhaust steam, making it more energy efficient. -- CNN |
2006-04-12, 12:18 PM | #20 | |
The Doink
Real Name: Scott Join Date: Nov 2002
Location: Portland, OR
Posts: 20,335
Car: '09 OBXT, '02 WRX, '96 Miata
Class: PDX/TT-6
The way out is through
|
Quote:
__________________
Is you is, or is you ain't, my con-stit-u-ints? |
|
2006-04-12, 12:21 PM | #21 |
JDM Cowboy
Real Name: Nick Join Date: Oct 2003
Location: Somewhere
Posts: 8,642
Car: 2015 Mazda 3
|
Bugs, fixed?
I'm sorry, thats not my department.
__________________
While a standard engine is powered by a belt connected to the crankshaft, a turbo engine runs on its own exhaust steam, making it more energy efficient. -- CNN |
2006-04-12, 02:16 PM | #22 |
EJ205
Join Date: Jan 2006
Location: Reno, NV
Posts: 1,840
Car: Impreza and an Impreza
Class: AS / CRS PerfStock
"pedal on the right"
|
Nice Code that will give me something to play around with
|
2006-04-12, 03:12 PM | #23 | |
The Doink
Real Name: Scott Join Date: Nov 2002
Location: Portland, OR
Posts: 20,335
Car: '09 OBXT, '02 WRX, '96 Miata
Class: PDX/TT-6
The way out is through
|
Quote:
See if you can note the way I handle street tire, ladies classes, season points for both class and pax championships, novice results, run no points, drops, perfect attendance reporting, driver aliases, name scrambling, .RGG importing, single event reporting, season standings reporting, and probably 20 other nuances I can't even recall since I wrote this software like 8 months ago. Basically, the problem isn't anywhere as simple as 2 DB tables and a PAX lookup. For example, you tell me how that will tell the connection between SM and TSM and how you'll know to consider them in the same championship but applying the street tire PAX factor to just one of them before final classification. Or how you'll know that "Allen Snellbaker" and "Alan Snellbacher" are actually the same person even though his name changed between the Round 1 results and the Round 3 results because someone in the bus mis-typed his name. Or how you'll handle the consolidation of PAX points for one driver even though s/he's changed classes throughout the season. Finally, tell me how a web-based DB driven application is going to do a lick of good on a laptop that's running off a generator in a bus parked on the tarmac at Stead airport, you got satalite internet access you'll loan to SCCA so we can update and print results from the bus, or am I going to have to install a webserver on the SCCA laptop and run it locally? The problem set for this software is non-trivial.
__________________
Is you is, or is you ain't, my con-stit-u-ints? |
|
2006-04-12, 03:16 PM | #24 |
EJ205
Real Name: Khail Join Date: Dec 2002
Location: Reno, NV
Posts: 1,769
Car: 2016 VW GTI
Meets? We have meets?
|
Cool, Scott's panties are in a bunch again. Good ol' Scott!
|
2006-04-12, 03:24 PM | #25 | |
The Doink
Real Name: Scott Join Date: Nov 2002
Location: Portland, OR
Posts: 20,335
Car: '09 OBXT, '02 WRX, '96 Miata
Class: PDX/TT-6
The way out is through
|
Quote:
__________________
Is you is, or is you ain't, my con-stit-u-ints? |
|
Thread Tools | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
MikeK's new heroes | Nick Koan | Off Topic Chat | 1 | 2007-01-14 01:02 PM |
How can I disable email notification of new posts? | left footed whooten | Website News & Issues | 3 | 2006-09-18 10:32 AM |