Beispiel #1
0
        public static void ModifyQCMappingList_CS <TC>(XCollection <TC> qcList, bool withBracket)
            where TC : QueryCriteriaItem, IDicomMappingItem, new()
        {
            if (qcList == null)
            {
                return;
            }
            bool found = true;

            while (found)
            {
                found = false;
                int count = qcList.Count;
                for (int index = 0; index < count; index++)
                {
                    TC item = qcList[index];

                    IDicomMappingItem dcmItem = item as IDicomMappingItem;
                    if (dcmItem == null)
                    {
                        continue;
                    }

                    if (dcmItem.DPath != null &&
                        dcmItem.DPath.VR == DVR.CS &&
                        dcmItem.DPath.Path == DicomMappingHelper.DataColumnName2DPath(item.SourceField))
                    {
                        qcList.Remove(item);

                        if (withBracket)    // for GetRule()
                        {
                            qcList.Insert(index, DicomMappingHelper.GetRightBracket <TC>());
                        }

                        for (int i = Program.ConfigMgt.Config.CSDivisionMAXCount - 1; i >= 0; i--)  // for GetRule() and for NT Service to create QC DataSet
                        {
                            QueryCriteriaItem itemSub = dcmItem.Clone() as QueryCriteriaItem;
                            itemSub.SourceField = itemSub.SourceField + "_" + i.ToString();
                            itemSub.Operator    = QueryCriteriaOperator.Like;
                            if (i == 0)
                            {
                                itemSub.Type = QueryCriteriaType.None;
                            }
                            else
                            {
                                itemSub.Type = QueryCriteriaType.Or;
                            }
                            qcList.Insert(index, itemSub);
                        }

                        if (withBracket)    // for GetRule()
                        {
                            TC itemAnd = DicomMappingHelper.GetLeftBracket <TC>();
                            itemAnd.Type = QueryCriteriaType.And;
                            qcList.Insert(index, itemAnd);
                        }

                        found = true;
                        break;
                    }
                }
            }
        }