public void AddAccounts(JwList<VmAccount> v, String fileName) { JwList<JwCsvRow> rows = JwUtility.ReadCsvFile(fileName); foreach(JwCsvRow row in rows) { VmAccount ac = new VmAccount(row.Fields); v.Add(ac); } }
public JwList<VmNest> GetAllNests() { JwList<VmNest> v = VmNestManager.Default.GetAllNests(); JwList<VmNest> nests = new JwList<VmNest>(); foreach( VmNest nest in v ) { nests.Add( VmNestManager.Default.GetNest(nest.Id)); } return nests; }
public JwList<VmItemManifest> GetAllItems() { JwList<VmItemManifest> v = new JwList<VmItemManifest>(); int nestId = Engine.Nest.Id; JwList<VmNestedItem> nestedItems = VmAirportData.Default.AirportOutputData.GetNestedItemFile(nestId).GetAll(); foreach( VmNestedItem nestedItem in nestedItems) { VmItemManifest item = VmItemManager.Default.GetItem(nestedItem.ItemId); v.Add(item); } return v; }
//# __________ PROTOCOL :: CONSTRUCTOR __________ #// public static JwList<VmScheduledFlight> Read() { JwList<VmScheduledFlight> v = new JwList<VmScheduledFlight>(); String pathName = JwUtility.JoinPath( VmAirportData.Default.GetInputPath(), "scheduledFlight.txt"); JwList<JwCsvRow> rows = JwUtility.ReadCsvFile(pathName); foreach( JwCsvRow row in rows) { VmScheduledFlight sf = Convert(row.Fields); v.Add(sf); } return v; }
public void AddUpload( JwList<VmScheduledUpload> v, String name, String fullName, String fileTypeCode, String airportCode) { VmScheduledUpload o = new VmScheduledUpload(); o.Name = name; o.FullName = fullName; o.FileType = fileTypeCode; o.AirportCode = airportCode; FileInfo fi = new FileInfo(fullName); o.SizeInBytes = ( fi.Exists ) ? fi.Length : 0; v.Add(o); }
//# __________ PROTOCOL :: PUBLIC (OTHER) __________ #// public JwList<VmPlannedRouteConfiguration> GetPlannedRouteConfigurations(JwDate plannedRouteDate) { JwList<VmPlannedRouteConfiguration> v = new JwList<VmPlannedRouteConfiguration>(); foreach(VmPlannedRouteConfiguration config in GetPlannedRouteConfigurations() ) { if( config.IncludesDate(plannedRouteDate) ) v.Add(config); } return v; }
public JwList<VmNest> GetAllNests() { JwList<VmNest> nests = new JwList<VmNest>(); JwList<VmNestManifest> v = VmAirportData.Default.AirportOutputData.NestManifestFile.GetAll(); foreach( VmNestManifest nestManifest in v ) { VmNest nest = GetNest(nestManifest.NestId); if( nest == null) continue; nests.Add(nest); } return nests; }
public static JwList<String> ReadLines(String fileName) { JwList<String> v = new JwList<String>(); if( ! File.Exists(fileName) ) { return v; } FileStream fs = null; StreamReader reader = null; try { fs = new FileStream( fileName, FileMode.Open, FileAccess.Read); reader = new StreamReader(fs); while(true) { String s = reader.ReadLine(); if(s==null) break; v.Add(s); } } finally { if( reader != null ) reader.Close(); if( fs != null ) fs.Close(); } return v; }
public static JwList<String> Tokenize(String s, char[] delimiters) { JwList<String> v = new JwList<String>(); if ( s == null ) return v; char[] arr = s.ToCharArray(); int n = arr.Length; int i = -1; StringBuilder sb = new StringBuilder(n); while ( true ) { i++; if ( i == n ) break; char c = arr[i]; bool isDelimiter = false; foreach( char delimiter in delimiters) { if( c == delimiter) { isDelimiter = true; break; } } if ( isDelimiter ) { v.Add(sb.ToString()); sb.Length = 0; } else { sb.Append(c); } } v.Add(sb.ToString()); return v; }
public static JwList<String> BreakIntoSeperateLines(String value, int charactersPerLine, char delimeter) { JwList<String> lines = new JwList<String>(); StringBuilder currentLine = new StringBuilder(); JwList<String> tokens = Tokenize(value, delimeter); foreach(String token in tokens) { int nextLineLength = currentLine.Length + token.Length + 1; if( nextLineLength > charactersPerLine ) { if( currentLine.Length > 0 ) { lines.Add(currentLine.ToString()); currentLine.Length = 0; } } if( currentLine.Length != 0 ) currentLine.Append(" "); currentLine.Append(token); } if( currentLine.Length != 0 ) lines.Add(currentLine.ToString()); return lines; }
public JwList<VmScheduledUpload> GetChunkedScheduledUploads() { JwList<VmScheduledUpload> uploads = new JwList<VmScheduledUpload>(); JwList<JwCsvRow> rows = JwUtility.ReadCsvFile(GetChunkedSessionManifestFileName()); foreach( JwCsvRow row in rows) { VmScheduledUpload upload = new VmScheduledUpload(); upload.Name = row.Fields[0]; upload.FileType = row.Fields[1]; upload.SizeInBytes = JwUtility.ParseInteger(row.Fields[2]); upload.AirportCode = row.Fields[3]; uploads.Add(upload); } return uploads; }
public JwList<byte[]> GetAllRecords() { JwList<byte[]> v = new JwList<byte[]>(); for( int i = 0; i < GetRecordCount(); i++) { byte[] ba = ReadRecordAt(i); v.Add(ba); } return v; }
public void PopulateFlightCB() { _flightNumberCB.Items.Clear(); String destinationCode = (String)_destinationAirportSearchableComboBox.GetSelectedValue(); if( destinationCode == null ) return; JwList<VmScheduledFlight> data = new JwList<VmScheduledFlight>(); foreach(VmScheduledFlight sf in _scheduledFlights) { if( sf.MatchesDestinationAirportCode(destinationCode) ) { data.Add(sf); } } data.Sort(delegate(VmScheduledFlight sf1, VmScheduledFlight sf2) { return sf1.DepartureTime.CompareTo(sf2.DepartureTime); }); _flightNumberCB.AddRange(data); HandleFlightCBSelection(); }
//# __________ PROTOCOL :: STATIC __________ #// public JwInputControlModel.ValidateDelegateType GetValidateComboBoxRequiredDelegate( String modelName, String fieldName) { return delegate(Object o) { JwList<JwValidationError> v = new JwList<JwValidationError>(); if( o == null ) { JwValidationError err = new JwRequiredValidationError(modelName, fieldName); v.Add(err); } return v; }; }
public void AddIfBeingUsed(JwList<VmEventManagerIF> v, VmEventManagerIF eventManager) { if( eventManager == null ) return; if( !eventManager.HasMoreEvents() ) return; v.Add(eventManager); }
public JwList<String> GetAirportCodesForUser(String userName) { userName = userName.ToLower(); JwList<String> userAirportCodes = new JwList<String>(); JwList<String> airports = VmAccountData.Default.GetDeviceAirports(); foreach( String airportCode in airports ) { VmAirportData ad = new VmAirportData(VmAccountData.Default.AccountInputData,airportCode); VmUser user = ad.GetUser(userName); if( user != null ) userAirportCodes.Add(airportCode); } return userAirportCodes; }