public CswNbtNode GetNode(string NodeId, string NodeKey, CswDateTime Date = null)
        {
            CswNbtNode Node = null;

            if (!string.IsNullOrEmpty(NodeKey))
            {
                //CswNbtNodeKey RealNodeKey = new CswNbtNodeKey( CswNbtResources, FromSafeJavaScriptParam( NodeKey ) );
                CswNbtNodeKey RealNodeKey = new CswNbtNodeKey(NodeKey);
                Node = _CswNbtResources.getNode(RealNodeKey, Date);
            }
            else if (!string.IsNullOrEmpty(NodeId))
            {
                CswPrimaryKey RealNodeId = new CswPrimaryKey();
                if (CswTools.IsInteger(NodeId))
                {
                    RealNodeId.TableName  = "nodes";
                    RealNodeId.PrimaryKey = CswConvert.ToInt32(NodeId);
                }
                else
                {
                    RealNodeId.FromString(NodeId);
                }
                Node = _CswNbtResources.getNode(RealNodeId, Date);
            }
            return(Node);
        } // getNode()
        public CswNbtActDispenseContainer(CswNbtResources CswNbtResources, string SourceContainerNodeId, string DispenseTransactionId = null, string DispenseTransactionProperties = null)
        {
            _CswNbtResources      = CswNbtResources;
            _CswNbtSdTabsAndProps = new CswNbtSdTabsAndProps(_CswNbtResources);

            if (false == String.IsNullOrEmpty(SourceContainerNodeId))
            {
                CswPrimaryKey SourceContainerPK = new CswPrimaryKey();
                SourceContainerPK.FromString(SourceContainerNodeId);
                _SourceContainer = _CswNbtResources.Nodes.GetNode(SourceContainerPK);
                if (false == String.IsNullOrEmpty(DispenseTransactionId))
                {
                    CswPrimaryKey ContainerDispenseTransactionId = new CswPrimaryKey();
                    ContainerDispenseTransactionId.FromString(DispenseTransactionId);
                    _TempDispenseTransaction = _CswNbtResources.Nodes.GetNode(ContainerDispenseTransactionId);
                    if (null != _TempDispenseTransaction)
                    {
                        _CswNbtSdTabsAndProps.saveProps(_TempDispenseTransaction.NodeId, Int32.MinValue, CswConvert.ToJObject(DispenseTransactionProperties), _TempDispenseTransaction.NodeTypeId, null, IsIdentityTab: false, setIsTempToFalse: false);
                    }
                    _SourceContainer.Dispenser = new CswNbtContainerDispenser(_CswNbtResources, new CswNbtContainerDispenseTransactionBuilder(_CswNbtResources, _TempDispenseTransaction), _SourceContainer);
                }
            }
            else
            {
                throw new CswDniException(CswEnumErrorType.Error, "Cannot execute dispense contianer action with an undefined Source Container.", "Attempted to constuct CswNbtActDispenseContainer without a valid Source Container.");
            }
            if (false == _CswNbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.CISPro))
            {
                throw new CswDniException(CswEnumErrorType.Error, "Cannot use the Dispense action without the required module.", "Attempted to constuct CswNbtActSubmitRequest without the required module.");
            }
        }
        public JObject dispenseSourceContainer(string DispenseType, string Quantity, string UnitId, string RequestItemId)
        {
            JObject ret = new JObject();

            if (null != _SourceContainer)
            {
                CswEnumNbtContainerDispenseType DispenseTypeEnum = _getDispenseTypeFromAction(DispenseType);
                CswPrimaryKey UnitOfMeasurePk = new CswPrimaryKey();
                UnitOfMeasurePk.FromString(UnitId);
                CswPrimaryKey RequestItemPk = new CswPrimaryKey();
                RequestItemPk.FromString(RequestItemId);
                Double RealQuantity = CswConvert.ToDouble(Quantity);

                if (DispenseTypeEnum == CswEnumNbtContainerDispenseType.Add)
                {
                    RealQuantity = -RealQuantity; // deducting negative quantity is adding quantity
                }

                _SourceContainer.DispenseOut(DispenseTypeEnum, RealQuantity, UnitOfMeasurePk, RequestItemPk);
                _SourceContainer.postChanges(false);

                string ViewId = _getViewForAllDispenseContainers();
                ret["viewId"] = ViewId;
            }
            return(ret);
        }
