Esempio n. 1
0
        /// <summary>
        /// Returns a thin JArray of grid row values
        /// </summary>
        public JArray getThinGridRows(Int32 MaxRows, bool AlwaysShowHeader = false)
        {
            JArray      RetRows = new JArray();
            ICswNbtTree Tree    = _CswNbtResources.Trees.getTreeFromView(_View, true, false, false);

            if (_View.Visibility == CswEnumNbtViewVisibility.Property && Tree.getChildNodeCount() > 0)
            {
                Tree.goToNthChild(0);
            }

            Int32 NodeCount = Tree.getChildNodeCount();

            if (MaxRows == Int32.MinValue)
            {
                MaxRows = NodeCount;
            }
            bool IsTruncated = false;

            if (AlwaysShowHeader || NodeCount > 0)
            {
                JArray HeaderRow = new JArray();
                CswCommaDelimitedString HeaderCols = new CswCommaDelimitedString();
                RetRows.Add(HeaderRow);
                foreach (CswViewBuilderProp VbProp in _PropsInGrid)
                {
                    HeaderRow.Add(VbProp.PropName);
                    HeaderCols.Add(VbProp.PropName);
                }

                if (NodeCount > 0)
                {
                    for (Int32 C = 0; C < MaxRows && C < NodeCount; C += 1)
                    {
                        Tree.goToNthChild(C);

                        JArray ThisRow = new JArray();
                        RetRows.Add(ThisRow);
                        foreach (CswNbtTreeNodeProp Prop in Tree.getChildNodePropsOfNode())
                        {
                            Int32 ColumnIdx = HeaderCols.IndexOf(Prop.PropName);
                            if (ColumnIdx >= 0)
                            {
                                _ensureIndex(ThisRow, ColumnIdx);
                                ThisRow[ColumnIdx] = Prop.Gestalt;
                            }
                        }

                        IsTruncated = IsTruncated || Tree.getCurrentNodeChildrenTruncated();

                        Tree.goToParentNode();
                    }

                    if (IsTruncated)
                    {
                        RetRows.Add(new JArray("Results Truncated"));
                    }
                }
            }
            return(RetRows);
        } // getGridOuterJson()
        private void _upgradeGHSNTP()
        {
            CswNbtMetaDataObjectClass GHSOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.GHSClass);
            CswCommaDelimitedString   ClassificationOptions = new CswCommaDelimitedString
            {
                "Category 1",
                "Category 2",
                "Category 3",
                "Category 4",
                "Category 1 A/1 B/1 C",
                "Category 2 (skin)/2A (eye)",
                "Category 2A",
                "Category 2B",
                "Category 1/ 1A / 1B",
                "Category 1A or Category 1B",
                "Type A",
                "Type B",
                "Type C&D",
                "Type E&F",
                "Compressed Gas",
                "Liquidfied Gas",
                "Dissolved Gas",
                "Refridgerated Liquidified Gas"
            };

            _addOCP(GHSOC, new CswNbtWcfMetaDataModel.ObjectClassProp
            {
                PropName    = CswNbtObjClassGHS.PropertyName.Classification,
                FieldType   = CswEnumNbtFieldType.List,
                ListOptions = ClassificationOptions.ToString()
            });
        }
Esempio n. 3
0
        public override void ReadJSON(JObject JObject, Dictionary <Int32, Int32> NodeMap, Dictionary <Int32, Int32> NodeTypeMap)
        {
            CswCommaDelimitedString NewSelectedNodeTypeIds = SelectedNodeTypeIds;

            CswCheckBoxArrayOptions CBAOptions = new CswCheckBoxArrayOptions();

            if (null != JObject[_ElemName_Options])
            {
                CBAOptions.ReadJson((JObject)JObject[_ElemName_Options]);
            }
            foreach (CswCheckBoxArrayOptions.Option Option in CBAOptions.Options)
            {
                if (Option.Values.Count > 0)
                {
                    if (Option.Values.Count > 0 && true == Option.Values[0])
                    {
                        NewSelectedNodeTypeIds.Add(Option.Key);
                    }
                    else if (false == Option.Values[0])
                    {
                        NewSelectedNodeTypeIds.Remove(Option.Key);
                    }
                }
            }
            SelectedNodeTypeIds = NewSelectedNodeTypeIds;
        } // ReadJSON()
        } // update()

        private void _deleteDuplicateRows( CswCommaDelimitedString NodeIds, CswCommaDelimitedString NTPIds )
        {
            foreach( string id in NodeIds )
            {
                string where = "where nodeid = " + id + " and nodetypepropid in (" + NTPIds.ToString() + ")";
                CswTableUpdate jnpTU = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "RemoveDups" + id, "jct_nodes_props" );
                DataTable tbl = jnpTU.getTable( where );
                if( tbl.Rows.Count > 1 )
                {
                    bool skip = true;
                    foreach( DataRow row in tbl.Rows )
                    {
                        if( skip ) //leave one row for the prop
                        {
                            skip = false;
                        }
                        else
                        {
                            row.Delete();
                        }
                    }
                    jnpTU.update( tbl );
                }
            }
        }
