Esempio n. 1
0
        public SeriesListForm(HauliDBHandler dbHandler)
        {
            InitializeComponent();

            // TODO: Complete member initialization
            this.dbHandler = dbHandler;

               // seuraList = new List<SeuraListLine>();

            seuraList = dbHandler.getSeuraList();

            idColumn.AspectGetter = delegate(object x) { return ((SeuraListLine)x).Id; };

            lyhenneColumn.AspectGetter = delegate(object x) { return ((SeuraListLine)x).Lyhenne; };
            lyhenneColumn.AspectPutter = delegate(object x, object newValue) { ((SeuraListLine)x).Lyhenne = newValue.ToString(); };

            kokoNimiColumn.AspectGetter = delegate(object x) { return ((SeuraListLine)x).KokoNimi; };
            kokoNimiColumn.AspectPutter = delegate(object x, object newValue) { ((SeuraListLine)x).KokoNimi = newValue.ToString(); };

            alueColumn.AspectGetter = delegate(object x) { return ((SeuraListLine)x).Alue; };
            alueColumn.AspectPutter = delegate(object x, object newValue) { ((SeuraListLine)x).Alue = newValue.ToString(); };

            buttonColumn.DisplayIndex = 4;
            buttonColumn.ImageGetter = delegate(object row)
            {
                    return 1;
            };
            buttonColumn.Tag = "buttonColumn";

            refresSeriesListView();
        }
Esempio n. 2
0
        public RoundScheduleView(HauliDBHandler dbHandler, string tc, string rd, bool dayTwo, string startingHday1, string startingMday1, string startingHday2, string startingMday2)
        {
            this.dbHandler = dbHandler;
            InitializeComponent();

            if (tc.Trim() != "")
                this.trackCount = Convert.ToInt32(tc);

            if (rd.Trim() != "")
                this.roundDuration = Convert.ToDouble(rd);

            if (startingHday1.Trim() != "")
                this.startingHourDay1 = Convert.ToDouble(startingHday1);

            if (startingHday2.Trim() != "")
                this.startingHourDay2 = Convert.ToDouble(startingHday2);

            if (startingMday1.Trim() != "")
                this.startingMinuteDay1 = Convert.ToDouble(startingMday1);

            if (startingMday2.Trim() != "")
                this.startingMinuteDay2 = Convert.ToDouble(startingMday2);

            HauliColors colors = new HauliColors();
            roundColors = colors.GetColors();

            List<object> tiedot = new List<object>();
            tiedot = dbHandler.getMainInfo();

            for (int i = 0; i < tiedot.Count; i++)
            {
                Console.WriteLine(tiedot[i].ToString());
                Console.WriteLine(tiedot.Count);
            }

            if (tiedot.Count < 7)
                day2Enabled = false;
            else
                day2Enabled = true;

            if (!day2Enabled)
                TabControl.TabPages.Remove(tabPage2);

            rataComboBox.Text = Convert.ToString((int)tiedot[3]);
            eraComboBox.Text = Convert.ToString((int)tiedot[4]);

            InitializeView();
            initializeTimeColumns();
            AutoArrangeRoundList();
            initializeTrackListViews();
        }