示例#4
0
        } // setupPhraseView()

        private void _setupClassificationView(CswNbtView View, CswCommaDelimitedString SelectedClassIds)
        {
            CswNbtMetaDataObjectClass GhsClassOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.GHSClassificationClass);
            CswNbtMetaDataNodeType    GhsClassNT = GhsClassOC.FirstNodeType;

            View.SetVisibility(CswEnumNbtViewVisibility.Hidden, null, null);
            View.ViewMode = CswEnumNbtViewRenderingMode.Grid;
            View.Root.ChildRelationships.Clear();
            if (SelectedClassIds.Count > 0)
            {
                CswNbtViewRelationship ClassVR = View.AddViewRelationship(GhsClassOC, false);
                foreach (string ClassId in SelectedClassIds)
                {
                    CswPrimaryKey ClassPk = new CswPrimaryKey();
                    ClassPk.FromString(ClassId);
                    ClassVR.NodeIdsToFilterIn.Add(ClassPk);
                }

                View.AddViewProperty(ClassVR, GhsClassOC.getObjectClassProp(CswNbtObjClassGHSClassification.PropertyName.Category));
                if (null != GhsClassNT)
                {
                    CswNbtMetaDataNodeTypeProp LanguageProp = GhsClassNT.getNodeTypePropByObjectClassProp(_getLanguageForTranslation());
                    CswNbtViewProperty         LanguageVP   = View.AddViewProperty(ClassVR, LanguageProp);
                    LanguageVP.Width = 100;
                }
            } // if( SelectedClassIds.Count > 0 )
            View.SaveToCache(IncludeInQuickLaunch: false, UpdateCache: true, KeepInQuickLaunch: false);
        }     // _setupClassificationView()
 public override void ReadJSON( JObject JObject, Dictionary<Int32, Int32> NodeMap, Dictionary<Int32, Int32> NodeTypeMap )
 {
     if( null != JObject[_NodeIDSubField.ToXmlNodeName( true )] )
     {
         string NodePkString = JObject[_NodeIDSubField.ToXmlNodeName( true )].ToString();
         CswPrimaryKey thisRelatedNodeId = new CswPrimaryKey();
         bool validPk = thisRelatedNodeId.FromString( NodePkString );
         if( false == validPk )
         {
             thisRelatedNodeId.TableName = "nodes";
             thisRelatedNodeId.PrimaryKey = CswConvert.ToInt32( NodePkString );
         }
         if( thisRelatedNodeId.PrimaryKey != Int32.MinValue )
         {
             if( NodeMap != null && NodeMap.ContainsKey( thisRelatedNodeId.PrimaryKey ) )
             {
                 thisRelatedNodeId.PrimaryKey = NodeMap[thisRelatedNodeId.PrimaryKey];
             }
             RelatedNodeId = thisRelatedNodeId;
             JObject["destnodeid"] = RelatedNodeId.PrimaryKey.ToString();
         }
         else
         {
             RelatedNodeId = null;
         }
     }
 }
        }//getExistingNodes()

        public static void deleteExistingNodes(ICswResources CswResources, CswNbtImportWcf.DltExistingNodesReturn Ret, object EmptyObject)
        {
            // In this case, we need to create a new instance of CswNbtResources
            // so that we can delete all nodes (including MLM nodes)
            CswNbtResources _CswNbtResources = CswNbtResourcesFactory.makeCswNbtResources(CswEnumAppType.Nbt, CswEnumSetupMode.NbtWeb, false);   //ExcludeDisabledModules needs to be false

            _CswNbtResources.AccessId        = CswResources.AccessId;
            _CswNbtResources.InitCurrentUser = _initUser;

            Collection <CswNbtImportWcf.DltExistingNodesReturn.DltExistingNodesReturnData.DoomedNode> DoomedNodes = _retriveDoomedNodes(_CswNbtResources);

            foreach (CswNbtImportWcf.DltExistingNodesReturn.DltExistingNodesReturnData.DoomedNode DoomedNode in DoomedNodes)
            {
                try
                {
                    CswPrimaryKey NodePrimeKey = new CswPrimaryKey();
                    NodePrimeKey.FromString("nodes_" + DoomedNode.NodeId);
                    CswNbtNode CurrentNode = _CswNbtResources.Nodes[NodePrimeKey];
                    if (null != CurrentNode)
                    {
                        CurrentNode.delete(true, true, false);
                    }
                }
                catch (Exception exception)
                {
                    throw new CswDniException(CswEnumErrorType.Error, "Error deleting node: ", exception.Message);
                }
            }

            _CswNbtResources.finalize();
            Ret.Data.DeleteSuccessful = true;
        }
        public JObject dispenseIntoChildContainers(string ContainerNodeTypeId, string DispenseGrid, string RequestItemId)
        {
            JObject ret = new JObject();

            if (null != _SourceContainer)
            {
                CswPrimaryKey RequestItemPk = new CswPrimaryKey();
                RequestItemPk.FromString(RequestItemId);
                JArray  GridArray = JArray.Parse(DispenseGrid);
                JObject jBarcodes = new JObject();
                ret["barcodes"] = jBarcodes;
                for (Int32 i = 0; i < GridArray.Count; i += 1)
                {
                    if (GridArray[i].Type == JTokenType.Object)
                    {
                        JObject CurrentRow               = (JObject)GridArray[i];
                        int     NumOfContainers          = CswConvert.ToInt32(CurrentRow["containerNo"]);
                        double  QuantityToDispense       = CswConvert.ToDouble(CurrentRow["quantity"]);
                        string  UnitId                   = CswConvert.ToString(CurrentRow["unitid"]);
                        CswCommaDelimitedString Barcodes = new CswCommaDelimitedString();
                        Barcodes.FromString(CswConvert.ToString(CurrentRow["barcodes"]));

                        CswPrimaryKey UnitOfMeasurePK = new CswPrimaryKey();
                        UnitOfMeasurePK.FromString(UnitId);

                        if (NumOfContainers == 0)
                        {
                            _SourceContainer.DispenseOut(
                                CswEnumNbtContainerDispenseType.Dispense, QuantityToDispense,
                                UnitOfMeasurePK, RequestItemPk);
                            _SourceContainer.postChanges(false);
                        }
                        else
                        {
                            for (Int32 c = 0; c < NumOfContainers; c += 1)
                            {
                                CswNbtObjClassContainer ChildContainer = _createChildContainer(ContainerNodeTypeId,
                                                                                               UnitOfMeasurePK, Barcodes[c]);
                                _SourceContainer.DispenseOut(
                                    CswEnumNbtContainerDispenseType.Dispense, QuantityToDispense,
                                    UnitOfMeasurePK, RequestItemPk, ChildContainer);
                                //ChildContainer.DispenseIn( CswEnumNbtContainerDispenseType.Dispense, QuantityToDispense, UnitOfMeasurePK, RequestItemPk, _SourceContainer );
                                ChildContainer.postChanges(false);

                                JObject BarcodeNode = new JObject();
                                jBarcodes[ChildContainer.NodeId.ToString()] = BarcodeNode;
                                BarcodeNode["nodeid"]   = ChildContainer.NodeId.ToString();
                                BarcodeNode["nodename"] = ChildContainer.NodeName;
                            }
                            _SourceContainer.postChanges(false);
                        }
                    }
                }
                _SourceContainer.postChanges(false);

                string ViewId = _getViewForAllDispenseContainers();
                ret["viewId"] = ViewId;
            }
            return(ret);
        }
        /// <summary>
        /// Finalize the new Material
        /// </summary>
        public JObject commitMaterial(string MaterialDefinition)
        {
            JObject RetObj = new JObject();

            JObject MaterialObj = CswConvert.ToJObject(MaterialDefinition);

            if (MaterialObj.HasValues)
            {
                JArray        SizesArray = CswConvert.ToJArray(MaterialObj["sizeNodes"]);
                CswPrimaryKey MaterialId = new CswPrimaryKey();
                MaterialId.FromString(CswConvert.ToString(MaterialObj["materialId"]));
                if (CswTools.IsPrimaryKey(MaterialId))
                {
                    CswNbtNode MaterialNode = _CswNbtResources.Nodes[MaterialId];
                    if (null != MaterialNode)
                    {
                        /* 1. Validate the new material and get its properties */
                        MaterialNode = _commitMaterialNode(MaterialObj);
                        RetObj["createdmaterial"] = true;

                        /* 2. Add the sizes */
                        if (_CswNbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.Containers))
                        {
                            SizesArray = _removeDuplicateSizes(SizesArray);
                            _addMaterialSizes(SizesArray, MaterialNode);
                            RetObj["sizescount"] = SizesArray.Count;
                        }

                        /* 3. Add landingpage data */
                        RetObj["landingpagedata"] = _getLandingPageData(MaterialNode);
                    }
                }
            }
            return(RetObj);
        }