Esempio n. 5
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()
        }                 // ToJSON()

        public override void ReadDataRow(DataRow PropRow, Dictionary <string, Int32> NodeMap, Dictionary <Int32, Int32> NodeTypeMap)
        {
            CswCommaDelimitedString NewValue = new CswCommaDelimitedString();

            NewValue.FromString(CswTools.XmlRealAttributeName(PropRow[_ValueSubField.ToXmlNodeName()].ToString()));
            Value = NewValue;
        }
        private CswCommaDelimitedString _getMaterialPKsForEP(CswPrimaryKey EPId)
        {
            CswCommaDelimitedString       EPMaterialPks = new CswCommaDelimitedString();
            CswNbtMetaDataObjectClass     ManufacturerEquivalentPartOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ManufacturerEquivalentPartClass);
            CswNbtMetaDataObjectClassProp EPOCP       = ManufacturerEquivalentPartOC.getObjectClassProp(CswNbtObjClassManufacturerEquivalentPart.PropertyName.EnterprisePart);
            CswNbtMetaDataObjectClassProp MaterialOCP = ManufacturerEquivalentPartOC.getObjectClassProp(CswNbtObjClassManufacturerEquivalentPart.PropertyName.Material);

            CswNbtView EPMatsView = new CswNbtView(_CswNbtResources);

            EPMatsView.ViewName = "Materials under " + EPId;
            CswNbtViewRelationship MEPVR = EPMatsView.AddViewRelationship(ManufacturerEquivalentPartOC, false);

            EPMatsView.AddViewPropertyAndFilter(MEPVR, EPOCP, SubFieldName: CswEnumNbtSubFieldName.NodeID, Value: EPId.PrimaryKey.ToString());
            CswNbtViewRelationship MatVR = EPMatsView.AddViewRelationship(MEPVR, CswEnumNbtViewPropOwnerType.First, MaterialOCP, false);

            ICswNbtTree EPMatsTree = _CswNbtResources.Trees.getTreeFromView(EPMatsView, false, true, true);

            for (int i = 0; i < EPMatsTree.getChildNodeCount(); i++)
            {
                EPMatsTree.goToNthChild(i);   //EP's MEPs
                if (EPMatsTree.getChildNodeCount() > 0)
                {
                    EPMatsTree.goToNthChild(0);   //MEP's Material
                    EPMaterialPks.Add(EPMatsTree.getNodeIdForCurrentPosition().PrimaryKey.ToString());
                    EPMatsTree.goToParentNode();
                }
                EPMatsTree.goToParentNode();
            }

            return(EPMaterialPks);
        }
Esempio n. 8
0
        public string getNameWhereFirst(string Where)
        {
            if (_getNameWhere == null)
            {
                _getNameWhere = new Dictionary <string, string>();
            }
            if (false == _getNameWhere.ContainsKey(Where))
            {
                CswCommaDelimitedString SelectCols = new CswCommaDelimitedString();
                SelectCols.Add(_NameColumnName);

                string WhereClause = Where;
                addModuleWhereClause(ref WhereClause);

                DataTable Table = _TableSelect.getTable(SelectCols, string.Empty, Int32.MinValue, WhereClause, false);
                if (Table.Rows.Count > 0)
                {
                    _getNameWhere[Where] = Table.Rows[0][_NameColumnName].ToString();
                }
                else
                {
                    _getNameWhere[Where] = string.Empty;
                }
            }
            return(_getNameWhere[Where]);
        } // getNameWhereFirst()
