/// <summary>
        /// Gets an array of PropertyInfo objects containing information about the properties of the entity
        /// </summary>
        /// <returns>An array of PropertyInfo objects containing information about the properties of the entity</returns>
        private PropertyInfo[] GetEntityProperties()
        {
            if (_Entity == null)
            {
                throw new IndException(ApplicationMessages.EXCEPTION_MUST_SET_ENTITY_PROPERTY);
            }
            Type entityType = _Entity.GetType();

            return(entityType.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly));
        }
示例#2
0
        /// <summary>
        /// Deletes the selected entities from the catalogue
        /// </summary>
        private void DeleteSelectedEntities()
        {
            List <IGenericEntity> entities = new List <IGenericEntity>();

            //For each selected entity in the grid
            foreach (GridItem gridItem in this.MasterTableView.Items)
            {
                if (gridItem is GridDataItem && ((CheckBox)((GridDataItem)gridItem)["DeleteColumn"].Controls[0]).Checked)
                {
                    GridDataItem   current      = (GridDataItem)gridItem;
                    IGenericEntity deleteEntity = BuildEntityForDeletion(current);

                    //HACK - no other suitable place found for passing also the current associate to the business object below
                    if (deleteEntity.GetType() == typeof(Associate))
                    {
                        ((Associate)deleteEntity).IdCurrentAssociate = ((CurrentUser)SessionManager.GetCurrentUser(this.Page)).IdAssociate;
                    }

                    deleteEntity.SetDeleted();
                    entities.Add(deleteEntity);
                }
            }
            EntityFactory.GetEntityInstance(_EntityType, SessionManager.GetConnectionManager(this.Page)).Save(entities);
        }