示例#9
0
        // This is used by CswNbtNodeProp for unique value enforcement
        public void AddUniqueFilterToView(CswNbtView View, CswNbtViewProperty UniqueValueViewProperty, CswNbtNodePropWrapper PropertyValueToCheck, bool EnforceNullEntries = false, CswNbtSubField SubField = null)
        {
            if (SubField == null)
            {
                SubField = SubFields.Default;
            }

            string StringValueToCheck = PropertyValueToCheck.GetSubFieldValue(SubField);

            // case 31292 - Kludge fix for NodeID filters
            if (SubField.Name == CswEnumNbtSubFieldName.NodeID && false == string.IsNullOrEmpty(StringValueToCheck))
            {
                CswPrimaryKey pkValue = new CswPrimaryKey();
                pkValue.FromString(StringValueToCheck);
                StringValueToCheck = pkValue.PrimaryKey.ToString();
            }
            CswEnumNbtFilterMode FilterMode;

            //case 27670 - in order to reserve the right for compound unique props to be empty, it has to be explicitly stated when creating the ForCompundUnique view
            if (EnforceNullEntries && String.IsNullOrEmpty(StringValueToCheck))
            {
                FilterMode = CswEnumNbtFilterMode.Null;
            }
            else
            {
                FilterMode = CswEnumNbtFilterMode.Equals;
            }

            View.AddViewPropertyFilter(UniqueValueViewProperty, SubField.Name, FilterMode, StringValueToCheck.Trim(), false);
        }
示例#10
0
        private CswPrimaryKey _HandleReference(string LocationNodeIdStr, string LocationBarcode)   //, Dictionary<Int32, Int32> NodeMap )
        {
            CswPrimaryKey LocationNodeId = new CswPrimaryKey();

            if (!string.IsNullOrEmpty(LocationNodeIdStr))
            {
                LocationNodeId.FromString(LocationNodeIdStr);
                if (LocationNodeId.PrimaryKey == Int32.MinValue && LocationBarcode != string.Empty)
                {
                    // Find the location with this barcode value
                    CswNbtMetaDataObjectClass     LocationObjectClass    = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.LocationClass);
                    CswNbtMetaDataObjectClassProp BarcodeObjectClassProp = LocationObjectClass.getObjectClassProp(CswNbtObjClassLocation.PropertyName.Barcode);

                    CswNbtView LocationView = new CswNbtView(_CswNbtResources);
                    // All locations..
                    CswNbtViewRelationship LocationRelationship = LocationView.AddViewRelationship(LocationObjectClass, false);
                    // ..with barcodes
                    CswNbtViewProperty BarcodeViewProperty = LocationView.AddViewProperty(LocationRelationship, BarcodeObjectClassProp);
                    // ..equal to the given barcode
                    CswNbtViewPropertyFilter BarcodeViewPropertyFilter = LocationView.AddViewPropertyFilter(BarcodeViewProperty, CswNbtFieldTypeRuleBarCode.SubFieldName.Barcode, CswEnumNbtFilterMode.Equals, LocationBarcode, false);

                    ICswNbtTree LocationTree = _CswNbtResources.Trees.getTreeFromView(_CswNbtResources.CurrentNbtUser, LocationView, true, false, false);
                    if (LocationTree.getChildNodeCount() > 0)
                    {
                        LocationTree.goToNthChild(0);
                        CswNbtNode LocationNode = LocationTree.getNodeForCurrentPosition();
                        LocationNodeId = LocationNode.NodeId;
                    }
                }
            } // if(!string.IsNullOrEmpty(LocationNodeIdStr))
            return(LocationNodeId);
        }     // _HandleReference()
示例#11
0
        } // getSubscriptions()

        public static void saveSubscriptions(ICswResources CswResources, CswWebSvcReturn Return, MailReportSubscriptions Request)
        {
            CswNbtResources           CswNbtResources = (CswNbtResources)CswResources;
            CswPrimaryKey             ThisUserPk      = CswNbtResources.CurrentNbtUser.UserId;
            CswNbtMetaDataObjectClass MailReportOC    = CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.MailReportClass);

            foreach (MailReportSubscriptions.Subscription sub in Request.Subscriptions)
            {
                if (sub.Modified)
                {
                    CswPrimaryKey NodeId = new CswPrimaryKey();
                    NodeId.FromString(sub.NodeId);

                    CswNbtObjClassMailReport MailReportNode = CswNbtResources.Nodes[NodeId];
                    if (sub.Subscribed)
                    {
                        MailReportNode.Recipients.AddUser(ThisUserPk);
                    }
                    else
                    {
                        MailReportNode.Recipients.RemoveUser(ThisUserPk);
                    }
                    MailReportNode.postChanges(false);
                }
            }
        } // saveSubscriptions()
