コード例 #1
0
        /// <summary>
        /// WCF method to copy request items to recurring
        /// </summary>
        public static void copyRecurring(ICswResources CswResources, CswNbtRequestDataModel.CswRequestReturn Ret, CswNbtRequestDataModel.CswRequestReturn.Ret Request)
        {
            CswNbtResources NbtResources = _validate(CswResources);
            bool            Succeeded    = false;

            if (Request.RequestItems.Any())
            {
                CswNbtWebServiceRequesting ws  = new CswNbtWebServiceRequesting(NbtResources);
                CswNbtActRequesting        act = new CswNbtActRequesting(NbtResources);
                //So here we're getting the "Recurring" Request and copying the request items from the current request into there
                CswNbtObjClassRequest RequestNode = act.getRecurringRequestNode();
                applyCopyLogic        SetRequest  = (Item) =>
                {
                    Item.Request.RelatedNodeId = RequestNode.NodeId;
                    Item.IsRecurring.Checked   = CswEnumTristate.True;
                };
                Succeeded = ws.copyRequestItems(Request, SetRequest);
            }
            Ret.Data.Succeeded = Succeeded;
        }
コード例 #2
0
        /// <summary>
        /// WCF method to copy a favorite to the current cart
        /// </summary>
        public static void copyFavorite(ICswResources CswResources, CswNbtRequestDataModel.CswRequestReturn Ret, CswNbtRequestDataModel.CswRequestReturn.Ret Request)
        {
            CswNbtResources NbtResources = _validate(CswResources);
            bool            Succeeded    = false;

            //...I have no idea what the difference is between Request.RequestId and Request.CswRequestId
            //I think they both refer to the current cart,
            //but then how are we differentiating between the current Request and the Favorite Request?
            if (CswTools.IsPrimaryKey(Request.CswRequestId) && Request.RequestItems.Any())
            {
                CswNbtObjClassRequest RequestNode = NbtResources.Nodes[Request.CswRequestId];
                if (null != RequestNode)
                {
                    CswNbtWebServiceRequesting ws         = new CswNbtWebServiceRequesting(NbtResources);
                    applyCopyLogic             SetRequest = (Item) =>
                    {
                        Item.Status.Value          = CswNbtObjClassRequestItem.Statuses.Pending;
                        Item.Request.RelatedNodeId = RequestNode.NodeId;
                    };
                    Succeeded = ws.copyRequestItems(Request, SetRequest);
                }
            }
            Ret.Data.Succeeded = Succeeded;
        }