/// <summary> /// To check the record has completed date or not /// </summary> /// <param name="record"></param> /// <returns></returns> public bool CheckComplete(SRiRecord record) { bool incomplete; // incomplete = false; try { foreach (var i in record.Inspections) { foreach (var v in i.Visits) { if (!v.Visit.DateVisit.HasValue) { incomplete = true; break; } } if (incomplete) { break; } } return(!incomplete); } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); return(incomplete); } }
/// #endregion /// ------------------------------------------------------------------------------------------------ #region Private Functions, Properties and Methods /// ------------------------------------------------------------------------------------------------ /// /// ------------------------------------------------------------------------------------------------ /// Name CreateMappings /// /// <summary> Creates the mapping collection from the record. /// </summary> /// <param name="record"> The record.</param> /// /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// private void CreateMappings(SRiRecord record) { List <IndexMapping> active; SRiVisit visit; // Active = new List <IndexMapping>(); for (int i = 0; i < record.Inspections.Count; i++) { // Create temporary collection for storing the mappings for this inspection. active = new List <IndexMapping>(); // // Find mappings for Visits. for (int v = 0; v < record.Inspections[i].Visits.Count; v++) { visit = record.Inspections[i].Visits[v]; switch (AppData.RecordModel.Filter) { case FilterMode.All: active.Add(new IndexMapping(Index, i, v, null)); break; case FilterMode.Complete: //if (visit.Completed) // active.Add(new IndexMapping(Index, i, v, null)); break; case FilterMode.Incomplete: //if (!visit.Completed) // active.Add(new IndexMapping(Index, i, v, null)); break; } // Note that we don't add Actions here because they are not visible on the left hand menu as cells. } // // If there are mappings for this Inspection then add them to // the mapping collection, with an entry for the inspection as well. if (active.Count > 0) { Active.Add(new IndexMapping(Index, i, null, null)); Active.AddRange(active); } } // // If the Active mapping collection has entries, insert an entry at the start for the Record. if (Active.Count > 0) { Active.Insert(0, new IndexMapping(Index, null, null, null)); } }
/// ------------------------------------------------------------------------------------------------ #region Public Constructors /// ------------------------------------------------------------------------------------------------ /// /// ------------------------------------------------------------------------------------------------ /// Name SRiPropertyDetail /// /// <summary> Creates a new instance of the SRiPropertyDetail class. /// </summary> /// <param name="cpinfo"> The CPInfo entity to pull details from.</param> /// /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// public SRiPropertyDetail(SRiCPInfoMeta cpinfo, SRiRecord record) { Title = "COMMERCIAL PREMISES"; Details = new SRiPropertyDetailsCollection(); Details.Add("Reference", cpinfo.CPInfo.RefVal); Details.Add("SRREC reference", record.RefVal); Details.Add("Occupier", cpinfo.CPInfo.Occupier); Details.Add("Contact", cpinfo.CPInfo.Contact); Details.Add("Main use of site", cpinfo.PremisesUseDescription); foreach (var fhrs in cpinfo.CPInfo.FHRSRecords) { if (!string.IsNullOrEmpty(fhrs.Rating) && fhrs.Assessed.HasValue) { Details.Add(string.Format("FHRS on {0}", fhrs.Assessed.ToDateString()), fhrs.Rating); } } }
/// #endregion /// ------------------------------------------------------------------------------------------------ #region Public Functions, Properties and Methods /// ------------------------------------------------------------------------------------------------ /// /// ------------------------------------------------------------------------------------------------ /// Name AlphaIndex /// /// <summary> Gets the alpha index to show in the main menu and the map for the specified record. /// </summary> /// <param name="record"> The record.</param> /// /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// public string AlphaIndex(SRiRecord record) { string index; // index = "?"; for (int i = 0; i < Mappings.Count; i++) { if (m_oRecordList[Mappings[i].Index].KeyVal.Equals(record.KeyVal)) { index = i.ToAlphaIndex(); break; } } // return(index); }
/// /// ------------------------------------------------------------------------------------------------ /// Name SRiPropertyDetail /// /// <summary> Creates a new instance of the SRiPropertyDetail class. /// </summary> /// <param name="licase"> The LICase entity to pull details from.</param> /// /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// public SRiPropertyDetail(SRiLICaseMeta licase, SRiRecord record) { Title = "LICENSING"; Details = new SRiPropertyDetailsCollection(); Details.Add("Reference", licase.LICase.RefVal); Details.Add("SRREC reference", record.RefVal); Details.Add("Type", licase.CNTypeDescription); Details.Add("License Plate", licase.LICase.PlateRef); Details.Add("Commend Date", licase.LICase.CommendDate); Details.Add("Expiry Date", licase.LICase.ExpiryDate); // foreach (var party in licase.LICase.LIParties) { if (!string.IsNullOrEmpty(party.FullName)) { Details.Add(licase.PartyTypeDescription(party), party.FullName); } } }
/// /// ------------------------------------------------------------------------------------------------ /// Name CompareDistance /// /// <summary> Compares SRiRecord x and y based on the premises distance from the user. /// </summary> /// <param name="x"> Object x.</param> /// <param name="y"> Object y.</param> /// /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// int CompareDistance(SRiRecord x, SRiRecord y) { int result; // if (x.DistanceFromUser < y.DistanceFromUser) { result = 1; } else if (y.DistanceFromUser < x.DistanceFromUser) { result = -1; } else { result = 0; } // return(result); }
/// /// ------------------------------------------------------------------------------------------------ /// Name CompareAlphaInverse /// /// <summary> Compares SRiRecord x and y based on a descending alphabetical sort order. /// </summary> /// <param name="x"> Object x.</param> /// <param name="y"> Object y.</param> /// /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// int CompareAlphaInverse(SRiRecord x, SRiRecord y) { int result; // switch (CompareAlpha(x, y)) { case 1: result = -1; break; case -1: result = 1; break; default: result = 0; break; } // return(result); }
/// /// ------------------------------------------------------------------------------------------------ /// Name CheckComplete /// /// <summary> Checks if all the visits in the record are complete. If they are True is returned. /// </summary> /// <param name="record"> The record.</param> /// /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// private bool CheckComplete(SRiRecord record) { bool incomplete; // incomplete = false; foreach (var i in record.Inspections) { foreach (var v in i.Visits) { if (!v.Visit.DateVisit.HasValue) { incomplete = true; break; } } if (incomplete) { break; } } return(!incomplete); }
/// /// ------------------------------------------------------------------------------------------------ /// Name CompareDate /// /// <summary> Compares SRiRecord x and y based on the premises earliest due date. /// </summary> /// <param name="x"> Object x.</param> /// <param name="y"> Object y.</param> /// /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// int CompareDate(SRiRecord x, SRiRecord y) { int result; // if (x.EarliestDueDate.HasValue && y.EarliestDueDate.HasValue) { result = DateTime.Compare(x.EarliestDueDate.Value, y.EarliestDueDate.Value); } else if (x.EarliestDueDate.HasValue) { result = 1; } else if (y.EarliestDueDate.HasValue) { result = -1; } else { result = 0; } // return(result); }
/// ------------------------------------------------------------------------------------------------ #region Public Constructor /// ------------------------------------------------------------------------------------------------ /// /// ------------------------------------------------------------------------------------------------ /// Name RecordMapping /// /// <summary> Creates a new instance of the RecordMapping class. /// </summary> /// <param name="record"> The record to map.</param> /// <param name="index"> The index of the record.</param> /// /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// public RecordMapping(SRiRecord record, int index) { Index = index; CreateMappings(record); }
/// #endregion /// ------------------------------------------------------------------------------------------------ #region Private Functions, Properties and Methods /// ------------------------------------------------------------------------------------------------ /// /// ------------------------------------------------------------------------------------------------ /// Name CompareAlpha /// /// <summary> Compares SRiRecord x and y based on an ascending alphabetical sort order. /// </summary> /// <param name="x"> Object x.</param> /// <param name="y"> Object y.</param> /// /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ /// int CompareAlpha(SRiRecord x, SRiRecord y) { return(StringComparer.CurrentCulture.Compare(x.TradeName, y.TradeName)); }