示例#12
0
        public CswNbtView setupPhraseView(CswNbtView View, CswCommaDelimitedString SelectedPhraseIds)
        {
            CswNbtMetaDataObjectClass GhsPhraseOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.GHSPhraseClass);
            CswNbtMetaDataNodeType    GhsPhraseNT = GhsPhraseOC.FirstNodeType;

            View.SetVisibility(CswEnumNbtViewVisibility.Hidden, null, null);
            View.ViewMode = CswEnumNbtViewRenderingMode.Grid;
            View.Root.ChildRelationships.Clear();
            if (SelectedPhraseIds.Count > 0)
            {
                CswNbtViewRelationship PhraseVR = View.AddViewRelationship(GhsPhraseOC, false);
                foreach (string PhraseId in SelectedPhraseIds)
                {
                    CswPrimaryKey PhrasePk = new CswPrimaryKey();
                    PhrasePk.FromString(PhraseId);
                    PhraseVR.NodeIdsToFilterIn.Add(PhrasePk);
                }

                View.AddViewProperty(PhraseVR, GhsPhraseOC.getObjectClassProp(CswNbtObjClassGHSPhrase.PropertyName.Code));
                if (null != GhsPhraseNT)
                {
                    CswNbtMetaDataNodeTypeProp LanguageProp = GhsPhraseNT.getNodeTypePropByObjectClassProp(_getLanguageForTranslation());
                    CswNbtViewProperty         LanguageVP   = View.AddViewProperty(PhraseVR, LanguageProp);
                    LanguageVP.Width = 100;
                }
            } // if( SelectedPhraseIds.Count > 0 )

            return(View);
        } // setupPhraseView()
        } // getPercentDone()

        /// <summary>
        /// Run the next iteration of this batch operation
        /// </summary>
        public void runBatchOp(CswNbtObjClassBatchOp BatchNode)
        {
            try
            {
                if (BatchNode != null && BatchNode.OpNameValue == CswEnumNbtBatchOpName.MultiEdit)
                {
                    BatchNode.start();

                    MultiEditBatchData BatchData = new MultiEditBatchData(BatchNode.BatchData.Text);
                    if (BatchData.SourceNodeId != null && BatchData.CopyNodeIds.Count > 0 && BatchData.NodeTypePropIds.Count > 0)
                    {
                        CswNbtNode SourceNode = _CswNbtResources.Nodes[BatchData.SourceNodeId];
                        if (SourceNode != null)
                        {
                            string NodeIdStr = BatchData.CopyNodeIds.First.ToString();

                            CswPrimaryKey CopyToNodePk = new CswPrimaryKey();
                            CopyToNodePk.FromString(NodeIdStr);

                            if (Int32.MinValue != CopyToNodePk.PrimaryKey)
                            {
                                CswNbtNode CopyToNode = _CswNbtResources.Nodes[CopyToNodePk];
                                if (CopyToNode != null &&
                                    _CswNbtResources.Permit.isNodeWritable(CswEnumNbtNodeTypePermission.Edit, CopyToNode.getNodeType(), CopyToNode.NodeId))
                                {
                                    foreach (CswNbtMetaDataNodeTypeProp NodeTypeProp in BatchData.NodeTypePropIds.Select(PropId => _CswNbtResources.MetaData.getNodeTypeProp(CswConvert.ToInt32(PropId))))
                                    {
                                        CopyToNode.Properties[NodeTypeProp].copy(SourceNode.Properties[NodeTypeProp]);
                                    }

                                    CopyToNode.postChanges(false);

                                    //BatchNode.appendToLog( "Copied values for: " + CopyToNode.NodeName + " (" + CopyToNode.NodeId.PrimaryKey.ToString() + ")" );
                                } // if( CopyToNode != null )
                            }     // if( Int32.MinValue != CopyToNodePk.PrimaryKey )

                            // Setup for next iteration
                            BatchData.CopyNodeIds.RemoveAt(0);
                            BatchNode.BatchData.Text    = BatchData.ToString();
                            BatchNode.PercentDone.Value = getPercentDone(BatchNode);
                        } // if( SourceNode != null )
                        else
                        {
                            BatchNode.finish();
                        }
                    }
                    else
                    {
                        BatchNode.finish();
                    }

                    BatchNode.postChanges(false);
                } // if( BatchNode != null && BatchNode.OpNameValue == NbtBatchOpName.MultiEdit )
            }
            catch (Exception ex)
            {
                BatchNode.error(ex);
            }
        } // runBatchOp()
示例#14
0
        public static void ClearMolFingerprint(ICswResources CswResources, MolDataReturn Return, MolData Request)
        {
            //TODO: remove me
            CswNbtResources NbtResources = (CswNbtResources)CswResources;
            CswPrimaryKey   pk           = new CswPrimaryKey();

            pk.FromString(Request.nodeId);
        }
            private static CswPrimaryKey _setLocationPk(JToken BatchDataLocation)
            {
                CswPrimaryKey Location   = null;
                string        LocationId = CswConvert.ToString(BatchDataLocation);

                if (false == String.IsNullOrEmpty(LocationId))
                {
                    Location = new CswPrimaryKey();
                    Location.FromString(LocationId);
                }
                return(Location);
            }
        private void _deleteNode(string NodePk)
        {
            CswPrimaryKey DeleteNodePk = new CswPrimaryKey();

            DeleteNodePk.FromString(NodePk);

            if (Int32.MinValue != DeleteNodePk.PrimaryKey)
            {
                CswNbtNode DeleteNode = _CswNbtResources.Nodes[DeleteNodePk];
                if (DeleteNode != null)
                {
                    DeleteNode.delete();
                }
            }
        }
示例#17
0
 /// <summary>
 /// Index of nodes by NodeId.  NodeTypeId is looked up and NodeSpecies.Plain is assumed.  See <see cref="GetNode(CswPrimaryKey, int, CswEnumNbtNodeSpecies, CswDateTime)"/>
 /// </summary>
 /// <param name="NodeId">String representation of Primary Key of Node</param>
 public CswNbtNode this[string NodePk]
 {
     get
     {
         CswNbtNode    Ret    = null;
         CswPrimaryKey NodeId = new CswPrimaryKey();
         NodeId.FromString(NodePk);
         Debug.Assert(CswTools.IsPrimaryKey(NodeId), "The request did not specify a valid materialid.");
         if (CswTools.IsPrimaryKey(NodeId))
         {
             Ret = this[NodeId];
         }
         return(Ret);
     }
 }
        public override void ReadJSON(JObject JObject, Dictionary <Int32, Int32> NodeMap, Dictionary <Int32, Int32> NodeTypeMap)
        {
            if (null != JObject[_QuantitySubField.ToXmlNodeName(true)])
            {
                Quantity = CswConvert.ToDouble(JObject[_QuantitySubField.ToXmlNodeName(true)].ToString());
            }
            if (null != JObject[_UnitNameSubField.ToXmlNodeName(true)])
            {
                CachedUnitName = JObject[_UnitNameSubField.ToXmlNodeName(true)].ToString();
            }
            //if( null != JObject[_Val_kg_SubField.ToXmlNodeName( true )] )
            //{
            //    Val_kg = CswConvert.ToDouble( JObject[_Val_kg_SubField.ToXmlNodeName( true )].ToString() );
            //}
            //if( null != JObject[_Val_Liters_SubField.ToXmlNodeName( true )] )
            //{
            //    Val_Liters = CswConvert.ToDouble( JObject[_Val_Liters_SubField.ToXmlNodeName( true )].ToString() );
            //}

            if (null != JObject[_UnitIdSubField.ToXmlNodeName(true)])
            {
                string        NodePkString = JObject[_UnitIdSubField.ToXmlNodeName(true)].ToString();
                CswPrimaryKey thisUnitId   = new CswPrimaryKey();
                bool          validPk      = thisUnitId.FromString(NodePkString);
                if (false == validPk)
                {
                    thisUnitId.TableName  = "nodes";
                    thisUnitId.PrimaryKey = CswConvert.ToInt32(NodePkString);
                }
                if (CswTools.IsPrimaryKey(thisUnitId))
                {
                    if (NodeMap != null && NodeMap.ContainsKey(thisUnitId.PrimaryKey))
                    {
                        thisUnitId.PrimaryKey = NodeMap[thisUnitId.PrimaryKey];
                    }
                    UnitId = thisUnitId;
                    JObject["destnodeid"] = UnitId.PrimaryKey.ToString();
                    //PendingUpdate = true;
                }
                else
                {
                    UnitId = null;
                }
            }
        }
        public CswNbtActDispenseContainer(CswNbtResources CswNbtResources, string SourceContainerNodeId)
        {
            _CswNbtResources = CswNbtResources;

            if (false == String.IsNullOrEmpty(SourceContainerNodeId))
            {
                CswPrimaryKey SourceContainerPK = new CswPrimaryKey();
                SourceContainerPK.FromString(SourceContainerNodeId);
                _SourceContainer = _CswNbtResources.Nodes.GetNode(SourceContainerPK);
            }
            else
            {
                throw new CswDniException(CswEnumErrorType.Error, "Cannot execute dispense contianer action with an undefined Source Container.", "Attempted to constuct CswNbtActDispenseContainer without a valid Source Container.");
            }
            if (false == _CswNbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.CISPro))
            {
                throw new CswDniException(CswEnumErrorType.Error, "Cannot use the Dispense action without the required module.", "Attempted to constuct CswNbtActSubmitRequest without the required module.");
            }
        }
