Exemplo n.º 1
0
        public override void update()
        {
            // Remove the "Define Sizes for this Material" landing page item for the Create Material wizard
            // Originally added in CswUpdateSchema_01T_Case27881

            CswNbtLandingPageTable LandingPageObj = _CswNbtSchemaModTrnsctn.getLandingPageTable();
            string CreateMaterialActionId = _CswNbtSchemaModTrnsctn.Actions[CswEnumNbtActionName.Create_Material].ActionId.ToString();
            string RoleId = "nodes_1";
            CswNbtObjClassRole AdminRole = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "Administrator" );
            if( null != AdminRole )
            {
                RoleId = AdminRole.NodeId.ToString();
            }

            LandingPageData Items = LandingPageObj.getLandingPageItems( new LandingPageData.Request()
                {
                    RoleId = RoleId,
                    ActionId = CreateMaterialActionId
                } );
            foreach( LandingPageData.LandingPageItem Item in Items.LandingPageItems )
            {
                if( Item.Text == "Define Sizes for this Material" )
                {
                    LandingPageObj.deleteLandingPageItem( new LandingPageData.Request()
                        {
                            LandingPageId = CswConvert.ToInt32( Item.LandingPageId )
                        } );
                }
            } // foreach
        } // update()
Exemplo n.º 2
0
        }//afterPopulateProps()

        public override CswNbtNode CopyNode( bool IsNodeTemp = false, Action<CswNbtNode> OnCopy = null )
        {
            CswNbtNode CopiedNode = _CswNbtResources.Nodes.makeNodeFromNodeTypeId( NodeTypeId, IsTemp : IsNodeTemp, OnAfterMakeNode : delegate( CswNbtNode NewNode )
            {
                //copy each property from the old node
                    NewNode.copyPropertyValues( Node );


                //get the landing page items from the original role's welcome page and loop through them, copying each to new page
                //NOTE: if we ever implement non-welcome page role specific LPIs, this will need to be updated
                    CswNbtLandingPage LandingPageBuilder = new CswNbtLandingPage( _CswNbtResources );
                    
                    LandingPageData NewNodeLandingPageData = LandingPageBuilder.getWelcomePageItems( this.NodeId );
                    foreach(LandingPageData.LandingPageItem Item in NewNodeLandingPageData.LandingPageItems)
                    {
                        LandingPageBuilder.copyLandingPageItem( NewNode.NodeId.ToString(), Item );
                    }

                //copy the views to the new role
                    _CswNbtResources.ViewSelect.copyViewsByRoleId( NodeId, NewNode.NodeId );

                //if the thing that requested this copy had a callback, fire it
                    if( null != OnCopy )
                    {
                        OnCopy( NewNode );
                    }
            }, IsCopy : true );
            return CopiedNode;
        }
