Exemplo n.º 1
0
        private void populateClubsDropDownThread()
        {
            Trace.WriteLine("FCompetitors: populateClubsDropDownThread() " +
                            "started on thread \"" +
                            Thread.CurrentThread.Name +
                            "\" ( " +
                            Thread.CurrentThread.ManagedThreadId.ToString() +
                            " )");

            lock (populateClubsDropDownThreadLock)
            {
                // Get the teams from the database
                Structs.Club[] clubs = CommonCode.GetClubs();
                DatasetTeams   ds    = new DatasetTeams();

                foreach (Structs.Club club in clubs)
                {
                    DatasetTeams.ClubsRow row =
                        ds.Clubs.NewClubsRow();
                    row.ClubId   = club.ClubId;
                    row.ClubName = club.Name;
                    ds.Clubs.AddClubsRow(row);
                }
                this.DdClubs.DataSource    = ds.Clubs;
                this.DdClubs.ValueMember   = "ClubId";
                this.DdClubs.DisplayMember = "ClubName";
            }
            Trace.WriteLine("FCompetitors: populateClubsDropDownThread() ended.");
        }
Exemplo n.º 2
0
        public override DataSet Clone()
        {
            DatasetTeams cln = ((DatasetTeams)(base.Clone()));

            cln.InitVars();
            return(cln);
        }
Exemplo n.º 3
0
        private void populateWeaponsClassDropDown()
        {
            Trace.WriteLine("FCompetitors: populateWeaponsClassDropDown() " +
                            "started on thread \"" +
                            Thread.CurrentThread.Name +
                            "\" ( " +
                            Thread.CurrentThread.ManagedThreadId.ToString() +
                            " )");

            Structs.Competition[] comps = CommonCode.GetCompetitions();
            if (comps.Length == 0)
            {
                return;
            }

            Structs.Competition comp = comps[0];

            DatasetTeams ds = new DatasetTeams();

            for (int i = 1; i <= Structs.ResultWeaponsClassMax; i++)
            {
                Structs.ResultWeaponsClass wc = (Structs.ResultWeaponsClass)i;
                try
                {
                    int test = int.Parse(wc.ToString());
                }
                catch (System.FormatException)
                {
                    DatasetTeams.WeaponClassRow row =
                        ds.WeaponClass.NewWeaponClassRow();
                    row.ClassId   = i;
                    row.ClassName = wc.ToString() + "-vapen";
                    if ((comp.Type != Structs.CompetitionTypeEnum.MagnumField &
                         row.ClassName.IndexOf("M") == -1) |
                        (comp.Type == Structs.CompetitionTypeEnum.MagnumField &
                         row.ClassName.IndexOf("M") > -1 &
                         row.ClassName != "M-vapen"))
                    {
                        ds.WeaponClass.AddWeaponClassRow(row);
                    }
                }
                this.ddWeaponClass.DataSource    = ds.WeaponClass;
                this.ddWeaponClass.DisplayMember = "ClassName";
                this.ddWeaponClass.ValueMember   = "ClassId";
            }
            Trace.WriteLine("FCompetitors: populateWeaponsClassDropDown() ended.");
        }
