当前位置: 首页>>代码示例>>C#>>正文


C# Database.FindTrimObjectByUri方法代码示例

本文整理汇总了C#中Database.FindTrimObjectByUri方法的典型用法代码示例。如果您正苦于以下问题:C# Database.FindTrimObjectByUri方法的具体用法?C# Database.FindTrimObjectByUri怎么用?C# Database.FindTrimObjectByUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Database的用法示例。


在下文中一共展示了Database.FindTrimObjectByUri方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

 static void Main(string[] args)
 {
     TrimApplication.Initialize();
     using (Database db = new Database())
     {
         OriginHistory  fdfd = (OriginHistory)db.FindTrimObjectByUri(BaseObjectTypes.OriginHistory, 119);
         if(fdfd!=null)
         {
             var lst = fdfd.GetChildObjectList(BaseObjectTypes.Record);
             foreach(Record r in lst)
             {
                 Console.WriteLine(r.Number + Environment.NewLine);
             }
         }
     }
 }
开发者ID:WyldLynxGitHub,项目名称:SunshineCoastCouncil-master,代码行数:16,代码来源:Program.cs

示例2: run

        public bool run(Database db)
        {
            Console.WriteLine("Initialise BulkDataLoader sample ...");
            //
            Console.WriteLine("Enter Container Uri");
            lCont = Convert.ToInt64(Console.ReadLine());

            // create an origin to use for this sample. Look it up first just so you can rerun the code.
            m_origin = db.FindTrimObjectByName(BaseObjectTypes.Origin, "Bulk Loader Sample") as Origin;
            if (m_origin == null)
            {
                m_origin = new Origin(db, OriginType.Custom1);
                m_origin.Name = "Bulk Loader Sample";
                m_origin.OriginLocation = "n.a";
                // sample code assumes you have a record type defined called "Document"
                m_origin.DefaultRecordType = db.FindTrimObjectByUri(BaseObjectTypes.RecordType,2) as RecordType;
                // don't bother with other origin defaults for the sample, just save it so we can use it
                m_origin.Save();
            }
            // construct a BulkDataLoader for this origin
            m_loader = new BulkDataLoader(m_origin);
            // initialise it as per instructions
            if (!m_loader.Initialise())
            {
                // this sample has no way of dealing with the error.
                Console.WriteLine(m_loader.ErrorMessage);
                return false;
            }
            Console.WriteLine("Starting up an import run ...");
            // the sample is going to do just one run, let's get started...
            // you will need to specify a working folder that works for you (see programming guide)
            m_loader.LogFileName = "Logtest";
            
            m_loader.StartRun("Simulated Input Data", "C:\\junk");
            //13 13 HP TRIM Bulk Data Importing Programming Guide
            // setup the property array that will be used to transfer record metadata
            PropertyOrFieldValue[] recordFields = new PropertyOrFieldValue[4];
            recordFields[0] = new PropertyOrFieldValue(PropertyIds.RecordTitle);
            recordFields[1] = new PropertyOrFieldValue(PropertyIds.RecordDateCreated);
            recordFields[2] = new PropertyOrFieldValue(PropertyIds.RecordNotes);
            recordFields[3] = new PropertyOrFieldValue(PropertyIds.RecordContainer);
            //recordFields[3] = new PropertyOrFieldValue(PropertyIds.RecordAuthor);
            // now lets add some records
            while (getNextRecord(recordFields))
            {
                Console.WriteLine("Importing record #" + System.Convert.ToString(m_recordCount) + " ...");
                Record importRec = m_loader.NewRecord();
                
                
                    // set the record properties
                    m_loader.SetProperties(importRec, recordFields);
                    // attach an electronic. The sample just does this for the first record, and uses
                    // a mail message to avoid having to find a document on the hard drive somewhere.
                
                    //InputDocument doc = new InputDocument();
                    
                    //    doc.SetAsMailMessage();
                    //    doc.Subject = "Imported mail message #" + System.Convert.ToString(m_recordCount);
                    //    doc.Content = "Some mail messages have very little content";
                    //    doc.SentDate = new TrimDateTime(2007, 12, 14, 10, 30, 15);
                    //    doc.ReceivedDate = new TrimDateTime(2007, 12, 14, 14, 30, 30);
                    //    EmailParticipant mailContactFrom = new EmailParticipant("[email protected]","Random Kindness", "SMTP");
                        
                    //        doc.SetAuthor(mailContactFrom);
                        
                    //    EmailParticipant mailContactTo = new EmailParticipant("[email protected]", "Little Animals", "SMTP");
                        
                    //        doc.AddRecipient(MailRecipientType.To, mailContactTo);
                        
                    //    m_loader.SetDocument(importRec, doc, BulkLoaderCopyMode.WindowsCopy);
                    
                    // submit it to the bulk loader
                    m_loader.SubmitRecord(importRec);
                
            }
            // by now the loader has accumulated 5 record inserts and 5 location inserts
            // if you set a breakpoint here and look into the right subfolder of your working folder
            // you will see a bunch of temporary files ready to be loaded into the SQL engine
            // process this batch
            Console.WriteLine("Processing import batch ...");
            m_loader.ProcessAccumulatedData();
            
            // grab a copy of the history object (it is not available in bulk loader after we end the run
            Int64 runHistoryUri = m_loader.RunHistoryUri;
            // we're done, lets end the run now
            Console.WriteLine("Processing complete ...");
            m_loader.EndRun();

            // just for interest, lets look at the origin history object and output what it did
            OriginHistory hist = new OriginHistory(db, runHistoryUri);
            Console.WriteLine("Number of records created ..... "
        + System.Convert.ToString(hist.RecordsCreated));
            Console.WriteLine("Number of locations created ... "
            + System.Convert.ToString(hist.LocationsCreated));
            Console.WriteLine("Logfile; " + m_loader.LogFileName);

            return true;
        }
开发者ID:WyldLynxGitHub,项目名称:SunshineCoastCouncil-master,代码行数:98,代码来源:bulkLoaderSample.cs

示例3: CheckFolderlevel

 private static bool CheckFolderlevel(long toplevel, Database db)
 {
     bool bExists = false;
     //try
     //{
     Classification c = db.FindTrimObjectByUri(BaseObjectTypes.Classification, toplevel) as Classification;
             //TrimMainObjectSearch objClas = new TrimMainObjectSearch(db, BaseObjectTypes.Classification);
             //objClas.SetSearchString("title:" + toplevel);
             if (c!=null)
             {
                 Console.WriteLine("First Level Folder Exists");
                 bExists = true;
             }
             else
             {
                 Console.WriteLine("First Level Folder could not be found, check the following folder exist in RM: "+toplevel+" in "+db.Database.Name+" with the dataset ID: "+db.Id);
                 bExists = false;
             }
            
         //}
     //}
     //catch (Exception exp)
     //{
     //    Console.WriteLine("Connect to RM SDK issue, Error: " + exp.Message.ToString());
     //}
     return bExists;
 }
开发者ID:WyldLynxGitHub,项目名称:SunshineCoastCouncil-master,代码行数:27,代码来源:Program.cs

示例4: getToplevel

        private static Classification getToplevel(long toplevelUri, Database db)
        {
            Classification c = db.FindTrimObjectByUri(BaseObjectTypes.Classification, toplevelUri) as Classification;

            return c;
        }
开发者ID:WyldLynxGitHub,项目名称:SunshineCoastCouncil-master,代码行数:6,代码来源:Program.cs


注:本文中的Database.FindTrimObjectByUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。