Пример #1
0
        /// <summary>
        /// Fetches a business object's data
        /// </summary>
        public bool FetchById(int id)
        {
            DataTable table = DataAccess.GetById(id);

            // if the table has no data than load failed
            BusinessRules.Assert("FetchIdNotFound", "Business Object with id=" + id + " was not found", table.Rows.Count == 0);
            if (!BusinessRules.AreNoBrokenRules)
            {
                return(false);
            }

            PopulateDataMembersFromDataRow(table.Rows[0]);
            IsNew      = false;
            IsModified = false;

            // make sure loaded data is valid according to business rules
            return(IsValid);
        }