Esempio n. 1
0
 public Filter(RaceData raceData)
 {
     _raceID = raceData.RaceID;
      _connectionSting = raceData.connectionString;
      data.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;
      data.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Raised;
      data.CellBorderStyle = DataGridViewCellBorderStyle.Raised;
      data.AllowUserToAddRows = false;
 }
Esempio n. 2
0
 public Filter(RaceData raceData)
 {
     _raceID                       = raceData.RaceID;
     _connectionSting              = raceData.connectionString;
     data.AutoSizeRowsMode         = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;
     data.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Raised;
     data.CellBorderStyle          = DataGridViewCellBorderStyle.Raised;
     data.AllowUserToAddRows       = false;
 }
Esempio n. 3
0
 //on "Race!" button click. create race data, hide this window, pop up new "Main" window
 private void BtnRace_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedItem==null || comboBox1.SelectedItem.ToString()=="")
         MessageBox.Show("No Race Selected");
     else {
         var data = new RaceData(this, comboBox1.SelectedItem.ToString(), CommonSQL.SQLiteConnectionString);
         var mainWindow = new MainWindow(data);
         this.Hide();
         mainWindow.Show(); 
     }
 }
Esempio n. 4
0
 //pre-pop with runner data and get runner ID (this will preform an update)
 public NewUserWindow(RaceData _raceData, MainWindow _parent, string firstName, string lastName, DateTime dob, string bibID, char sex, string team, string org)
     : this(_raceData, _parent)
 {
     textBoxFirstName.Text = firstName;
     textBoxLastName.Text = lastName;
     dateTimePicker1.Value = dob;
     textBoxBibId.Text = bibID;
     textBoxTeam.Text = team;
     textBoxOrginization.Text=org;
     tbGender.Text = sex+"";
     _RunnerID=CommonSQL.GetRunnerID(firstName, lastName, dob);
 }
Esempio n. 5
0
 //this is how we realy start the main window... sets defaults for clock and timemr
 public MainWindow(RaceData data)
 {
     raceData=data;
     InitializeComponent();
     comboBoxKeySelect.SelectedIndex = 0;
     //becouse the default is to start with the Keyboard Timer
     //set clock to inital default of 0
     SetClock(new TimeSpan(0,0,0));
     panelClock.Visible = true;
     //this is to make the clock update in the gui
     clockRefreshTimer.Elapsed += new ElapsedEventHandler(delegate { SetClock(timingDevice.GetCurrentTime()); });
 }
Esempio n. 6
0
 //pre-pop with runner data and get runner ID (this will preform an update)
 public NewUserWindow(RaceData _raceData, MainWindow _parent, string firstName, string lastName, DateTime dob, string bibID, char sex, string team, string org)
     : this(_raceData, _parent)
 {
     textBoxFirstName.Text    = firstName;
     textBoxLastName.Text     = lastName;
     dateTimePicker1.Value    = dob;
     textBoxBibId.Text        = bibID;
     textBoxTeam.Text         = team;
     textBoxOrginization.Text = org;
     tbGender.Text            = sex + "";
     _RunnerID = CommonSQL.GetRunnerID(firstName, lastName, dob);
 }
Esempio n. 7
0
 //this is how we realy start the main window... sets defaults for clock and timemr
 public MainWindow(RaceData data)
 {
     raceData = data;
     InitializeComponent();
     comboBoxKeySelect.SelectedIndex = 0;
     //becouse the default is to start with the Keyboard Timer
     //set clock to inital default of 0
     SetClock(new TimeSpan(0, 0, 0));
     panelClock.Visible = true;
     //this is to make the clock update in the gui
     clockRefreshTimer.Elapsed += new ElapsedEventHandler(delegate { SetClock(timingDevice.GetCurrentTime()); });
 }
Esempio n. 8
0
 public Filter(RaceData raceData, string name, string query, int width=-1, int height=-1)
     : this(raceData)
 {
     this.name = name;
       _Sql = query;
       if (width > 0 && height > 0)
       {
           data.Width = width;
           data.Height = height;
       }
       else
         data.AutoSize = true;
 }