Esempio n. 9
0
        public Stream downloadBulkEditData(string ViewId, string NodeTypeId, string PropIds)
        {
            CswNbtWebServiceBulkEdit.BulkEditDownload Ret = new CswNbtWebServiceBulkEdit.BulkEditDownload();

            CswNbtWebServiceBulkEdit.BulkEditParams Params = new CswNbtWebServiceBulkEdit.BulkEditParams();
            Params.ViewId     = ViewId;
            Params.NodeTypeId = CswConvert.ToInt32(NodeTypeId);
            CswCommaDelimitedString PropIdsCds = new CswCommaDelimitedString();

            PropIdsCds.FromString(PropIds);
            Params.PropIds = PropIdsCds.ToIntCollection();

            var SvcDriver = new CswWebSvcDriver <CswNbtWebServiceBulkEdit.BulkEditDownload, CswNbtWebServiceBulkEdit.BulkEditParams>(
                CswWebSvcResourceInitializer: new CswWebSvcResourceInitializerNbt(_Context, null),
                ReturnObj: Ret,
                WebSvcMethodPtr: CswNbtWebServiceBulkEdit.DownloadBulkEditData,
                ParamObj: Params
                );

            SvcDriver.run();

            WebOperationContext.Current.OutgoingResponse.Headers.Set("Content-Disposition", "attachment;filename=\"bulkedit.csv\";");
            WebOperationContext.Current.OutgoingResponse.ContentType = "text/csv";

            MemoryStream mem     = new MemoryStream();
            BinaryWriter BWriter = new BinaryWriter(mem);

            BWriter.Write(Encoding.UTF8.GetBytes(wsTools.DataTableToCSV(Ret.CsvData)));
            mem.Position = 0;

            return(mem);
        }
        public static void Initialize(ICswResources CswResources, CswNbtExplorerReturn Return, CswNbtExplorerRequest Request)
        {
            CswNbtResources NbtResources = (CswNbtResources)CswResources;
            CswPrimaryKey   NodeId       = CswConvert.ToPrimaryKey(Request.NodeId);

            if (Request.Depth <= 4 || Request.Depth > 0)  //We never want a request higher than 4 and 0 doesn't make sense
            {
                MAX_DEPTH = Request.Depth;
            }

            FilterVal = new CswCommaDelimitedString();
            if (String.IsNullOrEmpty(Request.FilterVal))
            {
                FilterVal.FromString(CswNbtArborGraph._setDefaultFilterVal(NbtResources));
            }
            else
            {
                FilterVal.FromString(Request.FilterVal);
            }


            StartingNode = NbtResources.Nodes[NodeId];
            CswNbtMetaDataNodeType startingNT = StartingNode.getNodeType();

            //Add the initial node to the graph
            _addToGraph(Return, StartingNode.NodeName, string.Empty, NodeId.ToString(), startingNT.IconFileName, 0, "Instance", NodeId.ToString(), startingNT.NodeTypeName, Int32.MinValue);

            _recurseForRelatingNodes(NbtResources, Return, StartingNode, 1, NodeId.ToString());

            _recurseForRelatedNTs(NbtResources, Return, StartingNode.NodeTypeId, 1, NodeId.ToString());
        }
