Exemple #1
0
        private JProperty _getNode(CswNbtNode ThisNode, bool RunProps = true, NodeSpecies ThisNodeSpecies = null)
        {
            JProperty Ret = new JProperty("No Results");

            if (null != ThisNode)
            {
                string ThisNodeName = ThisNode.NodeName;

                Ret = new JProperty(NodeIdPrefix + ThisNode.NodeId);
                JObject NodeProps = new JObject();
                Ret.Value = NodeProps;

                NodeSpecies NodeSpecie = ThisNodeSpecies ?? ThisNode.NodeSpecies;
                if (NodeSpecies.More == NodeSpecie)
                {
                    ThisNodeName = "Results Truncated at " + _MobilePageSize;
                }

                NodeProps["node_name"]   = CswTools.SafeJavascriptParam(ThisNodeName);
                NodeProps["nodetype"]    = CswTools.SafeJavascriptParam(ThisNode.getNodeType().NodeTypeName);
                NodeProps["objectclass"] = CswTools.SafeJavascriptParam(ThisNode.getObjectClass().ObjectClass.ToString());
                NodeProps["nodespecies"] = CswTools.SafeJavascriptParam(NodeSpecie.ToString());
                if (RunProps)
                {
                    JObject TabsObj = new JObject();
                    NodeProps["tabs"] = TabsObj;
                    _runProperties(ThisNode, TabsObj);
                }

                if (ThisNode.Locked)
                {
                    NodeProps["iconfilename"] = "Images/quota/lock.gif";
                }
                else if (false == string.IsNullOrEmpty(ThisNode.IconFileName))
                {
                    NodeProps["iconfilename"] = CswNbtMetaDataObjectClass.IconPrefix16 + CswTools.SafeJavascriptParam(ThisNode.IconFileName);
                }

                _addObjectClassProps(ThisNode, NodeProps);

                foreach (CswNbtMetaDataNodeTypeProp MetaDataProp in _CswNbtResources.MetaData.getNodeTypeProps(ThisNode.NodeTypeId)
                         .Cast <CswNbtMetaDataNodeTypeProp>()
                         .Where(MetaDataProp => MetaDataProp.MobileSearch))
                {
                    if ((MetaDataProp.getObjectClassProp() != null))
                    {
                        NodeProps["search_ocp_" + MetaDataProp.ObjectClassPropId] = CswTools.SafeJavascriptParam(ThisNode.Properties[MetaDataProp].Gestalt);
                    }
                    else
                    {
                        NodeProps["search_ntp_" + MetaDataProp.PropId] = CswTools.SafeJavascriptParam(ThisNode.Properties[MetaDataProp].Gestalt);
                    }
                }
            }
            return(Ret);
        }
Exemple #2
0
        private static void _addObjectClassProps(CswNbtNode Node, JObject NodeProps)
        {
            switch (Node.getObjectClass().ObjectClass)
            {
            case CswNbtMetaDataObjectClass.NbtObjectClass.InspectionDesignClass:
            {
                NodeProps["location"] = Node.Properties[CswNbtObjClassInspectionDesign.PropertyName.Location].Gestalt;
                NodeProps["duedate"]  = Node.Properties[CswNbtObjClassInspectionDesign.PropertyName.Date].Gestalt;
                NodeProps["status"]   = Node.Properties[CswNbtObjClassInspectionDesign.PropertyName.Status].Gestalt;
                NodeProps["target"]   = Node.Properties[CswNbtObjClassInspectionDesign.PropertyName.Target].Gestalt;
                break;
            }

            case CswNbtMetaDataObjectClass.NbtObjectClass.InspectionTargetClass:
            {
                NodeProps["location"]    = Node.Properties[CswNbtObjClassInspectionTarget.PropertyName.Location].Gestalt;
                NodeProps["description"] = Node.Properties[CswNbtObjClassInspectionTarget.PropertyName.Description].Gestalt;
                NodeProps["status"]      = Node.Properties[CswNbtObjClassInspectionTarget.PropertyName.Status].Gestalt;
                //NodeProps["lastinspectiondate"] = Node.Properties[CswNbtObjClassInspectionTarget.LastInspectionDatePropertyName].Gestalt;
                break;
            }
            }
        }
Exemple #3
0
 public void GetResource(CswNbtResource Return, CswNbtAPIGenericRequest GenericRequest)
 {
     if (hasPermission(GenericRequest, Return))
     {
         try
         {
             CswNbtNode Node = _CswNbtResources.Nodes.GetNode(GenericRequest.NodeId);
             if (null != Node && GenericRequest.MetaDataName.ToLower() == Node.getNodeType().NodeTypeName.ToLower())
             {
                 Return.NodeId      = GenericRequest.NodeId;
                 Return.NodeName    = Node.NodeName;
                 Return.NodeType    = Node.getNodeType().NodeTypeName;
                 Return.ObjectClass = Node.ObjClass.ObjectClass.ObjectClassName;
                 CswNbtMetaDataPropertySet propSet = Node.getObjectClass().getPropertySet();
                 if (null != propSet)
                 {
                     Return.PropertySet = propSet.Name;
                 }
                 Return.URI          = BuildURI(Return.NodeType, Node.NodeId.PrimaryKey);
                 Return.PropertyData = GetPropertyData(Node);
             }
             else
             {
                 Return.Status = HttpStatusCode.NotFound;
             }
         }
         catch (Exception)
         {
             Return.Status = HttpStatusCode.InternalServerError;
         }
     }
     else
     {
         Return.Status = HttpStatusCode.Forbidden;
     }
 }