示例#20
0
        /// <summary>
        /// Run the next iteration of this batch operation
        /// </summary>
        public void runBatchOp(CswNbtObjClassBatchOp BatchNode)
        {
            try
            {
                if (BatchNode != null && BatchNode.OpNameValue == CswEnumNbtBatchOpName.MultiButtonClick)
                {
                    BatchNode.start();

                    MultiButtonClickBatchData BatchData = new MultiButtonClickBatchData(BatchNode.BatchData.Text);
                    if (BatchData.MultiNodeIds.Count > 0)
                    {
                        String        NodeIdStr   = BatchData.MultiNodeIds.First.ToString();
                        CswPrimaryKey MultiNodePk = new CswPrimaryKey();
                        MultiNodePk.FromString(NodeIdStr);

                        CswNbtMetaDataNodeTypeProp NodeTypeProp = _CswNbtResources.MetaData.getNodeTypeProp(BatchData.NodeTypePropId);
                        if (Int32.MinValue != MultiNodePk.PrimaryKey && null != NodeTypeProp)
                        {
                            CswNbtObjClass.NbtButtonData ButtonData = new CswNbtObjClass.NbtButtonData(NodeTypeProp);
                            CswNbtNode MultiNode = _CswNbtResources.Nodes[MultiNodePk];
                            if (MultiNode != null)
                            {
                                MultiNode.ObjClass.triggerOnButtonClick(ButtonData);
                            }
                        }
                        // Setup for next iteration
                        BatchData.MultiNodeIds.RemoveAt(0);
                        BatchNode.BatchData.Text    = BatchData.ToString();
                        BatchNode.PercentDone.Value = getPercentDone(BatchNode);
                    }
                    else
                    {
                        BatchNode.finish();
                    }
                    BatchNode.postChanges(false);
                }
            }
            catch (Exception ex)
            {
                BatchNode.error(ex);
            }
        } // runBatchOp()
示例#21
0
        } // registerBalanceConfiguration()




        public static void getBalanceInformation( ICswResources CswResources, CswNbtBalanceReturn Return, string Request )
        {

            CswNbtResources NbtResources = (CswNbtResources) CswResources;
            Return.Data.BalanceList = new Collection<SerialBalance>();
            CswPrimaryKey BalanceKey = new CswPrimaryKey();
            BalanceKey.FromString( Request );


            CswNbtObjClassBalance Balance = NbtResources.Nodes[BalanceKey];

            Return.Data.BalanceList.Add( new SerialBalance
            {
                NbtName = Balance.Name.Text,
                CurrentWeight = Balance.Quantity.Quantity,
                UnitOfMeasurement = Balance.Quantity.CachedUnitName,
                NodeId = Balance.NodeId.ToString(),
                IsActive = (Balance.LastActive.DateTimeValue + TimeSpan.FromMinutes(10) > DateTime.Now),
            } );


        }//getBalanceInformation( ICswResources CswResources, CswNbtBalanceReturn Return, string Request )
        /// <summary>
        /// Helper method for adding data to the return object
        /// </summary>
        private static void _addToGraph(CswNbtExplorerReturn Return, string Label, string OwnerId, string TargetId, string Icon, int level, string Type, string Id, string MetaDataName, int RelatingPropId)
        {
            string URI = "api/v1/" + MetaDataName;

            if ("Instance" == Type)
            {
                CswPrimaryKey nodeid = new CswPrimaryKey();
                nodeid.FromString(TargetId);
                URI += "/" + nodeid.PrimaryKey;
            }

            Return.Data.Nodes.Add(new CswNbtArborNode()
            {
                NodeIdStr = TargetId,
                data      = new CswNbtArborNode.CswNbtArborNodeData()
                {
                    Icon           = "Images/newicons/100/" + Icon,
                    Label          = Label,
                    NodeId         = Id,
                    Level          = level,
                    Type           = Type,
                    URI            = URI,
                    RelatingPropId = RelatingPropId
                }
            });

            if (false == String.IsNullOrEmpty(OwnerId) && false == String.IsNullOrEmpty(TargetId))
            {
                Return.Data.Edges.Add(new CswNbtArborEdge()
                {
                    OwnerNodeIdStr  = OwnerId,
                    TargetNodeIdStr = TargetId,
                    data            = new CswNbtArborEdge.CswNbtArborEdgeData()
                    {
                        Length = level * 10
                    }
                });
            }
        }