Esempio n. 3
0
        /// <summary>
        /// MainUIform-konstruktori, joka alustaa käyttöliittymäkomponentit ja
        /// tietokannanmuokkausluokan.
        /// </summary>
        public MainUIform()
        {
            InitializeComponent();
            rataComboBox.Text = "1";
            eraComboBox.Text = "15";
            //Tarkistetaan tietokanta
            try
            {
                dbHandler = new HauliDBHandler();

                if (!File.Exists("ObjectListView.dll"))
                    throw new HauliException("Tiedostoa ObjectListView.dll ei löytynyt");
            }
            catch (HauliException e)
            {
                MessageBox.Show(e.Message, "Virhe", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }

            // Hae kannasta näytettävää kamaa pääikkunaan
            getMainInfo();
        }
Esempio n. 4
0
        public TeamListForm(HauliDBHandler dbHandler)
        {
            InitializeComponent();

            this.dbHandler = dbHandler;

            teamList = new List<TeamListLine>();

            teamList = dbHandler.getTeamList();

            idColumn.AspectGetter = delegate(object x) { return ((TeamListLine)x).Id; };

            teamColumn.AspectGetter = delegate(object x) { return ((TeamListLine)x).Joukkue; };
            teamColumn.AspectPutter = delegate(object x, object newValue) { ((TeamListLine)x).Joukkue = newValue.ToString(); };

            buttonColumn.DisplayIndex = 2;
            buttonColumn.ImageGetter = delegate(object row)
            {
                return 1;
            };
            buttonColumn.Tag = "buttonColumn";

            refresTeamListView();
        }
Esempio n. 5
0
        public ContestantListForm(HauliDBHandler dbHandler)
        {
            InitializeComponent();
            this.dbHandler = dbHandler;

            AutoCompleteStringCollection seuraAutoCompleteCollection = new AutoCompleteStringCollection();
            AutoCompleteStringCollection joukkueAutoCompleteCollection = new AutoCompleteStringCollection();
            seuraList = new List<string>();
            sarjaList = new List<string>();

            moveHandCursor = new Cursor("Resources/move.cur");

            seuraList = dbHandler.getSeuraBox();

            seuraAutoCompleteCollection.AddRange(seuraList.ToArray());
            seuraComboBox.AutoCompleteCustomSource = seuraAutoCompleteCollection;
            seuraComboBox.Items.AddRange(seuraList.ToArray());

            sarjaList = dbHandler.getSarjaBox();

            joukkueList = dbHandler.getJoukkueBox();

            joukkueAutoCompleteCollection.AddRange(joukkueList.ToArray());
            joukkueComboBox.AutoCompleteCustomSource = seuraAutoCompleteCollection;
            joukkueComboBox.Items.AddRange(joukkueList.ToArray());

            sarjaComboBox.Items.AddRange(sarjaList.ToArray());
            sarjaComboBox.Text = sarjaList[0];

            objectListView1.DragSource = new SimpleDragSource();

            RearrangingDropSink dropsink = new RearrangingDropSink(true);
            dropsink.FeedbackColor = Color.Black;
            objectListView1.DropSink = dropsink;

            contestantList = new List<ContestantListLine>();
            contestantList = dbHandler.getContestant();

            /*
            contestantList.Add(new RoundDivider(false, 1, "Erä"));

            contestantList.Add(new Contestant(generateId(), "Teppo", "Töppönen", "OSH", "Y", "Jouko-poukot"));
            contestantList.Add(new Contestant(generateId(), "Aeppo", "Töppönen", "OSH", "Y", "Ninja-pinjat"));
            contestantList.Add(new Contestant(generateId(), "Beppo", "Töppönen", "OSH", "Y", "Jouko-poukot"));
            contestantList.Add(new Contestant(generateId(), "Ceppo", "Töppönen", "OSH", "Y", ""));
            contestantList.Add(new RoundDivider(false, 2, "Erä"));
            contestantList.Add(new Contestant(generateId(), "Deppo", "Töppönen", "OSH", "Y", ""));
            contestantList.Add(new Contestant(generateId(), "Eeppo", "Töppönen", "OSH", "Y", "Jouko-poukot"));
            contestantList.Add(new Contestant(generateId(), "Feppo", "Töppönen", "OSH", "Y", ""));
            contestantList.Add(new Contestant(generateId(), "Geppoliina", "Töppönen", "OSH", "N", "Ninja-pinjat"));
            contestantList.Add(new RoundDivider(false, 3, "Erä"));
            contestantList.Add(new Contestant(generateId(), "Heppo", "Töppönen", "OSH", "Y", "Ninja-pinjat"));
            contestantList.Add(new Contestant(generateId(), "Ieppo", "Töppönen", "OSH", "Y", ""));
            contestantList.Add(new Contestant(generateId(), "Jeppoliina", "Töppönen", "OSH", "N", "Jouko-poukot"));
            contestantList.Add(new Contestant(generateId(), "Keppo", "Töppönen", "OSH", "Y", ""));
            contestantList.Add(new RoundDivider(false, 4, "Erä"));
            contestantList.Add(new Contestant(generateId(), "Zeppo", "Töppönen", "OSH", "Y", ""));
            */

            idColumn.AspectGetter = delegate(object x) { return ((ContestantListLine)x).Id; };

            grabColumn.AspectGetter = delegate(object x) { return " "; };

            nameColumn.AspectGetter = delegate(object x) { return ((ContestantListLine)x).FullName; };
            nameColumn.AspectPutter = delegate(object x, object newValue) { ((ContestantListLine)x).FullName = newValue.ToString(); };

            seuraColumn.AspectGetter = delegate(object x) { return ((ContestantListLine)x).Seura; };
            seuraColumn.AspectPutter = delegate(object x, object newValue) { ((ContestantListLine)x).Seura = newValue.ToString(); };

            sarjaColumn.AspectGetter = delegate(object x) { return ((ContestantListLine)x).Sarja; };
            sarjaColumn.AspectPutter = delegate(object x, object newValue) { ((ContestantListLine)x).Sarja = newValue.ToString(); };

            joukkueColumn.AspectGetter = delegate(object x) { return ((ContestantListLine)x).Team; };
            joukkueColumn.AspectPutter = delegate(object x, object newValue) { ((ContestantListLine)x).Team = newValue.ToString(); };

            grabColumn.DisplayIndex = 1;
            grabColumn.ImageGetter = delegate(object row)
            {
                if (((ContestantListLine)row) is RoundDivider)
                    return -1;
                else
                    return 3;

            };
            grabColumn.Tag = "grabColumn";

            buttonColumn1.ImageGetter = delegate(object row)
            {
                if (!(((ContestantListLine)row) is RoundDivider))
                    return 0;
                else
                    return 2;

            };
            buttonColumn1.Tag = "buttonColumn1";

            buttonColumn2.ImageGetter = delegate(object row)
            {
                if (!(((ContestantListLine)row) is RoundDivider) || (((ContestantListLine)row).Id > 1))
                    return 1;
                else
                    return -1;
            };
            buttonColumn2.Tag = "buttonColumn2";

            objectListView1.SetObjects(contestantList);
            countRoundSizes();

            tallennettu = true;
        }