Exemple #4
0
        public JObject getMenu(CswNbtView View, string SafeNodeKey, Int32 NodeTypeId, string PropIdAttr, bool ReadOnly, string NodeId)
        {
            CswTimer MainMenuTimer = new CswTimer();

            JObject Ret = new JObject();

            CswPrimaryKey RelatedNodeId   = new CswPrimaryKey();
            string        RelatedNodeName = string.Empty;
            CswNbtNode    Node            = null;

            if (false == String.IsNullOrEmpty(SafeNodeKey))
            {
                CswNbtNodeKey NbtNodeKey = new CswNbtNodeKey(SafeNodeKey);
                Node = _CswNbtResources.Nodes[NbtNodeKey];
            }
            else if (false == String.IsNullOrEmpty(NodeId))
            {
                CswPrimaryKey NodePk = CswConvert.ToPrimaryKey(NodeId);
                Node = _CswNbtResources.Nodes[NodePk];
            }
            if (null != Node)
            {
                RelatedNodeId   = Node.NodeId;
                RelatedNodeName = Node.NodeName;
            }

            // MORE
            if (_MenuItems.Contains("More"))
            {
                JObject MoreObj = new JObject();

                if (null == View && Int32.MinValue != NodeTypeId)
                {
                    // ADD for Searches
                    if (_MenuItems.Contains("Add") && false == ReadOnly)
                    {
                        JObject AddObj = new JObject();

                        CswNbtMetaDataNodeType NodeType = _CswNbtResources.MetaData.getNodeType(NodeTypeId);
                        if (null != NodeType && _CswNbtResources.Permit.canNodeType(CswEnumNbtNodeTypePermission.Create, NodeType) && NodeType.getObjectClass().CanAdd)
                        {
                            AddObj[NodeType.NodeTypeName] = makeAddMenuItem(NodeType, RelatedNodeId, RelatedNodeName);
                            AddObj["haschildren"]         = true;
                            Ret["Add"] = AddObj;
                        }
                    } // if( _MenuItems.Contains( "Add" ) && false == ReadOnly )
                }     // if( null == View && Int32.MinValue != NodeTypeId )
                if (null != View)
                {
                    // ADD for Views
                    if (_MenuItems.Contains("Add") && false == ReadOnly)
                    {
                        JObject AddObj = new JObject();

                        // case 21672
                        CswNbtViewNode ParentNode = View.Root;
                        bool           LimitToFirstLevelRelationships = (View.ViewMode == CswEnumNbtViewRenderingMode.Grid);
                        if (LimitToFirstLevelRelationships && View.Visibility == CswEnumNbtViewVisibility.Property)
                        {
                            if (null == Node)
                            {
                                ICswNbtTree Tree = _CswNbtResources.Trees.getTreeFromView(View, false, false, false);
                                if (Tree.getChildNodeCount() > 0)
                                {
                                    Tree.goToNthChild(0);
                                    CswNbtNodeKey NodeKey = Tree.getNodeKeyForCurrentPosition();
                                    Node = _CswNbtResources.Nodes[NodeKey];
                                    if (null != Node)
                                    {
                                        RelatedNodeId   = Node.NodeId;
                                        RelatedNodeName = Node.NodeName;
                                    }
                                }
                            }
                            if (View.Root.ChildRelationships.Count > 0)
                            {
                                ParentNode = View.Root.ChildRelationships[0];
                            }
                        }
                        foreach (JProperty AddNodeType in ParentNode.AllowedChildNodeTypes(LimitToFirstLevelRelationships)
                                 .Select(Entry => new JProperty(Entry.NodeType.NodeTypeName,
                                                                makeAddMenuItem(Entry.NodeType, RelatedNodeId, RelatedNodeName))))
                        {
                            AddObj.Add(AddNodeType);
                        }

                        if (AddObj.HasValues)
                        {
                            AddObj["haschildren"] = true;
                            Ret["Add"]            = AddObj;
                        }
                    }

                    // COPY
                    if (
                        _MenuItems.Contains("Copy") &&
                        false == ReadOnly &&
                        null != Node && Node.NodeSpecies == CswEnumNbtNodeSpecies.Plain &&
                        View.ViewMode != CswEnumNbtViewRenderingMode.Grid &&
                        _CswNbtResources.Permit.canNodeType(CswEnumNbtNodeTypePermission.Create, Node.getNodeType()) &&
                        Node.getObjectClass().CanAdd //If you can't Add the node, you can't Copy it either
                        )
                    {
                        MoreObj["Copy"]               = new JObject();
                        MoreObj["Copy"]["copytype"]   = _getActionType(Node.getNodeType());
                        MoreObj["Copy"]["action"]     = CswEnumNbtMainMenuActions.CopyNode.ToString();
                        MoreObj["Copy"]["nodeid"]     = Node.NodeId.ToString();
                        MoreObj["Copy"]["nodename"]   = Node.NodeName;
                        MoreObj["Copy"]["nodetypeid"] = Node.NodeTypeId.ToString();
                    }

                    // DELETE
                    if (_MenuItems.Contains("Delete") &&
                        false == ReadOnly &&
                        false == string.IsNullOrEmpty(SafeNodeKey) &&
                        null != Node &&
                        View.ViewMode != CswEnumNbtViewRenderingMode.Grid &&
                        Node.NodeSpecies == CswEnumNbtNodeSpecies.Plain &&
                        _CswNbtResources.Permit.isNodeWritable(CswEnumNbtNodeTypePermission.Delete, Node.getNodeType(), Node.NodeId))
                    {
                        MoreObj["Delete"]             = new JObject();
                        MoreObj["Delete"]["action"]   = CswEnumNbtMainMenuActions.DeleteNode.ToString();
                        MoreObj["Delete"]["nodeid"]   = Node.NodeId.ToString();
                        MoreObj["Delete"]["nodename"] = Node.NodeName;
                    }

                    // SAVE VIEW AS
                    if (_MenuItems.Contains("Save View As") &&
                        false == View.ViewId.isSet() &&
                        _CswNbtResources.Permit.can(_CswNbtResources.Actions[CswEnumNbtActionName.Edit_View]))
                    {
                        View.SaveToCache(false);
                        MoreObj["Save View As"]             = new JObject();
                        MoreObj["Save View As"]["action"]   = CswEnumNbtMainMenuActions.SaveViewAs.ToString();
                        MoreObj["Save View As"]["viewid"]   = View.SessionViewId.ToString();
                        MoreObj["Save View As"]["viewmode"] = View.ViewMode.ToString();
                    }

                    JObject PrintObj = null;

                    // PRINT LABEL

                    bool ValidForTreePrint = (false == string.IsNullOrEmpty(SafeNodeKey) &&
                                              View.ViewMode != CswEnumNbtViewRenderingMode.Grid &&
                                              null != Node &&
                                              null != Node.getNodeType() &&
                                              Node.getNodeType().HasLabel);

                    bool  ValidForGridPrint    = false;
                    bool  TryValidForGridPrint = (View.ViewMode == CswEnumNbtViewRenderingMode.Grid);
                    Int32 MultiPrintNodeTypeId = Int32.MinValue;
                    if (TryValidForGridPrint)
                    {
                        CswNbtViewRelationship TryRel = null;
                        if (View.Visibility != CswEnumNbtViewVisibility.Property && View.Root.ChildRelationships.Count == 1)
                        {
                            TryRel = View.Root.ChildRelationships[0];
                        }
                        else if (View.Visibility == CswEnumNbtViewVisibility.Property &&
                                 View.Root.ChildRelationships.Count == 1 &&
                                 View.Root.ChildRelationships[0].ChildRelationships.Count == 1)
                        {
                            TryRel = View.Root.ChildRelationships[0].ChildRelationships[0];
                        }

                        if (null != TryRel)
                        {
                            ICswNbtMetaDataDefinitionObject MdDef = TryRel.SecondMetaDataDefinitionObject();
                            if (null != MdDef)
                            {
                                if (MdDef.HasLabel)
                                {
                                    //This assumes that only NodeTypes will implement this property
                                    MultiPrintNodeTypeId = MdDef.UniqueId;
                                    ValidForGridPrint    = true;
                                }
                            }
                        }
                    }

                    if (_MenuItems.Contains("Print") &&
                        (ValidForTreePrint || ValidForGridPrint))
                    {
                        PrintObj = PrintObj ?? new JObject(new JProperty("haschildren", true));
                        PrintObj["Print Label"]           = new JObject();
                        PrintObj["Print Label"]["action"] = CswEnumNbtMainMenuActions.PrintLabel.ToString();

                        if (ValidForTreePrint)
                        {
                            PrintObj["Print Label"]["nodeid"]     = Node.NodeId.ToString();
                            PrintObj["Print Label"]["nodetypeid"] = Node.NodeTypeId;
                            PrintObj["Print Label"]["nodename"]   = Node.NodeName;
                        }
                        else if (ValidForGridPrint)
                        {
                            PrintObj["Print Label"]["nodetypeid"] = MultiPrintNodeTypeId;
                        }
                    }
                    // PRINT
                    if (_MenuItems.Contains("Print") &&
                        View.ViewMode == CswEnumNbtViewRenderingMode.Grid)
                    {
                        View.SaveToCache(false);
                        PrintObj = PrintObj ?? new JObject(new JProperty("haschildren", true));
                        PrintObj["Print View"]           = new JObject();
                        PrintObj["Print View"]["action"] = CswEnumNbtMainMenuActions.PrintView.ToString();
                    }

                    if (null != PrintObj)
                    {
                        MoreObj["Print"] = PrintObj;
                    }

                    // EXPORT
                    if (_MenuItems.Contains("Export"))
                    {
                        if (CswEnumNbtViewRenderingMode.Grid == View.ViewMode)
                        {
                            JObject ExportObj = new JObject();
                            MoreObj["Export"] = ExportObj;

                            View.SaveToCache(false);
                            ExportObj["CSV"] = new JObject();
                            string ExportLink = "wsNBT.asmx/gridExportCSV?ViewId=" + View.SessionViewId + "&SafeNodeKey='";
                            if (CswEnumNbtViewVisibility.Property == View.Visibility)
                            {
                                ExportLink += SafeNodeKey;
                            }
                            ExportLink += "'";

                            ExportObj["CSV"]["popup"] = ExportLink;

                            ExportObj["haschildren"] = true;
                        }
                    }
                } // if( null != View )

                // EDIT VIEW
                if (_MenuItems.Contains("Edit View") &&
                    _CswNbtResources.Permit.can(CswEnumNbtActionName.Edit_View) &&
                    (null == View || (false == View.IsSystem || CswNbtObjClassUser.ChemSWAdminUsername == _CswNbtResources.CurrentNbtUser.Username)))
                {
                    MoreObj["Edit View"]           = new JObject();
                    MoreObj["Edit View"]["action"] = CswEnumNbtMainMenuActions.editview.ToString();
                }

                if (_MenuItems.Contains("Multi-Edit") &&
                    false == ReadOnly &&
                    null != View &&
                    _CswNbtResources.Permit.can(CswEnumNbtActionName.Multi_Edit) &&
                    // Per discussion with David, for the short term eliminate the need to validate the selection of nodes across different nodetypes in Grid views.
                    // Case 21701: for Grid Properties, we need to look one level deeper
                    // Case 29032: furthermore (for Grids), we need to exclude ObjectClass relationships (which can also produce the multi-nodetype no-no
                    (View.ViewMode != CswEnumNbtViewRenderingMode.Grid ||
                     ((View.Root.ChildRelationships.Count == 1 && View.Root.ChildRelationships[0].SecondType == CswEnumNbtViewRelatedIdType.NodeTypeId) &&
                      (View.Visibility != CswEnumNbtViewVisibility.Property || (View.Root.ChildRelationships[0].ChildRelationships.Count == 1 && View.Root.ChildRelationships[0].ChildRelationships[0].SecondType == CswEnumNbtViewRelatedIdType.NodeTypeId))))
                    )
                {
                    MoreObj["Multi-Edit"]           = new JObject();
                    MoreObj["Multi-Edit"]["action"] = CswEnumNbtMainMenuActions.multiedit.ToString();
                }
                if (_MenuItems.Contains("Bulk Edit") &&
                    false == ReadOnly &&
                    null != View &&
                    _CswNbtResources.Permit.can(CswEnumNbtActionName.Bulk_Edit))
                {
                    MoreObj["Bulk Edit"]           = new JObject();
                    MoreObj["Bulk Edit"]["action"] = CswEnumNbtMainMenuActions.bulkedit.ToString();
                }

                if (MoreObj.Count > 0)
                {
                    MoreObj["haschildren"] = true;
                    Ret["More"]            = MoreObj;
                }
            } // if( _MenuItems.Contains( "More" ) )

            _CswNbtResources.logTimerResult("CswNbtWebServiceMainMenu.getMenu()", MainMenuTimer.ElapsedDurationInSecondsAsString);


            return(Ret);
        } // getMenu()
        public int saveFile(string PropIdAttr, byte[] BlobData, string ContentType, string FileName, out string Href, int BlobDataId = Int32.MinValue, bool PostChanges = true, CswNbtNode Node = null)
        {
            CswPropIdAttr PropId = new CswPropIdAttr(PropIdAttr);

            CswNbtMetaDataNodeTypeProp MetaDataProp = _CswNbtResources.MetaData.getNodeTypeProp(PropId.NodeTypePropId);

            if (null == Node)
            {
                Node = _CswNbtResources.Nodes[PropId.NodeId];
            }
            CswNbtNodePropWrapper FileProp = Node.Properties[MetaDataProp];

            if (_CswNbtResources.Permit.canNodeType(CswEnumNbtNodeTypePermission.Edit, MetaDataProp.getNodeType(), _CswNbtResources.CurrentNbtUser) &&
                _CswNbtResources.Permit.isPropWritable(CswEnumNbtNodeTypePermission.Edit, MetaDataProp, null, FileProp))
            {
                if (Int32.MinValue == FileProp.JctNodePropId)
                {
                    FileProp.makePropRow(); //if we don't have a jct_node_prop row for this prop, we do now
                    if (PostChanges)
                    {
                        Node.postChanges(true);
                    }
                }

                if (FileProp.getFieldType().FieldType == CswEnumNbtFieldType.Image)
                {
                    //case 29692: support EXIF image rotation metadata to properly orient photos
                    bool         img_ok = false;
                    MemoryStream ms     = new MemoryStream(BlobData, 0, BlobData.Length);
                    ms.Write(BlobData, 0, BlobData.Length);
                    System.Drawing.Image img = null;

                    try
                    {
                        img    = Image.FromStream(ms, true);
                        img_ok = true;
                    }
                    catch
                    {
                    }

                    if (img_ok == true)
                    {
                        FixOrientation(ref img);
                        ImageConverter converter = new ImageConverter();
                        BlobData = (byte[])converter.ConvertTo(img, typeof(byte[]));
                    }
                }



                //Save the file to blob_data
                CswTableUpdate BlobUpdate  = _CswNbtResources.makeCswTableUpdate("saveBlob", "blob_data");
                string         whereClause = "where jctnodepropid = " + FileProp.JctNodePropId;
                if (Int32.MinValue != BlobDataId)
                {
                    whereClause += " and blobdataid = " + BlobDataId;
                }
                DataTable BlobTbl = BlobUpdate.getTable(whereClause);
                if (BlobTbl.Rows.Count > 0 &&
                    (Int32.MinValue != BlobDataId ||
                     FileProp.getFieldTypeValue() == CswEnumNbtFieldType.File ||
                     FileProp.getFieldTypeValue() == CswEnumNbtFieldType.MOL))
                {
                    BlobTbl.Rows[0]["blobdata"]    = BlobData;
                    BlobTbl.Rows[0]["contenttype"] = ContentType;
                    BlobTbl.Rows[0]["filename"]    = FileName;
                    BlobTbl.Rows[0]["auditlevel"]  = MetaDataProp.AuditLevel;
                    BlobDataId = CswConvert.ToInt32(BlobTbl.Rows[0]["blobdataid"]);
                }
                else
                {
                    DataRow NewRow = BlobTbl.NewRow();
                    NewRow["jctnodepropid"] = FileProp.JctNodePropId;
                    NewRow["blobdata"]      = BlobData;
                    NewRow["contenttype"]   = ContentType;
                    NewRow["filename"]      = FileName;
                    NewRow["auditlevel"]    = MetaDataProp.AuditLevel;
                    BlobDataId = CswConvert.ToInt32(NewRow["blobdataid"]);
                    BlobTbl.Rows.Add(NewRow);
                }
                BlobUpdate.update(BlobTbl);

                if (Node.getObjectClass().ObjectClass == CswEnumNbtObjectClass.ReportClass)
                {
                    CswNbtObjClassReport Report        = Node;
                    CswFilePath          FilePathTools = new CswFilePath(_CswNbtResources);
                    string ReportPath = FilePathTools.getFullReportFilePath(Report.RPTFile.JctNodePropId.ToString());
                    _createReportFile(ReportPath, Report.RPTFile.JctNodePropId, BlobData);
                }

                if (CswEnumNbtFieldType.File == FileProp.getFieldTypeValue())
                {
                    SetLastModified(FileProp);
                }

                FileProp.SyncGestalt();
                if (PostChanges)
                {
                    Node.postChanges(false);
                }

                Href = CswNbtNodePropBlob.getLink(FileProp.JctNodePropId, PropId.NodeId, BlobDataId);
            } //canNodeType() && isPropWritable()
            else
            {
                Href = string.Empty; //To satifsy the "ref string Href"
                throw new CswDniException(CswEnumErrorType.Error, "You do not have sufficient priveledges to save files", "User " + _CswNbtResources.CurrentNbtUser.UserId + " attemped to save blobdata on JctNodeProp " + FileProp.JctNodePropId);
            }
            return(BlobDataId);
        }
