Beispiel #1
0
        static PdmCacheManager()
        {
            PdmCacheManager.StartBaseCache();



            SystemDefineEntityList = DictPdmEntityBlEntity.Where(o => o.Value.EntityType.HasValue && o.Value.EntityType.Value == (int)EmEntityType.SystemDefineTable).Select(o => o.Value).ToList();
            UserDefineEntityList   = DictPdmEntityBlEntity.Where(o => (o.Value.EntityType.HasValue) && o.Value.EntityType.Value == (int)EmEntityType.UserDefineTable).Select(o => o.Value).ToList();

            PdmCacheEntityLookupItem.SetupAllLookItemCache();

            SetupEntityScanTimer();
        }
        public static void GetAllGridSpecailColumnIds(PdmGridClrDto blockPdmGridDto, List <int> allGridRefGridBlockIds, List <int> allGridRefGridColumnIds, List <int> allGridRefSimpleDcuIds)
        {
            // List<PdmGridMetaColumnClrDto> selectedBlockColumnListDto = blockPdmGridDto.PdmGridMetaColumnList;

            CollectOneGridSimpleDcuAndColumnBlockIdColumnId(blockPdmGridDto, allGridRefGridBlockIds, allGridRefGridColumnIds, allGridRefSimpleDcuIds);

            // need to add dependency  Grid key column !
            List <int> allDistinctGridids = PdmCacheManager.GetMutiplePdmGridMetaColumnEntityFromCache(allGridRefGridColumnIds).Select(o => o.GridId).Distinct().ToList();

            foreach (int gridId in allDistinctGridids)
            {
                PdmGridClrDto agridEntity = PdmCacheManager.DictGridCache[gridId];;

                // product grid key column
                foreach (var column in agridEntity.ProductGridForeignKeyColumns)
                {
                    allGridRefGridColumnIds.Add(column.GridColumnId);
                }

                // current ref grid column
                foreach (var column in agridEntity.CurrentRefRegularColumnKeyAndDynamicMatrixKeyDCUColumn)
                {
                    allGridRefGridColumnIds.Add(column.GridColumnId);
                }

                // current grid simple dcu
                foreach (var column in agridEntity.CurrentRefSimpleDCUColumns)
                {
                    allGridRefSimpleDcuIds.Add(column.Dcuid.Value);
                }

                foreach (var column in agridEntity.ProductGridSimpleDCUColumn)
                {
                    allGridRefSimpleDcuIds.Add(column.Dcuid.Value);
                }

                // need to add prodcut grid column and Display column as well

                allGridRefGridColumnIds.AddRange(agridEntity.KeyMetaColumns.Select(o => o.GridColumnId));

                List <int> productGridColumnAndAndDislayColumnIds = GetProductGridColumnAndAndDislayFields(agridEntity);
                allGridRefGridColumnIds.AddRange(productGridColumnAndAndDislayColumnIds);
            }
        }
Beispiel #3
0
        public static DataTable ConvertSimpleGridProductRowToDataTable(IEnumerable <SimpleGridProductRow> rowList, List <int> columnIds, DataTable table)
        {
            //



            Dictionary <int, int> dictGridColumnIdAndType = PdmCacheManager.GetMutiplePdmGridMetaColumnEntityFromCache(columnIds).ToDictionary(o => o.GridColumnId, o => o.ColumnTypeId);

            foreach (var gridRow in rowList)
            {
                DataRow dataRow = table.NewRow();

                dataRow[GridColumnConstantName.ProductReferenceID] = gridRow.ProductReferenceId;
                dataRow[GridColumnConstantName.RowValueGUID]       = gridRow.RowValueGuId;
                dataRow[GridColumnConstantName.Sort] = gridRow.Sort;

                foreach (int columnId in columnIds)
                {
                    object value = ControlTypeValueConverter.ConvertValueToObject(gridRow[columnId], dictGridColumnIdAndType[columnId]);


                    if (value == null)
                    {
                        dataRow[columnId.ToString()] = DBNull.Value;
                    }
                    else
                    {
                        //  CLROutput.Output("convervalue=" + value);
                        dataRow[columnId.ToString()] = value;

                        //  CLROutput.Output("dataRow[subitem.id.ToString()]" + dataRow[subitem.id.ToString()]);
                    }

                    // need to remove !!!! !
                    // dataRow[columnId.ToString()] = value;
                }

                table.Rows.Add(dataRow);
            }

            return(table);
        }
