Esempio n. 1
0
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteStartElement("M");
            if (!IsSystem)
            {
                writer.WriteAttributeString("sys", IsSystem.ToString());
            }

            if (IsPrivate)
            {
                writer.WriteAttributeString("pri", IsPrivate.ToString());
            }

            if (Sender != null && Sender.Length != 0)
            {
                writer.WriteAttributeString("sen", Sender);
            }

            if (Receiver != null && Receiver.Length != 0)
            {
                writer.WriteAttributeString("rec", Receiver);
            }

            writer.WriteString(Text);

            writer.WriteEndElement();
        }
Esempio n. 2
0
        public string GetStairData(string modelData)
        {
            dynamic paramSet = JsonConvert.DeserializeObject <dynamic>(modelData);

            double defThreshold    = 0.5;
            double stressThreshold = 0;

            if (paramSet.material == 0)
            {
                stressThreshold = 3000; //steel psi
            }
            else
            {
                stressThreshold = 500; //wood psi
            }

            IsSystem sysDef    = GetSystem(paramSet);
            IsSystem sysStress = GetSystem(paramSet);

            string[] defData    = GetSystemMesh(sysDef, eAreaResultType.DEFORMATION_GLOBAL, "ALL", defThreshold);
            string[] stressData = GetSystemMesh(sysStress, eAreaResultType.S_VM_AVG, "ALL", stressThreshold);

            DataPackage data = new DataPackage();

            data.defMin     = defData[0];
            data.defMax     = defData[1];
            data.defJson    = defData[2];
            data.stressMin  = stressData[0];
            data.stressMax  = stressData[1];
            data.stressJson = stressData[2];

            string dataJson = JsonConvert.SerializeObject(data);

            return(dataJson);
        }
        public override int GetHashCode()
        {
            int hashResult = Name == null ? 0 : Name.GetHashCode();

            hashResult ^= IsVisible.GetHashCode();
            hashResult ^= IsSystem.GetHashCode();
            hashResult ^= IsDeleted.GetHashCode();
            return(hashResult);
        }
Esempio n. 4
0
        public override JObject ToJson()
        {
            JObject jObject = base.ToJson();

            jObject.Add("Name", Name);
            jObject.Add("Code", Code);
            jObject.Add("IsSystem", IsSystem.ToString());
            jObject.Add("IsDefault", IsDefault.ToString());
            return(jObject);
        }
Esempio n. 5
0
        internal IDictionary <string, object> GetAllValues()
        {
            var values = new Dictionary <string, object>();

            values.Add("Id", Id);
            values.Add("NodeTypeId", NodeTypeId);
            values.Add("NodeType", FormatNodeType(NodeTypeId));
            values.Add("ContentListId", ContentListId);
            values.Add("ContentListTypeId", ContentListTypeId);
            values.Add("ParentId", ParentId);
            values.Add("Name", Name);
            values.Add("DisplayName", DisplayName);
            values.Add("Path", Path);
            values.Add("Index", Index);
            values.Add("CreatingInProgress", CreatingInProgress.ToString().ToLower());
            values.Add("IsDeleted", IsDeleted.ToString().ToLower());
            values.Add("IsInherited", IsInherited.ToString().ToLower());
            values.Add("CreationDate", FormatDate(CreationDate));
            values.Add("ModificationDate", FormatDate(ModificationDate));
            values.Add("CreatedById", CreatedById);
            values.Add("CreatedBy", FormatUser(CreatedById));
            values.Add("ModifiedById", ModifiedById);
            values.Add("ModifiedBy", FormatUser(ModifiedById));
            values.Add("VersionId", VersionId);
            values.Add("Version", Version.ToString());
            values.Add("VersionCreationDate", FormatDate(VersionCreationDate));
            values.Add("VersionModificationDate", FormatDate(VersionModificationDate));
            values.Add("VersionCreatedById", VersionCreatedById);
            values.Add("VersionCreatedBy", FormatUser(VersionCreatedById));
            values.Add("VersionModifiedById", VersionModifiedById);
            values.Add("VersionModifiedBy", FormatUser(VersionModifiedById));
            values.Add("Locked", Locked.ToString().ToLower());
            values.Add("LockedById", LockedById);
            values.Add("LockedBy", FormatUser(LockedById));
            values.Add("ETag", ETag);
            values.Add("LockType", LockType);
            values.Add("LockTimeout", LockTimeout);
            values.Add("LockDate", FormatDate(LockDate));
            values.Add("LockToken", LockToken);
            values.Add("LastLockUpdate", FormatDate(LastLockUpdate));
            values.Add("IsSystem", IsSystem.ToString().ToLower());
            values.Add("ClosestSecurityNodeId", ClosestSecurityNodeId);
            values.Add("SavingState", SavingState);

            foreach (var key in dynamicData.Keys)
            {
                var propType = ActiveSchema.PropertyTypes.GetItemById(key);
                if (propType != null)
                {
                    values.Add(propType.Name.Replace("#", "_"), FormatDynamicData(dynamicData[key] ?? string.Empty, propType.DataType));
                }
            }
            return(values);
        }