Exemplo n.º 4
0
        private void populateTeamsDropDownThread()
        {
            Trace.WriteLine("FCompetitors: populateTeamsDropDown() " +
                            "started on thread \"" +
                            Thread.CurrentThread.Name +
                            "\" ( " +
                            Thread.CurrentThread.ManagedThreadId.ToString() +
                            " )");

            if (DdTeams.InvokeRequired)
            {
                Invoke(PopulateTeamsDropDownThreadInvoker);
                return;
            }

            lock (populateTeamsDropDownThreadLock)
            {
                DdTeamsView.Table = null;

                // Get the teams from the database
                Structs.Team[] teams = CommonCode.GetTeams();
                DatasetTeams   ds    = new DatasetTeams();

                // Create the default row
                DatasetTeams.TeamsRow defaultrow =
                    ds.Teams.NewTeamsRow();
                defaultrow.TeamsId   = -1;
                defaultrow.TeamsName = NewTeamString;
                ds.Teams.AddTeamsRow(defaultrow);

                foreach (Structs.Team team in teams)
                {
                    DatasetTeams.TeamsRow row =
                        ds.Teams.NewTeamsRow();
                    row.TeamsId = team.TeamId;
                    string clubName = CommonCode.GetClub(team.ClubId).Name;
                    row.TeamsName = clubName + " - " + team.Name;
                    ds.Teams.AddTeamsRow(row);
                }
                DdTeamsView.Table     = ds.Teams;
                DdTeamsView.Sort      = "TeamsName";
                DdTeams.DisplayMember = "TeamsName";
                DdTeams.ValueMember   = "TeamsId";
            }
            Trace.WriteLine("FCompetitors: populateTeamsDropDown() ended.");
        }
Exemplo n.º 5
0
        private void populateCompetitors()
        {
            Trace.WriteLine("FCompetitors: DdClubs_SelectedIndexChanged() " +
                            "started on thread \"" +
                            Thread.CurrentThread.Name +
                            "\" ( " +
                            Thread.CurrentThread.ManagedThreadId.ToString() +
                            " )");

            Structs.Club club =
                CommonCode.GetClub(
                    (string)this.DdClubs.SelectedValue);
            Structs.ResultWeaponsClass wclass =
                (Structs.ResultWeaponsClass)
                    (int) this.ddWeaponClass.SelectedValue;

            // Get all shooters that belong to the current club and
            // have a competitor with the current class
            //Structs.Shooter[] shooters = CommonCode.GetShooters(club, wclass);
            Structs.Competitor[] comps = CommonCode.GetCompetitors(club, wclass, "Surname, Givenname");

            DatasetTeams ds1 = new DatasetTeams();
            DatasetTeams ds2 = new DatasetTeams();
            DatasetTeams ds3 = new DatasetTeams();
            DatasetTeams ds4 = new DatasetTeams();
            DatasetTeams ds5 = new DatasetTeams();

            shooters = new Hashtable();
            addShootersToDS(ds1, comps);
            addShootersToDS(ds2, comps);
            addShootersToDS(ds3, comps);
            addShootersToDS(ds4, comps);
            addShootersToDS(ds5, comps);

            // Bind the dropdowns to the datatable
            this.ddCompetitor1.DataSource = ds1.Competitors;
            this.ddCompetitor2.DataSource = ds2.Competitors;
            this.ddCompetitor3.DataSource = ds3.Competitors;
            this.ddCompetitor4.DataSource = ds4.Competitors;
            this.ddCompetitor5.DataSource = ds5.Competitors;

            Trace.WriteLine("FCompetitors: DdClubs_SelectedIndexChanged() ended.");
        }
Exemplo n.º 6
0
        private void addShootersToDS(DatasetTeams ds, Structs.Competitor[] comps)
        {
            // Add all those shooters to the datatable

            // Add a default line on top
            DatasetTeams.CompetitorsRow defaultrow =
                ds.Competitors.NewCompetitorsRow();
            defaultrow.CompId   = -1;
            defaultrow.CompName = NewCompetitorString;
            ds.Competitors.AddCompetitorsRow(defaultrow);

            foreach (Structs.Competitor comp in comps)
            {
                DatasetTeams.CompetitorsRow row =
                    ds.Competitors.NewCompetitorsRow();

                Structs.Shooter shooter;
                if (shooters.ContainsKey(comp.ShooterId))
                {
                    shooter = (Structs.Shooter)shooters[comp.ShooterId];
                }
                else
                {
                    shooter = CommonCode.GetShooter(comp.ShooterId);
                    shooters.Add(comp.ShooterId, shooter);
                }

                row.CompName = shooter.Surname + " " + shooter.Givenname;
                if (int.Parse(shooter.CardNr) > 0)
                {
                    row.CompName += " (" + shooter.CardNr + ")";
                }
                row.CompId = comp.CompetitorId;
                ds.Competitors.AddCompetitorsRow(row);
            }
        }