Esempio n. 11
0
        public Collection <Int32> getPks(string Where)
        {
            if (_PksWhere == null)
            {
                _PksWhere = new Dictionary <string, Collection <Int32> >();
            }
            if (false == _PksWhere.ContainsKey(Where))
            {
                CswCommaDelimitedString Select = new CswCommaDelimitedString();
                Select.Add(_PkColumnName);

                string WhereClause = Where;
                addModuleWhereClause(ref WhereClause);

                DataTable Table = _TableSelect.getTable(Select, string.Empty, Int32.MinValue, WhereClause, false);

                Collection <Int32> Coll = new Collection <Int32>();
                foreach (DataRow Row in Table.Rows)
                {
                    Coll.Add(CswConvert.ToInt32(Row[_PkColumnName]));
                }
                _PksWhere[Where] = Coll;
            }
            return(_PksWhere[Where]);
        } // getPks(Where)
        public static void GetFilterOpts(ICswResources CswResources, CswNbtExplorerReturn Return, string Request)
        {
            CswNbtResources NbtResources = (CswNbtResources)CswResources;

            CswCommaDelimitedString ValsCDS = new CswCommaDelimitedString();

            Return.Data.FilterVal = CswNbtArborGraph._setDefaultFilterVal(NbtResources);
            ValsCDS.FromString(Return.Data.FilterVal);

            foreach (CswNbtMetaDataNodeType NodeType in NbtResources.MetaData.getNodeTypes())
            {
                Return.Data.Opts.Add(new ArborFilterOpt()
                {
                    selected = ValsCDS.Contains("NT_" + NodeType.NodeTypeId),
                    text     = NodeType.NodeTypeName,
                    value    = "NT_" + NodeType.NodeTypeId.ToString()
                });
            }

            foreach (CswNbtMetaDataObjectClass ObjClass in NbtResources.MetaData.getObjectClasses())
            {
                Return.Data.Opts.Add(new ArborFilterOpt()
                {
                    selected = ValsCDS.Contains("OC_" + ObjClass.ObjectClassId.ToString()),
                    text     = ObjClass.ObjectClassName,
                    value    = "OC_" + ObjClass.ObjectClassId.ToString()
                });
            }
        }
        public override void update()
        {
            //_CswNbtSchemaModTrnsctn.addObjectClassPropRow
            CswCommaDelimitedString FormatOptionString = new CswCommaDelimitedString();
            FormatOptionString.Add( MailRptFormatOptions.Link.ToString() );
            FormatOptionString.Add( MailRptFormatOptions.CSV.ToString() );


            CswNbtMetaDataObjectClass MailRptOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.MailReportClass );
            CswNbtMetaDataObjectClassProp MailRptFormatProp =
                _CswNbtSchemaModTrnsctn.createObjectClassProp( MailRptOC,
                                                 new CswNbtWcfMetaDataModel.ObjectClassProp
                                                 {
                                                     PropName = CswNbtObjClassMailReport.OutputFormatPropertyName.ToString(),
                                                     FieldType = CswNbtMetaDataFieldType.NbtFieldType.List,
                                                     ListOptions = FormatOptionString.ToString(),
                                                     SetValOnAdd = false,
                                                     IsRequired = false
                                                 }
                      );

            _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( MailRptFormatProp, CswNbtSubField.SubFieldName.Value, MailRptFormatOptions.Link.ToString() );
            _CswNbtSchemaModTrnsctn.MetaData.makeMissingNodeTypeProps();

        }//Update()
        }//afterDeleteNode()

        #endregion

        #region Private Helper Methods

        /// <summary>
        /// Make sure the list of Hazard Class options on the Chemical NodeType matches
        /// the default set of hazard class options (except FL-Comb)
        /// </summary>
        private void _syncDefaultHazardClassOptions()
        {
            CswNbtMetaDataObjectClass ChemicalOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ChemicalClass);

            foreach (CswNbtMetaDataNodeType ChemicalNT in ChemicalOC.getNodeTypes())
            {
                CswNbtMetaDataNodeTypeProp ChemicalHazardClassesNTP = _CswNbtResources.MetaData.getNodeTypePropByObjectClassProp(ChemicalNT.NodeTypeId, CswNbtObjClassChemical.PropertyName.HazardClasses);
                if (null != ChemicalHazardClassesNTP)
                {
                    CswNbtMetaDataNodeTypeProp FireClassHazardTypesNTP = _CswNbtResources.MetaData.getNodeTypePropByObjectClassProp(NodeTypeId, PropertyName.HazardClass);
                    if (null != FireClassHazardTypesNTP)
                    {
                        //string FLComb = "FL-Comb";
                        //int index = FireClassHazardTypesNTP.ListOptions.IndexOf( FLComb );
                        //string FireClassListOptions = FireClassHazardTypesNTP.ListOptions.Remove( index, FLComb.Length );
                        //ChemicalHazardClassesNTP.ListOptions = FireClassListOptions;

                        CswCommaDelimitedString HazardClassOptions = new CswCommaDelimitedString();
                        HazardClassOptions.FromString(HazardClass[CswNbtFieldTypeRuleList.AttributeName.Options]);
                        HazardClassOptions.Remove("FL-Comb");

                        ChemicalHazardClassesNTP.DesignNode.AttributeProperty[CswNbtFieldTypeRuleMultiList.AttributeName.Options].AsText.Text = HazardClassOptions.ToString();
                        ChemicalHazardClassesNTP.DesignNode.postChanges(false);
                    }
                }
            }
        }
        /// <summary>
        /// Add a value to the set of selected values
        /// </summary>
        public void AddValue(string ValueToAdd)
        {
            CswCommaDelimitedString myValue = Value;

            myValue.Add(ValueToAdd, IsUnique: true);
            Value = myValue;
        }