示例#23
0
        } // getPercentDone()

        /// <summary>
        /// Run the next iteration of this batch operation
        /// </summary>
        public void runBatchOp(CswNbtObjClassBatchOp BatchNode)
        {
            if (BatchNode != null && BatchNode.OpNameValue == CswEnumNbtBatchOpName.BulkEdit)
            {
                try
                {
                    bool NoErrors = true;
                    BatchNode.start();

                    BulkEditBatchData BatchData = new BulkEditBatchData(BatchNode.BatchData.Text);

                    if (BatchData.CurrentRow < BatchData.TotalRows)
                    {
                        if (null != BatchData.excelData.Columns["nodeid"])
                        {
                            int   NodesProcessedPerIteration = CswConvert.ToInt32(_CswNbtResources.ConfigVbls.getConfigVariableValue(CswEnumConfigurationVariableNames.NodesProcessedPerCycle));
                            Int32 r;
                            for (r = BatchData.CurrentRow; r < BatchData.excelData.Rows.Count && (r - BatchData.CurrentRow) < NodesProcessedPerIteration && NoErrors; r++)
                            {
                                try
                                {
                                    DataRow row = BatchData.excelData.Rows[r];

                                    CswPrimaryKey NodeId = new CswPrimaryKey();
                                    NodeId.FromString(row["nodeid"].ToString());
                                    if (CswTools.IsPrimaryKey(NodeId))
                                    {
                                        CswNbtNode Node = _CswNbtResources.Nodes[NodeId];
                                        if (null != Node)
                                        {
                                            foreach (DataColumn col in BatchData.excelData.Columns)
                                            {
                                                if (NoErrors)
                                                {
                                                    try
                                                    {
                                                        if (col.ColumnName != "nodeid")
                                                        {
                                                            CswNbtMetaDataNodeTypeProp Prop = Node.getNodeType().getNodeTypeProp(col.ColumnName);
                                                            CswNbtSubField             SubField;
                                                            if (null != Prop)
                                                            {
                                                                SubField = Prop.getFieldTypeRule().SubFields.Default;
                                                            }
                                                            else
                                                            {
                                                                string propName     = col.ColumnName.Substring(0, col.ColumnName.LastIndexOf(" "));
                                                                string subFieldName = col.ColumnName.Substring(col.ColumnName.LastIndexOf(" ") + 1);
                                                                Prop     = Node.getNodeType().getNodeTypeProp(propName);
                                                                SubField = Prop.getFieldTypeRule().SubFields[(CswEnumNbtSubFieldName)subFieldName];
                                                            }
                                                            Node.Properties[Prop].SetSubFieldValue(SubField, row[col.ColumnName]);
                                                        } // if( col.ColumnName != "nodeid" )
                                                    }     // try
                                                    catch (Exception ex)
                                                    {
                                                        BatchNode.error(ex, "Error on row: " + (r + 1).ToString() + ", column: " + col.ColumnName + "; ");
                                                        NoErrors = false;
                                                    }
                                                }
                                            } // foreach( DataColumn col in BatchData.excelData.Columns )
                                        }     // if( null != Node )
                                        Node.postChanges(false);
                                    }         // if( CswTools.IsPrimaryKey( NodeId ) )
                                }             // try
                                catch (Exception ex)
                                {
                                    BatchNode.error(ex, "Error on row: " + (r + 1).ToString() + "; ");
                                    NoErrors = false;
                                }
                            } // for

                            if (NoErrors)
                            {
                                // Setup for next iteration
                                BatchData.CurrentRow        = r;
                                BatchNode.BatchData.Text    = BatchData.ToString();
                                BatchNode.PercentDone.Value = getPercentDone(BatchNode);
                            }
                        } // if( null != BatchData.excelData.Columns["nodeid"] )
                    }     // if(BatchData.CurrentRow < BatchData.TotalRows)
                    else
                    {
                        BatchNode.finish();
                    }
                    BatchNode.postChanges(false);
                }
                catch (Exception ex)
                {
                    BatchNode.error(ex);
                }
            } // if( BatchNode != null && BatchNode.OpNameValue == NbtBatchOpName.MultiEdit )
        }     // runBatchOp()
        private CswNbtNode _commitMaterialNode(JObject MaterialObj)
        {
            CswNbtNode Ret = null;

            Int32 MaterialNodeTypeId = CswConvert.ToInt32(MaterialObj["materialnodetypeid"]);

            if (Int32.MinValue != MaterialNodeTypeId)
            {
                CswNbtMetaDataNodeType MaterialNt = _CswNbtResources.MetaData.getNodeType(MaterialNodeTypeId);
                if (null != MaterialNt)
                {
                    Ret = _CswNbtResources.Nodes[CswConvert.ToString(MaterialObj["materialId"])];
                    if (null != Ret)
                    {
                        // Set the Vendor node property isTemp = false if necessary
                        bool          IsConstituent = CswConvert.ToBoolean(MaterialObj["isConstituent"]);
                        CswPrimaryKey VendorNodePk  = CswConvert.ToPrimaryKey(CswConvert.ToString(MaterialObj["supplierid"]));
                        if (CswTools.IsPrimaryKey(VendorNodePk) && false == IsConstituent)
                        {
                            CswNbtObjClassVendor VendorNode = _CswNbtResources.Nodes.GetNode(VendorNodePk);
                            if (null != VendorNode && VendorNode.IsTemp)
                            {
                                VendorNode.PromoteTempToReal();
                            }
                        }

                        //Ret.IsTemp = false;
                        JObject MaterialProperties          = (JObject)MaterialObj["properties"];
                        CswNbtSdTabsAndProps SdTabsAndProps = new CswNbtSdTabsAndProps(_CswNbtResources);
                        SdTabsAndProps.saveProps(Ret.NodeId, Int32.MinValue, MaterialProperties, Ret.NodeTypeId, null, IsIdentityTab: false, setIsTempToFalse: false);

                        NewMaterial FinalMaterial = new NewMaterial(_CswNbtResources, Ret);
                        FinalMaterial.TradeName = CswConvert.ToString(MaterialObj["tradename"]);
                        if (false == IsConstituent)
                        {
                            FinalMaterial.SupplierId = CswConvert.ToPrimaryKey(CswConvert.ToString(MaterialObj["supplierid"]));
                            FinalMaterial.PartNo     = CswConvert.ToString(MaterialObj["partno"]);
                        }

                        CswNbtPropertySetMaterial NodeAsMaterial = FinalMaterial.commit();
                        NodeAsMaterial.Save.setHidden(value: false, SaveToDb: true);

                        JObject RequestObj = CswConvert.ToJObject(MaterialObj["request"]);
                        if (RequestObj.HasValues)
                        {
                            _processRequest(CswConvert.ToString(RequestObj["requestitemid"]), NodeAsMaterial);
                        }
                        CswNbtActReceiving Receiving = new CswNbtActReceiving(_CswNbtResources);

                        CswPrimaryKey SDSNodeId = new CswPrimaryKey();
                        if (null != MaterialObj["sdsDocId"])
                        {
                            SDSNodeId.FromString(MaterialObj["sdsDocId"].ToString());
                            JObject SDSProps = CswConvert.ToJObject(MaterialObj["sdsDocProperties"]);
                            Receiving.commitSDSDocNode(NodeAsMaterial.NodeId, SDSNodeId, SDSProps);
                        }
                        Ret.PromoteTempToReal();
                    }
                }

                if (null == Ret)
                {
                    throw new CswDniException(CswEnumErrorType.Error,
                                              "Failed to create new material.",
                                              "Attempted to call _commitMaterialNode failed.");
                }
            }
            return(Ret);
        }
        public void assignPropsToLocations( string LocationNodeKeys, bool UpdateInventoryGroup, string SelectedInventoryGroupNodeId, bool UpdateAllowInventory, string AllowInventory, bool UpdateControlZone, string SelectedControlZoneNodeId, bool UpdateStorageCompatability, string SelectedImages )
        {

            if( false == string.IsNullOrEmpty( LocationNodeKeys ) )
            {


                ///we don't pre-load he allowinventory value because there's no extra expense
                ///to doing so repeatedly in the loop

                CswNbtNode InventoryGroupNode = null;
                if( ( true == UpdateInventoryGroup ) && ( false == string.IsNullOrEmpty( SelectedInventoryGroupNodeId ) ) )
                {
                    CswPrimaryKey IGKey = new CswPrimaryKey();
                    IGKey.FromString( SelectedInventoryGroupNodeId );
                    InventoryGroupNode = _CswNbtResources.Nodes[IGKey];
                }

                CswNbtNode ControlZoneNode = null;
                if( ( true == UpdateControlZone ) && ( false == string.IsNullOrEmpty( SelectedControlZoneNodeId ) ) )
                {
                    CswPrimaryKey IGKey = new CswPrimaryKey();
                    IGKey.FromString( SelectedControlZoneNodeId );
                    ControlZoneNode = _CswNbtResources.Nodes[IGKey];
                }



                CswDelimitedString Images = new CswDelimitedString( ',' );
                if( true == UpdateStorageCompatability )
                {
                    if( false == string.IsNullOrEmpty( SelectedImages ) )
                    {
                        Images.FromString( SelectedImages );
                    }
                }



                foreach( string CurrentLocationKey in LocationNodeKeys.Split( ',' ) )
                {
                    if( false == string.IsNullOrEmpty( CurrentLocationKey ) )
                    {
                        CswNbtNodeKey LKey = new CswNbtNodeKey( CurrentLocationKey );
                        CswNbtObjClassLocation CurrentLocationNode = _CswNbtResources.Nodes[LKey];
                        if( null != CurrentLocationNode )
                        {

                            if( true == UpdateInventoryGroup )
                            {
                                if( null != InventoryGroupNode )
                                {
                                    CurrentLocationNode.InventoryGroup.RelatedNodeId = InventoryGroupNode.NodeId;
                                }
                                else
                                {
                                    CurrentLocationNode.InventoryGroup.RelatedNodeId = null;
                                }
                            }

                            if( true == UpdateControlZone )
                            {
                                if( null != ControlZoneNode )
                                {
                                    CurrentLocationNode.ControlZone.RelatedNodeId = ControlZoneNode.NodeId;
                                }
                                else
                                {
                                    CurrentLocationNode.ControlZone.RelatedNodeId = null;
                                }
                            }
                            

                            if( UpdateAllowInventory )
                            {
                                CurrentLocationNode.AllowInventory.Checked = CswConvert.ToTristate( AllowInventory );
                            }

                            if( UpdateStorageCompatability )
                            {
                                CurrentLocationNode.StorageCompatibility.Value = Images;
                            }

                            CurrentLocationNode.postChanges( true );

                        }//if current key yielded a node

                    } //if there is a location keye

                } //iterate locations


            }//if we have location keys

        }//assignInventoryGroupToLocations() 