Exemplo n.º 7
0
		private void addShootersToDS(DatasetTeams ds, Structs.Competitor[] comps)
		{
			// Add all those shooters to the datatable

			// Add a default line on top
			DatasetTeams.CompetitorsRow defaultrow = 
				ds.Competitors.NewCompetitorsRow();				
			defaultrow.CompId = -1;
			defaultrow.CompName = NewCompetitorString;
			ds.Competitors.AddCompetitorsRow(defaultrow);

			foreach(Structs.Competitor comp in comps)
			{
				DatasetTeams.CompetitorsRow row = 
					ds.Competitors.NewCompetitorsRow();
				
				Structs.Shooter shooter;
				if (shooters.ContainsKey(comp.ShooterId))
				{
					shooter = (Structs.Shooter)shooters[comp.ShooterId];
				}
				else
				{
					shooter = CommonCode.GetShooter(comp.ShooterId);
					shooters.Add(comp.ShooterId, shooter);
				}

				row.CompName = shooter.Surname + " " + shooter.Givenname;
				if (int.Parse(shooter.CardNr) > 0)
					row.CompName += " (" + shooter.CardNr + ")";
				row.CompId = comp.CompetitorId;
				ds.Competitors.AddCompetitorsRow(row);
			}
		}
Exemplo n.º 8
0
		private void populateCompetitors()
		{
			Trace.WriteLine("FCompetitors: DdClubs_SelectedIndexChanged() " +
				"started on thread \"" +
				Thread.CurrentThread.Name + 
				"\" ( " +
				Thread.CurrentThread.ManagedThreadId.ToString() + 
				" )");

			Structs.Club club = 
				CommonCode.GetClub(
				(string)this.DdClubs.SelectedValue);
			Structs.ResultWeaponsClass wclass = 
				(Structs.ResultWeaponsClass)
				(int)this.ddWeaponClass.SelectedValue;

			// Get all shooters that belong to the current club and 
			// have a competitor with the current class
			//Structs.Shooter[] shooters = CommonCode.GetShooters(club, wclass);
			Structs.Competitor[] comps = CommonCode.GetCompetitors(club, wclass, "Surname, Givenname");

			DatasetTeams ds1 = new DatasetTeams();
			DatasetTeams ds2 = new DatasetTeams();
			DatasetTeams ds3 = new DatasetTeams();
			DatasetTeams ds4 = new DatasetTeams();
			DatasetTeams ds5 = new DatasetTeams();

			shooters = new Hashtable();
			addShootersToDS(ds1, comps);
			addShootersToDS(ds2, comps);
			addShootersToDS(ds3, comps);
			addShootersToDS(ds4, comps);
			addShootersToDS(ds5, comps);

			// Bind the dropdowns to the datatable
			this.ddCompetitor1.DataSource = ds1.Competitors;
			this.ddCompetitor2.DataSource = ds2.Competitors;
			this.ddCompetitor3.DataSource = ds3.Competitors;
			this.ddCompetitor4.DataSource = ds4.Competitors;
			this.ddCompetitor5.DataSource = ds5.Competitors;

			Trace.WriteLine("FCompetitors: DdClubs_SelectedIndexChanged() ended.");
		}
