Click here to Skip to main content
15,894,137 members
Articles / Web Development / ASP.NET

Using Silverlight in Enterprise: RAD of User Friendly Database Access

Rate me:
Please Sign up or sign in to vote.
4.81/5 (19 votes)
31 Jul 2009CPOL8 min read 58.2K   7K   80  
This article introduces FulcrumWeb RAD Framework - A Silverlight UI Engine to build user friendly database driven applications
/********************************************************************
 *  FulcrumWeb RAD Framework - Fulcrum of your business             *
 *  Copyright (c) 2002-2009 FulcrumWeb, ALL RIGHTS RESERVED         *
 *                                                                  *
 *  THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED      *
 *  FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE        *
 *  COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE       *
 *  AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT  *
 *  AND PERMISSION FROM FULCRUMWEB. CONSULT THE END USER LICENSE    *
 *  AGREEMENT FOR INFORMATION ON ADDITIONAL RESTRICTIONS.           *
 ********************************************************************/

using System.Xml;

using Framework.Utils;

namespace Framework.Metadata
{
  //------------------------------------------------------------------------------
  /// <summary>
  /// Child entities change notification mode.
  /// </summary>
  public enum NxChildChangeNotificationMode { AllRecords, EachRecord }
  //------------------------------------------------------------------------------

  //------------------------------------------------------------------------------
  /// <summary>
	/// Class that holds information about child entity usage.
	/// </summary>
	public class CxChildEntityUsageMetadata : CxMetadataObject
	{
    //----------------------------------------------------------------------------
    protected CxEntityUsageMetadata m_ParentEntityUsage = null;
    //----------------------------------------------------------------------------

    //----------------------------------------------------------------------------
    /// <summary>
    /// Constructor.
    /// </summary>
    /// <param name="holder">metadata holder instance</param>
    /// <param name="element">XML element that holds metadata</param>
    /// <param name="parentEntityUsage">parent entity usage</param>
    public CxChildEntityUsageMetadata(
      CxMetadataHolder holder, 
      XmlElement element,
      CxEntityUsageMetadata parentEntityUsage) : 
      base(holder, element)
    {
      m_ParentEntityUsage = parentEntityUsage;
    }
    //----------------------------------------------------------------------------
    /// <summary>
    /// ID of the child entity usage.
    /// </summary>
    public string EntityUsageId
    {
      get { return CxText.ToUpper(this["entity_usage_id"]); }
    }
    //----------------------------------------------------------------------------
    /// <summary>
    /// Child entity usage.
    /// </summary>
    public CxEntityUsageMetadata EntityUsage
    {
      get { return Holder.EntityUsages[EntityUsageId]; }
    }
    //----------------------------------------------------------------------------
    /// <summary>
    /// true if child entity owned by parent one (rather than just referenced by).
    /// </summary>
    public bool OwnedBy
    {
      get { return (this["owned_by"] == "true"); }
    }
    //----------------------------------------------------------------------------
    /// <summary>
    /// Returns parent entity usage.
    /// </summary>
    override public CxMetadataObject ParentObject
    {
      get
      {
        return m_ParentEntityUsage;
      }
    }
    //----------------------------------------------------------------------------
    /// <summary>
    /// True if child entity usage should be visible in the hierarchical grid.
    /// </summary>
    public bool IsVisibleInHierarchy
    {
      get
      {
        if (EntityUsage != null && !EntityUsage.Visible)
          return false;
        if (CxUtils.IsEmpty(this["visible_in_hierarchy"]) &&
            Holder.Config != null &&
            Holder.Config.IsChildEntityUsageVisibleInHierarchy != NxBoolEx.Undefined)
        {
          return CxBoolEx.GetBool(Holder.Config.IsChildEntityUsageVisibleInHierarchy);
        }
        return this["visible_in_hierarchy"].ToLower() != "false";
      }
    }
    //----------------------------------------------------------------------------
    /// <summary>
    /// True if child entity usage should be visible on the detail page control 
    /// of the master entity grid frame.
    /// </summary>
    public bool IsVisibleInList
    {
      get
      {
        if (EntityUsage != null && (!EntityUsage.Visible || !EntityUsage.GetIsAccessGranted()))
          return false;
        return CxBool.Parse(this["visible_in_list"], true);
      }
    }
    //----------------------------------------------------------------------------
    /// <summary>
    /// True if child entity usage should be visible on the detail page control 
    /// of the master entity view form.
    /// </summary>
    public bool IsVisibleInView
    {
      get
      {
        if (EntityUsage != null && (!EntityUsage.Visible || !EntityUsage.GetIsAccessGranted()))
          return false;
        return CxBool.Parse(this["visible_in_view"], true);
      }
    }
    //----------------------------------------------------------------------------
    /// <summary>
    /// Returns windows panel name to place child entity usage grid in the view form.
    /// </summary>
    public string WinViewPlacement
    { get { return this["win_view_placement"]; } }
    //----------------------------------------------------------------------------
    /// <summary>
    /// Returns child entities change notification mode.
    /// </summary>
    public NxChildChangeNotificationMode ChangeNotificationMode
    { 
      get 
      {
        return CxEnum.Parse(
          this["change_notification_mode"], 
          NxChildChangeNotificationMode.AllRecords);
      }
    }
    //----------------------------------------------------------------------------
    /// <summary>
    /// True if child entity usage sould be customizable as child of another entity by user.
    /// </summary>
    public bool Customizable
    {
      get
      {
        if (EntityUsage == null)
          return false;

        return this["customizable"].ToLower() == "true";
      }
    }
    //----------------------------------------------------------------------------
  }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Ukraine Ukraine
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions