Beispiel #1
0
    public Microsoft.VisualBasic.Collection PdfReaderPages()
    {
        /* 1. make a List of PdfReaderPage elements */
        var csharp_list = new List <PdfReaderPage>()
        {
            new PdfReaderPage()
            {
                Foo = 1
            },
            new PdfReaderPage()
            {
                Foo = 2
            },
            new PdfReaderPage()
            {
                Foo = 3
            }
        };
        /* 2. convert it into a vb collection */
        var vb_coll = new Microsoft.VisualBasic.Collection();

        csharp_list.ForEach(x => vb_coll.Add(x));
        /* 3. deliver it */
        return(vb_coll);
    }
		public void OnAfterLoadDiagram(ISchematicInMemoryDiagram inMemoryDiagram)
		{
			// if add-in is not enabled then quit
			if (State != ESRI.ArcGIS.Desktop.AddIns.ExtensionState.Enabled) return;

			IEnumSchematicInMemoryFeature enumSchemElements;
			ISchematicInMemoryFeature schemElement;
			string nameRelatedCN = "";
			int numRelatedOID = 0;
			IFeatureClass esriFeatureClass;
			IFeature esriFeature;
			ISchematicInMemoryFeatureLinkerEdit schemFeatureLinkerEdit = (ISchematicInMemoryFeatureLinkerEdit)new SchematicLinker();
			ISchematicObjectClass myObjectType;
			ISchematicAttribute schemAttributeCID;
			ISchematicAttribute schemAttributeOID;
			ISchematicAttributeContainer schemAttributeContainer;

			IWorkspace esriWorkspace;
			Microsoft.VisualBasic.Collection colFCByName;

			colFCByName = new Microsoft.VisualBasic.Collection();
			esriWorkspace = inMemoryDiagram.SchematicDiagramClass.SchematicDataset.SchematicWorkspace.Workspace;

			// Retrieve all schematic element of the diagram

			enumSchemElements = (IEnumSchematicInMemoryFeature)inMemoryDiagram.SchematicInMemoryFeatures;
			enumSchemElements.Reset();

			schemElement = enumSchemElements.Next();
			while (schemElement != null)
			{
				// retrieve attribute
				myObjectType = schemElement.SchematicElementClass;
				schemAttributeContainer = (ISchematicAttributeContainer)schemElement.SchematicElementClass;
				schemAttributeCID = schemAttributeContainer.GetSchematicAttribute(AttClassNameName, false);
				schemAttributeOID = schemAttributeContainer.GetSchematicAttribute(AttObjectIdName, false);
				if (schemAttributeCID != null && schemAttributeOID != null)
				{
					// get value of attribute
					nameRelatedCN = schemAttributeCID.GetValue((ISchematicObject)schemElement).ToString();
					numRelatedOID = System.Convert.ToInt32(schemAttributeOID.GetValue((ISchematicObject)schemElement));

					// get feature from geodatabase
					esriFeatureClass = FindFeatureClassByName(esriWorkspace, nameRelatedCN, colFCByName);
					if (esriFeatureClass != null)
					{
						// get feature from FeatureClass
						esriFeature = esriFeatureClass.GetFeature(numRelatedOID);
						if (esriFeature != null)
						{
							// Associate geographical feature with schematic feature
							schemFeatureLinkerEdit.Associate(schemElement, esriFeature);
						}
					}
				}
				schemElement = enumSchemElements.Next();
			}
			colFCByName.Clear();
			colFCByName = null;
		}