示例#26
0
        } //getDemoDataGrid()

        public static void getDemoDataNodesAsGrid(ICswResources CswResources, CswNbtDemoDataReturn Return, CswNbtDemoDataRequests.CswDemoNodesGridRequest Request)
        {
            CswNbtResources CswNbtResources = (CswNbtResources)CswResources;

            //Build table infrastructure
            DataTable GridTable = new DataTable("depdendentnodestable");

            GridTable.Columns.Add(CswNbtDemoDataReturn.ColumnNames.NodeId, typeof(Int32));
            GridTable.Columns.Add(CswNbtDemoDataReturn.ColumnNames.Name, typeof(string));
            GridTable.Columns.Add(CswNbtDemoDataReturn.ColumnNames.Type, typeof(string));
            GridTable.Columns.Add(CswNbtDemoDataReturn.ColumnNames.IsDemo, typeof(string));
            //            GridTable.Columns.Add( CswNbtDemoDataReturn.ColumnNames.Action, typeof( sbyte ) );
            GridTable.Columns.Add(CswNbtDemoDataReturn.ColumnNames.MenuOptions, typeof(string));


            string DependentNodesQuery = "select n.nodeid, t.nodetypeid, n.nodename as \"name\" ,n.isdemo \"Is Demo\", t.nodetypename as \"type\" ";

            DependentNodesQuery += "from nodes n ";
            DependentNodesQuery += "join nodetypes t on (n.nodetypeid=t.nodetypeid) ";



            //We have to cope with oracle's limit of 1000 on lists
            //as per case 29811
            DependentNodesQuery += " where ";
            List <string> AllNodeIds        = Request.NodeIds;
            int           NumberoFInClauses = (AllNodeIds.Count / 1000) + 1; //we _only_ want the whole-number result here

            for (int idx = 0; idx < NumberoFInClauses; idx++)
            {
                if (idx > 0)
                {
                    DependentNodesQuery += " or ";
                }

                List <string> CurrentList = null;
                if (AllNodeIds.Count > 1000)
                {
                    CurrentList = AllNodeIds.GetRange(0, 1000);
                    AllNodeIds.RemoveRange(0, 1000);
                }
                else
                {
                    CurrentList = AllNodeIds;
                }

                CswDelimitedString DepdendentNodeIds = new CswDelimitedString(',');
                DepdendentNodeIds.FromArray(CurrentList.ToArray());
                DependentNodesQuery += " n.nodeid in (" + DepdendentNodeIds.ToString() + ") ";
            }



            DependentNodesQuery += "order by lower(n.nodename), lower(t.nodetypename)";

            CswArbitrarySelect DependentNodesSelect      = CswNbtResources.makeCswArbitrarySelect("select_depdendent_nodes", DependentNodesQuery);
            DataTable          DepdendentNodesTableTable = DependentNodesSelect.getTable();

            foreach (DataRow CurrentDependentNodeRow in DepdendentNodesTableTable.Rows)
            {
                DataRow NewGridRowOfDependentNodes = GridTable.NewRow();
                GridTable.Rows.Add(NewGridRowOfDependentNodes);

                NewGridRowOfDependentNodes[CswNbtDemoDataReturn.ColumnNames.NodeId] = CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.NodeId];
                NewGridRowOfDependentNodes[CswNbtDemoDataReturn.ColumnNames.Name]   = CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.Name];
                NewGridRowOfDependentNodes[CswNbtDemoDataReturn.ColumnNames.Type]   = CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.Type];
                NewGridRowOfDependentNodes[CswNbtDemoDataReturn.ColumnNames.IsDemo] = ("1" == CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.IsDemo].ToString()) ? "yes" : "no";

                CswPrimaryKey cswPrimaryKey = new CswPrimaryKey();
                cswPrimaryKey.FromString("nodes_" + CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.NodeId].ToString());
                CswNbtNodeKey CswNbtNodeKey = new CswNbtNodeKey();
                CswNbtNodeKey.NodeId     = cswPrimaryKey;
                CswNbtNodeKey.NodeTypeId = CswConvert.ToInt32(CurrentDependentNodeRow["nodetypeid"]);


                string menu_options = "{ ";
                menu_options += "\"nodeid\" : \"nodes_" + CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.NodeId].ToString() + "\",";
                menu_options += "\"nodename\" : \" " + CurrentDependentNodeRow[CswNbtDemoDataReturn.ColumnNames.Name].ToString() + "\",";
                menu_options += "\"nodekey\" : \" " + CswNbtNodeKey.ToString() + "\"";
                menu_options += " }";


                NewGridRowOfDependentNodes[CswNbtDemoDataReturn.ColumnNames.MenuOptions] = menu_options;
            }//iterate result rows

            CswNbtGrid Grid = new CswNbtGrid(CswNbtResources);

            Return.Data.Grid = Grid.DataTableToGrid(GridTable, IncludeEditFields: false);
        }//getDemoDataNodesAsGrid()