Esempio n. 6
0
        }//ToXml()

        public JObject ToJson()
        {
            //JObject Ret = new JObject();

            JObject RootPropObj = new JObject();

            //Ret[CswEnumNbtViewXmlNodeName.TreeView.ToString()] = RootPropObj;

            RootPropObj["nodename"]           = CswEnumNbtViewXmlNodeName.TreeView.ToString().ToLower();
            RootPropObj["viewname"]           = ViewName;
            RootPropObj["version"]            = "1.0";
            RootPropObj["iconfilename"]       = IconFileName;
            RootPropObj["selectable"]         = Selectable.ToString().ToLower();
            RootPropObj["mode"]               = ViewMode.ToString();
            RootPropObj["width"]              = (Width > 0) ? Width.ToString() : "";
            RootPropObj["viewid"]             = (ViewId.isSet()) ? ViewId.get().ToString() : "";
            RootPropObj["category"]           = Category;
            RootPropObj["visibility"]         = Visibility.ToString();
            RootPropObj["visibilityroleid"]   = (VisibilityRoleId != null) ? VisibilityRoleId.PrimaryKey.ToString() : "";
            RootPropObj["visibilityrolename"] = (VisibilityRoleId != null) ? _CswNbtResources.Nodes[VisibilityRoleId].NodeName : "";
            RootPropObj["visibilityuserid"]   = (VisibilityUserId != null) ? VisibilityUserId.PrimaryKey.ToString() : "";
            RootPropObj["visibilityusername"] = (VisibilityUserId != null) ? _CswNbtResources.Nodes[VisibilityUserId].NodeName : "";
            RootPropObj["groupbysiblings"]    = GroupBySiblings;
            RootPropObj["included"]           = Included.ToString().ToLower();
            RootPropObj["isdemo"]             = IsDemo.ToString().ToLower();
            RootPropObj["issystem"]           = IsSystem.ToString().ToLower();
            RootPropObj["includetempnodes"]   = IncludeTempNodes.ToString().ToLower();
            RootPropObj["gridgroupbycol"]     = GridGroupByCol.ToString().ToLower();
            RootPropObj["showdelete"]         = false; //for ViewContentTree - don't show the "X" on view root

            JObject ChildObject = new JObject();

            if (null == RootPropObj[_ChildRelationshipsName] ||
                RootPropObj[_ChildRelationshipsName].Type != JTokenType.Object)
            {
                RootPropObj[_ChildRelationshipsName] = ChildObject;

                // Recurse on child ViewNodes
                foreach (CswNbtViewRelationship ChildRelationship in ChildRelationships)
                {
                    JProperty ChildRelationshipProp = ChildRelationship.ToJson();
                    if (null == ChildObject[ChildRelationshipProp.Name])
                    {
                        ChildObject.Add(ChildRelationshipProp);
                    }
                }
            }
            //return Ret;
            return(RootPropObj);
        }//ToXml()
        public override int GetHashCode()
        {
            unchecked
            {
                int result = ResourceKey != null?ResourceKey.GetHashCode() : 0;

                result = (result * 397) ^ (CodecType != null ? CodecType.GetHashCode() : 0);
                result = (result * 397) ^ (MediaType != null ? MediaType.GetHashCode() : 0);
                result = (result * 397) ^ IsStrict.GetHashCode();
                result = (result * 397) ^ (Extensions != null ? Extensions.GetHashCode() : 0);
                result = (result * 397) ^ (Configuration != null ? Configuration.GetHashCode() : 0);
                result = (result * 397) ^ IsSystem.GetHashCode();
                return(result);
            }
        }