Exemple #6
0
        private bool _updateNodeProps(JObject NodeObj)
        {
            bool Ret = false;
            Collection <JProperty> Props = new Collection <JProperty>();


            if (null != NodeObj.Property("tabs"))
            {
                JObject Tabs = (JObject)NodeObj.Property("tabs").Value;
                foreach (JProperty Prop in from Tab
                         in Tabs.Properties()
                         where (null != Tab.Value)
                         select(JObject) Tab.Value
                         into TabProps
                         from Prop
                         in TabProps.Properties()
                         where (null != Prop.Value &&
                                Prop.Name != "nexttab" &&
                                Prop.Name != "currenttab")
                         let PropAtr = (JObject)Prop.Value
                                       where null != PropAtr["wasmodified"] &&
                                       CswConvert.ToBoolean(PropAtr["wasmodified"])
                                       select Prop)
                {
                    Props.Add(Prop);
                }
            }


            // post changes once per node, not once per prop
            Collection <CswNbtNode> NodesToPost = new Collection <CswNbtNode>();

            foreach (JProperty Prop in Props)
            {
                if (null != Prop.Name)
                {
                    string        NodePropId      = Prop.Name; // ~ "prop_4019_nodeid_nodes_24709"
                    string[]      SplitNodePropId = NodePropId.Split('_');
                    Int32         NodeTypePropId  = CswConvert.ToInt32(SplitNodePropId[1]);
                    CswPrimaryKey NodePk          = new CswPrimaryKey(SplitNodePropId[3], CswConvert.ToInt32(SplitNodePropId[4]));

                    CswNbtNode Node = _CswNbtResources.Nodes[NodePk];
                    CswNbtMetaDataNodeTypeProp MetaDataProp = _CswNbtResources.MetaData.getNodeTypeProp(NodeTypePropId);

                    JObject PropObj = (JObject)Prop.Value;

                    CswNbtMetaDataNodeTypeTab Tab = _CswNbtResources.MetaData.getNodeTypeTab(Node.NodeTypeId, CswConvert.ToString(PropObj["currenttab"]));
                    Node.Properties[MetaDataProp].ReadJSON(PropObj, null, null);

                    //Case 20964. Client needs to know whether the inspection is complete.
                    if (false == Ret && Node.getObjectClass().ObjectClass == CswNbtMetaDataObjectClass.NbtObjectClass.InspectionDesignClass)
                    {
                        CswNbtMetaDataObjectClassProp MetaDataOCP = MetaDataProp.getObjectClassProp();
                        if (MetaDataOCP != null)
                        {
                            CswNbtMetaDataObjectClassProp Finish = _CswNbtResources.MetaData.getObjectClassProp(Node.getObjectClassId(), CswNbtObjClassInspectionDesign.PropertyName.Finish);
                            CswNbtMetaDataObjectClassProp Cancel = _CswNbtResources.MetaData.getObjectClassProp(Node.getObjectClassId(), CswNbtObjClassInspectionDesign.PropertyName.Cancel);
                            if (MetaDataOCP == Finish ||
                                MetaDataOCP == Cancel)
                            {
                                //Ret = Ret || Node.Properties[MetaDataProp].AsButton.Checked == Tristate.True;
                                CswNbtObjClass.NbtButtonData ButtonData = new CswNbtObjClass.NbtButtonData(MetaDataProp);
                                ((CswNbtObjClassInspectionDesign)Node).onButtonClick(ButtonData);
                            }
                        }
                    }

                    if (false == NodesToPost.Contains(Node))
                    {
                        NodesToPost.Add(Node);
                    }
                }
            }

            foreach (CswNbtNode Node in NodesToPost)
            {
                Node.postChanges(false);
            }
            return(Ret);
        }
        public void UpdateNode(CswNbtNode Node, bool ForceUpdate)
        {
            // BZ 10240
            if ((Node.PendingUpdate || ForceUpdate) && Node.getObjectClass().ObjectClass == CswEnumNbtObjectClass.EquipmentClass)
            {
                ((CswNbtObjClassEquipment)Node).SyncEquipmentToAssembly();
            }
            // Case 30126
            if (null != Node.getObjectClass().getPropertySet())
            {
                if ((Node.PendingUpdate || ForceUpdate) && Node.getObjectClass().getPropertySet().Name == CswEnumNbtPropertySetName.MaterialSet)
                {
                    ((CswNbtPropertySetMaterial)Node).onUpdatePropertyValue();
                }
            }

            // Update all out of date values for a given node
            foreach (CswNbtNodePropWrapper PropWrapper in Node.Properties)
            {
                if (PropWrapper.PendingUpdate || Node.PendingUpdate || ForceUpdate)
                {
                    switch (PropWrapper.getFieldTypeValue())
                    {
                    case CswEnumNbtFieldType.Composite:
                        CswNbtNodePropComposite CompositeProp = PropWrapper.AsComposite;
                        CompositeProp.RecalculateCompositeValue();
                        break;

                    case CswEnumNbtFieldType.Location:
                        CswNbtNodePropLocation LocationProp = PropWrapper.AsLocation;
                        LocationProp.RefreshNodeName();
                        break;

                    case CswEnumNbtFieldType.LogicalSet:
                        CswNbtNodePropLogicalSet LogicalSetProp = PropWrapper.AsLogicalSet;
                        LogicalSetProp.RefreshStringValue(SetPendingUpdate: false);
                        break;

                    case CswEnumNbtFieldType.NodeTypeSelect:
                        CswNbtNodePropNodeTypeSelect NodeTypeSelectProp = PropWrapper.AsNodeTypeSelect;
                        NodeTypeSelectProp.RefreshSelectedNodeTypeNames();
                        break;

                    case CswEnumNbtFieldType.PropertyReference:
                        CswNbtNodePropPropertyReference PropertyReferenceProp = PropWrapper.AsPropertyReference;
                        PropertyReferenceProp.RecalculateReferenceValue();
                        break;

                    case CswEnumNbtFieldType.Quantity:
                        CswNbtNodePropQuantity QuantityProp = PropWrapper.AsQuantity;
                        QuantityProp.RefreshNodeName();
                        break;

                    case CswEnumNbtFieldType.Relationship:
                        CswNbtNodePropRelationship RelationshipProp = PropWrapper.AsRelationship;
                        RelationshipProp.RefreshNodeName();
                        break;

                    case CswEnumNbtFieldType.ViewPickList:
                        CswNbtNodePropViewPickList ViewPickListProp = PropWrapper.AsViewPickList;
                        ViewPickListProp.RefreshViewName();
                        break;

                    case CswEnumNbtFieldType.ViewReference:
                        CswNbtNodePropViewReference ViewReferenceProp = PropWrapper.AsViewReference;
                        ViewReferenceProp.RefreshViewName();
                        break;

                    case CswEnumNbtFieldType.MTBF:
                        CswNbtNodePropMTBF MTBFProp = PropWrapper.AsMTBF;
                        MTBFProp.RefreshCachedValue();
                        break;

                    default:
                        if (PropWrapper.PendingUpdate)
                        {
                            PropWrapper.setPendingUpdate(false);
                        }
                        break;
                    } // switch (PropWrapper.FieldType.FieldType)
                }     // if(PropWrapper.PendingUpdate)
            }         // foreach (CswNbtNodePropWrapper PropWrapper in Node.Properties)

            if (Node.PendingUpdate)
            {
                Node.PendingUpdate = false;
            }
        } // UpdateNode()