Exemplo n.º 3
0
        public override void update()
        {
            CswNbtNode CisproRequestFulfillerRole = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "CISPro_Request_Fulfiller" );
            if( null != CisproRequestFulfillerRole )
            {
                LandingPageData PageData = _CswNbtSchemaModTrnsctn.getLandingPageTable().getLandingPageItems( new LandingPageData.Request
                    {
                        RoleId = CisproRequestFulfillerRole.NodeId.ToString(),
                        ActionId = null
                    } );

                Collection<Int32> DoomedIds = new Collection<int>();
                foreach( LandingPageData.LandingPageItem PageItem in PageData.LandingPageItems )
                {
                    if( PageItem.Text == "Pending Requests" )
                    {
                        _CswNbtSchemaModTrnsctn.getLandingPageTable().addLandingPageItem( new LandingPageData.Request
                            {
                                Type = CswEnumNbtLandingPageItemType.Link,
                                RoleId = CisproRequestFulfillerRole.NodeId.ToString(),
                                Text = "Submitted Requests",
                                NodeViewId = PageItem.ViewId,
                                PkValue = PageItem.ViewId,
                                ButtonIcon = "cart.png",
                                ViewType = CswEnumNbtViewType.View.ToString()
                            } );
                        DoomedIds.Add( CswConvert.ToInt32( PageItem.LandingPageId ) );
                    }
                }
                foreach( int DoomedId in DoomedIds )
                {
                    _CswNbtSchemaModTrnsctn.getLandingPageTable().deleteLandingPageItem( new LandingPageData.Request { LandingPageId = DoomedId } );
                }

            }

            foreach( CswEnumNbtObjectClass Member in CswNbtPropertySetRequestItem.Members() )
            {
                CswNbtMetaDataObjectClass MemberOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( Member );
                foreach( CswNbtMetaDataNodeType NodeType in MemberOc.getLatestVersionNodeTypes() )
                {
                    CswNbtMetaDataNodeTypeProp CommentsNtp = NodeType.getNodeTypePropByObjectClassProp( CswNbtPropertySetRequestItem.PropertyName.Comments );
                    CommentsNtp.updateLayout( CswEnumNbtLayoutType.Add, false );

                    if( null != CisproRequestFulfillerRole )
                    {
                        _CswNbtSchemaModTrnsctn.Permit.set( CswEnumNbtNodeTypePermission.Edit, NodeType, CisproRequestFulfillerRole, true );
                    }
                }
            }

            CswNbtMetaDataObjectClass RequestOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RequestClass );
            foreach( CswNbtMetaDataNodeType RequestNt in RequestOc.getNodeTypes() )
            {
                RequestNt.NameTemplateValue = "";
                RequestNt.addNameTemplateText( CswNbtObjClassRequest.PropertyName.Name );
                RequestNt.addNameTemplateText( CswNbtObjClassRequest.PropertyName.SubmittedDate );
            }

        } // update()
Exemplo n.º 4
0
        public LandingPageData GetData(User theUser)
        {
            LandingPageData data = new LandingPageData {
                ActiveUsers = sysInfoRepo.GetActiveUsers(),
                TotalTasks  = taskRepo.GetTotalCount(),
                UserTasks   = taskRepo.GetTasksFor(theUser)
            };

            return(data);
        }
Exemplo n.º 5
0
            public void WithOneUserAndNoTasks()
            {
                ITaskRepository taskRepo = Substitute.For <ITaskRepository>();

                taskRepo.GetTotalCount().Returns(0);
                taskRepo.GetTasksFor(Arg.Any <User>())
                .Returns(new HashSet <Core.Model.Task>());

                ISystemInfoRepository sysInfoRepo = Substitute.For <ISystemInfoRepository>();

                sysInfoRepo.GetActiveUsers().Returns(1);

                LoadLandingPageData useCase = new LoadLandingPageData(taskRepo, sysInfoRepo);
                User theUser = new User {
                    Username = "******"
                };

                LandingPageData data = useCase.GetData(theUser);

                Assert.That(data.ActiveUsers, Is.EqualTo(1));
                Assert.That(data.TotalTasks, Is.EqualTo(0));
                Assert.That(data.UserTasks, Has.Count.EqualTo(0));
            }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (TodoListContext context = new TodoListContext())
            {
                ITaskRepository       taskRepo = new EFTaskRepository(context);
                ISystemInfoRepository sysRepo  = new EFSystemInfoRepository();

                LoadLandingPageData useCase = new LoadLandingPageData(taskRepo, sysRepo);
                User theuser = new User {
                    UserId = 1
                };

                LandingPageData data = useCase.GetData(theuser);

                ActiveUser = data.ActiveUsers;
                TotalTask  = data.TotalTasks;


                //var connectionFromConfiguration = WebConfigurationManager.ConnectionStrings["ToDoListStr"];
                //using (SqlConnection dbConnection = new SqlConnection(connectionFromConfiguration.ConnectionString))
                //{
                //    try
                //    {
                //        dbConnection.Open();
                //        Message = "Connection Succesfull";

                //    }
                //    catch (SqlException ex)
                //    {
                //        Message = "connection failed";
                //    }


                //}
            }
        }
 public LandingPageItemsReturn()
 {
     Data = new LandingPageData();
 }