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


C# Database.FindTrimObjectByName方法代码示例

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


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

示例1: GetFolderUri

 private static Record GetFolderUri(string p1, string p2, Database db)
 {
     Record r = null;
     Classification c = (Classification)db.FindTrimObjectByName(BaseObjectTypes.Classification, "zz Legacy T1 ECM - Business Folders - " + p1);
     if(c!=null)
     {
         TrimMainObjectSearch mso = new TrimMainObjectSearch(db, BaseObjectTypes.Record);
         //string ss = "title:" + reader.GetString(7) + " and classification:zz Legacy T1 ECM - Business Folders - " + reader.GetString(6);
         mso.SetSearchString("classification:"+c.Uri);
         foreach(Record rec in mso)
         {
             if(rec.Title==p2)
             {
                 r = rec;
             }
         }
     }
     return r;
 }
开发者ID:WyldLynxGitHub,项目名称:SunshineCoastCouncil-master,代码行数:19,代码来源:Program.cs

示例2: Main


//.........这里部分代码省略.........
                        {
                            newRevision nr = new newRevision();
                            nr.DocSetID = reader.GetInt32(0).ToString();
                            nr.revision = reader.GetInt16(1);
                            nr.Location = reader.GetString(2);
                            nr.Filename = reader.GetString(3);
                            lstRev.Add(nr);
                        }
                    }
                }
                Console.WriteLine("Sql query transfered to List, total to process: " + lstRev.Count().ToString());
                int icount = 0;
                int iDocSource = 0;
                string strTotalList = lstRev.Count().ToString();
                TrimApplication.Initialize();
                //Record r = new Record(db)eq3
                foreach (newRevision rr in lstRev)
                {
                    icount++;
                    using (Database db = new Database())
                    {
                        //string strStorageLoc = FindMappedStorage(rr.Location) + "\\" + rr.Filename; ;
                        //string strStorageLoc2 = FindMappedStorageNas(rr.Location) + "\\" + rr.Filename;
                        ////string strStorageLoc = @"D:\SCC\ECM\0BF\00FB8C37.001.pdf";
                        //if (File.Exists(strStorageLoc))
                        //{
                        //    //Look for alternative
                        //    iDocSource = 1;
                        //}
                        //else if (File.Exists(strStorageLoc2))
                        //{
                        //    iDocSource = 2;
                        //}
                        //else
                        //{
                        //    iDocSource = 0;
                        //    Console.WriteLine("Document could not be found");
                        //    //Loggitt("Document  " + strStorageLoc + "  could not be found", "Revision load error");
                        //}
                        //if (iDocSource > 0)
                        //{
                        string strStorageLoc = FindMappedAllStorage(rr.Filename);
                        if (strStorageLoc != null)
                        {
                            Record r = (Record)db.FindTrimObjectByName(BaseObjectTypes.Record, rr.DocSetID);
                            if (r != null)
                            {
                                if (r.RevisionNumber < rr.revision)
                                {
                                    try
                                    {
                                        if (r.DateRegistered <= r.DateReceived)
                                        {
                                            DateTime tdtDateReceived = r.DateReceived;
                                            r.DateRegistered = (TrimDateTime)tdtDateReceived.AddHours(1);
                                        }
                                        r.Save();

                                        InputDocument doc = new InputDocument();
                                        doc.SetAsFile(strStorageLoc);
                                        r.SetDocument(doc, true, false, "Add new ECM revision - migration");
                                        r.Save();
                                        Console.WriteLine("Added new revision " + rr.revision.ToString() + " to record " + rr.DocSetID + ", item " + icount.ToString() + " of " + strTotalList);
                                        deleteEcmSource(strStorageLoc);
                                        //Console.ReadLine();
                                    }
                                    catch (Exception exp)
                                    {
                                        Console.WriteLine("Record number " + rr.DocSetID + "  could not be added");
                                        Loggitt("Record number " + rr.DocSetID + "  could not be added - Error: " + exp.Message.ToString(), "Revision load error");
                                        //Console.ReadLine();

                                    }
                                }
                            }
                            else
                            {
                                Console.WriteLine("Record number " + rr.DocSetID + "  could not be found");
                                //Console.ReadLine();
                                // Loggitt("Record number " + rr.DocSetID + "  could not be found", "Revision load error");
                            }
                        }
                        else
                        {
                            Console.WriteLine("Record " + rr.DocSetID + "  document could not be found");
                            //Console.ReadLine();
                        }
                    }

                }

            }
            catch (Exception exp)
            {
                Console.WriteLine("Error: "+exp.Message.ToString());
                Loggitt(exp.Message.ToString(), "Revision load error");
                Console.ReadLine();

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

示例3: processtoEddie


//.........这里部分代码省略.........
                FieldDefinition fd_ECMStreetsPostcode = new FieldDefinition(db, "ECM Streets:Postcode");
                FieldDefinition fd_ECMStreetsStreet_Name = new FieldDefinition(db, "ECM Streets:Street_Name");
                FieldDefinition fd_ECMUserGroupsDescription = new FieldDefinition(db, "ECM UserGroups:Description");
                FieldDefinition fd_ECMUserGroupsExtNo = new FieldDefinition(db, "ECM UserGroups:ExtNo");
                FieldDefinition fd_ECMUserGroupsGivenName = new FieldDefinition(db, "ECM UserGroups:GivenName");
                FieldDefinition fd_ECMUserGroupsOrgEmail = new FieldDefinition(db, "ECM UserGroups:OrgEmail");
                FieldDefinition fd_ECMUserGroupsSurname = new FieldDefinition(db, "ECM UserGroups:Surname");
                FieldDefinition fd_ECMVolumeFilename = new FieldDefinition(db, "ECM Volume:Filename");
                FieldDefinition fd_ECMVolumeLastModified = new FieldDefinition(db, "ECM Volume:LastModified");
                FieldDefinition fd_ECMVolumeMedia = new FieldDefinition(db, "ECM Volume:Media");
                FieldDefinition fd_ECMVolumePrimaryCacheName = new FieldDefinition(db, "ECM Volume:PrimaryCacheName");
                FieldDefinition fd_ECMVolumeRenditionTypeName = new FieldDefinition(db, "ECM Volume:RenditionTypeName");
                FieldDefinition fd_ECMVolumeShareDrive = new FieldDefinition(db, "ECM Volume:ShareDrive");
                FieldDefinition fd_ECMVolumeSize = new FieldDefinition(db, "ECM Volume:Size");
                FieldDefinition fd_ECMVolumeStatus = new FieldDefinition(db, "ECM Volume:Status");
                FieldDefinition fd_ECMVolumeStorageLocation = new FieldDefinition(db, "ECM Volume:StorageLocation");
                //FieldDefinition fd_ECMVolumeUpdatable = new FieldDefinition(db, "ECM Volume:Updatable");
                //
                RecordType rt = new RecordType(db, 16);
                //Console.WriteLine("Processing {0} on thread {1}", filename, Thread.CurrentThread.ManagedThreadId);



                //});

                foreach (ECMMigration ecm in lstecm)
                {
                    iCount++;
                    DateTime dt2 = DateTime.Now;
                    TimeSpan result = dt2 - dt1;
                    Console.WriteLine("Processing {0} - Number {1} of {2}, time since start {3} - batch offset {4}, Fetch {5} ({6})", ecm.DocSetID, iCount.ToString(), strTotal, result.TotalMinutes.ToString(), strOffset, strFetch, (Convert.ToInt32(strOffset) + iCount).ToString());
                    try
                    {
                        Record reccheck = (Record)db.FindTrimObjectByName(BaseObjectTypes.Record, ecm.DocSetID);
                        //if (reccheck == null)
                        //{
                        string strStorageLoc = FindMappedStorage(ecm.ECMVolumeStorageLocation) + "\\" + ecm.ECMVolumeFilename;
                        if (File.Exists(strStorageLoc))
                        {
                            Record reccont = GetFolderUri(ecm.ECMBCSFunction_Name + " - " + ecm.ECMBCSActivity_Name.Replace("-", "~"), ecm.ECMBCSSubject_Name, db);
                            if (reccont != null)
                            {
                                string fTitle;
                                if (ecm.ECMDescription == null)
                                {
                                    fTitle = "Record description from ECM Export is Null";
                                    //strErrorCol = strErrorCol + "Ecm description to Title issue: Description Null for record no " + h.DocSetID.ToString() + Environment.NewLine;
                                }
                                else
                                {
                                    if (ecm.ECMDescription.Length > 253)
                                    {
                                        fTitle = ecm.ECMDescription.Substring(0, 253);
                                        //strErrorCol = strErrorCol + "Ecm description to Title issue: Description greater then 254 ch, description truncated for record no " + h.DocSetID.ToString() + Environment.NewLine;
                                    }
                                    else if (ecm.ECMDescription.Length < 1)
                                    {
                                        fTitle = "Record description from ECM Export is Empty";
                                        //strErrorCol = strErrorCol + "Ecm description to Title issue: Description blank for record no " + h.DocSetID.ToString() + Environment.NewLine;
                                    }
                                    else
                                    {
                                        fTitle = ecm.ECMDescription;
                                    }
                                }
开发者ID:WyldLynxGitHub,项目名称:SunshineCoastCouncil-master,代码行数:66,代码来源:Program.cs

示例4: 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

示例5: SyncUdfs

        private static void SyncUdfs()
        {
            List<ADDITIONALFIELD> lstaf = new List<ADDITIONALFIELD>();
            ADDITIONALFIELD af = new ADDITIONALFIELD();
            af.LENGTH = "65536";
            af.NAME = "ECM Application:RAM_Application_Number";
            lstaf.Add(af);

            af.LENGTH = "65536";
            af.NAME = "ECM Application:RAM_Application_Number1";
            lstaf.Add(af);


            //MySerializableClass myObject;
            // Construct an instance of the XmlSerializer with the type
            // of object that is being deserialized.

            XmlSerializer mySerializer = new XmlSerializer(typeof(List<ADDITIONALFIELD>));
            // To read the file, create a FileStream.

            //TextWriter textWriter = new StreamWriter(@"D:\Users\WyldLynx\Documents\ECMTEST.xml");

            //mySerializer.Serialize(textWriter, lstaf);
            //textWriter.Close();


            //
            FileStream myFileStream = new FileStream(@"\ECMTEST.xml", FileMode.Open);
            // Call the Deserialize method and cast to the object type.
            lstaf = (List<ADDITIONALFIELD>)mySerializer.Deserialize(myFileStream);

            TrimApplication.Initialize();
            using (Database db = new Database())
            {
                foreach (ADDITIONALFIELD aff in lstaf)
                {
                    if (db.FindTrimObjectByName(BaseObjectTypes.FieldDefinition, aff.NAME) == null)
                    {
                        FieldDefinition fd = new FieldDefinition(db);
                        fd.Name = aff.NAME;


                        switch (Convert.ToInt64(aff.FORMAT))
                        {
                            case 0:
                                fd.Format = UserFieldFormats.String;
                                break;
                            case 1:
                                fd.Format = UserFieldFormats.Number;
                                break;
                            case 2:
                                fd.Format = UserFieldFormats.Boolean;
                                break;
                            case 3:
                                fd.Format = UserFieldFormats.Date;
                                break;
                            case 4:
                                fd.Format = UserFieldFormats.Datetime;
                                break;
                            case 5:
                                fd.Format = UserFieldFormats.Decimal;
                                break;
                            case 6:
                                fd.Format = UserFieldFormats.Text;
                                break;
                            case 7:
                                fd.Format = UserFieldFormats.Currency;
                                break;
                            //case 8:
                            //    fd.Format = UserFieldFormats.
                            //    break;
                            case 9:
                                fd.Format = UserFieldFormats.Object;
                                break;
                            //case 10:
                            //    fd.Format = UserFieldFormats.
                            //    break;
                            case 11:
                                fd.Format = UserFieldFormats.String;
                                break;

                            case 13:
                                fd.Format = UserFieldFormats.Geography;
                                break;
                        }
                        fd.UpperLimit = aff.UPPERLIMIT;
                        fd.Length = Convert.ToInt32(aff.LENGTH);
                        fd.SetNotes("Additional field syncronised automatically", NotesUpdateType.AppendWithUserStamp);
                        RecordType rt = new RecordType(db, 16);
                        fd.SetIsUsedForRecord(rt, true);
                        fd.Save();
                        
                        Console.WriteLine("new additional field added: " + fd.Name);

                    }
                    else
                    {
                        Console.WriteLine("Additional field already exists: " + aff.NAME);
                    }

//.........这里部分代码省略.........
开发者ID:WyldLynxGitHub,项目名称:SunshineCoastCouncil-master,代码行数:101,代码来源:Program.cs

示例6: processtoRM

        private static void processtoRM()
        {
            long recuri = 0;
            long folderUri = 0;
            long classUri = 0;
            
            if (!TrimApplication.HasBeenInitialized)
            {
                TrimApplication.Initialize();
            }
            TrimApplication.HasUserInterface = true;

            using (Database db = new Database())
            {
                try
                {
                    db.Connect();
                    Console.WriteLine("Connected to RM successfully as : " + db.CurrentUser.Name + " on " + db.Id + "/" + db.WorkgroupServerName);
                    Console.WriteLine("Hit q to quit or any other key to continue");
                    if (Console.ReadLine() == "q")
                    {
                        Environment.Exit(0);
                    }

                }
                catch (Exception exp)
                {
                    Console.WriteLine("Error: " + exp);
                    return;
                }
                Console.WriteLine("Enter location of Json file");
                FileLocation = Console.ReadLine();
                List<Sheets> myMessage = JsonConvert.DeserializeObject<List<Sheets>>(File.ReadAllText(@FileLocation));
                Console.WriteLine("Enter the Classification Uri for this process:");
                foreach (var file in myMessage)
                {

                    toplevelUri = Convert.ToInt64(Console.ReadLine());
                    if (getToplevel(toplevelUri, db) != null)
                    {
                        toplevel = getToplevel(toplevelUri, db).Title;
                        Console.WriteLine("Confirm that this is the folder stating point for this process: " + toplevel + " Hit q to quit or any other key to continue.");
                        if (Console.ReadLine() == "q")
                        {
                            Environment.Exit(0);
                        }
                    }
                    else
                    {
                        Console.WriteLine("Please check the high level classification Uri and try again:");
                        Console.ReadLine();
                        Environment.Exit(0);
                    }

                    Console.WriteLine("Enter the SS line number to process from, minimum should be 2.");
                    long linenumber = Convert.ToInt64(Console.ReadLine());
                    long tl = toplevelUri;
                    foreach (Rows r in file.Rows.Where(x => x.SheetLine >= linenumber))
                    {

                        try
                        {
                            Classification cl1 = (Classification)db.FindTrimObjectByName(BaseObjectTypes.Classification, toplevel + " - " + CleanupFolderName(r.level1));
                            if (cl1 == null)
                            {
                                cl1 = CreateFolderStructure(r.level1, toplevel, "c", db, FindStartingNumber(tl, db));
                                classUri = cl1.Uri;
                            }

                            Classification cl2 = (Classification)db.FindTrimObjectByName(BaseObjectTypes.Classification, cl1.Title + " - " + CleanupFolderName(r.level2));
                            if (cl2 == null)
                            {
                                cl2 = CreateFolderStructure(r.level2, cl1.Title, "c", db, FindStartingNumber(cl1.Uri, db));
                                classUri = cl2.Uri;
                            }

                            Classification cl3 = (Classification)db.FindTrimObjectByName(BaseObjectTypes.Classification, cl2.Title + " - " + CleanupFolderName(r.level3));
                            if (cl3 == null)
                            {
                                cl3 = CreateFolderStructure(r.level3, cl2.Title, "r", db, FindStartingNumber(cl2.Uri, db));
                                classUri = cl3.Uri;
                            }

                            if (r.Folders != null)
                            {
                                if (r.Folders.Count() > 0)
                                {
                                    foreach (var f in r.Folders)
                                    {
                                        Record chkRec = CheckifFolderAlreadyExists(cl3, f.folder, db);
                                        //
                                        if (chkRec == null)
                                        {
                                            //Console.WriteLine("Did not find existing folder: " + cl3.Title + " " + f.folder);
                                            try
                                            {
                                                recuri = CreateNewRMfolder(f.folder, cl3.Uri, db);
                                                f.RMuri = recuri.ToString();
                                                Console.WriteLine("Created new folder: Uri " + recuri.ToString());
                                            }
//.........这里部分代码省略.........
开发者ID:WyldLynxGitHub,项目名称:SunshineCoastCouncil-master,代码行数:101,代码来源:Program.cs


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