예제 #1
0
        private static void UpdateUserDefineCache()
        {
            using (SqlConnection conn = new SqlConnection(PLMConstantString.PLM_APP_ConnectionString))
            {
                conn.Open();

                string lastChange = PdmCacheEntityLookupItem.GetLastChangeCheckSum(conn, UserDefineEntityTableName);


                if (lastChange != string.Empty && lastChange != LastScanUserDefinePdmEntityBlClrDto.LastScanCheckSum)
                {
                    // CLROutput.InsertException(conn, " lastChange before userdefine " + LastScanUserDefinePdmEntityBlClrDto.LastScanCheckSum);

                    Dictionary <int, List <LookupItemDto> > dictUserDefineLookupItem = PLMSEntityClrBL.GetUserDefineEntityDisplayInfoList(UserDefineEntityList, conn);


                    foreach (int entityId in dictUserDefineLookupItem.Keys)
                    {
                        Dictionary <object, string> result = PdmCacheEntityLookupItem.ConvertLookItemToDictionaryItem(dictUserDefineLookupItem[entityId]);

                        // if(
                        DictEntityLookupCache.Remove(entityId);
                        DictEntityLookupCache.Add(entityId, result);
                    }



                    LastScanUserDefinePdmEntityBlClrDto.LastScanCheckSum = lastChange;

                    // CLROutput.InsertException(conn, " lastChange userdefine  after" + LastScanUserDefinePdmEntityBlClrDto.LastScanCheckSum);
                }
            }
        }
예제 #2
0
        private static void UpdateSystemDefineCache(PdmEntityBlClrDto entity)
        {
            int entityId = entity.EntityId;

            CLROutput.OutputDebug("UpdateSystemDefineCache start...  ConnectInfo:" + entity.ConnectInfo);

            // CLROutput.OutputDebug("UpdateSystemDefineCache start...");

            if (!string.IsNullOrEmpty(entity.ConnectInfo))
            {
                //try
                //{
                using (SqlConnection conn = new SqlConnection(entity.ConnectInfo))
                {
                    conn.Open();

                    string lastChange = PdmCacheEntityLookupItem.GetLastChangeCheckSum(conn, entity.SysTableName);

                    //  CLROutput.InsertException(conn, "entity.LastScanCheckSum: " + entity.LastScanCheckSum + "lastChange :" + lastChange);

                    CLROutput.OutputDebug("entity.LastScanCheckSum: " + entity.LastScanCheckSum + "lastChange :" + lastChange);

                    if (lastChange != entity.LastScanCheckSum)
                    {
                        if (DictEntityLookupCache.ContainsKey(entityId))
                        {
                            CLROutput.OutputDebug(" lastChange sysdefine before DictEntityLookupCache " + "__" + entity.EntityCode + "__" + entity.LastScanCheckSum, conn);
                            List <LookupItemDto>        newLookupitem = PdmCacheEntityLookupItem.GetOneSystemDefinTableLookupItems(conn, PLMSEntityClrBL.GetSysDefineQueryIDAndDisplay(entity));
                            Dictionary <object, string> result        = PdmCacheEntityLookupItem.ConvertLookItemToDictionaryItem(newLookupitem);

                            DictEntityLookupCache.Remove(entityId);
                            DictEntityLookupCache.Add(entityId, result);

                            entity.LastScanCheckSum = lastChange;
                            // CLROutput.InsertException(conn, " lastChange sysdefine  after" + "__" + entity.EntityCode + "__" + entity.LastScanCheckSum);
                        }
                    }
                }

                //}
                //catch (Exception ex)
                //{

                //    //using (SqlConnection conn = new SqlConnection(PLMConstantString.PLM_APP_ConnectionString))
                //    //{
                //    //    conn.Open();
                //    //    CLROutput.InsertException(conn, " exception " + entity.EntityId  + "__" + entity.EntityCode   + ex.ToString());

                //    //}

                //}
            }
        }