Пример #1
0
		private void menuPrintLabelsResultPatrol_Print(string patrolidstring, 
			FPrintSelection printSelection)
		{
			Structs.Patrol patrol = CommonCode.GetPatrol(int.Parse(patrolidstring));
			CPrintResultLabels print = new CPrintResultLabels(
				ref CommonCode, 
				patrol, 
				(int)printSelection.numericUpDown1.Value);

			PrintDialog dlg = new PrintDialog();
			dlg.Document = print;
			dlg.Document.DefaultPageSettings.Landscape = false;
			DialogResult result = dlg.ShowDialog();

			if (result == DialogResult.OK)
			{
				print.Print();
			}
		}
Пример #2
0
		private void menuPrintPrelResultPatrol_Print(string patrolidstring, 
			FPrintSelection printSelection)
		{
			Structs.Patrol patrol = CommonCode.GetPatrol(int.Parse(patrolidstring));
			CPrintResultlistByPatrol print = new CPrintResultlistByPatrol(ref CommonCode, patrol);

			PrintDialog dlg = new PrintDialog() ;
			dlg.Document = print;
			dlg.Document.DefaultPageSettings.Landscape = true;
			DialogResult result = dlg.ShowDialog();

			if (result == DialogResult.OK) 
			{
				print.Color = dlg.PrinterSettings.SupportsColor;
				print.Print();
			}
		}
Пример #3
0
		private void menuPrintLabelsResultPatrol_Click(object sender, EventArgs e)
		{
			Trace.WriteLine("FMain: Entering menuPrintLabelsResultPatrol_Click()");

			FPrintSelection printSelection = new FPrintSelection();
			printSelection.chkPrintAll.Text = "";
			printSelection.chkPrintAll.Checked = false;
			printSelection.chkPrintAll.Visible = false;
			printSelection.lblSelection.Text = "Patrull";

			// Add rows to dropdown
			Structs.Patrol[] patrols =
				CommonCode.GetPatrols();

			foreach (Structs.Patrol patrol in patrols)
			{
				System.Data.DataRow row =
					printSelection.TablePrintSelection.NewRow();
				row["Id"] = patrol.PatrolId.ToString();
				row["Name"] = patrol.PatrolId.ToString() + " - " + patrol.StartDateTimeDisplay.ToShortTimeString();
				printSelection.TablePrintSelection.Rows.Add(row);
			}

			// make sure there is a call back
			printSelection.EnablePrint +=
				new FPrintSelection.EnablePrintHandler(menuPrintLabelsResultPatrol_Print);
			printSelection.EnableMain +=
				new FPrintSelection.EnableMainHandler(enableMain);
			printSelection.lblSelection.Visible = true;
			printSelection.chkPrintAll.Checked = false;
			printSelection.chkPrintAll.Visible = false;
			printSelection.numericUpDown1.Visible = true;
			printSelection.lblNumericUpDown1.Visible = true;
			printSelection.lblNumericUpDown1.Text = "Hoppa över etiketter";
			printSelection.Visible = true;
			printSelection.Focus();

			Trace.WriteLine("FMain.menuPrintPrelResultPatrol_Click ending");
		}
Пример #4
0
		private void menuPrintResultClub_Click(object sender, System.EventArgs e)
		{
			Trace.WriteLine("FMain: Entering menuPrintResultClub_Click()");

			FPrintSelection printSelection = new FPrintSelection();
			printSelection.chkPrintAll.Text = "Skriv ut samtliga patruller";
			printSelection.chkPrintAll.Checked = false;
			printSelection.lblSelection.Text = "Patrull";

			// Add rows to dropdown
			Structs.Club[] clubs = 
				CommonCode.GetClubs();

			foreach(Structs.Club club in clubs)
			{
				if (CommonCode.GetShooters(club).Length>0)
				{
					System.Data.DataRow row =
						printSelection.TablePrintSelection.NewRow();
					row["Id"] = club.ClubId;
					row["Name"] = club.Name;
					printSelection.TablePrintSelection.Rows.Add(row);
				}
			}

			// make sure there is a call back
			printSelection.EnablePrint += 
				new FPrintSelection.EnablePrintHandler(menuPrintResultClub_Print);
			printSelection.EnableMain += 
				new FPrintSelection.EnableMainHandler(enableMain);
			printSelection.lblSelection.Visible = false;
			printSelection.chkPrintAll.Checked = false;
			printSelection.chkPrintAll.Visible = false;
			printSelection.Visible = true;
			printSelection.Focus();

			Trace.WriteLine("FMain.menuPrintResultClub_Click ending");
		}
Пример #5
0
		private void menuPrintResultClub_Print(string clubId, FPrintSelection printSelection)
		{
			Trace.WriteLine("FMain: Entering menuPrintResultClub_Print()");

			try 
			{
				bool printed = false;
				for(int i=0;i<=Structs.WeaponClassMax;i++)
				{
					Structs.ResultWeaponsClass wclass = (Structs.ResultWeaponsClass)i;
					try
					{
						int.Parse(wclass.ToString());
					}
					catch(System.FormatException)
					{
						if (resultsExist(wclass, clubId))
						{
							printResults(wclass, false, clubId);
							printed = true;
						}
					}
				}
				if (printed == false)
					MessageBox.Show("Det finns inte några resultat inmatade.");
			} 
			catch(Exception exc)
			{
				MessageBox.Show("Fel uppstod vid utskrift:\n" + exc.ToString());
				Trace.WriteLine("FMain: " + exc.ToString());
			}
		}
