/// <summary>
 /// Initializes a new instance of the <see cref="UPRecordSelectorRowData"/> class.
 /// </summary>
 /// <param name="resultRow">The result row.</param>
 /// <param name="functionValues">The function values.</param>
 /// <param name="recordIdentification">The record identification.</param>
 /// <param name="rowResult">The row result.</param>
 public UPRecordSelectorRowData(UPMResultRow resultRow, Dictionary <string, object> functionValues, string recordIdentification, object rowResult)
 {
     this.ResultRow                = resultRow;
     this.FunctionValues           = functionValues;
     this.RootRecordIdentification = recordIdentification;
     this.RowResult                = rowResult;
 }
Exemplo n.º 2
0
        /// <summary>
        /// The row from result row.
        /// </summary>
        /// <param name="crmRow">
        /// The crm row.
        /// </param>
        /// <returns>
        /// The <see cref="UPMResultRow"/>.
        /// </returns>
        public virtual UPMResultRow RowFromResultRow(UPCRMResultRow crmRow)
        {
            RecordIdentifier identifier = new RecordIdentifier(crmRow.RecordIdentificationAtIndex(0));
            UPMResultRow     resultRow  = new UPMResultRow(identifier)
            {
                Invalid = true, DataValid = true
            };

            this.TheDelegate?.ResultRowProviderDidCreateRowFromDataRow(this, resultRow, crmRow);
            return(resultRow);
        }
        /// <summary>
        /// Gets the geolocation of record
        /// </summary>
        /// <param name="resultRow">Result row</param>
        /// <returns>Location for given result row</returns>
        public static Location Location(UPMResultRow resultRow)
        {
            UPMGpsXField gpsXField = null;
            UPMGpsYField gpsYField = null;

            foreach (UPMField field in resultRow.Fields)
            {
                if (field is UPMGpsXField)
                {
                    gpsXField = (UPMGpsXField)field;
                }
                else if (field is UPMGpsYField)
                {
                    gpsYField = (UPMGpsYField)field;
                }
            }

            return(new Location(gpsXField?.StringValue?.ToDouble() ?? 0, gpsYField?.StringValue?.ToDouble() ?? 0));
        }
        /// <summary>
        /// Applies the updates from Result row.
        /// </summary>
        /// <param name="row">
        /// The row.
        /// </param>
        public void ApplyUpdatesFromResultRow(UPMResultRow row)
        {
            if (row == this)
            {
                // do nothing as we assume that if we get the same object it HASN'T changed
                return;
            }

            if (row.Fields != this.Fields)
            {
                this.Fields = row.Fields;
            }

            if (row.DetailActions != this.DetailActions)
            {
                this.DetailActions = row.DetailActions;
            }

            if (row.Icon != this.Icon)
            {
                this.Icon = row.Icon;
            }

            if (row.RecordImageDocument != this.RecordImageDocument)
            {
                this.RecordImageDocument = row.RecordImageDocument;
            }

            if (row.StatusIndicatorIcon != this.StatusIndicatorIcon)
            {
                this.StatusIndicatorIcon = row.StatusIndicatorIcon;
            }

            this.OnlineData = row.OnlineData;
            this.RemoveAllChildren();
            foreach (UPMGroup group in row.Children)
            {
                this.AddChild(group);
            }

            this.RowColor = row.RowColor;
            this.Invalid  = false;
        }
        /// <summary>
        /// The result row at index.
        /// </summary>
        /// <param name="index">
        /// The index.
        /// </param>
        /// <returns>
        /// The <see cref="UPMResultRow"/>.
        /// </returns>
        public UPMResultRow ResultRowAtIndex(int index)
        {
            if (this.ResultRowProvider != null)
            {
                if (this.createdChildren.Count > index)
                {
                    var resultRowObject = this.createdChildren[index];
                    if (resultRowObject != null)
                    {
                        return(resultRowObject);
                    }
                }

                UPMResultRow resultRow = this.ResultRowProvider.RowAtIndex(index);

                if (this.createdChildren.Count == index)
                {
                    this.createdChildren.Add(resultRow);
                }
                else if (this.createdChildren.Count > index)
                {
                    this.createdChildren[index] = resultRow;
                }
                else
                {
                    for (int i = this.createdChildren.Count; i < index; i++)
                    {
                        this.createdChildren.Add(null);
                    }

                    this.createdChildren.Add(resultRow);
                }

                return(resultRow);
            }

            return(this.Children[index] as UPMResultRow);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="GeoUPMResultRow"/> class.
 /// </summary>
 /// <param name="resultRow">Result row</param>
 /// <param name="distance">Distance</param>
 public GeoUPMResultRow(UPMResultRow resultRow, double distance)
     : this(resultRow?.Identifier)
 {
     this.ResultRow = resultRow;
     this.Distance  = distance;
 }
 /// <summary>
 /// The add result row.
 /// </summary>
 /// <param name="resultRow">
 /// The result row.
 /// </param>
 public void AddResultRow(UPMResultRow resultRow)
 {
     this.AddChild(resultRow);
 }