Exemplo n.º 9
0
		private void populateWeaponsClassDropDown()
		{
			Trace.WriteLine("FCompetitors: populateWeaponsClassDropDown() " +
				"started on thread \"" +
				Thread.CurrentThread.Name + 
				"\" ( " +
				Thread.CurrentThread.ManagedThreadId.ToString() + 
				" )");

			Structs.Competition[] comps = CommonCode.GetCompetitions();
			if (comps.Length == 0)
				return;

			Structs.Competition comp = comps[0];

			DatasetTeams ds = new DatasetTeams();
			for(int i=1;i<=Structs.ResultWeaponsClassMax;i++)
			{
				Structs.ResultWeaponsClass wc = (Structs.ResultWeaponsClass)i;
				try
				{
					int test = int.Parse(wc.ToString());
				}
				catch(System.FormatException)
				{
					DatasetTeams.WeaponClassRow row =
							ds.WeaponClass.NewWeaponClassRow();
					row.ClassId = i;
					row.ClassName = wc.ToString() + "-vapen";
					if ((comp.Type != Structs.CompetitionTypeEnum.MagnumField &
						row.ClassName.IndexOf("M") == -1) |
						(comp.Type == Structs.CompetitionTypeEnum.MagnumField &
						row.ClassName.IndexOf("M") > -1 &
						row.ClassName != "M-vapen"))
					{
						ds.WeaponClass.AddWeaponClassRow(row);
					}
				}
				this.ddWeaponClass.DataSource = ds.WeaponClass;
				this.ddWeaponClass.DisplayMember = "ClassName";
				this.ddWeaponClass.ValueMember = "ClassId";
			}
			Trace.WriteLine("FCompetitors: populateWeaponsClassDropDown() ended.");
		}
Exemplo n.º 10
0
		private void populateClubsDropDownThread()
		{
			Trace.WriteLine("FCompetitors: populateClubsDropDownThread() " +
				"started on thread \"" +
				Thread.CurrentThread.Name + 
				"\" ( " +
				Thread.CurrentThread.ManagedThreadId.ToString() + 
				" )");

			lock(populateClubsDropDownThreadLock)
			{
				// Get the teams from the database
				Structs.Club[] clubs = CommonCode.GetClubs();
				DatasetTeams ds = new DatasetTeams();

				foreach(Structs.Club club in clubs)
				{
					DatasetTeams.ClubsRow row =
						ds.Clubs.NewClubsRow();
					row.ClubId = club.ClubId;
					row.ClubName = club.Name;
					ds.Clubs.AddClubsRow(row);
				}
				this.DdClubs.DataSource = ds.Clubs;
				this.DdClubs.ValueMember = "ClubId";
				this.DdClubs.DisplayMember = "ClubName";
			}
			Trace.WriteLine("FCompetitors: populateClubsDropDownThread() ended.");
		}
Exemplo n.º 11
0
		private void populateTeamsDropDownThread()
		{
			Trace.WriteLine("FCompetitors: populateTeamsDropDown() " +
				"started on thread \"" +
				Thread.CurrentThread.Name + 
				"\" ( " +
				Thread.CurrentThread.ManagedThreadId.ToString() + 
				" )");

			if ( DdTeams.InvokeRequired )
			{
				Invoke(PopulateTeamsDropDownThreadInvoker);
				return;
			}
				
			lock(populateTeamsDropDownThreadLock)
			{
				DdTeamsView.Table = null;

				// Get the teams from the database
				Structs.Team[] teams = CommonCode.GetTeams();
				DatasetTeams ds = new DatasetTeams();

				// Create the default row
				DatasetTeams.TeamsRow defaultrow =
					ds.Teams.NewTeamsRow();
				defaultrow.TeamsId = -1;
				defaultrow.TeamsName = NewTeamString;
				ds.Teams.AddTeamsRow(defaultrow);

				foreach(Structs.Team team in teams)
				{
					DatasetTeams.TeamsRow row =
						ds.Teams.NewTeamsRow();
					row.TeamsId = team.TeamId;
					string clubName = CommonCode.GetClub(team.ClubId).Name;
					row.TeamsName = clubName + " - " + team.Name;
					ds.Teams.AddTeamsRow(row);
				}
				DdTeamsView.Table = ds.Teams;
				DdTeamsView.Sort = "TeamsName";
				DdTeams.DisplayMember = "TeamsName";
				DdTeams.ValueMember = "TeamsId";
			}
			Trace.WriteLine("FCompetitors: populateTeamsDropDown() ended.");
		}