예제 #1
0
        public override void setDBValuesFromRequest(LandingPageData.Request Request)
        {
            CswEnumNbtViewType ViewType = (CswEnumNbtViewType)Request.ViewType;

            if (ViewType == CswEnumNbtViewType.View)
            {
                _ItemRow["to_nodeviewid"] = CswConvert.ToDbVal(new CswNbtViewId(Request.PkValue).get());
            }
            else if (ViewType == CswEnumNbtViewType.Action)
            {
                _ItemRow["to_actionid"] = CswConvert.ToDbVal(Request.PkValue);
            }
            else if (ViewType == CswEnumNbtViewType.Report)
            {
                CswPrimaryKey ReportPk = CswConvert.ToPrimaryKey(Request.PkValue);
                _ItemRow["to_reportid"] = CswConvert.ToDbVal(ReportPk.PrimaryKey);
            }
            else if (ViewType == CswEnumNbtViewType.Search)
            {
                CswPrimaryKey SearchPk = CswConvert.ToPrimaryKey(Request.PkValue);
                _ItemRow["to_searchid"] = CswConvert.ToDbVal(SearchPk.PrimaryKey);
            }
            else
            {
                throw new CswDniException(CswEnumErrorType.Warning, "You must select a view", "No view was selected for new Link LandingPage Item");
            }
            _setCommonDbValuesFromRequest(Request);
        }
예제 #2
0
        public override void setItemDataForUI(DataRow LandingPageRow, LandingPageData.Request Request)
        {
            Int32 NodeTypeId = CswConvert.ToInt32(LandingPageRow["to_nodetypeid"]);

            if (NodeTypeId != Int32.MinValue)
            {
                CswNbtMetaDataNodeType NodeType = _CswNbtResources.MetaData.getNodeType(NodeTypeId);
                if (NodeType != null)
                {
                    bool CanAdd = NodeType.getObjectClass().CanAdd&& _CswNbtResources.Permit.canNodeType(CswEnumNbtNodeTypePermission.Create, NodeType);
                    if (CanAdd)
                    {
                        String DisplayText = LandingPageRow["displaytext"].ToString();
                        _ItemData.Text       = false == String.IsNullOrEmpty(DisplayText) ? DisplayText : "Add New " + NodeType.NodeTypeName;
                        _ItemData.NodeTypeId = NodeType.NodeTypeId.ToString();
                        _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + NodeType.IconFileName;
                        _ItemData.Type       = "add_new_nodetype";
                        _ItemData.ActionId   = LandingPageRow["to_actionid"].ToString();
                        Int32 ActionId = CswConvert.ToInt32(LandingPageRow["to_actionid"]);
                        if (ActionId != Int32.MinValue)
                        {
                            CswNbtAction ThisAction = _CswNbtResources.Actions[ActionId];
                            if (null != ThisAction)
                            {
                                _ItemData.ActionId   = ActionId.ToString();
                                _ItemData.ActionName = ThisAction.Name.ToString();
                            }
                        }
                    }
                    _setCommonItemDataForUI(LandingPageRow);
                }
            }
        }
예제 #3
0
        public void addLandingPageItem(LandingPageData.Request Request)
        {
            CswNbtLandingPageItem Item = CswNbtLandingPageItemFactory.makeLandingPageItem(_CswNbtResources, Request.Type);

            Item.setDBValuesFromRequest(Request);
            Item.saveToDB();
        }