Beispiel #3
0
        public ResponseObject Insert(List <Field> rec)
        {
            var             objResp = new ResponseObject();
            CommittalRecord comRec  = new CommittalRecord(this.Obj.GetProperty("DocClass"));

            foreach (Field field in rec)
            {
                P8QueryServer.DocumentProperty prop;
                prop = new P8QueryServer.DocumentProperty
                {
                    Name  = field.Name,
                    Value = field.Value,
                    Type  = field.Type == "Date" ? P8QueryServer.DocumentProperty.propType.TYPE_DATETIME : (field.Type == "Number" ? P8QueryServer.DocumentProperty.propType.TYPE_INTEGER : P8QueryServer.DocumentProperty.propType.TYPE_STRING)
                };
                comRec.Properties.Add(prop);
                if (field.Name == "ImagePath")
                {
                    prop = new P8QueryServer.DocumentProperty
                    {
                        Name  = "DocumentTitle",
                        Value = Path.GetFileName(field.Value),
                        Type  = P8QueryServer.DocumentProperty.propType.TYPE_STRING
                    };
                    comRec.Properties.Add(prop);
                    comRec.Contents.Add(field.Value);
                }
            }

            Microsoft.VisualBasic.Collection docCollection = new Microsoft.VisualBasic.Collection();
            docCollection.Add(comRec);

            var success = this.P8Connector.commitDocuments(ref docCollection);

            //log the id created if success, or the error if it failed
            if (success == true)
            {
                objResp.AdditionalInfo = comRec.Id;
                objResp.ResultCode     = true;
            }
            else
            {
                objResp.AdditionalInfo = P8Connector.getErrorString();
                objResp.ResultCode     = false;
            }



            return(objResp);
        }
Beispiel #4
0
        public void OnAfterLoadDiagram(ISchematicInMemoryDiagram inMemoryDiagram)
        {
            // if add-in is not enabled then quit
            if (State != ESRI.ArcGIS.Desktop.AddIns.ExtensionState.Enabled)
            {
                return;
            }

            IEnumSchematicInMemoryFeature enumSchemElements;
            ISchematicInMemoryFeature     schemElement;
            string        nameRelatedCN = "";
            int           numRelatedOID = 0;
            IFeatureClass esriFeatureClass;
            IFeature      esriFeature;
            ISchematicInMemoryFeatureLinkerEdit schemFeatureLinkerEdit = (ISchematicInMemoryFeatureLinkerEdit) new SchematicLinker();
            ISchematicObjectClass        myObjectType;
            ISchematicAttribute          schemAttributeCID;
            ISchematicAttribute          schemAttributeOID;
            ISchematicAttributeContainer schemAttributeContainer;

            IWorkspace esriWorkspace;

            Microsoft.VisualBasic.Collection colFCByName;

            colFCByName   = new Microsoft.VisualBasic.Collection();
            esriWorkspace = inMemoryDiagram.SchematicDiagramClass.SchematicDataset.SchematicWorkspace.Workspace;

            // Retrieve all schematic element of the diagram

            enumSchemElements = (IEnumSchematicInMemoryFeature)inMemoryDiagram.SchematicInMemoryFeatures;
            enumSchemElements.Reset();

            schemElement = enumSchemElements.Next();
            while (schemElement != null)
            {
                // retrieve attribute
                myObjectType            = schemElement.SchematicElementClass;
                schemAttributeContainer = (ISchematicAttributeContainer)schemElement.SchematicElementClass;
                schemAttributeCID       = schemAttributeContainer.GetSchematicAttribute(AttClassNameName, false);
                schemAttributeOID       = schemAttributeContainer.GetSchematicAttribute(AttObjectIdName, false);
                if (schemAttributeCID != null && schemAttributeOID != null)
                {
                    // get value of attribute
                    nameRelatedCN = schemAttributeCID.GetValue((ISchematicObject)schemElement).ToString();
                    numRelatedOID = System.Convert.ToInt32(schemAttributeOID.GetValue((ISchematicObject)schemElement));

                    // get feature from geodatabase
                    esriFeatureClass = FindFeatureClassByName(esriWorkspace, nameRelatedCN, colFCByName);
                    if (esriFeatureClass != null)
                    {
                        // get feature from FeatureClass
                        esriFeature = esriFeatureClass.GetFeature(numRelatedOID);
                        if (esriFeature != null)
                        {
                            // Associate geographical feature with schematic feature
                            schemFeatureLinkerEdit.Associate(schemElement, esriFeature);
                        }
                    }
                }
                schemElement = enumSchemElements.Next();
            }
            colFCByName.Clear();
            colFCByName = null;
        }
