Beispiel #1
0
        internal void enableMe(int newpatrolid)
        {
            Trace.WriteLine("FPatrol: enableMe started on thread \"" +
                            Thread.CurrentThread.Name + "\" ( " +
                            Thread.CurrentThread.ManagedThreadId.ToString() + " )");

            switch (CommonCode.GetCompetitions()[0].Type)
            {
            case Structs.CompetitionTypeEnum.Precision:
                this.Text                      = "Skjutlag";
                lblPatrolnumber.Text           = "Skjutlagsnr";
                dataGridAssigned.CaptionText   = "Skyttar i laget";
                dataGridUnassigned.CaptionText = "Skyttar utan lag";
                break;

            case Structs.CompetitionTypeEnum.Field:
                this.Text                      = "Patrull";
                lblPatrolnumber.Text           = "Patrullnummer";
                dataGridAssigned.CaptionText   = "Skyttar i patrullen";
                dataGridUnassigned.CaptionText = "Skyttar utan patrull";
                break;
            }

            this.Visible = true;
            this.Focus();
            patrolid = newpatrolid;
            updatePatrol();

            Trace.WriteLine("FPatrol: enableMe ended.");
        }
        internal void UpdatedCompetition()
        {
            Trace.WriteLine("FResultsView.UpdatedCompetition: Started.");

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

            Structs.Competition comp = comps[0];
            switch (comp.Type)
            {
            case Structs.CompetitionTypeEnum.Precision:
            {
                dataGridPoints.Width      = 0;
                dataGridPoints.HeaderText = "";
                break;
            }

            case Structs.CompetitionTypeEnum.Field:
            {
                break;
            }

            case Structs.CompetitionTypeEnum.MagnumField:
            {
                break;
            }

            default:
                throw new ApplicationException("Cannot find CompetitionType " + comp.Type.ToString());
            }
            Trace.WriteLine("FResultsView.UpdatedCompetition: Ended.");
        }
        internal void enableMe()
        {
            this.Visible = true;
            this.Focus();
            comps = CommonCode.GetCompetitions();
            if (comps.GetUpperBound(0) > -1)
            {
                competition = comps[0];

                this.txtName.Text                    = competition.Name;
                this.numPatrolSize.Value             = competition.PatrolSize;
                this.numPatrolTimeBetween.Value      = competition.PatrolTimeBetween;
                this.numStartHour.Value              = competition.StartTime.Hour;
                this.numStartMinute.Value            = competition.StartTime.Minute;
                this.dateTimePicker1.Value           = competition.StartTime;
                this.chkFinal.Checked                = competition.DoFinalShooting;
                this.chkUsePriceMoney.Checked        = competition.UsePriceMoney;
                this.txtShooterFee1.Text             = competition.ShooterFee1.ToString();
                this.txtShooterFee2.Text             = competition.ShooterFee2.ToString();
                this.txtShooterFee3.Text             = competition.ShooterFee3.ToString();
                this.txtShooterFee4.Text             = competition.ShooterFee4.ToString();
                this.txtFirstPrice.Text              = competition.FirstPrice.ToString();
                this.numPriceMoneyReturn.Value       = competition.PriceMoneyPercentToReturn;
                DDChampionship.SelectedIndex         = (int)competition.Championship;
                DDPatrolConnectionType.SelectedIndex = (int)competition.PatrolConnectionType;
                chkOneClass.Checked                  = competition.OneClass;
            }
            else
            {
                DDChampionship.SelectedIndex         = (int)competition.Championship;
                DDPatrolConnectionType.SelectedIndex = 0;
            }
        }
        private void getCurrentResults()
        {
            Structs.ShootersClass temp =
                (Structs.ShootersClass) this.currentUClass;

            Structs.Competition comp = CommonCode.GetCompetitions()[0];

            results =
                CommonCode.ResultsGet(wclass, temp,
                                      comp,
                                      !printPrelResults);
        }
Beispiel #5
0
        internal void UpdatedCompetition()
        {
            Structs.Competition[] comp =
                CommonCode.GetCompetitions();
            if (comp.Length == 0)
            {
                return;
            }

            MaxCompetitorsInPatrol =
                comp[0].PatrolSize;
            UpdatedCompetitors();
        }
Beispiel #6
0
 private void btnAddStation_Click(object sender, System.EventArgs e)
 {
     Structs.Station station = new Structs.Station();
     station.CompetitionId = CommonCode.GetCompetitions()[0].CompetitionId;
     station.Figures       = 3;
     station.Points        = false;
     station.Shoots        = 6;
     station.StationNr     = CommonCode.GetStationsCount() + 1;
     CommonCode.NewStation(station, false);
 }
Beispiel #7
0
        private void saveCurrentStation()
        {
            Trace.WriteLine("FStations: saveCurrentStation on thread \"" +
                            Thread.CurrentThread.Name + "\" ( " +
                            AppDomain.GetCurrentThreadId().ToString() + " )");

            if (CommonCode.GetCompetitions().Length == 0)
            {
                return;
            }

            foreach (Structs.Station station in stationList)
            {
                if (station.StationNr == int.Parse(this.lblStationNr.Text))
                {
                    // Found station, so change it by creating a new and
                    // updating with that
                    Structs.Station updStation = station;

                    updStation.CompetitionId = station.CompetitionId;
                    updStation.Figures       = (int)this.numNumberOfFigures.Value;
                    updStation.Shoots        = (int)this.numNumberOfShoots.Value;
                    updStation.Points        = this.chkPoints.Checked;
                    updStation.StationId     = station.StationId;
                    updStation.StationNr     = station.StationNr;

                    CommonCode.UpdateStation(updStation);
                    Trace.WriteLine("FStations: saveCurrentStation ended.");
                    return;
                }
            }
            Structs.Station newStation = new Structs.Station();
            newStation.StationId     = int.Parse(this.lblStationNr.Text);
            newStation.CompetitionId = CommonCode.GetCompetitions()[0].CompetitionId;
            newStation.Figures       = (int)this.numNumberOfFigures.Value;
            newStation.Points        = this.chkPoints.Checked;
            newStation.Shoots        = (int)this.numNumberOfShoots.Value;
            newStation.StationNr     = int.Parse(this.lblStationNr.Text);
            CommonCode.NewStation(newStation);

            Trace.WriteLine("FStations: saveCurrentStation ended.");
        }
        internal CPrintResultlistByPatrol(ref Common.Interface newCommon,
                                          Structs.Patrol patrolToPrint) : base()
        {
            CommonCode = newCommon;
            patrol     = patrolToPrint;

            Structs.Competition competition = CommonCode.GetCompetitions()[0];
            CompetitionType =
                competition.Type;
            this.NorwegianCount = competition.NorwegianCount;
        }
		internal CPrintResultlistByPatrol(ref Common.Interface newCommon, 
			Structs.Patrol patrolToPrint) : base ()  
		{
			CommonCode = newCommon;
			patrol = patrolToPrint;

			Structs.Competition competition = CommonCode.GetCompetitions()[0];
			CompetitionType =
				competition.Type;
			this.NorwegianCount = competition.NorwegianCount;
		}
        internal void enableMe()
        {
            Visible = true;
            Focus();
            comps = CommonCode.GetCompetitions();
            if (comps.GetUpperBound(0) > -1)
            {
                competition = comps[0];

                txtName.Text = competition.Name;
                chkNorwegianCount.Checked  = competition.NorwegianCount;
                numPatrolSize.Value        = competition.PatrolSize;
                numPatrolTime.Value        = competition.PatrolTime;
                numPatrolTimeBetween.Value = competition.PatrolTimeBetween;
                numPatrolRest.Value        = competition.PatrolTimeRest;
                numStartHour.Value         = competition.StartTime.Hour;
                numStartMinute.Value       = competition.StartTime.Minute;
                dateTimePicker1.Value      = competition.StartTime;
                chkFinal.Checked           = competition.DoFinalShooting;
                chkUsePriceMoney.Checked   = competition.UsePriceMoney;
                txtShooterFee1.Text        = competition.ShooterFee1.ToString();
                txtShooterFee2.Text        = competition.ShooterFee2.ToString();
                txtShooterFee3.Text        = competition.ShooterFee3.ToString();
                txtShooterFee4.Text        = competition.ShooterFee4.ToString();
                txtFirstPrice.Text         = competition.FirstPrice.ToString();
                numPriceMoneyReturn.Value  = competition.PriceMoneyPercentToReturn;
                if (competition.Type == Structs.CompetitionTypeEnum.MagnumField)
                {
                    lblCompetitionType.Text   = "Magnumfälttävlan";
                    chkNorwegianCount.Visible = false;
                }
                DDChampionship.SelectedIndex         = (int)competition.Championship;
                DDPatrolConnectionType.SelectedIndex = (int)competition.PatrolConnectionType;
                chkOneClass.Checked = competition.OneClass;
            }
            else
            {
                DDChampionship.SelectedIndex         = 0;
                DDPatrolConnectionType.SelectedIndex = 0;
            }
        }
        //Override OnBeginPrint to set up the font we are going to use
        protected override void OnBeginPrint(PrintEventArgs ev)
        {
            base.OnBeginPrint(ev);

            _competitors = _commonCode.GetCompetitors();
            _nrofseries  = _commonCode.GetStationsCount();
            _competition = _commonCode.GetCompetitions()[0];

            _labelDocument = _commonCode.Settings.PrinterSettings.LabelMirrorPrintDocument;
            _printFont     = new Font(_labelDocument.FontName, _labelDocument.FontSize,
                                      FontStyle.Regular);
        }
Beispiel #12
0
        internal void enableMe()
        {
            this.Visible = true;
            this.Focus();
            comps = CommonCode.GetCompetitions();
            if (comps.GetUpperBound(0) > -1)
            {
                competition = comps[0];

                this.txtName.Text = competition.Name;
                this.chkNorwegianCount.Checked  = competition.NorwegianCount;
                this.numPatrolSize.Value        = competition.PatrolSize;
                this.numPatrolTime.Value        = competition.PatrolTime;
                this.numPatrolTimeBetween.Value = competition.PatrolTimeBetween;
                this.numPatrolRest.Value        = competition.PatrolTimeRest;
                this.numStartHour.Value         = competition.StartTime.Hour;
                this.numStartMinute.Value       = competition.StartTime.Minute;
                this.dateTimePicker1.Value      = competition.StartTime;
                this.chkFinal.Checked           = competition.DoFinalShooting;
                this.chkUsePriceMoney.Checked   = competition.UsePriceMoney;
                this.txtShooterFee.Text         = competition.ShooterFee.ToString();
                this.txtFirstPrice.Text         = competition.FirstPrice.ToString();
                this.numPriceMoneyReturn.Value  = competition.PriceMoneyPercentToReturn;
            }
            else
            {
                /*competition = new Common.Interface.Competition();
                 * competition.Name = this.txtName.Text;
                 * competition.NorwegianCount = this.chkNorwegianCount.Checked;
                 * competition.PatrolSize = (int)this.numPatrolSize.Value;
                 * competition.PatrolTime = (int)this.numPatrolTime.Value;
                 * competition.PatrolTimeBetween = (int)this.numPatrolTimeBetween.Value;
                 * competition.PatrolTimeRest = (int)this.numPatrolRest.Value;
                 * competition.StartTime = this.dateTimePicker1.Value.Date;
                 * competition.StartTime =
                 *      competition.StartTime.AddHours((double)this.numStartHour.Value)
                 *      .AddMinutes((double)this.numStartMinute.Value);
                 * CommonCode.NewCompetition(competition);*/
            }
        }
        internal CPrintResultlist(ref Common.Interface newCommon,
                                  Structs.ResultWeaponsClass wclasswanted,
                                  Structs.ShootersClass uclasswanted,
                                  bool prelResults,
                                  string clubIdwanted) : base()
        {
            CommonCode       = newCommon;
            wclass           = wclasswanted;
            uclass           = uclasswanted;
            printPrelResults = prelResults;
            clubId           = clubIdwanted;

            competition     = CommonCode.GetCompetitions()[0];
            CompetitionType = competition.Type;
        }
Beispiel #14
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.");
        }