Esempio n. 9
0
 //on "Race!" button click. create race data, hide this window, pop up new "Main" window
 private void BtnRace_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedItem == null || comboBox1.SelectedItem.ToString() == "")
     {
         MessageBox.Show("No Race Selected");
     }
     else
     {
         var data       = new RaceData(this, comboBox1.SelectedItem.ToString(), CommonSQL.SQLiteConnectionString);
         var mainWindow = new MainWindow(data);
         this.Hide();
         mainWindow.Show();
     }
 }
Esempio n. 10
0
 public Filter(RaceData raceData, string name, string query, int width = -1, int height = -1)
     : this(raceData)
 {
     this.name = name;
     _Sql      = query;
     if (width > 0 && height > 0)
     {
         data.Width  = width;
         data.Height = height;
     }
     else
     {
         data.AutoSize = true;
     }
 }
Esempio n. 11
0
 public void TestFilters()
 {
     StartScreen ss = new StartScreen();
     RaceData racedata = new RaceData(ss, "RaceUnitTest", "Data Source=MyDatabase.sqlite;Version=3;");
     Filter filter = new Filter(racedata);
     //Test it returns filter
     var RealFilter = new List<Filter>();
     var TestFilter = new List<Filter>();
     RealFilter = Filter.BuildFromXML(racedata, "OveralFilter.xml", 5, 5);
     TestFilter = Filter.BuildFromXML(racedata, "OveralFilter.xml", 5, 5);
     //Test that two different instances of the same filter are not equal
     //and as a result do not get overwritten
     CollectionAssert.AreNotEqual(RealFilter, TestFilter);
     //Test the catch exception
     Assert.IsNull(Filter.BuildFromXML(racedata, "NoFilter.xml", 5, 5));
     //Test there is data in the datatable
     Assert.IsNotNull(filter.GetDataTable());
 }
Esempio n. 12
0
        //construct filter based on xml params
        public static List <Filter> BuildFromXML(RaceData raceData, string file, int width = -1, int height = -1)
        {
            var    filters = new List <Filter>();
            string name = null, sql = null;
            var    xml = new XmlTextReader(file);

            try
            {
                while (xml.Read())
                {
                    if (xml.IsStartElement())
                    {
                        if (xml.Name == "Name")
                        {
                            xml.Read();
                            name = xml.Value;
                        }
                        else if (xml.Name == "SQL")
                        {
                            xml.Read();
                            sql = xml.Value;
                        }
                    }
                    if (!string.IsNullOrEmpty(sql) && !string.IsNullOrEmpty(name) || (xml.IsEmptyElement && xml.Name == "Filter"))
                    {
                        filters.Add(new Filter(raceData, name, sql, width, height));
                        sql  = null;
                        name = null;
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return(null);
            }
            return(filters);
        }
Esempio n. 13
0
 //construct filter based on xml params
 public static List<Filter> BuildFromXML(RaceData raceData, string file, int width = -1, int height = -1)
 {
     var filters=new List<Filter>();
     string name=null, sql=null;
     var xml = new XmlTextReader(file);
     try
     {
         while (xml.Read())
         {
             if (xml.IsStartElement())
             {
                 if (xml.Name == "Name")
                 {
                     xml.Read();
                     name = xml.Value;
                 }
                 else if (xml.Name == "SQL")
                 {
                     xml.Read();
                     sql = xml.Value;
                 }
             }
             if (!string.IsNullOrEmpty(sql) && !string.IsNullOrEmpty(name)||(xml.IsEmptyElement && xml.Name=="Filter"))
             {
                 filters.Add(new Filter(raceData, name, sql, width, height));
                 sql = null;
                 name = null;
             }
         }
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
         return null;
     }
     return filters;
 }
Esempio n. 14
0
 //blank new runner window
 public NewUserWindow(RaceData _raceData, MainWindow _parent)
     : this(_raceData)
 {
     this.parent = _parent;
 }
Esempio n. 15
0
 //blank new runner window
 public NewUserWindow(RaceData _raceData)
 {
     raceData = _raceData;
     InitializeComponent();
 }
Esempio n. 16
0
 //blank new runner window
 public NewUserWindow(RaceData _raceData, MainWindow _parent) : this(_raceData)
 {
     this.parent = _parent;
 }
Esempio n. 17
0
 //blank new runner window
 public NewUserWindow(RaceData _raceData)
 {
     raceData = _raceData;
     InitializeComponent();
 }