Beispiel #5
0
        private IFeatureClass FindFeatureClassByName(IWorkspace workspace, string name, Microsoft.VisualBasic.Collection colFCByName)
        {
            IFeatureClass esriFeatureClass = null;

            try
            {
                // try to retrieve FeatureClass in collection
                esriFeatureClass = (IFeatureClass)colFCByName[name];
                return(esriFeatureClass);
            }
            catch { }

            IEnumDataset           enumDatasets;
            IDataset               esriDataset;
            IFeatureClassContainer featContainer;

            // get datasets
            enumDatasets = workspace.get_Datasets(esriDatasetType.esriDTFeatureDataset);
            enumDatasets.Reset();
            esriDataset = enumDatasets.Next();
            while (esriDataset != null)
            {
                // try to find class in dataset
                try
                {
                    featContainer = (IFeatureClassContainer)esriDataset;
                    // get FeatureClass from current dataset
                    esriFeatureClass = featContainer.get_ClassByName(name);
                    if (esriFeatureClass != null)
                    {
                        // if exists add to collection and quit
                        colFCByName.Add(esriFeatureClass, name, null, null);
                        return(esriFeatureClass);
                    }
                }
                catch { }
                // try another dataset
                esriDataset = enumDatasets.Next();
            }

            try
            {
                // try to find FeatureClass in workspace
                featContainer    = (IFeatureClassContainer)workspace;
                esriFeatureClass = featContainer.get_ClassByName(name);
                if (esriFeatureClass != null)
                {
                    // if exists add to collection and quit
                    colFCByName.Add(esriFeatureClass, name, null, null);
                    return(esriFeatureClass);
                }
            }
            catch { }
            return(null);
        }
Beispiel #6
0
        public void Apply(ISchematicInMemoryDiagram inMemoryDiagram, ESRI.ArcGIS.esriSystem.ITrackCancel cancelTracker)
        {
            if (m_reductionLinkName == "")
            {
                return;
            }

            IEnumSchematicInMemoryFeature enumSchematicElement;
            ISchematicInMemoryFeature     schemElement;
            ISchematicDiagramClass        diagramClass = null;
            ISchematicElementClass        elementClass;
            IEnumSchematicElementClass    enumElementClass;

            Microsoft.VisualBasic.Collection allreadyUsed = new Microsoft.VisualBasic.Collection();
            try
            {
                diagramClass = inMemoryDiagram.SchematicDiagramClass;
            }
            catch { }
            if (diagramClass == null)
            {
                return;
            }

            enumElementClass = diagramClass.AssociatedSchematicElementClasses;
            enumElementClass.Reset();
            elementClass = enumElementClass.Next();
            while (elementClass != null)
            {
                if (elementClass.Name == m_reductionLinkName)
                {
                    break;
                }
                elementClass = enumElementClass.Next();
            }
            if (elementClass == null)
            {
                return;
            }

            // Get all link from selected class
            enumSchematicElement = inMemoryDiagram.GetSchematicInMemoryFeaturesByClass(elementClass);
            enumSchematicElement.Reset();

            ISchematicInMemoryFeatureLink link     = null;
            ISchematicInMemoryFeatureNode fromNode = null;
            ISchematicInMemoryFeatureNode toNode   = null;
            int iFromPort = 0;
            int iToPort   = 0;
            ISchematicInMemoryFeature           newElem = null;
            IEnumSchematicInMemoryFeatureLink   enumIncidentLinks;
            ISchematicInMemoryFeatureLinkerEdit schemLinker = (ISchematicInMemoryFeatureLinkerEdit)(new SchematicLinkerClass());
            bool bReduction = false;

            schemElement = enumSchematicElement.Next();
            while (schemElement != null)
            {
                try
                {
                    string elemName = allreadyUsed[schemElement.Name].ToString();
                    // if found, this link is allready used
                    schemElement = enumSchematicElement.Next();
                    continue;
                }
                catch
                {
                    // Add link to collection
                    allreadyUsed.Add(schemElement.Name, schemElement.Name, null, null);
                }

                // Get from node and to node
                link     = (ISchematicInMemoryFeatureLink)schemElement;
                fromNode = link.FromNode;
                toNode   = link.ToNode;
                if (m_usePort)
                {
                    iFromPort = link.FromPort;
                    iToPort   = link.ToPort;
                }
                // Get all links from this node
                enumIncidentLinks = fromNode.GetIncidentLinks(esriSchematicEndPointType.esriSchematicOriginOrExtremityNode);
                enumIncidentLinks.Reset();
                newElem = enumIncidentLinks.Next();
                while (newElem != null)
                {
                    bReduction = false;
                    if (newElem == schemElement)
                    {
                        // the new link is the same link we works on
                        newElem = enumIncidentLinks.Next();
                        continue;
                    }
                    link = (ISchematicInMemoryFeatureLink)newElem;

                    // 1st case of comparison
                    if (fromNode == link.FromNode && toNode == link.ToNode)
                    {
                        if (m_usePort)
                        {
                            bReduction = (iFromPort == link.FromPort && iToPort == link.ToPort);
                        }
                        else
                        {
                            bReduction = true;
                        }
                    }
                    // 2nd case of comparison
                    else if (fromNode == link.ToNode && toNode == link.FromNode)
                    {
                        if (m_usePort)
                        {
                            bReduction = (iFromPort == link.ToPort && iToPort == link.FromPort);
                        }
                        else
                        {
                            bReduction = true;
                        }
                    }

                    if (bReduction)
                    {
                        try
                        {
                            schemLinker.ReportAssociations(newElem, schemElement);    // Reports asssociation to first link
                            allreadyUsed.Add(newElem.Name, newElem.Name, null, null); // Add link to collection
                            newElem.Displayed = false;                                // this link is not visible
                        }
                        catch { }
                    }
                    newElem = enumIncidentLinks.Next();
                }
                schemElement.Displayed = true;
                schemElement           = enumSchematicElement.Next();
            }
        }