Esempio n. 8
0
        private IsSystem GetSystem(dynamic modelData)
        {
            string   selectedJson = modelData.material + "_" + modelData.innerRadius + "_" + modelData.stringerThick + "_" + modelData.connectionType;
            string   rpath        = HttpContext.Current.Server.MapPath("~/Data/");
            IsSystem sys          = null;

            try
            {
                string text = System.IO.File.ReadAllText(rpath + selectedJson + ".json");

                //Console.WriteLine(text);
                sys = sSystemBase.Objectify(text);
            }
            catch
            {
                sys = null;
            }

            return(sys);
        }
Esempio n. 9
0
        private string [] GetSystemMesh(IsSystem sys, eAreaResultType resultType, string caseName, double threshold)
        {
            sSEScenario sc = new sSEScenario();

            sc.areaThreshold = threshold;
            sc.areaType      = resultType;
            sc.loadCase      = caseName;
            sBoundingBox bx;

            string json = sys.ConstructSystemPreviewMesh(sc, false, out bx).Jsonify(true);

            sRange dataRange = sys.GetAreaResultRange(caseName, resultType);
            string min       = dataRange.min.ToString();
            string max       = dataRange.max.ToString();

            string[] data = new string[3] {
                min, max, json
            };

            return(data);
        }
Esempio n. 10
0
        public XmlNode ToXml(XmlDocument XmlDoc)
        {
            XmlNode RootXmlNode = XmlDoc.CreateNode(XmlNodeType.Element, CswEnumNbtViewXmlNodeName.TreeView.ToString(), "");

            XmlAttribute ViewNameAttribute = XmlDoc.CreateAttribute("viewname");

            ViewNameAttribute.Value = ViewName;
            RootXmlNode.Attributes.Append(ViewNameAttribute);

            //bz #5157
            XmlAttribute ViewVersionAttribute = XmlDoc.CreateAttribute("version");

            ViewVersionAttribute.Value = "1.0";
            RootXmlNode.Attributes.Append(ViewVersionAttribute);

            XmlAttribute IconFileNameAttribute = XmlDoc.CreateAttribute("iconfilename");

            IconFileNameAttribute.Value = IconFileName;
            RootXmlNode.Attributes.Append(IconFileNameAttribute);

            XmlAttribute SelectableAttribute = XmlDoc.CreateAttribute("selectable");

            SelectableAttribute.Value = Selectable.ToString().ToLower();
            RootXmlNode.Attributes.Append(SelectableAttribute);

            XmlAttribute ModeAttribute = XmlDoc.CreateAttribute("mode");

            ModeAttribute.Value = ViewMode.ToString();
            RootXmlNode.Attributes.Append(ModeAttribute);

            XmlAttribute WidthAttribute = XmlDoc.CreateAttribute("width");

            if (Width > 0)
            {
                WidthAttribute.Value = Width.ToString();
            }
            else
            {
                WidthAttribute.Value = "";
            }
            RootXmlNode.Attributes.Append(WidthAttribute);

            XmlAttribute ViewIdAttribute = XmlDoc.CreateAttribute("viewid");

            if (ViewId.isSet())
            {
                ViewIdAttribute.Value = ViewId.get().ToString();
            }
            else
            {
                ViewIdAttribute.Value = "";
            }
            RootXmlNode.Attributes.Append(ViewIdAttribute);

            XmlAttribute CategoryAttribute = XmlDoc.CreateAttribute("category");

            CategoryAttribute.Value = Category.ToString();
            RootXmlNode.Attributes.Append(CategoryAttribute);

            XmlAttribute VisibilityAttribute = XmlDoc.CreateAttribute("visibility");

            VisibilityAttribute.Value = Visibility.ToString();
            RootXmlNode.Attributes.Append(VisibilityAttribute);

            XmlAttribute VisibilityRoleIdAttribute = XmlDoc.CreateAttribute("visibilityroleid");

            if (VisibilityRoleId != null)
            {
                VisibilityRoleIdAttribute.Value = VisibilityRoleId.PrimaryKey.ToString();
            }
            RootXmlNode.Attributes.Append(VisibilityRoleIdAttribute);

            XmlAttribute VisibilityUserIdAttribute = XmlDoc.CreateAttribute("visibilityuserid");

            if (VisibilityUserId != null)
            {
                VisibilityUserIdAttribute.Value = VisibilityUserId.PrimaryKey.ToString();
            }
            RootXmlNode.Attributes.Append(VisibilityUserIdAttribute);

            XmlAttribute GroupBySiblingsAttribute = XmlDoc.CreateAttribute("groupbysiblings");

            GroupBySiblingsAttribute.Value = GroupBySiblings.ToString().ToLower();
            RootXmlNode.Attributes.Append(GroupBySiblingsAttribute);

            XmlAttribute IncludedAttribute = XmlDoc.CreateAttribute("included");

            IncludedAttribute.Value = Included.ToString().ToLower();
            RootXmlNode.Attributes.Append(IncludedAttribute);

            XmlAttribute IsDemoAttribute = XmlDoc.CreateAttribute("isdemo");

            IsDemoAttribute.Value = IsDemo.ToString().ToLower();
            RootXmlNode.Attributes.Append(IsDemoAttribute);

            XmlAttribute IsSystemAttribute = XmlDoc.CreateAttribute("issystem");

            IsSystemAttribute.Value = IsSystem.ToString().ToLower();
            RootXmlNode.Attributes.Append(IsSystemAttribute);

            XmlAttribute IncludeTempNodesAttribute = XmlDoc.CreateAttribute("includetempnodes");

            IncludeTempNodesAttribute.Value = IncludeTempNodes.ToString().ToLower();
            RootXmlNode.Attributes.Append(IncludeTempNodesAttribute);

            XmlAttribute GridGroupByColAttribute = XmlDoc.CreateAttribute("gridgroupbycol");

            GridGroupByColAttribute.Value = GridGroupByCol.ToString().ToLower();
            RootXmlNode.Attributes.Append(GridGroupByColAttribute);

            // Recurse on child ViewNodes
            foreach (CswNbtViewRelationship ChildRelationship in this.ChildRelationships)
            {
                XmlNode ChildXmlNode = ChildRelationship.ToXml(XmlDoc);
                RootXmlNode.AppendChild(ChildXmlNode);
            }

            return(RootXmlNode);
        }//ToXml()
