Esempio n. 1
0
        public static DecreePartReferent CreateRangeReferent(DecreePartReferent min, DecreePartReferent max)
        {
            DecreePartReferent res = min.Clone() as DecreePartReferent;
            int cou = 0;

            foreach (Pullenti.Ner.Slot s in res.Slots)
            {
                Pullenti.Ner.Slot ss = max.FindSlot(s.TypeName, null, true);
                if (ss == null)
                {
                    return(null);
                }
                if (ss.Value == s.Value)
                {
                    continue;
                }
                if (max.FindSlot(s.TypeName, s.Value, true) != null)
                {
                    continue;
                }
                if ((++cou) > 1)
                {
                    return(null);
                }
                res.UploadSlot(s, string.Format("{0}-{1}", s.Value, ss.Value));
            }
            if (cou != 1)
            {
                return(null);
            }
            return(res);
        }