Beispiel #7
0
        static Dictionary <String, Object> generateConfigDictionary(ISimulation sim)
        {
            sinter_SetupFile            setup    = sim.setupFile;
            Dictionary <String, Object> jsonDict = new Dictionary <String, Object>();

            //First add the basic meta-data:

            jsonDict.Add("title", setup.title);
            jsonDict.Add("description", setup.simulationDescription);
            jsonDict.Add("aspenfile", setup.aspenFilename);
            jsonDict.Add("author", setup.author);
            jsonDict.Add("date", setup.dateString);
            jsonDict.Add("filetype", "sinterconfig");
            jsonDict.Add("version", 0.2);

            //Now, create the settings section:
            {
                Microsoft.VisualBasic.Collection IOObjects    = setup.Variables;
                Dictionary <String, Object>      settingsDict = new Dictionary <String, Object>();

                foreach (sinter_Variable ioobj in setup.Settings)
                {
                    Dictionary <String, Object> thisSetting = new Dictionary <String, Object>();
                    thisSetting.Add("type", ioobj.typeString);
                    thisSetting.Add("default", ioobj.Value);
                    thisSetting.Add("description", ioobj.description);
                    settingsDict.Add(ioobj.settingName, thisSetting);   //Settings only have 1 address String, it should be the name of the setting
                }
                if (settingsDict.Count > 0)
                {
                    jsonDict.Add("settings", settingsDict);
                }
            }

            //Now the input section
            {
                Microsoft.VisualBasic.Collection IOObjects  = setup.Variables;
                Dictionary <String, Object>      inputsDict = new Dictionary <String, Object>();

                foreach (sinter_Variable ioobj in IOObjects)
                {
                    if (ioobj.isInput)
                    { //Vectors SHOULD just work here, since JSON knows how to deal with double, int, and string arrays...
                        Dictionary <String, Object> thisInput = new Dictionary <String, Object>();
                        thisInput.Add("path", ioobj.addressStrings);
                        thisInput.Add("type", ioobj.typeString);
                        thisInput.Add("default", ioobj.Value);
                        thisInput.Add("description", ioobj.description);
                        thisInput.Add("units", ioobj.defaultUnits); //Old config files don't have units.

                        if (shouldOutputMinMax(ioobj))
                        {
                            thisInput.Add("min", ioobj.minimum);
                            thisInput.Add("max", ioobj.maximum);
                        }
                        inputsDict.Add(ioobj.name, thisInput);
                    }
                }
                if (inputsDict.Count > 0)
                {
                    jsonDict.Add("inputs", inputsDict);
                }
            }

            //outputs section
            {
                Microsoft.VisualBasic.Collection IOObjects   = setup.Variables;
                Dictionary <String, Object>      outputsDict = new Dictionary <String, Object>();

                foreach (sinter_Variable ioobj in IOObjects)
                {
                    if (ioobj.isOutput)
                    {
                        Dictionary <String, Object> thisOutput = new Dictionary <String, Object>();
                        thisOutput.Add("path", ioobj.addressStrings);
                        thisOutput.Add("type", ioobj.typeString);
                        thisOutput.Add("default", ioobj.Value);      //Yeah, the default is the canonical result, not whatever is in default
                        thisOutput.Add("description", ioobj.description);
                        thisOutput.Add("units", ioobj.defaultUnits); //Old config files don't have units.

                        outputsDict.Add(ioobj.name, thisOutput);
                    }
                }
                if (outputsDict.Count > 0)
                {
                    jsonDict.Add("outputs", outputsDict);
                }
            }


            //Now the inputtables section
            {
                Microsoft.VisualBasic.Collection tables     = setup.Tables;
                Dictionary <String, Object>      tablesDict = new Dictionary <String, Object>();

                foreach (sinter_Table ioobj in tables)
                {
                    if (ioobj.isInput)
                    {
                        Dictionary <String, Object> thisInput = new Dictionary <String, Object>();
                        thisInput.Add("rows", ioobj.rowStrings);
                        thisInput.Add("columns", ioobj.colStrings);
                        thisInput.Add("description", ioobj.description);

                        sinter_Variable[,] tableVars = ioobj.Value;
                        int        rLen  = tableVars.GetLength(0);
                        int        cLen  = tableVars.GetLength(1);
                        string[][] names = new String[rLen][];

                        for (int ii = 0; ii < tableVars.GetLength(0); ++ii)
                        {
                            string[] thisColVars = new String[cLen];
                            for (int jj = 0; jj < tableVars.GetLength(1); ++jj)
                            {
                                thisColVars[jj] = tableVars[ii, jj].name;
                            }
                            names[ii] = thisColVars;
                        }

                        thisInput.Add("contents", names);
                        tablesDict.Add(ioobj.name, thisInput);
                    }
                }
                if (tablesDict.Count > 0)
                {
                    jsonDict.Add("inputTables", tablesDict);
                }
            }

            //Now the outputtables section
            {
                Microsoft.VisualBasic.Collection tables     = setup.Tables;
                Dictionary <String, Object>      tablesDict = new Dictionary <String, Object>();

                foreach (sinter_Table ioobj in tables)
                {
                    if (ioobj.isOutput)
                    {
                        Dictionary <String, Object> thisInput = new Dictionary <String, Object>();
                        thisInput.Add("rows", ioobj.rowStrings);
                        thisInput.Add("columns", ioobj.colStrings);
                        thisInput.Add("description", ioobj.description);

                        sinter_Variable[,] tableVars = ioobj.Value;
                        int        rLen  = tableVars.GetLength(0);
                        int        cLen  = tableVars.GetLength(1);
                        string[][] names = new String[rLen][];

                        for (int ii = 0; ii < tableVars.GetLength(0); ++ii)
                        {
                            string[] thisColVars = new String[cLen];
                            for (int jj = 0; jj < tableVars.GetLength(1); ++jj)
                            {
                                thisColVars[jj] = tableVars[ii, jj].name;
                            }
                            names[ii] = thisColVars;
                        }

                        thisInput.Add("contents", names);
                        tablesDict.Add(ioobj.name, thisInput);
                    }
                }
                if (tablesDict.Count > 0)
                {
                    jsonDict.Add("outputTables", tablesDict);
                }
            }

            return(jsonDict);
        }
 private void Class_Initialize()
 {
     mCol = new VBCollection();
 }
 private void Class_Terminate()
 {
     mCol = null;
 }