예제 #4
0
        public override void setItemDataForUI(DataRow LandingPageRow, LandingPageData.Request Request)
        {
            Int32 ObjectClassPropId = CswConvert.ToInt32(LandingPageRow["to_objectclasspropid"]);

            if (ObjectClassPropId != Int32.MinValue)
            {
                CswNbtNode RequestNode = _CswNbtResources.Nodes.GetNode(CswConvert.ToPrimaryKey(Request.NodeId));
                if (null != RequestNode)
                {
                    CswNbtMetaDataNodeType NodeType = RequestNode.getNodeType();
                    if (null != NodeType)
                    {
                        String OCPName = _CswNbtResources.MetaData.getObjectClassPropName(ObjectClassPropId);
                        CswNbtMetaDataNodeTypeProp NodeTypeProp = NodeType.getNodeTypePropByObjectClassProp(OCPName);
                        if (null != NodeTypeProp && false == RequestNode.Properties[NodeTypeProp].AsButton.Hidden)
                        {
                            String DisplayText = LandingPageRow["displaytext"].ToString();
                            _ItemData.Text           = false == String.IsNullOrEmpty(DisplayText) ? DisplayText : "Add New " + NodeTypeProp.PropName;
                            _ItemData.NodeTypePropId = RequestNode.NodeId.ToString() + "_" + NodeTypeProp.PropId.ToString();
                            _ItemData.ActionName     = NodeTypeProp.PropName;
                            _ItemData.ButtonIcon     = CswNbtMetaDataObjectClass.IconPrefix100 + NodeType.IconFileName;
                            _setCommonItemDataForUI(LandingPageRow);
                        }
                    }
                }
            }
        }
예제 #5
0
        public override void setItemDataForUI(DataRow LandingPageRow, LandingPageData.Request Request)
        {
            Int32 NodeTypeId = CswConvert.ToInt32(LandingPageRow["to_nodetypeid"]);
            Int32 TabId      = CswConvert.ToInt32(LandingPageRow["to_tabid"]);

            if (NodeTypeId != Int32.MinValue && TabId != Int32.MinValue)
            {
                CswNbtMetaDataNodeType NodeType = _CswNbtResources.MetaData.getNodeType(NodeTypeId);
                if (NodeType != null)
                {
                    CswNbtMetaDataNodeTypeTab Tab = NodeType.getNodeTypeTab(TabId);
                    if (null != Tab)
                    {
                        CswNbtView TabView = getTabView(Request.NodeId, Request.NodeViewId, NodeType);
                        if (null != TabView && TabView.IsFullyEnabled())
                        {
                            String DisplayText = LandingPageRow["displaytext"].ToString();
                            _ItemData.Text       = false == String.IsNullOrEmpty(DisplayText) ? DisplayText : TabView.ViewName + " " + Tab.TabName;
                            _ItemData.ViewId     = TabView.SessionViewId.ToString();
                            _ItemData.ViewMode   = TabView.ViewMode.ToString().ToLower();
                            _ItemData.Type       = "view";
                            _ItemData.TabId      = TabId.ToString();
                            _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + NodeType.IconFileName;
                            _setCommonItemDataForUI(LandingPageRow);
                        }
                    }
                }
            }
        }
예제 #6
0
 /// <summary>
 /// Grabs all WelcomePage Items for the given RoleId
 /// </summary>
 /// <param name="RoleId">RoleId to filter by</param>
 /// <returns>Collection of LandingPage Items</returns>
 public LandingPageData getWelcomePageItems(CswPrimaryKey RoleId)
 {
     LandingPageData.Request Request = new LandingPageData.Request
     {
         RoleId = RoleId.ToString()
     };
     return(_LandingPageTable.getLandingPageItems(Request));
 }
예제 #7
0
 /// <summary>
 /// Deletes a LandingPage Item
 /// </summary>
 /// <param name="LandingPageId">Unique identifier of the LandingPage Item to delete</param>
 public void deleteLandingPageItem(Int32 LandingPageId)
 {
     LandingPageData.Request Request = new LandingPageData.Request
     {
         LandingPageId = LandingPageId
     };
     _LandingPageTable.deleteLandingPageItem(Request);
 }
 public override void setDBValuesFromRequest(LandingPageData.Request Request)
 {
     _setCommonDbValuesFromRequest(Request);
     _ItemRow["buttonicon"] = String.Empty;
     if (String.IsNullOrEmpty(Request.Text))
     {
         throw new CswDniException(CswEnumErrorType.Warning, "You must enter text to display", "No text entered for new Text LandingPage Item");
     }
 }