Пример #6
0
		private void menuPrintPatrollistByShooter_Print(string ShooterId, FPrintSelection printSelection)
		{
			Trace.WriteLine("FMain: Entering menuPrintPatrollistByShooter_Print()");

			try 
			{
				CPrintPatrollistByUser pd = new CPrintPatrollistByUser(ref CommonCode);
				pd.ShooterIdToPrint = int.Parse(ShooterId);

				PrintDialog dlg = new PrintDialog() ;
				dlg.Document = pd;
				DialogResult result = dlg.ShowDialog();

				if (result == DialogResult.OK) 
				{
					pd.Print();
				}

			} 
			catch(Exception exc)
			{
				MessageBox.Show("Fel uppstod vid utskrift:\n" + exc.ToString());
				Trace.WriteLine("FMain: " + exc.ToString());
			}
		}
Пример #7
0
		private void menuPrintPatrollistByShooter_Click(object sender, System.EventArgs e)
		{
			Trace.WriteLine("FMain: Entering menuPrintPatrollistByShooter_Click()");

			FPrintSelection printSelection = new FPrintSelection();
			printSelection.chkPrintAll.Text = "Skriv ut samtliga skyttar";

			// Add rows to dropdown
			Structs.Shooter[] shooters =
				CommonCode.GetShooters();

			foreach(Structs.Shooter shooter in shooters)
			{
				System.Data.DataRow row =
					printSelection.TablePrintSelection.NewRow();
				row["Id"] = shooter.ShooterId;
				row["Name"] = shooter.Givenname + ", " + shooter.Surname;
				printSelection.TablePrintSelection.Rows.Add(row);
			}

			// make sure there is a call back
			printSelection.EnablePrint += 
				new FPrintSelection.EnablePrintHandler(menuPrintPatrollistByShooter_Print);
			printSelection.EnableMain += 
				new FPrintSelection.EnableMainHandler(enableMain);
			printSelection.Visible = true;
			printSelection.Focus();
		}
Пример #8
0
		private void menuPrintPatrollistByClub_Print(string ClubId, FPrintSelection printSelection)
		{
			Trace.WriteLine("FMain: Entering menuPrintPatrollistByClub_Print()");

			try 
			{
				CPrintPatrollistByClub pd = new CPrintPatrollistByClub(ref CommonCode);
				pd.ClubIdToPrint = ClubId;

				PrintDialog dlg = new PrintDialog() ;
				dlg.Document = pd;
				dlg.Document.DefaultPageSettings.Landscape = false;
				DialogResult result = dlg.ShowDialog();

				if (result == DialogResult.OK) 
				{
					pd.Print();
				}

			} 
			catch(Exception exc)
			{
				MessageBox.Show("Fel uppstod vid utskrift:\n" + exc.ToString());
				Trace.WriteLine("FMain: " + exc.ToString());
			}
		}
Пример #9
0
		private void menuPrintPatrollistByPatrol_Print(string PatrolId, FPrintSelection printSelection)
		{
			Trace.WriteLine("FMain: Entering menuPrintPatrollistByPatrol_Print()");

			try 
			{
				CPrintPatrollistByPatrol pd = new CPrintPatrollistByPatrol(ref CommonCode);
				pd.MaxLanes = CommonCode.GetCompetitions()[0].PatrolSize;
				pd.PatrolIdToPrint = int.Parse(PatrolId);

				PrintDialog dlg = new PrintDialog() ;
				dlg.Document = pd;
				DialogResult result = dlg.ShowDialog();

				if (result == DialogResult.OK) 
				{
					pd.Print();
				}

			} 
			catch(Exception exc)
			{
				MessageBox.Show("Fel uppstod vid utskrift:\n" + exc.ToString());
				Trace.WriteLine("FMain: " + exc.ToString());
			}
		}
Пример #10
0
		private void menuPrintPatrollistByPatrol_Click(object sender, System.EventArgs e)
		{
			Trace.WriteLine("FMain: Entering menuPrintPatrollistByPatrol_Click()");

			FPrintSelection printSelection = new FPrintSelection();
			printSelection.chkPrintAll.Checked = false;
			switch(CommonCode.GetCompetitions()[0].Type)
			{
				case Structs.CompetitionTypeEnum.Field:
					printSelection.chkPrintAll.Text = "Skriv ut samtliga patruller";
					printSelection.lblSelection.Text = "Patrull";
					break;
				case Structs.CompetitionTypeEnum.Precision:
					printSelection.chkPrintAll.Text = "Skriv ut samtliga lag";
					printSelection.lblSelection.Text = "Lag";
					break;
			}

			// Add rows to dropdown
			Structs.Patrol[] patrols = 
				CommonCode.GetPatrols();

			foreach(Structs.Patrol patrol in patrols)
			{
				System.Data.DataRow row =
					printSelection.TablePrintSelection.NewRow();
				row["Id"] = patrol.PatrolId;
				row["Name"] = patrol.PatrolId.ToString() + " - " + 
					patrol.StartDateTimeDisplay.ToShortTimeString() +
					" - " + patrol.PClass.ToString();
				printSelection.TablePrintSelection.Rows.Add(row);
			}

			// make sure there is a call back
			printSelection.EnablePrint += 
				new FPrintSelection.EnablePrintHandler(menuPrintPatrollistByPatrol_Print);
			printSelection.EnableMain += 
				new FPrintSelection.EnableMainHandler(enableMain);
			printSelection.Visible = true;
			printSelection.Focus();
		}