Beispiel #10
0
 public void Dispose()
 {
     mCol = null;
 }
Beispiel #11
0
 public KChargeEnum(VBCollection col)
 {
     mCol = col;
 }
        private static void add2Application(string AppID, string AppShortName, string rigntsEntry)
        {
            // On Error GoTo AppAlreadyAdded
            Microsoft.VisualBasic.Collection xxx              = new Microsoft.VisualBasic.Collection();
            Microsoft.VisualBasic.Collection colRights        = new Microsoft.VisualBasic.Collection();;
            Microsoft.VisualBasic.Collection colExtendedDepts = new Microsoft.VisualBasic.Collection();;
            Microsoft.VisualBasic.Collection colAppDetails    = new Microsoft.VisualBasic.Collection();;
            string line = "";

            try
            {
                xxx.Add(colRights, "APPLICATION_RIGHTS", null, null);
                xxx.Add(colExtendedDepts, "EXTENDED_DEPARTMENTS", null, null);
                xxx.Add(new string[2] {
                    AppID, AppShortName
                }, "APPLICATION_DETAILS", null, null);

                mvarCol_AppRights.Add(xxx, AppShortName, null, null);
            }

            catch (Exception)
            {
                // Do The Finally part Here then!!!
                // MessageBox.Show(ex.Message);
            }
            finally
            {
                // AppAlreadyAdded

                SqlConnection DaConnection;
                SqlCommand    DaCommand;
                SqlDataReader DaDataReader;

                DaConnection = new SqlConnection();
                DaConnection.ConnectionString = _cnConn;  /* As set by the user */
                DaConnection.Open();

                DaCommand = new SqlCommand();
                /* Setting the connecction like this is just for test now!!! */
                DaCommand.Connection  = DaConnection;
                DaCommand.CommandType = System.Data.CommandType.Text;

                // line = Right(rightsEntry, Len(rightsEntry) - InStr(1, rigntsEntry, ","));
                line = rigntsEntry.Remove(0, rigntsEntry.IndexOf(",") + 1);

                if (rigntsEntry.ToUpper().Contains("APPLICATION_RIGHTS"))
                {
                    DaCommand.CommandText = "SELECT APPLICATION_ID, APPLICATION_SHORT_NAME FROM VIP_EXPANDED..APPLICATIONS WHERE APPLICATION_GROUP_ID=" + AppID + " ORDER BY APPLICATION_ID";
                    DaDataReader          = DaCommand.ExecuteReader();

                    if (DaDataReader.HasRows)
                    {
                        while (DaDataReader.Read())
                        {
                            mvarsRights = mvarsRights + "," + DaDataReader.GetValue(DaDataReader.GetOrdinal("APPLICATION_ID")).ToString();
                        }
                    }


                    // Dis 'n moeilike ene die!!

                    // SOLUTION!!!
                    Microsoft.VisualBasic.Collection b = (Microsoft.VisualBasic.Collection)((Microsoft.VisualBasic.Collection)mvarCol_AppRights[AppShortName])["APPLICATION_RIGHTS"];
                    b.Add(new string[2] {
                        AppID, line.ToString().Replace("'", "")
                    }, null, null, null);

                    DaDataReader.Close();
                }
                else
                {
                    DaCommand.CommandText = "SELECT DEPT_ID as SQL_ID, DEPT_DESCRIPTION as Description, DEPT_SHORT_NAME as SOURCE_ID FROM VIP_EXPANDED..VIEW_GOVERNMENT_STRUCTURE WHERE FINYEAR=" + getFinYear() + " AND DEPT_SHORT_NAME IN(" + line + "') ORDER BY SQL_ID";
                    DaCommand.Connection  = DaConnection;
                    DaDataReader          = DaCommand.ExecuteReader();

                    if (DaDataReader.HasRows)
                    {
                        while (DaDataReader.Read())
                        {
                            // Dis moeilike ene die!!
                            // mvarCol_AppRights(AppShortName)("EXTENDED_DEPARTMENTS").Add(Array(DaDataReader.GetValue(DaDataReader.GetOrdinal("SQL_ID")).ToString(), DaDataReader.GetValue(DaDataReader.GetOrdinal("DESCRIPTION")).ToString(), DaDataReader.GetValue(DaDataReader.GetOrdinal("SOURCE_ID")).ToString()));


                            // SOLUTION!!
                            Microsoft.VisualBasic.Collection b = (Microsoft.VisualBasic.Collection)((Microsoft.VisualBasic.Collection)mvarCol_AppRights[AppShortName])["EXTENDED_DEPARTMENTS"];
                            b.Add(new string[3] {
                                DaDataReader.GetValue(DaDataReader.GetOrdinal("SQL_ID")).ToString(), DaDataReader.GetValue(DaDataReader.GetOrdinal("DESCRIPTION")).ToString(), DaDataReader.GetValue(DaDataReader.GetOrdinal("SOURCE_ID")).ToString()
                            }, null, null, null);
                        }
                    }

                    DaDataReader.Close();
                }
            }
        }
 public HotButtonEnum(VBCollection col)
 {
     mCol = col;
 }
Beispiel #14
0
 public GCTenderEnum(VBCollection col)
 {
     mCol = col;
 }