Ejemplo n.º 1
0
 /// ------------------------------------------------------------------------------------------------
 #region Public Constructor
 /// ------------------------------------------------------------------------------------------------
 ///
 /// ------------------------------------------------------------------------------------------------
 /// Name		SRiSearchProperty
 ///
 /// <summary>	Creates a new instance of the SRiSearchResult class.
 /// </summary>
 /// <param name="property">		The property that is the content of the result.</param>
 /// <remarks>
 /// </remarks>
 /// ------------------------------------------------------------------------------------------------
 ///
 public SRiSearchResult(SRiProperty property)
 {
     Property               = property;
     Selected               = false;
     RequestType            = property.RequestGroups[0].Name;
     TargetResponse         = property.RequestGroups[0].EarliestTargetDate;
     TargetResponseToString = TargetResponse.ToString("dd/MMM/yyyy @ HH:mm", "Target response ", "No target response");
 }
Ejemplo n.º 2
0
        ///
        #endregion
        /// ------------------------------------------------------------------------------------------------
        #region Private Functions, Properties and Methods
        /// ------------------------------------------------------------------------------------------------
        ///
        /// ------------------------------------------------------------------------------------------------
        /// Name		CreateMappings
        ///
        /// <summary>	Creates the mapping collection from the record.
        /// </summary>
        /// <param name="property">		The record.</param>
        ///
        /// <remarks>
        /// </remarks>
        /// ------------------------------------------------------------------------------------------------
        ///
        private void CreateMappings(SRiProperty property)
        {
            List <IndexMapping> active;

            //
            ActiveCollapsed = new List <IndexMapping>();
            ActiveExpanded  = new List <IndexMapping>();
            for (int rg = 0; rg < property.RequestGroups.Count; rg++)
            {
                // Each request group is actually a set or records grouped by request type. If the filter
                // by type property is set, make sure that the request group type matches.
                if (AppData.PropertyModel.FilterByType == null ||
                    property.RequestGroups[rg].GroupType.Equals(AppData.PropertyModel.FilterByType))
                {
                    active = new List <IndexMapping>();
                    for (int r = 0; r < property.RequestGroups[rg].Records.Count; r++)
                    {
                        switch (AppData.PropertyModel.Filter)
                        {
                        case FilterMode.All:
                            active.Add(new IndexMapping(Index, rg, r));
                            break;

                        case FilterMode.Complete:
                            if (CheckComplete(property.RequestGroups[rg].Records[r].Record))
                            {
                                active.Add(new IndexMapping(Index, rg, r));
                            }
                            break;

                        case FilterMode.Incomplete:
                            if (!CheckComplete(property.RequestGroups[rg].Records[r].Record))
                            {
                                active.Add(new IndexMapping(Index, rg, r));
                            }
                            break;
                        }
                    }
                    //
                    if (active.Count > 0)
                    {
                        ActiveCollapsed.Add(new IndexMapping(Index, rg));
                        ActiveExpanded.Add(new IndexMapping(Index, rg));
                        ActiveExpanded.AddRange(active);
                    }
                }
            }
            //
            if (ActiveCollapsed.Count > 0)
            {
                ActiveCollapsed.Insert(0, new IndexMapping(Index, null, null));
            }
            if (ActiveExpanded.Count > 0)
            {
                ActiveExpanded.Insert(0, new IndexMapping(Index, null, null));
            }
        }
Ejemplo n.º 3
0
 public static void SetSavedStatus(this SRiProperty p, SRiProperty p2)
 {
     foreach (var rg in p.RequestGroups)
     {
         foreach (var rg2 in p2.RequestGroups)
         {
             if (rg.GroupType.Equals(rg2.GroupType))
             {
                 rg.SetSavedStatus(rg2);
                 break;
             }
         }
     }
 }
Ejemplo n.º 4
0
        ///
        /// ------------------------------------------------------------------------------------------------
        /// 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(SRiProperty x, SRiProperty y)
        {
            int result;

            //
            if (x.DistanceFromUser > y.DistanceFromUser)
            {
                result = 1;
            }
            else if (y.DistanceFromUser > x.DistanceFromUser)
            {
                result = -1;
            }
            else
            {
                result = 0;
            }
            //
            return(result);
        }
Ejemplo n.º 5
0
        ///
        /// ------------------------------------------------------------------------------------------------
        /// 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(SRiProperty x, SRiProperty y)
        {
            int result;

            //
            switch (CompareAlpha(x, y))
            {
            case 1:
                result = -1;
                break;

            case -1:
                result = 1;
                break;

            default:
                result = 0;
                break;
            }
            //
            return(result);
        }
Ejemplo n.º 6
0
        ///
        /// ------------------------------------------------------------------------------------------------
        /// 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(SRiProperty x, SRiProperty y)
        {
            int result;

            //
            if (x.EarliestScheduleDate.HasValue && y.EarliestScheduleDate.HasValue)
            {
                result = DateTime.Compare(x.EarliestScheduleDate.Value, y.EarliestScheduleDate.Value);
            }
            else if (x.EarliestScheduleDate.HasValue)
            {
                result = 1;
            }
            else if (y.EarliestScheduleDate.HasValue)
            {
                result = -1;
            }
            else
            {
                result = 0;
            }
            //
            return(result);
        }
Ejemplo n.º 7
0
 /// ------------------------------------------------------------------------------------------------
 #region Public Constructor
 /// ------------------------------------------------------------------------------------------------
 ///
 /// ------------------------------------------------------------------------------------------------
 /// Name		RecordMapping
 ///
 /// <summary>	Creates a new instance of the RecordMapping class.
 /// </summary>
 /// <param name="property">		The record to map.</param>
 /// <param name="index">		The index of the record.</param>
 ///
 /// <remarks>
 /// </remarks>
 /// ------------------------------------------------------------------------------------------------
 ///
 public PropertyMapping(SRiProperty property, int index)
 {
     Index = index;
     CreateMappings(property);
 }
Ejemplo n.º 8
0
 ///
 #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(SRiProperty x, SRiProperty y)
 {
     return(StringComparer.CurrentCulture.Compare(x.TradeName, y.TradeName));
 }