Beispiel #4
0
        private static System.Data.DataTable GetTabDataTable(int tabId, string referenceIds, bool isShowLookupitem, bool IsSubItemFullPathName)
        {
            string[] arrayInputmainReferenceIds = referenceIds.Trim().Replace(System.Environment.NewLine, "").Split(',');

            PdmTabClrDto aPdmTabClrDto = PdmCacheManager.DictTabCache[tabId];


            List <BlockSubitemClrUserDefineDto> tabSubitemDtoList = PdmCacheManager.GetTabBlockSubitem(tabId);
            List <int> subitemIds = tabSubitemDtoList.Select(o => o.SubItemID).ToList();
            List <PdmBlockSubItemClrDto> listclrSubitems = PdmCacheManager.GetMutiplePdmBlockSubItemEntityFromCache(subitemIds);


            System.Data.DataTable tabFieldResultDataTable = PLMSReferenceValueRetrieveBL.RetrieveDataTableReferenceSimpleDcutValue(arrayInputmainReferenceIds, listclrSubitems, isShowLookupitem);


            #region ------------- update Datatable column name by name conversion

            Dictionary <string, DataColumn> dictDataColumn = new Dictionary <string, DataColumn>();
            foreach (DataColumn dataColumn in tabFieldResultDataTable.Columns)
            {
                dictDataColumn.Add(dataColumn.ColumnName, dataColumn);
            }


            if (IsSubItemFullPathName)
            {
                foreach (var subitemDto in tabSubitemDtoList)
                {
                    if (dictDataColumn.ContainsKey(subitemDto.SubItemID.ToString()))
                    {
                        dictDataColumn[subitemDto.SubItemID.ToString()].ColumnName = subitemDto.SubItemFullPathName;
                    }
                }
            }
            else // it iwll show externa mappimg name
            {
                var dictSubItemMappng = PdmTabBlockSubItemExtraInfoDal.DictTabSubitemExternapMappingName[tabId];

                List <string> noMappingColumnsList = new List <string>();

                var productRefereIdSubItemDto = PdmCacheManager.GetPdmBlockSubItemDtoWithInternalCode(BlockRegister.ProductReferenceIdBlock.ProductReferenceId);

                string referenceIdExternaName = "";

                foreach (int subItemID in dictSubItemMappng.Keys)
                {
                    if (dictDataColumn.ContainsKey(subItemID.ToString()))
                    {
                        string exterName = dictSubItemMappng[subItemID];
                        if (string.IsNullOrEmpty(exterName))
                        {
                            exterName = subItemID.ToString() + "_NoMapping";

                            noMappingColumnsList.Add(exterName);
                        }

                        dictDataColumn[subItemID.ToString()].ColumnName = exterName;

                        if (subItemID == productRefereIdSubItemDto.SubItemId)
                        {
                            referenceIdExternaName = exterName;
                        }
                    }
                }

                foreach (string nomappingColumn in noMappingColumnsList)
                {
                    tabFieldResultDataTable.Columns.Remove(nomappingColumn);
                }

                if (!string.IsNullOrEmpty(referenceIdExternaName))
                {
                    // need to remove hradr coding referenceId
                    if (tabFieldResultDataTable.Columns.Contains(referenceIdExternaName))
                    {
                        tabFieldResultDataTable.Columns.Remove(referenceIdExternaName);

                        // rename productReferenId as referenceIdExternaName
                        tabFieldResultDataTable.Columns["ProductReferenceID"].ColumnName = referenceIdExternaName;
                    }
                }
            }

            #endregion
            return(tabFieldResultDataTable);
        }