This is the third part of syncing up data from our Document Management
System to SQL Server, so I will know the keywords a specific doc can
have associated to it and get the right one from OnBase the DM system.

In general we have data objects from both SQL Server and OnBase, and
will join them to see what is missing.  That missing is the key to add
to SQL Server.  This is a 1:M:1 type of data system.  1 document can
have multiple keywords and this is normalized with only allowing 1 row
per keyword in the OBDocKeywords table.




if (Phase1Count != Phase3Count)  // We have data from Onbase keywords
not in SQL Server
                {

                    //Join dSQLOB to dSQLKw(keywords from ONBase to
get their GUIDS)
                    var EntireDocTypeKw = (from NewOB in dSQLOB
                                     join ArryLis in dSQLKW
                                     on NewOB.kywordName equals ArryLis.kwname
                                     into AllResultSet
                                     from f in AllResultSet.DefaultIfEmpty()
                                     select new
                                     {
                                         KwGuid = NewOB.kywordId,
                                         KwName = NewOB.kywordName
                                     }
                                     ).ToList();

                    //There may be already existing DocTypeKewords
records so need to filter
                    //in such a way that the Keyword id from
OBDocKeywords does not exist in
                    //DocTypeKeywords indicating the Guids changed or
these are new keyword Guids
                    var NotExitingDocTypeKw = (from EntireDocType in
EntireDocTypeKw
                                               join OldDocTypeKw in DocTypeKwrds
                                               on EntireDocType.KwGuid
equals OldDocTypeKw.KeywordId
                                               into NewResultSet
                                               from f in
NewResultSet.DefaultIfEmpty()
                                               select new
                                               {
                                                   KwGuid =
EntireDocType.KwGuid,
                                                   KwName =
EntireDocType.KwName,
                                                   MissingGuid = ( f
== null ? "No Id" : f.KeywordId.ToString())
                                               }
                                               ).Where(a =>
a.MissingGuid == "No Id").ToList();


// add the data to SS
                    for (int y = 0; y < NotExitingDocTypeKw.Count; y++)
                    {
                        DocTypeKeywords oDtKw = new DocTypeKeywords();
                        oDtKw.Id = Guid.NewGuid();
                        oDtKw.KeywordId = NotExitingDocTypeKw[y].KwGuid;
                        oDtKw.DocTypeId = oDTGuid;
                        oDtKw.DocKeywordAttached = false;
                        oDtKw.CreDate = DateTime.Now;
                        oDtKw.ModDate = LinqFixes.nullFix();
                        oElogs2Entity.AddToDocTypeKeywords(oDtKw);
// post the transactions to the queue
                    }
                  int saved =  oElogs2Entity.SaveChanges();   //
submit the rows to the db.
                }

                //**** END PHASE 3
                return "Saved a total of "+Convert.ToString(saved)+"
new Keywords" ;
            }

-- 
Stephen Russell

Sr. Production Systems Programmer
CIMSgts

901.246-0159 cell

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to