/// <summary>
        ///     Loads the latest SprDbObject information from the MDB database.
        /// </summary>
        public void Refresh()
        {
            Row = Application.RefreshRow(TableName, Id);

            if (Row.RowState == DataRowState.Detached)
            {
                Row.Table.Rows.Add(Row);
            }

            Row.AcceptChanges();
        }
Exemple #2
0
        /// <summary>
        /// Update extra location specific fields in DataRow APartnerLocationDR
        /// </summary>
        /// <param name="ALocationDT">Table containing location records to be used to update APartnerLocation records.</param>
        /// <param name="APartnerLocationDR">Single DataRow to be updated with Location specific information.</param>
        /// <param name="AMakePLocationRecordUnchanged">Set to true to make the PLocation Record unchanged
        /// (by calling .AcceptChanges() on it).</param>
        public static void SyncPartnerEditTDSPartnerLocation(PLocationTable ALocationDT, PartnerEditTDSPPartnerLocationRow APartnerLocationDR,
                                                             bool AMakePLocationRecordUnchanged = false)
        {
            DataRow      Row;
            PLocationRow LocationRow;

            if (APartnerLocationDR.RowState != DataRowState.Deleted)
            {
                Row = ALocationDT.Rows.Find(new Object[] { APartnerLocationDR.SiteKey, APartnerLocationDR.LocationKey });

                if (Row != null)
                {
                    LocationRow = (PLocationRow)Row;

                    APartnerLocationDR.LocationLocality    = LocationRow.Locality;
                    APartnerLocationDR.LocationStreetName  = LocationRow.StreetName;
                    APartnerLocationDR.LocationAddress3    = LocationRow.Address3;
                    APartnerLocationDR.LocationCity        = LocationRow.City;
                    APartnerLocationDR.LocationCounty      = LocationRow.County;
                    APartnerLocationDR.LocationPostalCode  = LocationRow.PostalCode;
                    APartnerLocationDR.LocationCountryCode = LocationRow.CountryCode;

                    APartnerLocationDR.LocationCreatedBy = LocationRow.CreatedBy;

                    if (!LocationRow.IsDateCreatedNull())
                    {
                        APartnerLocationDR.LocationDateCreated = (DateTime)LocationRow.DateCreated;
                    }

                    APartnerLocationDR.LocationModifiedBy = LocationRow.ModifiedBy;

                    if (!LocationRow.IsDateModifiedNull())
                    {
                        APartnerLocationDR.LocationDateModified = (DateTime)LocationRow.DateModified;
                    }

                    if (AMakePLocationRecordUnchanged)
                    {
                        Row.AcceptChanges();
                    }
                }
            }
        }