internal void PatrolAddEmpty(bool notifyGui) { database = myInterface.databaseClass.Database; DateTime compStart = myInterface.GetCompetitions()[0].StartTime; int timeBetweenPatrols = database.Competition[0].PatrolTimeBetween; int lastStart = 0 - timeBetweenPatrols; int patrolId = 0; foreach(DatabaseDataset.PatrolsRow row in database.Patrols) { if (row.StartDateTime > lastStart) { lastStart = row.StartDateTime; } if (row.PatrolId > patrolId) patrolId = row.PatrolId; } Structs.Patrol patrol = new Structs.Patrol(); patrol.PatrolId = patrolId + 1; patrol.StartDateTime = compStart.AddMinutes((int)(lastStart + timeBetweenPatrols)); patrol.CompetitionId = database.Competition[0].CompetitionId; myInterface.NewPatrol(patrol, notifyGui); }
internal CPrintResultLabels(ref Common.Interface newCommon, Structs.Patrol PatrolToPrint, int AlreadyPrintedLabels) : base() { CommonCode = newCommon; Patrol = PatrolToPrint; labelCount = AlreadyPrintedLabels; }
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; }
private void updatePatrolWithThread() { Trace.WriteLine("FPatrol: updatePatrolWithThread started on thread \"" + Thread.CurrentThread.Name + "\" ( " + Thread.CurrentThread.ManagedThreadId.ToString() + " )"); Trace.WriteLine("FPatrol: updatePatrolWithThread locking " + "\"bindingLock\" on thread \"" + Thread.CurrentThread.Name + "\" ( " + Thread.CurrentThread.ManagedThreadId.ToString() + " )"); lock(bindingLock) { try { Updating = true; Trace.WriteLine("FPatrol: updatePatrolWithThread locked " + "\"bindingLock\" on thread \"" + Thread.CurrentThread.Name + "\" ( " + Thread.CurrentThread.ManagedThreadId.ToString() + " )"); try { Patrol = CommonCode.GetPatrol(patrolid); } catch (Common.CannotFindIdException) { if (InvokeRequired) Invoke(SetVisibillity, new object[] { false }); else Visible = false; return; } catch (ApplicationException) { if (InvokeRequired) Invoke(SetVisibillity, new object[] { false }); else Visible = false; return; } if (this.InvokeRequired) { this.Invoke(BindPatrolNumberAndClass); } else { this.bindPatrolNumberAndClass(); } createDatasetPatrol(); populatePatrol(Patrol); populateUnassigned(Patrol.PClass); if (this.InvokeRequired) this.Invoke(BindDatagrid); else this.bindDatagrid(); Trace.WriteLine("FPatrol: updatePatrolWithThread unlocking " + "\"bindingLock\" on thread \"" + Thread.CurrentThread.Name + "\" ( " + Thread.CurrentThread.ManagedThreadId.ToString() + " )"); } finally { Updating = false; } } Trace.WriteLine("FPatrol: updatePatrolWithThread ended."); }
internal Structs.Patrol getPatrol(int id) { Trace.WriteLine("CDatabase: Entering getPatrol(" + id.ToString() + ")"); Structs.Patrol patrol = new Structs.Patrol(); if (getCompetitions().Length == 0) throw new CannotFindIdException("Cannot find patrol with Id " + id.ToString()); DateTime compStart = getCompetitions()[0].StartTime; foreach(DatabaseDataset.PatrolsRow row in Database.Patrols.Select("PatrolId=" + id.ToString())) { if (row.PatrolId == id) { patrol.CompetitionId = row.CompetitionId; patrol.PatrolId = row.PatrolId; patrol.StartDateTime = compStart.AddMinutes(row.StartDateTime); if (row.StartDateTimeDisplay < -1054800000) patrol.StartDateTimeDisplay = compStart.AddMinutes(row.StartDateTime); else patrol.StartDateTimeDisplay = compStart.AddMinutes(row.StartDateTimeDisplay); patrol.PClass = (Structs.PatrolClass)row.PClass; patrol.LockedForAutomatic = row.Automatic; return patrol; } } throw new CannotFindIdException("Cannot find patrol with Id " + id.ToString()); }
internal Structs.Patrol[] getPatrols( Structs.PatrolClass patrolClass, bool alsoIncludeUnknownClass, bool OnlyIncludePatrolsWithSpace, int PatrolIdToAlwaysView) { Trace.WriteLine("CDatabase: Entering getPatrols(PatrolClass=" + patrolClass.ToString() + ", alsoIncludeUnknownClass=" + alsoIncludeUnknownClass.ToString() + ")"); string select = "PClass=" + ((int)patrolClass).ToString(); if (alsoIncludeUnknownClass) select += " or PClass=" + ((int)Structs.PatrolClass.Okänd).ToString(); ArrayList patrols = new ArrayList(); Structs.Patrol patrol = new Structs.Patrol(); Structs.Competition competition = getCompetitions()[0]; DateTime compStart = competition.StartTime; foreach(DatabaseDataset.PatrolsRow row in Database.Patrols.Select( select, "PatrolId")) { patrol = new Structs.Patrol(); patrol.CompetitionId = row.CompetitionId; patrol.PatrolId = row.PatrolId; patrol.StartDateTime = compStart.AddMinutes(row.StartDateTime); patrol.PClass = (Structs.PatrolClass)row.PClass; if (row.StartDateTimeDisplay > -1054800000) patrol.StartDateTimeDisplay = compStart.AddMinutes(row.StartDateTimeDisplay); else patrol.StartDateTimeDisplay = patrol.StartDateTime; patrol.LockedForAutomatic = row.Automatic; if (!OnlyIncludePatrolsWithSpace | Database.Competitors.Select("PatrolId=" + patrol.PatrolId.ToString()).Length<competition.PatrolSize | patrol.PatrolId == PatrolIdToAlwaysView) { patrols.Add(patrol); } } return (Structs.Patrol[])patrols.ToArray(patrol.GetType()); }
internal Structs.Patrol[] getPatrols() { Trace.WriteLine("CDatabase: Entering getPatrols()"); ArrayList patrols = new ArrayList(); Structs.Patrol patrol = new Structs.Patrol(); DateTime compStart = getCompetitions()[0].StartTime; foreach(DatabaseDataset.PatrolsRow row in Database.Patrols.Select("", "PatrolId")) { patrol = new Structs.Patrol(); patrol.CompetitionId = row.CompetitionId; patrol.PatrolId = row.PatrolId; patrol.StartDateTime = compStart.AddMinutes(row.StartDateTime); patrol.PClass = (Structs.PatrolClass)row.PClass; if (row.StartDateTimeDisplay > -1054800000) patrol.StartDateTimeDisplay = compStart.AddMinutes(row.StartDateTimeDisplay); else patrol.StartDateTimeDisplay = patrol.StartDateTime; patrol.LockedForAutomatic = row.Automatic; patrols.Add(patrol); } return (Structs.Patrol[])patrols.ToArray(patrol.GetType()); }