Esempio n. 16
0
 public override void afterPropertySetPopulateProps()
 {
     if (Owner.RelatedNodeId != null)
     {
         CswNbtNode EquipmentOrAssemblyNode = _CswNbtResources.Nodes[Owner.RelatedNodeId];
         if (EquipmentOrAssemblyNode != null)
         {
             CswCommaDelimitedString NewYValues = new CswCommaDelimitedString();
             if (EquipmentOrAssemblyNode.getObjectClass().ObjectClass == CswEnumNbtObjectClass.EquipmentClass)
             {
                 CswNbtObjClassEquipment EquipmentNodeAsEquipment = (CswNbtObjClassEquipment)EquipmentOrAssemblyNode;
                 foreach (string YValue in EquipmentNodeAsEquipment.Parts.YValues)
                 {
                     if (EquipmentNodeAsEquipment.Parts.CheckValue(CswNbtObjClassEquipment.PartsXValueName, YValue))
                     {
                         NewYValues.Add(YValue);
                     }
                 }
             }
             else if (EquipmentOrAssemblyNode.getObjectClass().ObjectClass == CswEnumNbtObjectClass.EquipmentAssemblyClass)
             {
                 CswNbtObjClassEquipmentAssembly AssemblyNodeAsAssembly = (CswNbtObjClassEquipmentAssembly)EquipmentOrAssemblyNode;
                 foreach (string YValue in AssemblyNodeAsAssembly.AssemblyParts.YValues)
                 {
                     if (AssemblyNodeAsAssembly.AssemblyParts.CheckValue(CswNbtObjClassEquipmentAssembly.PartsXValueName, YValue))
                     {
                         NewYValues.Add(YValue);
                     }
                 }
             }
             this.Parts.YValues = NewYValues;
         } // if( EquipmentOrAssemblyNode != null )
     }     // if( Owner.RelatedNodeId != null )
 }         //afterPopulateProps()
        } // ValidateValues()

        /// <summary>
        /// Remove a value from the set of selected values
        /// </summary>
        public void RemoveValue(string ValueToRemove)
        {
            CswCommaDelimitedString myValue = Value;

            myValue.RemoveAll(ValueToRemove);
            Value = myValue;
        }
        private void _init()
        {
            if (Int32.MinValue != _fkDefId)
            {
                CswTableSelect FkeyDefsSelect = _CswNbtResources.makeCswTableSelect("fetch_fkey_def_sql", "fkey_definitions");
                DataTable      FkeyDefsTable  = FkeyDefsSelect.getTable("fkeydefid", _fkDefId);
                string         Sql            = FkeyDefsTable.Rows[0]["sql"].ToString();

                CswArbitrarySelect ListOptsSelect = _CswNbtResources.makeCswArbitrarySelect("list_options_query", Sql);
                DataTable          ListOptsTable  = ListOptsSelect.getTable();

                _Options = new Collection <CswNbtNodeTypePropListOption>();
                _Options.Add(new CswNbtNodeTypePropListOption("", ""));
                foreach (DataRow CurrentRow in ListOptsTable.Rows)
                {
                    _Options.Add(new CswNbtNodeTypePropListOption(CurrentRow[FkeyDefsTable.Rows[0]["ref_column"].ToString()].ToString(),
                                                                  CurrentRow[FkeyDefsTable.Rows[0]["pk_column"].ToString()].ToString()));
                }//iterate listopts rows
            }
            else
            {
                CswCommaDelimitedString Opts = new CswCommaDelimitedString();
                Opts.FromString(_ListOptions);
                Override(Opts);
            }
        }
Esempio n. 19
0
        }        //ctor

        public override void update()
        {
            _CswTstCaseRsrc = new CswTestCaseRsrc(_CswNbtSchemaModTrnsctn);
            _CswTstCaseRsrc_014.CswNbtSchemaModTrnsctn = _CswNbtSchemaModTrnsctn;


            CswTableSelect CswTableSelectNodeTypes = _CswNbtSchemaModTrnsctn.makeCswTableSelect(Description, "nodetypes");
            DataTable      NodetypesTable          = CswTableSelectNodeTypes.getTable(" where lower(tablename)='materials'");
            Int32          NodeTypeId = Convert.ToInt32(NodetypesTable.Rows[0]["nodetypeid"]);

            CswNbtMetaDataNodeType NodeType       = _CswNbtSchemaModTrnsctn.MetaData.getNodeType(NodeTypeId);
            CswTableUpdate         CswTableUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate(Description, NodeType.TableName);
            string PkColumnName = _CswNbtSchemaModTrnsctn.getPrimeKeyColName(NodeType.TableName);

            //bz # 9102: This is the way of getting the record that causes the updated record disappear
            CswCommaDelimitedString SelectColumns = null; //new CswCommaDelimitedString();
            //foreach( CswNbtMetaDataNodeTypeProp CurrentNodeTypeProp in NodeType.getNodeTypeProps() )
            //{
            //    foreach( CswNbtSubField CurrentSubField in CurrentNodeTypeProp.getFieldTypeRule().SubFields )
            //    {
            //        if( CurrentSubField.RelationalColumn != string.Empty )
            //            SelectColumns.Add( CurrentSubField.RelationalColumn );
            //    }
            //}//iterate node type props to set up select columns
            DataTable DataTable = CswTableUpdate.getTable(SelectColumns, PkColumnName, _CswTstCaseRsrc_014.InsertedMaterialsRecordPk, string.Empty, false);

            DataTable.Rows[0]["materialname"] = "nu _CswTstCaseRsrc_014.Purpose";

            CswTableUpdate.update(DataTable);
        }
