internal static List <LookupItemDto> GetOneSystemDefinTableLookupItems(SqlConnection conn, string queryTAble)
        {
            List <LookupItemDto> listDto = new List <LookupItemDto> ();

            try
            {
                DataTable datatable = DataAcessHelper.GetDataTableQueryResult(conn, queryTAble);

                foreach (DataRow row in datatable.Rows)
                {
                    LookupItemDto itemDto = new LookupItemDto();
                    // itemDto.Id = (int)row["Id"];
                    itemDto.Id      = row["Id"];
                    itemDto.Display = row["Display"] as string;
                    listDto.Add(itemDto);
                }
            }
            catch (Exception ex)
            {
            }



            return(listDto);
        }
示例#2
0
        private static Dictionary <int, List <LookupItemDto> > GetSysDefineEntityDisplayInfoListNew(List <PdmEntityBlClrDto> sysDefineEntityList, SqlConnection conn)
        {
            Dictionary <int, List <LookupItemDto> > toReturn = new Dictionary <int, List <LookupItemDto> >();

            Dictionary <string, string> dictTableNameAndQuery = new Dictionary <string, string>();

            foreach (var aPdmEntityDto in sysDefineEntityList)
            {
                string systemQueryTable = GetSysDefineQueryIDAndDisplay(aPdmEntityDto);
                //  CLROutput.OutputDebug("aPdmEntityDto.SysTableName" + aPdmEntityDto.EntityId + "=" + aPdmEntityDto.EntityCode + aPdmEntityDto.SysTableName);
                if (!dictTableNameAndQuery.ContainsKey(aPdmEntityDto.SysTableName))
                {
                    dictTableNameAndQuery.Add(aPdmEntityDto.SysTableName, systemQueryTable);

                    CLROutput.OutputDebug("aPdmEntityDto.SysTableName" + aPdmEntityDto.EntityId + "=" + aPdmEntityDto.EntityCode + aPdmEntityDto.SysTableName + " systemQueryTable=" + systemQueryTable);
                }
            }

            // SqlContext.Pipe.Send("queryRowValue=" + allSystemQueryTable);
            DataSet result = DataAcessHelper.GetDataSetQueryResult(conn, dictTableNameAndQuery);

            //  var dictTableNameAndDto = sysDefineEntityList.ToDictionary(o => o.EntityId , o => o);

            foreach (var SysEntityDto in sysDefineEntityList)
            {
                string sysTableName = SysEntityDto.SysTableName;
                foreach (DataTable datatable in result.Tables)
                {
                    //  CLROutput.SendDataTable(datatable);

                    if (sysTableName == datatable.TableName)
                    {
                        List <LookupItemDto> listDto = new List <LookupItemDto>();
                        foreach (DataRow row in datatable.Rows)
                        {
                            LookupItemDto itemDto = new LookupItemDto();
                            itemDto.Id      = (int)row["Id"];
                            itemDto.Display = row["Display"] as string;
                            listDto.Add(itemDto);
                        }

                        toReturn.Add(SysEntityDto.EntityId, listDto);
                    }

                    //if(
                    // DataSetUtilities.SendDataTable(datatable);
                }
            }

            return(toReturn);
        }