예제 #9
0
 /// <summary>
 /// Grabs all LandingPage Items for the given RoleId and/or ActionId
 /// </summary>
 /// <param name="ActionId">Action ID (for Action-specific Landing Pages)</param>
 /// <param name="RoleId">RoleId (for Welcome Page)</param>
 /// <returns></returns>
 public LandingPageData getLandingPageItems(Int32 ActionId, CswPrimaryKey RoleId)
 {
     LandingPageData.Request Request = new LandingPageData.Request
     {
         ActionId = ActionId.ToString(),
         RoleId   = RoleId.ToString()
     };
     return(_LandingPageTable.getLandingPageItems(Request));
 }
예제 #10
0
 /// <summary>
 /// Moves a LandingPage Item to the specified cell (or next available cell)
 /// </summary>
 /// <param name="LandingPageId">Unique identifier of the LandingPage Item to move</param>
 /// <param name="NewRow">New Row Number (subject to change based on availability)</param>
 /// <param name="NewCol">New Column Number</param>
 public void moveLandingPageItem(Int32 LandingPageId, Int32 NewRow, Int32 NewCol)
 {
     LandingPageData.Request Request = new LandingPageData.Request
     {
         LandingPageId = LandingPageId,
         NewRow        = NewRow,
         NewColumn     = NewCol
     };
     _LandingPageTable.moveLandingPageItem(Request);
 }
예제 #11
0
        public override void setDBValuesFromRequest(LandingPageData.Request Request)
        {
            Int32 ObjectClassPropId = CswConvert.ToInt32(Request.PkValue);

            if (ObjectClassPropId != Int32.MinValue)
            {
                _ItemRow["to_objectclasspropid"] = CswConvert.ToDbVal(ObjectClassPropId);
            }
            else
            {
                throw new CswDniException(CswEnumErrorType.Warning, "You must select a valid button type", "No button selected for new Button LandingPage Item");
            }
            _setCommonDbValuesFromRequest(Request);
        }
예제 #12
0
 public void moveLandingPageItem(LandingPageData.Request Request)
 {
     Request.NewRow = _getNextAvailableRow(Request.LandingPageId, Request.NewRow, Request.NewColumn);
     if (Request.LandingPageId != Int32.MinValue)
     {
         CswTableUpdate LandingPageUpdate = _CswNbtResources.makeCswTableUpdate("MoveLandingPageItem", "landingpage");
         DataTable      LandingPageTable  = LandingPageUpdate.getTable("landingpageid", Request.LandingPageId);
         if (LandingPageTable.Rows.Count > 0)
         {
             DataRow LandingPageRow = LandingPageTable.Rows[0];
             LandingPageRow["display_row"] = CswConvert.ToDbVal(Request.NewRow);
             LandingPageRow["display_col"] = CswConvert.ToDbVal(Request.NewColumn);
             LandingPageUpdate.update(LandingPageTable);
         }
     }
 }
예제 #13
0
        public LandingPageData getLandingPageItems(LandingPageData.Request Request)
        {
            LandingPageData Items            = new LandingPageData();
            DataTable       LandingPageTable = _getLandingPageTable(Request.RoleId, Request.ActionId);

            foreach (DataRow LandingPageRow in LandingPageTable.Rows)
            {
                CswNbtLandingPageItem Item = CswNbtLandingPageItemFactory.makeLandingPageItem(_CswNbtResources, LandingPageRow["componenttype"].ToString());
                Item.setItemDataForUI(LandingPageRow, Request);
                if (false == String.IsNullOrEmpty(Item.ItemData.LandingPageId))
                {
                    Items.LandingPageItems.Add(Item.ItemData);
                }
            }
            return(Items);
        }
예제 #14
0
        public override void setDBValuesFromRequest(LandingPageData.Request Request)
        {
            Int32 TabId      = CswConvert.ToInt32(Request.PkValue);
            Int32 NodeTypeId = CswConvert.ToInt32(Request.NodeTypeId);

            if (TabId != Int32.MinValue && NodeTypeId != Int32.MinValue)
            {
                _ItemRow["to_tabid"]      = CswConvert.ToDbVal(TabId);
                _ItemRow["to_nodetypeid"] = CswConvert.ToDbVal(NodeTypeId);
            }
            else
            {
                throw new CswDniException(CswEnumErrorType.Warning, "You must select a tab", "No tab selected for new Tab LandingPage Item");
            }
            _setCommonDbValuesFromRequest(Request);
        }