Esempio n. 20
0
        public CswCommaDelimitedString GetNodesToReport()
        {
            CswCommaDelimitedString NodesStr = new CswCommaDelimitedString();

            NodesStr.FromString(NodesToReport.Text);
            return(NodesStr);
        } // GetNodesToReport()
        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);
        }
Esempio n. 22
0
        public override void update()
        {
            string SQL = @"select jctnodepropid
                             from (select j1.nodeid, j1.nodetypepropid, max(j1.jctnodepropid) jctnodepropid
                                     from jct_nodes_props j1
                                     join jct_nodes_props j2 on (j1.nodetypepropid = j2.nodetypepropid
                                                                 and j1.nodeid = j2.nodeid 
                                                                 and j1.jctnodepropid <> j2.jctnodepropid)
                                    group by j1.nodeid, j1.nodetypepropid)";

            CswArbitrarySelect DupeSelect = _CswNbtSchemaModTrnsctn.makeCswArbitrarySelect( "29797_select", SQL );
            DataTable DupeTable = DupeSelect.getTable();
            if( DupeTable.Rows.Count > 0 )
            {
                CswCommaDelimitedString JctIds = new CswCommaDelimitedString();
                foreach( DataRow DupeRow in DupeTable.Rows )
                {
                    JctIds.Add( DupeRow["jctnodepropid"].ToString() );
                }

                CswTableUpdate JctUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "29797_update", "jct_nodes_props" );
                DataTable JctTable = JctUpdate.getTable( "where jctnodepropid in (" + JctIds.ToString() + ")" );
                foreach( DataRow JctRow in JctTable.Rows )
                {
                    JctRow.Delete();
                }
                JctUpdate.update( JctTable );
            }
        } // update()
