/// <summary> /// This method deSerializes the record from a byte array. /// </summary> /// <param name="data"> The byte array containing the escher record information</param> /// <param name="offset">The starting offset into data </param> /// <param name="recordFactory">May be null since this is not a container record.</param> /// <returns>The number of bytes Read from the byte array.</returns> public override int FillFields(byte[] data, int offset, EscherRecordFactory recordFactory) { int bytesRemaining = ReadHeader(data, offset); if (IsContainerRecord) { int bytesWritten = 0; thedata = new byte[0]; offset += 8; bytesWritten += 8; while (bytesRemaining > 0) { EscherRecord child = recordFactory.CreateRecord(data, offset); int childBytesWritten = child.FillFields(data, offset, recordFactory); bytesWritten += childBytesWritten; offset += childBytesWritten; bytesRemaining -= childBytesWritten; ChildRecords.Add(child); } return(bytesWritten); } else { thedata = new byte[bytesRemaining]; Array.Copy(data, offset + 8, thedata, 0, bytesRemaining); return(bytesRemaining + 8); } }
private void AscendingClicked(string obj) { List <ChildRecord> reorderedList = new List <ChildRecord>(); if (obj.Equals("NameAscending")) { var list = ChildRecords.OrderBy(a => a.LastName); reorderedList = new List <ChildRecord>(list); } else if (obj.Equals("DOBAscending")) { var list = ChildRecords.OrderBy(a => a.DOBDateField); reorderedList = new List <ChildRecord>(list); } else if (obj.Equals("LocationAscending")) { var list = ChildRecords.OrderBy(a => a.Location); reorderedList = new List <ChildRecord>(list); } else if (obj.Equals("EnrollmentAscending")) { var list = ChildRecords.OrderBy(a => a.EnrollmentDateField); reorderedList = new List <ChildRecord>(list); } else if (obj.Equals("ChildAscendingDecending")) { bool isAscending = (ChildRecords.SequenceEqual(ChildRecords.OrderBy(a => a.ChildID))) ? true : false; reorderedList = isAscending ? new List <ChildRecord>(ChildRecords.OrderByDescending(a => a.ChildID)) : new List <ChildRecord>(ChildRecords.OrderBy(a => a.ChildID)); } ChildRecords.Clear(); ChildRecords = reorderedList; }
private void DecendingClicked(string obj) { List <ChildRecord> reorderedList = new List <ChildRecord>(); if (obj.Equals("NameDecending")) { var list = ChildRecords.OrderByDescending(a => a.LastName); reorderedList = new List <ChildRecord>(list); } else if (obj.Equals("DOBDecending")) { var list = ChildRecords.OrderByDescending(a => a.DOBDateField); reorderedList = new List <ChildRecord>(list); } else if (obj.Equals("LocationDecending")) { var list = ChildRecords.OrderByDescending(a => a.Location); reorderedList = new List <ChildRecord>(list); } else if (obj.Equals("EnrollmentDecending")) { var list = ChildRecords.OrderByDescending(a => a.EnrollmentDateField); reorderedList = new List <ChildRecord>(list); } ChildRecords.Clear(); ChildRecords = reorderedList; }
/// <summary> /// Serializes to an existing byte array without serialization listener. /// This is done by delegating to Serialize(int, byte[], EscherSerializationListener). /// </summary> /// <param name="offset">the offset within the data byte array.</param> /// <param name="data"> the data array to Serialize to.</param> /// <param name="listener">a listener for begin and end serialization events.</param> /// <returns>The number of bytes written.</returns> public override int Serialize(int offset, byte[] data, EscherSerializationListener listener) { listener.BeforeRecordSerialize(offset, RecordId, this); LittleEndian.PutShort(data, offset, Options); LittleEndian.PutShort(data, offset + 2, RecordId); int remainingBytes = 0; for (IEnumerator iterator = ChildRecords.GetEnumerator(); iterator.MoveNext();) { EscherRecord r = (EscherRecord)iterator.Current; remainingBytes += r.RecordSize; } remainingBytes += _remainingLength; LittleEndian.PutInt(data, offset + 4, remainingBytes); int pos = offset + 8; for (IEnumerator iterator = ChildRecords.GetEnumerator(); iterator.MoveNext();) { EscherRecord r = (EscherRecord)iterator.Current; pos += r.Serialize(pos, data, listener); } listener.AfterRecordSerialize(pos, RecordId, pos - offset, this); return(pos - offset); }
protected void LoadChildRecords() { ChildRecords.Clear(); foreach (DataLink dl in Links) { LoadChildRecords(dl.ChildRecordType); } }
public GEDCOMEventStructure(int level, string tag, string date, string place) : base(new GEDCOMRecord(level, "", "", tag, "")) { var dateRecord = new GEDCOMRecord(level + 1, "", "", "DATE", date); ChildRecords.Add(dateRecord); var placeRecord = new GEDCOMPlaceStructure(level + 1, place); ChildRecords.Add(placeRecord); }
protected string GetChildData(GEDCOMTag childTag, GEDCOMTag grandChildTag) { string data = ""; var child = ChildRecords.GetLineByTag <GEDCOMRecord>(childTag); if (child != null) { data = child._childRecords.GetRecordData(grandChildTag); } return(data); }
/// <summary> /// Do any of our (top level) children have the /// given recordId? /// </summary> /// <param name="recordId">The record id.</param> /// <returns> /// <c>true</c> if [has child of type] [the specified record id]; otherwise, <c>false</c>. /// </returns> public bool HasChildOfType(short recordId) { for (IEnumerator iterator = ChildRecords.GetEnumerator(); iterator.MoveNext();) { EscherRecord r = (EscherRecord)iterator.Current; if (r.RecordId == recordId) { return(true); } } return(false); }
protected void LoadChildRecords(Type type) { using (SqlConnection conn = new SqlConnection(SQLDMGlobal.ConnectionString())) { conn.Open(); SqlCommand cmd = conn.CreateCommand(); try { foreach (DataLink dl in Links.FindAll(c => c.ChildRecordType == type)) { DataRecord childDummy = SQLDMGlobal.FindDummy(type); if (childDummy != null) { cmd.CommandText = string.Format("select * from {0} where [{1}] = {2}", childDummy.FullSafeTableName, dl.ChildFieldName, dl.ParentField.ParameterName); SqlParameter param = GetSqlParameter(dl.ParentField.ParameterName); if (param != null) { cmd.Parameters.Add(param); } SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; DataTable dt = new DataTable(); da.Fill(dt); foreach (DataRow row in dt.Rows) { DataRecord inst = (DataRecord)System.Activator.CreateInstance(dl.ChildRecordType); FillRecord(row, inst, true); ChildRecords.Add(inst); } cmd.Parameters.Clear(); } } } catch (Exception ex) { if (conn.State == ConnectionState.Open) { conn.Close(); } throw ex; } finally { conn.Close(); } } }
protected void SetChildXRefId(GEDCOMTag childTag, string xRefId) { GEDCOMRecord child = ChildRecords.GetLineByTag <GEDCOMRecord>(childTag); if (child == null) { ChildRecords.Add(new GEDCOMRecord(Level + 1, "", xRefId, childTag.ToString(), "")); } else { child._xRefId = xRefId; } }
protected void SetChildData(GEDCOMTag childTag, string data) { GEDCOMRecord child = ChildRecords.GetLineByTag <GEDCOMRecord>(childTag); if (child == null) { ChildRecords.Add(new GEDCOMRecord(Level + 1, "", "", childTag.ToString(), data)); } else { child.Data = data; } }
public void CheckBoxChanged() { if (ChildRecords.Where(p => p.IsImageVisible == false && p.IsCheckboxVisible == false).Count() > 0) { Console.Write(""); } else { var count = ChildRecords.Where(p => p.isChecked).Count(); _selectAll = count == ChildRecords.Count(); OnPropertyChanged(nameof(SelectAll)); } }
/// <summary> /// Splits the Data field into Child CONT records /// </summary> public void SplitData() { string[] data = Data.Split(new[] { '\n' }); if (data.Length > 1) { //The original Data field holds the first part Data = data[0]; //Add CONT records for eacdh other part for (int i = 1; i < data.Length; i++) { ChildRecords.Insert(i - 1, new GEDCOMRecord(Level + 1, "", "", "CONT", data[i])); } } }
public async Task LoadChildRecordsFromDB() { int addedBy; IsTableBottomLineVisible = true; var initialChildRecords = new List <ChildRecord>(); if (Application.Current.Properties.ContainsKey("UserID")) { var isSuccess = int.TryParse(Application.Current.Properties["UserID"].ToString(), out addedBy); if (isSuccess) { var childRecords = (_studentService.GetStudentsByOfflineID(addedBy)); var hasPermission = await userPermissionService.GetStudentEditPermissionsAsync() || Application.Current.Properties["UserTypeID"].ToString() == "1" || Application.Current.Properties["UserTypeID"].ToString() == "6"; foreach (var childRecord in childRecords) { if (childRecord.SelectedLocationId.HasValue && AllLocations != null && AllLocations.Any() && AllLocations.Where(p => p.IsEnabled).Any(p => p.LocationId == childRecord.SelectedLocationId.Value)) { initialChildRecords.Add(new ChildRecord() { IsChildEditEnable = hasPermission || childRecord.AddedBy == addedBy, EditIconImage = hasPermission || childRecord.AddedBy == addedBy ? "icon_edit.png" : "icon_edit_gray.png", AddRfIconImage = hasPermission || childRecord.AddedBy == addedBy ? "icon_add_record.png" : "icon_add_record_gray.png", FirstName = childRecord.FirstName, LastName = childRecord.LastName, ChildID = childRecord.ChildID, ChildUserID = childRecord.UserId, DOB = childRecord.Birthdate.ToString("MM/dd/yyyy"), Enrollment = childRecord.EnrollmentDate.Date != DateTime.MinValue.Date ? childRecord.EnrollmentDate.ToString("MM/dd/yyyy") : "", Location = AllLocations != null && AllLocations.Any() && childRecord.SelectedLocationId != null ? AllLocations.FirstOrDefault(p => p.LocationId == childRecord.SelectedLocationId.Value)?.LocationName : "", LocationID = (childRecord.SelectedLocationId == null) ? 0 : Convert.ToInt32(childRecord.SelectedLocationId), OfflineStudentId = childRecord.OfflineStudentID }); } } var list = initialChildRecords.OrderBy(a => a.LastName + a.FirstName); initialChildRecords = new List <ChildRecord>(list); } } SearchResult = string.Format(ErrorMessages.RecordsFoundMessage, initialChildRecords.Where(p => p.IsImageVisible == true && p.IsCheckboxVisible == true).Count(), initialChildRecords.Where(p => p.IsImageVisible == true && p.IsCheckboxVisible == true).Count() == 1 ? "Match" : "Matches"); SearchErrorColor = Color.Black; SearchErrorVisible = true; ChildRecords.Clear(); ChildRecords = initialChildRecords; }
/// <summary> /// Recursively find records with the specified record ID /// </summary> /// <param name="recordId"></param> /// <param name="out1">list to store found records</param> public void GetRecordsById(short recordId, ref ArrayList out1) { for (IEnumerator it = ChildRecords.GetEnumerator(); it.MoveNext();) { Object er = it.Current; EscherRecord r = (EscherRecord)er; if (r is EscherContainerRecord) { EscherContainerRecord c = (EscherContainerRecord)r; c.GetRecordsById(recordId, ref out1); } else if (r.RecordId == recordId) { out1.Add(er); } } }
/// <summary> /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>. /// </summary> /// <returns> /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>. /// </returns> public override string ToString() { String nl = Environment.NewLine; StringBuilder children = new StringBuilder(); if (ChildRecords.Count > 0) { children.Append(" children: " + nl); int count = 0; for (IEnumerator iterator = ChildRecords.GetEnumerator(); iterator.MoveNext();) { EscherRecord record = (EscherRecord)iterator.Current; children.Append(" Child " + count + ":" + nl); String childResult = (record).ToString(); childResult = childResult.Replace("\n", "\n "); children.Append(" "); children.Append(childResult); children.Append(nl); //if (record is EscherContainerRecord) //{ // EscherContainerRecord ecr = (EscherContainerRecord)record; // children.Append(ecr.ToString()); //} //else //{ // children.Append(record.ToString()); //} count++; } } return (this.GetType().Name + " (" + RecordName + "):" + nl + " isContainer: " + IsContainerRecord + nl + " version: 0x" + HexDump.ToHex(Version) + nl + " instance: 0x" + HexDump.ToHex(Instance) + nl + " recordId: 0x" + HexDump.ToHex(RecordId) + nl + " numchildren: " + ChildRecords.Count + nl + children.ToString()); }
private void UpdateChildRecordTableBounds(double listviewheight) { double rowHeight = 0.0; double totalRowHeight = 0.0; if (ChildRecords.Any()) { rowHeight = ChildRecords.FirstOrDefault().RowHeight; totalRowHeight = ChildRecords.Count() * rowHeight; } if (totalRowHeight > listviewheight) { IsTableBottomLineVisible = true; } else if (ChildRecords.Count > 0) { ChildRecords[ChildRecords.Count - 1].IsTableSepartorVisble = true; IsTableBottomLineVisible = false; } }
/// <summary> /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>. /// </summary> /// <returns> /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>. /// </returns> public override String ToString() { String nl = Environment.NewLine; StringBuilder children = new StringBuilder(); if (ChildRecords.Count > 0) { children.Append(" children: " + nl); for (IEnumerator iterator = ChildRecords.GetEnumerator(); iterator.MoveNext();) { EscherRecord record = (EscherRecord)iterator.Current; children.Append(record.ToString()); children.Append(nl); } } String theDumpHex = ""; try { if (_thedata.Length != 0) { theDumpHex = " Extra Data(" + _thedata.Length + "):" + nl; theDumpHex += HexDump.Dump(_thedata, 0, 0); } } catch (Exception) { theDumpHex = "Error!!"; } return(this.GetType().Name + ":" + nl + " isContainer: " + IsContainerRecord + nl + " version: 0x" + HexDump.ToHex(Version) + nl + " instance: 0x" + HexDump.ToHex(Instance) + nl + " recordId: 0x" + HexDump.ToHex(RecordId) + nl + " numchildren: " + ChildRecords.Count + nl + theDumpHex + children.ToString()); }
protected void SetChildData(GEDCOMTag childTag, GEDCOMTag grandChildTag, string data) { GEDCOMRecord child = ChildRecords.GetLineByTag <GEDCOMRecord>(childTag); if (child == null) { child = new GEDCOMRecord(Level + 1, "", "", childTag.ToString(), ""); ChildRecords.Add(child); } GEDCOMRecord grandChild = child.ChildRecords.GetLineByTag <GEDCOMRecord>(grandChildTag); if (grandChild == null) { child.ChildRecords.Add(new GEDCOMRecord(Level + 2, "", "", grandChildTag.ToString(), data)); } else { grandChild.Data = data; } }
/// <summary> /// The contract of this method is to deSerialize an escher record including /// it's children. /// </summary> /// <param name="data">The byte array containing the Serialized escher /// records.</param> /// <param name="offset">The offset into the byte array.</param> /// <param name="recordFactory">A factory for creating new escher records</param> /// <returns>The number of bytes written.</returns> public override int FillFields(byte[] data, int offset, EscherRecordFactory recordFactory) { int bytesRemaining = ReadHeader(data, offset); int bytesWritten = 8; offset += 8; while (bytesRemaining > 0 && offset < data.Length) { EscherRecord child = recordFactory.CreateRecord(data, offset); int childBytesWritten = child.FillFields(data, offset, recordFactory); bytesWritten += childBytesWritten; offset += childBytesWritten; bytesRemaining -= childBytesWritten; ChildRecords.Add(child); if (offset >= data.Length && bytesRemaining > 0) { Console.WriteLine("WARNING: " + bytesRemaining + " bytes remaining but no space left"); } } return(bytesWritten); }
/// <summary> /// This method deSerializes the record from a byte array. /// </summary> /// <param name="data"> The byte array containing the escher record information</param> /// <param name="offset">The starting offset into data </param> /// <param name="recordFactory">May be null since this is not a container record.</param> /// <returns>The number of bytes Read from the byte array.</returns> public override int FillFields(byte[] data, int offset, EscherRecordFactory recordFactory) { int bytesRemaining = ReadHeader(data, offset); /* * Modified by Zhang Zhang * Have a check between avaliable bytes and bytesRemaining, * take the avaliable length if the bytesRemaining out of range. * July 09, 2010 */ int avaliable = data.Length - (offset + 8); if (bytesRemaining > avaliable) { bytesRemaining = avaliable; } if (IsContainerRecord) { int bytesWritten = 0; thedata = new byte[0]; offset += 8; bytesWritten += 8; while (bytesRemaining > 0) { EscherRecord child = recordFactory.CreateRecord(data, offset); int childBytesWritten = child.FillFields(data, offset, recordFactory); bytesWritten += childBytesWritten; offset += childBytesWritten; bytesRemaining -= childBytesWritten; ChildRecords.Add(child); } return(bytesWritten); } else { thedata = new byte[bytesRemaining]; Array.Copy(data, offset + 8, thedata, 0, bytesRemaining); return(bytesRemaining + 8); } }
public void ReloadAscendingOrder() { List <ChildRecord> reorderedList = new List <ChildRecord>(); if (!isAscending) { var list = ChildRecords.OrderBy(a => a.LastName); reorderedList = new List <ChildRecord>(list); List <ChildRecord> toRemove = reorderedList.Where(W => W.IsImageVisible == false && W.IsCheckboxVisible == false).ToList(); if (toRemove.Count() > 0) { foreach (var item in toRemove) { bool isSuccess = reorderedList.Remove(item); } if (reorderedList.Count < 20) { var rowsToAdd = 20 - reorderedList.Count; for (int i = 0; i < rowsToAdd; i++) { reorderedList.Insert(reorderedList.Count, new ChildRecord() { IsCheckboxVisible = false, IsImageVisible = false }); } } } isAscending = true; } else { var list = ChildRecords.OrderByDescending(a => a.LastName); reorderedList = new List <ChildRecord>(list); isAscending = false; } ChildRecords.Clear(); ChildRecords = reorderedList; }
/// <summary> /// Toes the string. /// </summary> /// <param name="indent">The indent.</param> /// <returns></returns> public String ToString(String indent) { String nl = Environment.NewLine; StringBuilder children = new StringBuilder(); if (ChildRecords.Count > 0) { children.Append(" children: " + nl); int count = 0; for (IEnumerator iterator = ChildRecords.GetEnumerator(); iterator.MoveNext();) { String newIndent = indent + " "; EscherRecord record = (EscherRecord)iterator.Current; children.Append(newIndent + "Child " + count + ":" + nl); if (record is EscherContainerRecord) { EscherContainerRecord ecr = (EscherContainerRecord)record; children.Append(ecr.ToString(newIndent)); } else { children.Append(record.ToString()); } count++; } } return (indent + this.GetType().Name + " (" + RecordName + "):" + nl + indent + " isContainer: " + IsContainerRecord + nl + indent + " options: 0x" + HexDump.ToHex(Options) + nl + indent + " recordId: 0x" + HexDump.ToHex(RecordId) + nl + indent + " numchildren: " + ChildRecords.Count + nl + indent + children.ToString()); }
internal override int Serialize(BinaryWriter dataWriter) { dataWriter.Write(getOptions()); dataWriter.Write(GetRecordId()); int num = 0; IEnumerator enumerator = ChildRecords.GetEnumerator(); while (enumerator.MoveNext()) { EscherRecord escherRecord = (EscherRecord)enumerator.Current; num += escherRecord.RecordSize; } dataWriter.Write(num); int num2 = 8; IEnumerator enumerator2 = ChildRecords.GetEnumerator(); while (enumerator2.MoveNext()) { EscherRecord escherRecord2 = (EscherRecord)enumerator2.Current; num2 += escherRecord2.Serialize(dataWriter); } return(num2); }
protected string GetChildData(GEDCOMTag childTag) { return(ChildRecords.GetRecordData(childTag)); }
public async void SearchClicked(string dob, string enrollmentDate) { var searchChildRecords = new List <ChildRecord>(); var isMorethan1000 = false; IsTableViewVisble = true; await LoadChildRecordsFromDB(); if (!string.IsNullOrEmpty(FirstName) || !string.IsNullOrEmpty(LastName) || (SelectedLocations != null && SelectedLocations.Any()) || !string.IsNullOrEmpty(SelectedCountry) || !string.IsNullOrEmpty(dob) || !string.IsNullOrEmpty(enrollmentDate) || !string.IsNullOrEmpty(ChildID)) { IEnumerable <ChildRecord> query = ChildRecords; if (!string.IsNullOrEmpty(FirstName)) { query = query.Where(p => !string.IsNullOrEmpty(p.FirstName) && p.FirstName.ToLower().Contains(FirstName.ToLower())); } if (!string.IsNullOrEmpty(LastName)) { query = query.Where(p => !string.IsNullOrEmpty(p.LastName) && p.LastName.ToLower().Contains(LastName.ToLower())); } if (!string.IsNullOrEmpty(ChildID)) { query = query.Where(p => !string.IsNullOrEmpty(p.ChildID) && p.ChildID.ToLower().Contains(ChildID.ToLower())); } if (!string.IsNullOrEmpty(dob)) { query = query.Where(p => !string.IsNullOrEmpty(p.DOB) && p.DOB == dob); } if (!string.IsNullOrEmpty(enrollmentDate)) { query = query.Where(p => !string.IsNullOrEmpty(p.Enrollment) && p.Enrollment == enrollmentDate); } if (SelectedLocations.Count > 0) { query = query.Where(p => !string.IsNullOrEmpty(p.Location) && SelectedLocations.Contains(p.Location)); } searchChildRecords = new List <ChildRecord>(query); } else { searchChildRecords = ChildRecords; } if (!searchChildRecords.Any()) { SearchResult = ErrorMessages.RecordMatchesFoundMessage; SearchErrorColor = Color.Red; SearchErrorVisible = true; } else { SearchResult = string.Format(ErrorMessages.RecordsFoundMessage, searchChildRecords.Count(), searchChildRecords.Count() == 1 ? "Match" : "Matches"); SearchErrorColor = Color.Black; SearchErrorVisible = true; if (searchChildRecords.Count > 1000) { isMorethan1000 = true; SearchResult = ErrorMessages.SearchError; SearchErrorColor = Color.Red; SearchErrorVisible = true; } else if (searchChildRecords.Count > 5) { searchChildRecords[searchChildRecords.Count - 1].IsTableSepartorVisble = false; } else { searchChildRecords[searchChildRecords.Count - 1].IsTableSepartorVisble = true; IsTableBottomLineVisible = false; } if (SelectAll) { int index = 0; foreach (var record in searchChildRecords) { searchChildRecords[index].isChecked = true; index++; } } } var list = searchChildRecords.OrderBy(a => a.LastName); var reorderedList = new List <ChildRecord>(list); ChildRecords.Clear(); if (!isMorethan1000) { ChildRecords = reorderedList; } }
/// <summary> /// Fetch child records /// </summary> public async void GetChildRecords() { int addedBy; if (ChildRecords.Any()) { ChildRecords.Clear(); } var initialChildRecords = new List <ChildRecord>(); if (Application.Current.Properties.ContainsKey("UserID")) { var isSuccess = int.TryParse(Application.Current.Properties["UserID"].ToString(), out addedBy); if (isSuccess) { var childRecords = (_studentService.GetStudentsByOfflineID(addedBy)); var testRecords = (_clinicalTestFormService.GetStudentTestForms()).Where(x => x.FormStatus != "Not started").Select(x => x.LocalStudentId).ToList(); var filteredChildRecord = childRecords.FindAll(x => testRecords.Contains(x.OfflineStudentID)); foreach (var childRecord in filteredChildRecord) { if (childRecord.SelectedLocationId.HasValue && AllLocations != null && AllLocations.Any() && AllLocations.Where(p => p.IsEnabled).Any(p => p.LocationId == childRecord.SelectedLocationId.Value)) { string birthdate = (childRecord.Birthdate.Month < 10 ? "0" + childRecord.Birthdate.Month : childRecord.Birthdate.Month + "") + "/" + (childRecord.Birthdate.Day < 10 ? "0" + childRecord.Birthdate.Day : childRecord.Birthdate.Day + "") + "/" + childRecord.Birthdate.Year; initialChildRecords.Add(new ChildRecord() { Name = childRecord.FirstName + " " + childRecord.LastName, selected = false, Location = AllLocations != null && AllLocations.Any() && childRecord.SelectedLocationId != null ? AllLocations.FirstOrDefault(p => p.LocationId == childRecord.SelectedLocationId.Value)?.LocationName : "", LocationID = (childRecord.SelectedLocationId == null) ? 0 : Convert.ToInt32(childRecord.SelectedLocationId), OfflineStudentId = childRecord.OfflineStudentID, DOB = birthdate }); } } var list = initialChildRecords.OrderBy(a => a.LastName); initialChildRecords = new List <ChildRecord>(list); var searchChildRecords = new List <ChildRecord>(); IEnumerable <ChildRecord> query = initialChildRecords; if (SelectedLocations.Count > 0) { query = query.Where(p => !string.IsNullOrEmpty(p.Location) && SelectedLocations.Contains(p.Location)); } searchChildRecords = new List <ChildRecord>(query); foreach (var item in searchChildRecords) { ChildRecords.Add(item); } } } if (ChildRecords.Count == 0) { SelectedChild = "No results found"; IsChildRecordButtonEnabled = false; IsBatteryTypeButtonEnabled = false; } else { SelectedChild = null; } }
protected void AddChildRecord(string childId, string childXRefId, string childTag, string childData) { ChildRecords.Add(new GEDCOMRecord(Level + 1, childId, childXRefId, childTag, childData)); }
protected string GetChildXRefId(GEDCOMTag childTag) { return(ChildRecords.GetXRefID(childTag)); }
/// <summary> /// Adds the child record. /// </summary> /// <param name="childRecord">The child record.</param> public void AddChildRecord(EscherRecord childRecord) { ChildRecords.Add(childRecord); }