예제 #15
0
 public void deleteLandingPageItem(LandingPageData.Request Request)
 {
     if (Request.LandingPageId != Int32.MinValue)
     {
         CswTableUpdate LandingPageUpdate = _CswNbtResources.makeCswTableUpdate("RemoveLandingPageItem", "landingpage");
         DataTable      LandingPageTable  = LandingPageUpdate.getTable("landingpageid", Request.LandingPageId);
         if (LandingPageTable.Rows.Count > 0)
         {
             foreach (DataRow LandingPageRow in LandingPageTable.Rows)
             {
                 LandingPageRow.Delete();
             }
             LandingPageUpdate.update(LandingPageTable);
         }
     }
 }
예제 #16
0
        public void updateLandingPageItem(LandingPageData.Request Request)
        {
            Request.NewRow = _getNextAvailableRow(Request.LandingPageId, Request.NewRow, Request.NewColumn);
            if (Request.LandingPageId != Int32.MinValue)
            {
                CswNbtLandingPageItem Item = CswNbtLandingPageItemFactory.makeLandingPageItem(_CswNbtResources, Request.Type);
                Item.setDBValuesFromRequest(Request);

                CswTableUpdate LandingPageUpdate = _CswNbtResources.makeCswTableUpdate("MoveLandingPageItem", "landingpage");
                DataTable      LandingPageTable  = LandingPageUpdate.getTable("landingpageid", Request.LandingPageId);
                if (LandingPageTable.Rows.Count > 0)
                {
                    LandingPageTable.Rows[0].Delete();
                    LandingPageTable.Rows.Add(Item.ItemRow);
                    LandingPageUpdate.update(LandingPageTable);
                }
            }
        }
예제 #17
0
        public override void setDBValuesFromRequest(LandingPageData.Request Request)
        {
            Int32 NodeTypeId = CswConvert.ToInt32(Request.NodeTypeId);

            if (NodeTypeId != Int32.MinValue)
            {
                _ItemRow["to_nodetypeid"] = CswConvert.ToDbVal(NodeTypeId);
                String ActionId = _getAddAction(NodeTypeId);
                if (false == String.IsNullOrEmpty(ActionId))
                {
                    _ItemRow["to_actionid"] = ActionId;
                }
            }
            else
            {
                throw new CswDniException(CswEnumErrorType.Warning, "You must select something to add", "No nodetype selected for new Add LandingPage Item");
            }
            _setCommonDbValuesFromRequest(Request);
        }
예제 #18
0
 /// <summary>
 /// Add a LandingPage Item
 /// </summary>
 /// <param name="Type">The Type of Landing Page Item to add</param>
 /// <param name="ItemToAdd">LandingPage Item data</param>
 public void addLandingPageItem(CswEnumNbtLandingPageItemType Type, LandingPageData.Request ItemToAdd)
 {
     ItemToAdd.Type = Type;
     _LandingPageTable.addLandingPageItem(ItemToAdd);
 }
예제 #19
0
 public abstract void setItemDataForUI(DataRow LandingPageRow, LandingPageData.Request Request);
 public override void setItemDataForUI(DataRow LandingPageRow, LandingPageData.Request Request)
 {
     _ItemData.Text = LandingPageRow["displaytext"].ToString();
     _setCommonItemDataForUI(LandingPageRow);
 }
예제 #21
0
        } // _setCommonItemDataForUI()

        public abstract void setDBValuesFromRequest(LandingPageData.Request Request);
