public static bool Verify(RevOrderCode a, RevisionFilters.Criteria c)
        {
            string ax;

            if (c.SubDataEnum != null)
            {
                ax = a?[c.SubDataEnum.SubDataIdx] ?? "";
                return(Verify(ax, c));
            }

            ax = a?.ToString() ?? "";
            return(Verify(ax, c));
        }
Beispiel #2
0
        // has two purposes:
        // translate the data read to the correct format
        // basically nothing for most
        // put the data in the correct order
        // [i] = is the order from the above
        // [j] = the correct order in the array
        private static RevisionDataFields MakeRevDataItem(dynamic[] items)
        {
            RevisionDataFields df = new RevisionDataFields();

            df.Order = count++;

            for (int i = 0; i < items.Length; i++)
            {
                DataItems.DataEnum d = xlate[i];
                int j = d.DataIdx;

                switch (i)
                {
                // selected
                case 0:
                {
                    df[j] = bool.Parse(items[i]);
                    break;
                }

                // rev order code
                case 2:
                {
                    RevOrderCode rc = new RevOrderCode();
                    rc.AltId = items[i++];
                    REV_SUB_ALTID.Display.DataWidth = rc.AltId.Length;

                    rc.TypeCode = items[i++];
                    REV_SUB_TYPE_CODE.Display.DataWidth = rc.TypeCode.Length;

                    rc.DisciplineCode = items[i];
                    REV_SUB_DISCIPLINE_CODE.Display.DataWidth = rc.DisciplineCode.Length;

                    df[j] = rc;

                    items[i] = rc;

                    break;
                }

                // sequence
                case 1:
                // tag elem id
                case 13:
                // cloud elem id
                case 14:
                {
                    df[j] = Int32.Parse(items[i]);
                    break;
                }

                // visibility
                case 7:
                {
                    df[j] = Enum.Parse(typeof(RevisionVisibility), items[i]);
                    break;
                }

                // date
                case 10:
                {
                    df[j] = DateTime.Parse(items[i]);
                    break;
                }

                default:                        // all else - string
                {
                    df[j] = items[i];
                    break;
                }
                }

                d.Display.DataWidth = (items[i]?.ToString() ?? "").Length;
            }

            // "fix" the type code and the disc code
            df = UpdateCodes(df);

//			CompareCodes(df);

            return(df);
        }