Esempio n. 23
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()
Esempio n. 24
0
        }//_getPreferredSuppliers()

        private static Collection <VendorOption> _getAvailableDataSources(CswNbtC3ClientManager CswNbtC3ClientManager, CswC3Params CswC3Params)
        {
            Collection <VendorOption> AvailableDataSources = new Collection <VendorOption>();

            SearchClient C3SearchClient = CswNbtC3ClientManager.initializeC3Client();

            if (null != C3SearchClient)
            {
                CswRetObjSearchResults SourcesList = C3SearchClient.getDataSources(CswC3Params);
                if (null != SourcesList)
                {
                    //Create the "All Sources" option
                    CswCommaDelimitedString AllSources = new CswCommaDelimitedString();
                    AllSources.FromArray(SourcesList.AvailableDataSources);

                    VendorOption allSourcesDs = new VendorOption();
                    allSourcesDs.value   = AllSources.ToString();
                    allSourcesDs.display = "All Sources";
                    AvailableDataSources.Add(allSourcesDs);

                    //Add available data source options
                    foreach (string DataSource in SourcesList.AvailableDataSources)
                    {
                        VendorOption dS = new VendorOption();
                        dS.value   = DataSource;
                        dS.display = DataSource;
                        AvailableDataSources.Add(dS);
                    }
                } //if( null != SourcesList )
            }     //if( null != C3SearchClient )

            return(AvailableDataSources);
        }//_getAvailableDataSources()
        public override void update()
        {
            CswCommaDelimitedString NewFireHazardClasses = new CswCommaDelimitedString {"Corr (liquified gas)",
                "CRY-NFG",
                "Exp-1.1",
                "Exp-1.2",
                "Exp-1.3", 
                "Exp-1.4", 
                "Exp-1.4G", 
                "Exp-1.5",
                "Exp-1.6", 
                "H.T. (liquified gas)", 
                "N/R",
                "NFG", 
                "NFG (liquified)", 
                "NFS", 
                "Tox (liquified gas)"};

            FireClassExemptAmountNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Fire Class Exempt Amount" );
            if( null != FireClassExemptAmountNT )
            {
                FireClassExemptAmountSetOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.FireClassExemptAmountSetClass );
                if( null != FireClassExemptAmountSetOC )
                {
                    FireClassExemptAmountSetNT = FireClassExemptAmountSetOC.FirstNodeType;
                    if( null != FireClassExemptAmountSetNT )
                    {
                        foreach( KeyValuePair<CswPrimaryKey, string> NodeIdAndName in FireClassExemptAmountSetNT.getNodeIdAndNames( false, true ) )
                        {
                            if( NodeIdAndName.Value.Equals( "Default" ) )
                            {
                                SetNameNodeId = NodeIdAndName.Key;
                            }
                        }

                        #region FireClassExemptAmount Nodes

                        _createFireClassExemptAmountNode( 301.2, NewFireHazardClasses[0], "(liquified gas)", "Health", "Corrosives" );
                        _createFireClassExemptAmountNode( 212.2, NewFireHazardClasses[1], "NFG", "Physical", "Cryogenic" );
                        _createFireClassExemptAmountNode( 213.1, NewFireHazardClasses[2], "1.1", "Physical", "Explosive" );
                        _createFireClassExemptAmountNode( 213.2, NewFireHazardClasses[3], "1.2", "Physical", "Explosive" );
                        _createFireClassExemptAmountNode( 213.3, NewFireHazardClasses[4], "1.3", "Physical", "Explosive" );
                        _createFireClassExemptAmountNode( 213.4, NewFireHazardClasses[5], "1.4", "Physical", "Explosive" );
                        _createFireClassExemptAmountNode( 213.5, NewFireHazardClasses[6], "1.4G", "Physical", "Explosive" );
                        _createFireClassExemptAmountNode( 213.6, NewFireHazardClasses[7], "1.5", "Physical", "Explosive" );
                        _createFireClassExemptAmountNode( 213.7, NewFireHazardClasses[8], "1.6", "Physical", "Explosive" );
                        _createFireClassExemptAmountNode( 301.4, NewFireHazardClasses[9], "(liquified gas)", "Health", "Highly Toxic" );
                        _createFireClassExemptAmountNode( 1000.0, NewFireHazardClasses[10], "", "", "Non-Regulated" );
                        _createFireClassExemptAmountNode( 1000.0, NewFireHazardClasses[11], "", "", "Non-Flammable Gas" );
                        _createFireClassExemptAmountNode( 1000.0, NewFireHazardClasses[12], "(liquified)", "", "Non-Flammable Gas" );
                        _createFireClassExemptAmountNode( 1000.0, NewFireHazardClasses[13], "", "", "Non-Flammable Solid" );
                        _createFireClassExemptAmountNode( 308.1, NewFireHazardClasses[14], "(liquified gas)", "Health", "Toxic" );

                        #endregion FireClassExemptAmount Nodes

                    }//if( null != FireClassExemptAmountSetNT )
                }
            }//if( null != FireClassExemptAmountNT )

        } // update()
 private void _removeTargetsNotMatchingSelectedParent()
 {
     //If only one Parent NT is allowed (and selected), cycle through selected Target NTs and remove any that aren't related to the selected Parent NT
     if( Node.getNodeType().getFirstVersionNodeType().NodeTypeName == InspectionGeneratorNodeTypeName &&
         ParentType.SelectMode == CswEnumNbtPropertySelectMode.Single &&
         ParentType.SelectedNodeTypeIds.Count > 0 )
     {
         CswCommaDelimitedString InvalidNodeTypes = new CswCommaDelimitedString();
         foreach( Int32 InspectionDesignNodeTypeId in TargetType.SelectedNodeTypeIds.ToIntCollection() )
         {
             CswNbtMetaDataNodeType InspectionDesignNt = _CswNbtResources.MetaData.getNodeType( InspectionDesignNodeTypeId );
             if( null != InspectionDesignNt )
             {
                 Int32 InspectionTargetNTId = CswConvert.ToInt32( ParentType.SelectedNodeTypeIds[0] );
                 CswNbtMetaDataNodeTypeProp DesignTargetNtp = InspectionDesignNt.getNodeTypePropByObjectClassProp( CswNbtObjClassInspectionDesign.PropertyName.Target );
                 if( _fkIsValid( DesignTargetNtp ) && InspectionTargetNTId != DesignTargetNtp.FKValue )
                 {
                     InvalidNodeTypes.Add( InspectionDesignNt.NodeTypeName );
                     TargetType.SelectedNodeTypeIds.Remove( InspectionDesignNt.NodeTypeId.ToString() );
                 }
             }
         }
         if( InvalidNodeTypes.Count > 0 && false == Owner.wasAnySubFieldModified() )
         {
             throw new CswDniException( CswEnumErrorType.Warning,
                 "Unable to add the following " + TargetType.PropName + " options because they do not belong to " + Owner.CachedNodeName +
                 ": <br/>" + InvalidNodeTypes.ToString().Replace( ",", "<br/>" ),
                 "Invalid Target Type options selected: " + InvalidNodeTypes );
         }
     }
 }
        public CswCommaDelimitedString SelectedUserNames()
        {
            CswCommaDelimitedString SelectedUserNames = new CswCommaDelimitedString();
            //ICswNbtTree UsersTree = _CswNbtResources.Trees.getTreeFromObjectClass( CswNbtMetaDataObjectClassName.NbtObjectClass.UserClass );
            //for( int c = 0; c < UsersTree.getChildNodeCount(); c++ )
            //{
            //    UsersTree.goToNthChild( c );
            CswNbtMetaDataObjectClass UserOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.UserClass);

            foreach (CswNbtNode UserNode in UserOC.getNodes(false, false))
            {
                CswPrimaryKey ThisUserId   = UserNode.NodeId;   //UsersTree.getNodeIdForCurrentPosition();
                string        ThisUserName = UserNode.NodeName; // UsersTree.getNodeNameForCurrentPosition();

                foreach (Int32 UserId in SelectedUserIds.ToIntCollection())
                {
                    if (UserId != Int32.MinValue)
                    {
                        if (ThisUserId.PrimaryKey == UserId)
                        {
                            SelectedUserNames.Add(ThisUserName);
                        }
                    }
                } // foreach( Int32 UserId in SelectedUserIds.ToIntCollection() )

                //UsersTree.goToParentNode();
            } // for( int c = 0; c < UsersTree.getChildNodeCount(); c++ )

            // Sort alphabetically
            SelectedUserNames.Sort();

            return(SelectedUserNames);
        } // SelectedUserNames()