示例#27
0
        public void updateDemoData( List<string> node_ids_convert_to_non_demo, List<string> view_ids_convert_to_non_demo, List<string> node_ids_remove, List<string> view_ids_remove, List<string> Errors )
        {

            //*****************
            //just in case: converto-to-non-demo takes precendence over delete?
            foreach( string CurrentViewId in view_ids_convert_to_non_demo )
            {
                if( view_ids_remove.Contains( CurrentViewId ) )
                {
                    view_ids_remove.Remove( CurrentViewId );
                }
            }

            foreach( string CurrentnodeId in node_ids_convert_to_non_demo )
            {
                if( node_ids_remove.Contains( CurrentnodeId ) )
                {
                    node_ids_remove.Remove( CurrentnodeId );
                }
            }



            //**********************
            // Views 
            if( view_ids_convert_to_non_demo.Count > 0 )
            {

                CswCommaDelimitedString ViewIdsToConvert = new CswCommaDelimitedString();
                ViewIdsToConvert.FromArray( view_ids_convert_to_non_demo.ToArray() );

                try
                {

                    CswTableUpdate ConvertViewsToNonDemoUpdate = _CswNbtResources.makeCswTableUpdate( "update_views_to_non_demo", "node_views" );
                    DataTable ViewsTable = ConvertViewsToNonDemoUpdate.getTable( " where nodeviewid in (" + ViewIdsToConvert.ToString() + ")" );
                    foreach( DataRow CurrentRow in ViewsTable.Rows )
                    {
                        CurrentRow["isdemo"] = CswConvert.ToDbVal( false );
                    }

                    ConvertViewsToNonDemoUpdate.update( ViewsTable );
                }
                catch( Exception Exception )
                {

                    Errors.Add( "Error converting demo views " + ViewIdsToConvert.ToString() + " to non-demo: " + Exception.Message );
                }

            }//if we have view to udpate


            if( view_ids_remove.Count > 0 )
            {

                CswCommaDelimitedString ViewIdsToRemove = new CswCommaDelimitedString();
                ViewIdsToRemove.FromArray( view_ids_remove.ToArray() );
                try
                {

                    CswTableUpdate ConvertViewsToNonDemoUpdate = _CswNbtResources.makeCswTableUpdate( "delete_demo_views", "node_views" );
                    string WhereClause = " where nodeviewid in (" + ViewIdsToRemove.ToString() + ")";
                    DataTable ViewsTable = ConvertViewsToNonDemoUpdate.getTable( WhereClause );
                    foreach( DataRow CurrentRow in ViewsTable.Rows )
                    {
                        CurrentRow.Delete();
                    }

                    ConvertViewsToNonDemoUpdate.update( ViewsTable );
                }
                catch( Exception Exception )
                {

                    Errors.Add( "Error removing demo views " + ViewIdsToRemove.ToString() + " : " + Exception.Message );
                }

            }//if we have view to udpate


            //***************************************************************
            // ***** Nodes
            //**********************
            if( node_ids_convert_to_non_demo.Count > 0 )
            {

                CswDelimitedString NodesIdsToconvert = new CswCommaDelimitedString();
                NodesIdsToconvert.FromArray( node_ids_convert_to_non_demo.ToArray() );

                try
                {

                    CswTableUpdate ConvertNodesToNonDemoUpdate = _CswNbtResources.makeCswTableUpdate( "update_Nodes_to_non_demo", "nodes" );
                    DataTable NodesTable = ConvertNodesToNonDemoUpdate.getTable( " where Nodeid in (" + NodesIdsToconvert + ")" );
                    foreach( DataRow CurrentRow in NodesTable.Rows )
                    {
                        CurrentRow["isdemo"] = CswConvert.ToDbVal( false );
                    }

                    ConvertNodesToNonDemoUpdate.update( NodesTable );
                }

                catch( Exception Exception )
                {

                    Errors.Add( "Error converting nodes " + NodesIdsToconvert.ToString() + " to non-demo: " + Exception.Message );
                }

            }//if we have nodes to convert


            if( node_ids_remove.Count > 0 )
            {
                foreach( string NodeIdToRemove in node_ids_remove )
                {
                    try
                    {
                        CswPrimaryKey NodePrimeKey = new CswPrimaryKey();
                        NodePrimeKey.FromString( "nodes_" + NodeIdToRemove );
                        CswNbtNode CurrentNode = _CswNbtResources.Nodes[NodePrimeKey];
                        if( null != CurrentNode )
                        {
                            CurrentNode.delete();
                        }

                    }
                    catch( Exception Exception )
                    {
                        string Error = "Error removing nodes to non-demo: " + Exception.Message;
                        Errors.Add( Error );
                    }

                }//iterate node ids to remove

            }//if we have nodes to delete

        }//updateDemoData()