Пример #1
0
        public override DataSet Clone()
        {
            DSInternetExport cln = ((DSInternetExport)(base.Clone()));

            cln.InitVars();
            return(cln);
        }
Пример #2
0
        internal string ExportPatrolsByClub()
        {
            StringBuilder html = new StringBuilder();

            html.Append(createHtmlHeader());
            html.Append(createCompetitionHeader());
            DSInternetExport ds = getShootersForPatrolExportByClub();

            ds.Locale = new System.Globalization.CultureInfo("sv");

            string lastClubName = "";
            int    clubPayed    = 0;
            int    line         = 0;

            foreach (System.Data.DataRow rowTemp in ds.PatrolsByClub.Select("", "ClubName, ShooterName, PatrolId"))
            {
                DSInternetExport.PatrolsByClubRow row = (DSInternetExport.PatrolsByClubRow)rowTemp;
                if (lastClubName != row.ClubName)
                {
                    html.Append(createClubFooter(lastClubName, clubPayed));
                    html.Append(createClubHeader(row));
                    lastClubName = row.ClubName;
                    line         = 0;
                }
                line++;
                html.Append("<tr>");
                html.Append("<td></td>");
                html.Append("<td" + getCssClassLine(line) + ">" + row.ShooterName + "</td>");
                html.Append("<td" + getCssClassLine(line) + ">" + row.ShooterClass + "</td>");
                html.Append("<td" + getCssClassLine(line) + ">" + row.PatrolId.ToString() + "</td>");
                html.Append("<td" + getCssClassLine(line) + ">" + row.Lane.ToString() + "</td>");
                html.Append("<td" + getCssClassLine(line) + ">" + row.Start.ToShortTimeString() + "</td>");
                html.Append("<td" + getCssClassLine(line) + ">" + row.Weapon + "</td>");
                html.Append("<td" + getCssClassLine(line) + ">" + row.WeaponCaliber + "</td>");
                html.Append("</tr>");
            }
            html.Append(createHtmlFooter());

            return(html.ToString());
        }
		private string createClubHeader(DSInternetExport.PatrolsByClubRow row)
		{
			StringBuilder html = new StringBuilder();
			html.Append("<!--- club header --->\r\n<table>\r\n");
			html.Append("<tr>");
			html.Append("<th>" + row.ClubId + "</th>");
			html.Append("<th>" + row.ClubName + "</th>");
			html.Append("<th>Klass</th>");
			html.Append("<th>Patr</th>");
			html.Append("<th>Fig</th>");
			html.Append("<th>Starttid</th>");
			html.Append("<th>Vapenfabrikat</th>");
			html.Append("<th>Kaliber</th>");
			html.Append("</tr>\r\n");
			return html.ToString();
		}
		DSInternetExport getShootersForPatrolExportByClub()
		{
			DSInternetExport toReturn = new DSInternetExport();
			Hashtable shooters = new Hashtable();
			Hashtable clubs = new Hashtable();
			Hashtable weapons = new Hashtable();
			foreach(Structs.Competitor comp in 
				myInterface.GetCompetitors())
			{
				if (comp.PatrolId != -1 &
					comp.Lane != -1)
				{
					DSInternetExport.PatrolsByClubRow newRow =
						toReturn.PatrolsByClub.NewPatrolsByClubRow();

					newRow.PatrolId = comp.PatrolId;
					newRow.Lane = comp.Lane;

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

					newRow.ShooterName = shooter.Surname + " " + shooter.Givenname;
					newRow.Payed = shooter.Payed;

					Structs.Club club;
					if (clubs.Contains(shooter.ClubId))
						club = (Structs.Club)clubs[shooter.ClubId];
					else
					{
						club = myInterface.GetClub(shooter.ClubId);
						clubs.Add(shooter.ClubId, club);
					}

					newRow.ClubName = club.Name;
					newRow.ClubId = shooter.ClubId;

					Structs.Patrol patrol = myInterface.GetPatrol(comp.PatrolId);
					newRow.Start = patrol.StartDateTimeDisplay;

					Structs.Weapon weapon;
					if (weapons.Contains(comp.WeaponId))
						weapon = (Structs.Weapon)weapons[comp.WeaponId];
					else
					{
						weapon = myInterface.GetWeapon(comp.WeaponId);
						weapons.Add(comp.WeaponId, weapon);
					}
					newRow.Weapon = weapon.Manufacturer;
					newRow.WeaponCaliber = weapon.Caliber;

					Structs.ShootersClassShort shootershort = (Structs.ShootersClassShort)
						(int)comp.ShooterClass;
					newRow.ShooterClass = shootershort.ToString()
						.Replace("Klass", "")
						.Replace("Damklass", "D") +
						weapon.WClass.ToString()
						.Replace("1", "")
						.Replace("2", "")
						.Replace("3", "");

					toReturn.PatrolsByClub.AddPatrolsByClubRow(newRow);
				}
			}
			return toReturn;
		}
Пример #5
0
        DSInternetExport getShootersForPatrolExportByClub()
        {
            DSInternetExport toReturn = new DSInternetExport();
            Hashtable        shooters = new Hashtable();
            Hashtable        clubs    = new Hashtable();
            Hashtable        weapons  = new Hashtable();

            foreach (Structs.Competitor comp in
                     myInterface.GetCompetitors())
            {
                if (comp.PatrolId != -1 &
                    comp.Lane != -1)
                {
                    DSInternetExport.PatrolsByClubRow newRow =
                        toReturn.PatrolsByClub.NewPatrolsByClubRow();

                    newRow.PatrolId = comp.PatrolId;
                    newRow.Lane     = comp.Lane;

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

                    newRow.ShooterName = shooter.Surname + " " + shooter.Givenname;
                    newRow.Payed       = shooter.Payed;

                    Structs.Club club;
                    if (clubs.Contains(shooter.ClubId))
                    {
                        club = (Structs.Club)clubs[shooter.ClubId];
                    }
                    else
                    {
                        club = myInterface.GetClub(shooter.ClubId);
                        clubs.Add(shooter.ClubId, club);
                    }

                    newRow.ClubName = club.Name;
                    newRow.ClubId   = shooter.ClubId;

                    Structs.Patrol patrol = myInterface.GetPatrol(comp.PatrolId);
                    newRow.Start = patrol.StartDateTimeDisplay;

                    Structs.Weapon weapon;
                    if (weapons.Contains(comp.WeaponId))
                    {
                        weapon = (Structs.Weapon)weapons[comp.WeaponId];
                    }
                    else
                    {
                        weapon = myInterface.GetWeapon(comp.WeaponId);
                        weapons.Add(comp.WeaponId, weapon);
                    }
                    newRow.Weapon        = weapon.Manufacturer;
                    newRow.WeaponCaliber = weapon.Caliber;

                    Structs.ShootersClassShort shootershort = (Structs.ShootersClassShort)
                                                                  (int) comp.ShooterClass;
                    newRow.ShooterClass = shootershort.ToString()
                                          .Replace("Klass", "")
                                          .Replace("Damklass", "D") +
                                          weapon.WClass.ToString()
                                          .Replace("1", "")
                                          .Replace("2", "")
                                          .Replace("3", "");

                    toReturn.PatrolsByClub.AddPatrolsByClubRow(newRow);
                }
            }
            return(toReturn);
        }