예제 #22
0
        public override void setItemDataForUI(DataRow LandingPageRow, LandingPageData.Request Request)
        {
            bool   finishLoading = false; //this will be set to true if and only if there's a valid link to be made
            String DisplayText   = LandingPageRow["displaytext"].ToString();
            Int32  ViewId        = CswConvert.ToInt32(LandingPageRow["to_nodeviewid"]);

            if (ViewId != Int32.MinValue)
            {
                CswNbtViewId NodeViewId = new CswNbtViewId(ViewId);
                CswNbtView   ThisView   = _CswNbtResources.ViewSelect.restoreView(NodeViewId);
                if (null != ThisView && ThisView.IsFullyEnabled() && ThisView.IsVisible())
                {
                    finishLoading  = true;
                    _ItemData.Text = LandingPageRow["displaytext"].ToString() != string.Empty ? LandingPageRow["displaytext"].ToString() : ThisView.ViewName;

                    _ItemData.ViewId   = NodeViewId.ToString();
                    _ItemData.ViewMode = ThisView.ViewMode.ToString().ToLower();
                    if (ThisView.Root.ChildRelationships.Count > 0 && ThisView.Root.ChildRelationships[0] != null)
                    {
                        _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + ThisView.Root.ChildRelationships[0].SecondIconFileName;
                    }
                    _ItemData.Type = "view";
                }
            }
            Int32 ActionId = CswConvert.ToInt32(LandingPageRow["to_actionid"]);

            if (ActionId != Int32.MinValue)
            {
                CswNbtAction ThisAction = _CswNbtResources.Actions[ActionId];
                if (null != ThisAction)
                {
                    if (_CswNbtResources.Permit.can(ThisAction.Name))
                    {
                        finishLoading        = true;
                        _ItemData.Text       = false == String.IsNullOrEmpty(DisplayText) ? DisplayText : CswNbtAction.ActionNameEnumToString(ThisAction.Name);
                        _ItemData.ActionId   = ActionId.ToString();
                        _ItemData.ActionName = ThisAction.Name.ToString();
                        _ItemData.ActionUrl  = ThisAction.Url;
                        _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + ThisAction.IconFileName;
                        _ItemData.Type       = "action";
                    }
                }
            }
            Int32 ReportId = CswConvert.ToInt32(LandingPageRow["to_reportid"]);

            if (ReportId != Int32.MinValue)
            {
                CswPrimaryKey ReportPk       = new CswPrimaryKey("nodes", ReportId);
                CswNbtNode    ThisReportNode = _CswNbtResources.Nodes[ReportPk];
                if (null != ThisReportNode)
                {
                    finishLoading        = true;
                    _ItemData.Text       = false == String.IsNullOrEmpty(DisplayText) ? DisplayText : ThisReportNode.NodeName;
                    _ItemData.ReportId   = ReportPk.ToString();
                    _ItemData.Type       = "report";
                    _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + ThisReportNode.getNodeType().IconFileName;
                }
            }
            Int32 SearchId = CswConvert.ToInt32(LandingPageRow["to_searchid"]);

            if (SearchId != Int32.MinValue)
            {
                CswPrimaryKey SearchPk = new CswPrimaryKey("search", SearchId);
                CswNbtSearch  Search   = _CswNbtResources.SearchManager.restoreSearch(SearchPk);
                if (null != Search)
                {
                    finishLoading        = true;
                    _ItemData.Text       = Search.Name;
                    _ItemData.ReportId   = SearchPk.ToString();
                    _ItemData.Type       = "search";
                    _ItemData.ButtonIcon = CswNbtMetaDataObjectClass.IconPrefix100 + "magglass.png";
                }
            }

            //we only want to send the item back with a landingpageid if it contains a valid link
            if (finishLoading)
            {
                _setCommonItemDataForUI(LandingPageRow);
            }
        }
예제 #23
0
 protected virtual void _setCommonDbValuesFromRequest(LandingPageData.Request Request)
 {
     _setCommonItemDataForDBImpl(Request.RoleId, Request.ActionId, Request.Type, Request.NewColumn, Request.NewRow, Request.Text, Request.ButtonIcon);
 }
예제 #24
0
 /// <summary>
 /// Updates a LandingPage Item to match the given data
 /// </summary>
 /// <param name="LandingPageId">Unique identifier of the LandingPage Item to update</param>
 /// <param name="ItemToUpdate">New LandingPage Item data (ALL data must be included)</param>
 public void updateLandingPageItem(Int32 LandingPageId, LandingPageData.Request ItemToUpdate)
 {
     ItemToUpdate.LandingPageId = LandingPageId;
     _LandingPageTable.updateLandingPageItem(ItemToUpdate);
 }