Beispiel #15
0
        private void saveCurrent()
        {
            int nrOfStations         = (int)numNrOfSeries.Value;
            int nrOfShootsPerStation = (int)numNrOfShootPerSeries.Value;

            int shoots  = 0;
            int figures = 0;

            switch (chkUseOnlyOneBoxForResult.Checked)
            {
            case true:
                figures = 1;
                shoots  = 10 * nrOfShootsPerStation;
                break;

            case false:
                figures = nrOfShootsPerStation;
                shoots  = 10 * nrOfShootsPerStation;
                break;
            }
            for (int i = 1; i <= CommonCode.GetStationsCount(); i++)
            {
                Structs.Station station = CommonCode.GetStation(i, false);
                station.Figures = figures;
                station.Shoots  = shoots;
                CommonCode.UpdateStation(station);
            }

            while (CommonCode.GetStationsCount() < nrOfStations)
            {
                Structs.Station station = new Structs.Station();
                station.CompetitionId = CommonCode.GetCompetitions()[0].CompetitionId;
                station.Figures       = figures;
                station.Points        = false;
                station.Shoots        = shoots;
                station.StationNr     = CommonCode.GetStationsCount() + 1;
                CommonCode.NewStation(station, false);
            }
            while (CommonCode.GetStationsCount() > nrOfStations)
            {
                Structs.Station station = CommonCode.GetStation(CommonCode.GetStationsCount(), false);
                CommonCode.DelStation(station);
            }

            Structs.Competition competition = CommonCode.GetCompetitions()[0];
            int timeAvailable = competition.PatrolTimeBetween;
            int timeNeeded    = calculateTimeRequirements();

            if (timeNeeded > timeAvailable)
            {
                DialogResult res = MessageBox.Show("Du har avsatt " + timeAvailable.ToString() +
                                                   " minuter för varje skjutlag.\r\n\r\n" +
                                                   "Beräknad tid för varje skjutlag med hänsyn taget till " +
                                                   "skjuttid (6 minuter per serie) och markeringstid " +
                                                   "(6 minuter per serie) är " +
                                                   timeNeeded.ToString() + " minuter.\r\n\r\n" +
                                                   "Vill du öka upp avsatt tid?",
                                                   "Kontrollberäkning",
                                                   MessageBoxButtons.YesNo,
                                                   MessageBoxIcon.Warning);
                if (res == DialogResult.Yes)
                {
                    competition.PatrolTimeBetween = timeNeeded;
                    CommonCode.UpdateCompetition(competition);
                    DateTime         patrolStart = competition.StartTime;
                    Structs.Patrol[] patrols     = CommonCode.GetPatrols();
                    for (int i = 0; i < patrols.Length; i++)
                    {
                        Structs.Patrol patrol = patrols[i];

                        //Trace.WriteLine(patrol.StartDateTimeDisplay.ToShortTimeString());
                        patrol.StartDateTime        = patrolStart;
                        patrol.StartDateTimeDisplay = patrolStart;
                        CommonCode.UpdatePatrol(patrol);

                        patrolStart = patrolStart.AddMinutes(timeNeeded);
                    }
                }
            }
        }
		internal CPrintPatrollistByPatrol(ref Common.Interface newCommon) : base ()  
		{
			CommonCode = newCommon;
			currentPatrol = CommonCode.GetPatrols()[0].PatrolId;
			competition = CommonCode.GetCompetitions()[0];
		}
 internal CPrintPatrollistByPatrol(ref Common.Interface newCommon) : base()
 {
     CommonCode    = newCommon;
     currentPatrol = CommonCode.GetPatrols()[0].PatrolId;
     competition   = CommonCode.GetCompetitions()[0];
 }
        private void printHeader(PrintPageEventArgs ev,
                                 Structs.Patrol patrol, ref float yPos)
        {
            //leftMargin = ev.MarginBounds.Left;
            int tab = 100;

            // Print RegistrationsInfo
            ev.Graphics.DrawString(
                "WinShooter",
                printAllbergFont, Brushes.Black,
                leftMargin, ev.PageBounds.Size.Height - 2 * printHeaderFont.GetHeight() - 20, new StringFormat());

            /*ev.Graphics.DrawString("©John Allberg",
             *      printAllbergFont, Brushes.Black, ev.PageBounds.Right-180,
             *      ev.PageBounds.Size.Height -2*printHeaderFont.GetHeight()-20,
             *      new StringFormat());*/

            // Print logo
            System.Drawing.Image image = getLogo();

            ev.Graphics.DrawImage(
                image,
                ev.MarginBounds.Right - image.Width,
                20,
                image.Width,
                image.Height);

            // Print patrol header
            ev.Graphics.DrawString("Tävling: ",
                                   printHeaderFont, Brushes.Black, leftMargin, yPos,
                                   new StringFormat());
            ev.Graphics.DrawString(CommonCode.GetCompetitions()[0].Name,
                                   printHeaderFont, Brushes.Black, leftMargin + tab, yPos,
                                   new StringFormat());
            yPos += printHeaderFont.GetHeight();

            string patrolHeader = "Patrull: ";

            switch (CommonCode.CompetitionCurrent.Type)
            {
            case Structs.CompetitionTypeEnum.Field:
                patrolHeader = "Patrull: ";
                break;

            case Structs.CompetitionTypeEnum.MagnumField:
                patrolHeader = "Patrull";
                break;

            case Structs.CompetitionTypeEnum.Precision:
                patrolHeader = "Lag: ";
                break;

            default:
                throw new ApplicationException("Unkown CompetitionType");
            }
            ev.Graphics.DrawString(patrolHeader,
                                   printHeaderFont, Brushes.Black, leftMargin, yPos,
                                   new StringFormat());
            ev.Graphics.DrawString(patrol.PatrolId.ToString(),
                                   printHeaderFont, Brushes.Black, leftMargin + tab, yPos,
                                   new StringFormat());
            yPos += printHeaderFont.GetHeight();

            ev.Graphics.DrawString("Starttid: ",
                                   printHeaderFont, Brushes.Black, leftMargin, yPos,
                                   new StringFormat());
            ev.Graphics.DrawString(patrol.StartDateTimeDisplay.ToShortTimeString(),
                                   printHeaderFont, Brushes.Black, leftMargin + tab, yPos,
                                   new StringFormat());
            yPos += printHeaderFont.GetHeight();
        }
		internal CPrintResultlist(ref Common.Interface newCommon, 
			Structs.ResultWeaponsClass wclasswanted,
			Structs.ShootersClass uclasswanted,
			bool prelResults,
			string clubIdwanted) : base ()  
		{
			CommonCode = newCommon;
			wclass = wclasswanted;
			uclass = uclasswanted;
			printPrelResults = prelResults;
			clubId = clubIdwanted;

			competition = CommonCode.GetCompetitions()[0];
			CompetitionType = competition.Type;
		}
Beispiel #20
0
        private void printHeader(PrintPageEventArgs ev,
                                 Structs.Shooter shooter, ref float yPos)
        {
            int tab = 125;

            // Print RegistrationsInfo
            ev.Graphics.DrawString(
                "WinShooter",
                printAllbergFont, Brushes.Black,
                LeftMargin, ev.PageBounds.Size.Height - 2 * printHeaderFont.GetHeight() - 20, new StringFormat());

            /*ev.Graphics.DrawString("©John Allberg",
             *      printHeaderFont, Brushes.Black, ev.PageBounds.Right-180,
             *      ev.PageBounds.Size.Height -2*printHeaderFont.GetHeight()-20,
             *      new StringFormat());*/

            // Print logo
            System.Drawing.Image image = getLogo();

            ev.Graphics.DrawImage(
                image,
                ev.MarginBounds.Right - image.Width / 4,
                20,
                image.Width / 4,
                image.Height / 4);

            // Print patrol header
            ev.Graphics.DrawString("Tävling: ",
                                   printHeaderFont, Brushes.Black, LeftMargin, yPos,
                                   new StringFormat());
            ev.Graphics.DrawString(CommonCode.GetCompetitions()[0].Name,
                                   printHeaderFont, Brushes.Black, LeftMargin + tab, yPos,
                                   new StringFormat());
            yPos += printHeaderFont.GetHeight();

            ev.Graphics.DrawString("Namn: ",
                                   printHeaderFont, Brushes.Black, LeftMargin, yPos,
                                   new StringFormat());
            ev.Graphics.DrawString(shooter.Surname + " " + shooter.Givenname,
                                   printHeaderFont, Brushes.Black, LeftMargin + tab, yPos,
                                   new StringFormat());
            yPos += printHeaderFont.GetHeight();

            ev.Graphics.DrawString("Skyttekort: ",
                                   printHeaderFont, Brushes.Black, LeftMargin, yPos,
                                   new StringFormat());
            ev.Graphics.DrawString(shooter.CardNr,
                                   printHeaderFont, Brushes.Black, LeftMargin + tab, yPos,
                                   new StringFormat());
            yPos += printHeaderFont.GetHeight();

            ev.Graphics.DrawString("Skytteklubb: ",
                                   printHeaderFont, Brushes.Black, LeftMargin, yPos,
                                   new StringFormat());
            Structs.Club club = CommonCode.GetClub(shooter.ClubId);
            ev.Graphics.DrawString(club.Name,
                                   printHeaderFont, Brushes.Black, LeftMargin + tab, yPos,
                                   new StringFormat());
            yPos += printHeaderFont.GetHeight();
            yPos += printHeaderFont.GetHeight();
            yPos += printHeaderFont.GetHeight();

            ev.Graphics.DrawString("Starttid",
                                   printHeaderFont, Brushes.Black, LeftMargin + tab1, yPos,
                                   new StringFormat());
            ev.Graphics.DrawString("Patrull",
                                   printHeaderFont, Brushes.Black, LeftMargin + tab2, yPos,
                                   new StringFormat());
            ev.Graphics.DrawString("Vapen",
                                   printHeaderFont, Brushes.Black, LeftMargin + tab3, yPos,
                                   new StringFormat());
            yPos += printHeaderFont.GetHeight();
        }