Esempio n. 11
0
        public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched)
        {
            bool ret          = false;
            bool valueMatched = false;

            if (columnName == "DataRefTypeID")
            {
                ret = true;
                if (DataRefTypeID.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "DataRefTypeGUID")
            {
                ret = true;
                if (DataRefTypeGUID.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "RevisionNo")
            {
                ret = true;
                if (RevisionNo.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "DataRefType")
            {
                ret = true;
                if (DataRefType.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "IsDefault")
            {
                ret = true;
                if (IsDefault.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "IsSystem")
            {
                ret = true;
                if (IsSystem.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "IsActive")
            {
                ret = true;
                if (IsActive.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "Sequence")
            {
                ret = true;
                if (Sequence.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            retValueMatched = valueMatched;
            return(ret);
        }
Esempio n. 12
0
        public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched)
        {
            bool ret          = false;
            bool valueMatched = false;

            if (columnName == "InfoCategoryID")
            {
                ret = true;
                if (InfoCategoryID.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "InfoCategoryGUID")
            {
                ret = true;
                if (InfoCategoryGUID.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "RevisionNo")
            {
                ret = true;
                if (RevisionNo.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "InfoCategoryName")
            {
                ret = true;
                if (InfoCategoryName.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "UserID")
            {
                ret = true;
                if (UserID.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "UserGUID")
            {
                ret = true;
                if (UserGUID.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "CreatedDate")
            {
                ret = true;
                if (CreatedDate.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "LastUpdateDate")
            {
                ret = true;
                if (LastUpdateDate.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "IsActive")
            {
                ret = true;
                if (IsActive.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "Sequence")
            {
                ret = true;
                if (Sequence.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "IsDefault")
            {
                ret = true;
                if (IsDefault.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            if (columnName == "IsSystem")
            {
                ret = true;
                if (IsSystem.ToString() == columnValue)
                {
                    valueMatched = true;
                }
            }
            retValueMatched = valueMatched;
            return(ret);
        }