Esempio n. 28
0
        private void _updateGHSNodes( string Word, CswNbtNode Related, CswCommaDelimitedString NodeIds, CswNbtMetaDataObjectClass GHSOC )
        {
            if( NodeIds.Count > 0 )
            {
                Collection<int> NodesToUpdate = new Collection<int>();
                string sql = "where nodeid in (" + NodeIds + ") and field1 = '" + Word + "'";
                CswTableUpdate PropUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "UpdateSignalWordPropsWarning", "jct_nodes_props" );
                DataTable PropsTbl = PropUpdate.getTable( sql );
                foreach( DataRow row in PropsTbl.Rows )
                {
                    NodesToUpdate.Add( CswConvert.ToInt32( row["nodeid"] ) );
                    row["gestaltsearch"] = "";
                    row["gestalt"] = "";
                    row["field1"] = "";
                    row["field2"] = "";
                }
                PropUpdate.update( PropsTbl );

                //Now update the nodes to have the REAL value for the signal word prop
                foreach( CswNbtObjClassGHS GHSNode in GHSOC.getNodes( false, true, false, true ).Where( Node => NodesToUpdate.Contains( Node.NodeId.PrimaryKey ) ) )
                {
                    GHSNode.SignalWord.RelatedNodeId = Related.NodeId;
                    GHSNode.postChanges( false );
                }
            }
        }
Esempio n. 29
0
        public CswCommaDelimitedString SelectedNodeTypeNames()
        {
            CswCommaDelimitedString NodeTypeNames = new CswCommaDelimitedString();

            foreach (string NodeTypeId in SelectedNodeTypeIds)
            {
                if (string.Empty != NodeTypeId)
                {
                    CswNbtMetaDataNodeType NodeType = _CswNbtResources.MetaData.getNodeType(CswConvert.ToInt32(NodeTypeId));
                    if (null != NodeType)
                    {
                        NodeTypeNames.Add(NodeType.getNodeTypeLatestVersion().NodeTypeName);
                    }
                }
            } // foreach(string NodeTypeId in SelectedNodeTypeIds)
            if (0 == NodeTypeNames.Count)
            {
                NodeTypeNames.Add("[none]");
            }

            // Sort alphabetically
            NodeTypeNames.Sort();

            return(NodeTypeNames);
        } // SelectedNodeTypeNames()
Esempio n. 30
0
        }//generateCAFSql()

        /// <summary>
        /// Get all the custom properties in a CAF schema
        /// </summary>
        private static string GetCAFPropertiesSQL(string propValsTblName, List <string> NodeTypes)
        {
            CswCommaDelimitedString cdsNTNames = new CswCommaDelimitedString();

            foreach (string ntName in NodeTypes)
            {
                cdsNTNames.Add("'" + ntName + "'");
            }

            string sql = @"select distinct p.propertyid,
                             p.propertyname,
                             p.propertytype,
                             p.required, 
                             p.readonly,
                             (select listopts from (select propertyid, listagg(replace(lkpitem, ',', ''), ',') within group (order by lkpitem) as listopts
                                   from properties_list_lkps@caflink
                                        group by propertyid) where propertyid = p.propertyid) listopts
                            from properties@caflink p
                                   join " + propValsTblName + @"@caflink pv on p.propertyid = pv.propertyid
                             where p.propertyid not in (select legacypropid from import_def_bindings idb
                                         join properties@caflink p on p.propertyid = idb.legacypropid and destnodetypename in (" + cdsNTNames + @") ) and p.deleted = 0
                            order by propertyid";

            return(sql);
        }