Ejemplo n.º 1
0
        public static IDAOFilter CreateIDatGuidFilter <T>(IDataAccess accessor, ArrayList args) where T : BaseDat <T>//, new()
        {
            IDAOFilter filter = accessor.NewFilter();

            if (args.Count == 2 && args[0] is string && (args[1] is Guid || args[1] is string))
            {
                if (args[1] is string)
                {
                    filter.AddWhere(new FilterGUID((string)args[0], new Guid(args[1].ToString())));
                }
                else if (args[1] is Guid)
                {
                    filter.AddWhere(new FilterGUID((string)args[0], (Guid)args[1]));
                }
                return(filter);
            }
            throw new ArgumentException("ќшибка формировани¤ IDatGuidFilter по заданным аргументам", args2string(args));
        }
Ejemplo n.º 2
0
        public static IDAOFilter CreateIDatFilter <T>(IDataAccess accessor, ArrayList args) where T : BaseDat <T>//, new()
        {
            IDAOFilter filter = accessor.NewFilter();

            if (args.Count == 1 && args[0] is int)
            {
                filter.AddWhere(new FilterID((int)args[0]));
                return(filter);
            }
            throw new ArgumentException("ќшибка формировани¤ IDatFilter по заданным аргументам", args2string(args));
        }
Ejemplo n.º 3
0
        public override IDAOFilter GetFilter()
        {
            IDataAccess da = SysAuditDat.ClassDataAccessor;
            IDAOFilter  f  = da.NewFilter();

            f.AddWhere(new FilterDateFromTo(SysAuditColumns.Dt, DateFrom, DateTo.AddDays(1)));

            if (!string.IsNullOrEmpty(Tbl))
            {
                Tbl = "%" + Tbl + "%";
                f.AddWhere(new FilterString(SysAuditColumns.Tbl, Tbl, true));
            }

            if (ID != 0)
            {
                //f.AddWhere(new FilterID(SysAuditColumns.TblID, ID));
                f.AddWhere(new FilterCustom(string.Format("OpContent.value('/*[1]/@id', 'int') = {0}", ID)));
            }

            if (!string.IsNullOrEmpty(User))
            {
                User = "******" + User + "%";
                f.AddWhere(new FilterString(SysAuditColumns.Usr, User, true));
            }

            if (!string.IsNullOrEmpty(Host))
            {
                Host = "%" + Host + "%";
                f.AddWhere(new FilterString(SysAuditColumns.ClientHost, Host, true));
            }

            if (!string.IsNullOrEmpty(Application))
            {
                Application = "%" + Application + "%";
                f.AddWhere(new FilterString(SysAuditColumns.ClientApplication, Application, true));
            }

            if (!string.IsNullOrEmpty(Server))
            {
                Server = "%" + Server + "%";
                f.AddWhere(new FilterString(SysAuditColumns.Srv, Server, true));
            }

            if (!string.IsNullOrEmpty(Base))
            {
                Base = "%" + Base + "%";
                f.AddWhere(new FilterString(SysAuditColumns.Db, Base, true));
            }

            return(f);
        }
Ejemplo n.º 4
0
        public static IDAOFilter CreateICardDatFilter <T>(IDataAccess accessor, ArrayList args) where T : BaseDat <T>//, new()
        {
            IDAOFilter filter = accessor.NewFilter();

            if (args.Count == 1)
            {
                if (args[0] is int)
                {
                    return(CreateIDatFilter <T>(accessor, args));
                }
                else if (args[0] is PathCard)
                {
                    filter.AddWhere(new FilterAND(new FilterString(BaseDat <T> .GetFieldName("Parent_FP"), ((PathCard)args[0]).Parent.ToString()), new FilterID(BaseDat <T> .GetFieldName("Code"), ((PathCard)args[0]).Code)));
                    return(filter);
                }
                else if (args[0] is string)
                {
                    string argVal = args[0].ToString();
                    if (PathCard.IsPathCard(argVal))
                    {
                        filter.AddWhere(new FilterAND(new FilterString(BaseDat <T> .GetFieldName("Parent_FP"), new PathCard(argVal).Parent.ToString()), new FilterID(BaseDat <T> .GetFieldName("Code"), new PathCard(argVal).Code)));
                        return(filter);
                    }
                }
            }
            else if (args.Count == 2)
            {
                //if (args[0] is PathTree && args[1] is int)
                if (PathTree.IsPathTree(args[0].ToString()) && args[1] is int)
                {
                    filter.AddWhere(new FilterAND(new FilterString(BaseDat <T> .GetFieldName("Parent_FP"), ((PathTree)args[0]).ToString()), new FilterID(BaseDat <T> .GetFieldName("Code"), (int)args[0])));
                    return(filter);
                }
                else if (args[0] is string && args[1] is int)
                {
                    filter.AddWhere(new FilterAND(new FilterString(BaseDat <T> .GetFieldName("Parent_FP"), (string)args[0]), new FilterID(BaseDat <T> .GetFieldName("Code"), (int)args[0])));
                    return(filter);
                }
            }
            throw new ArgumentException("ќшибка формировани¤ ICardDatFilter по заданным аргументам", args2string(args));
        }
Ejemplo n.º 5
0
        public static IDAOFilter CreateITreeDatFilter <T>(IDataAccess accessor, ArrayList args) where T : BaseDat <T>//, new()
        {
            IDAOFilter filter = accessor.NewFilter();

            if (args.Count == 1)
            {
                if (args[0] is int)
                {
                    return(CreateIDatFilter <T>(accessor, args));
                }
                else if (args[0] is PathTree)
                {
                    filter.AddWhere(new FilterString(BaseDat <T> .GetFieldName("FP"), ((PathTree)args[0]).ToString()));
                    return(filter);
                }
                else if (args[0] is string)
                {
                    filter.AddWhere(new FilterString(BaseDat <T> .GetFieldName("FP"), (string)args[0]));
                    return(filter);
                }
            }
            throw new ArgumentException("ќшибка формировани¤ ITreeDatFilter по заданным аргументам", args2string(args));
        }