Пример #1
0
        private static List<Usage> List(string Number, int From, int To)
        {
            List<Usage> result = new List<Usage> ();

            QueryBuilder qb = new QueryBuilder (QueryBuilderType.Select);
            qb.Table (DatabaseTableName);
            qb.Columns ("id");

            if ((From > 0) && (To > 0))
            {
                qb.AddWhere ("'"+ From +"' <= createtimestamp");
                qb.AddWhereAND ();
                qb.AddWhere ("createtimestamp <= '"+ To +"'");

                if (Number != string.Empty)
                {
                    qb.AddWhereAND ();
                }
            }

            if (Number != string.Empty)
            {
            //				A:004588334660|B:004550460609|45|2|1307363676|1:
                qb.AddWhere ("type", "=", "1");
                qb.AddWhereAND ();
                qb.AddWhere ("data", "like", "%|A:"+ Number +"|%");
            }

            Query query = Runtime.DBConnection.Query (qb.QueryString);
            if (query.Success)
            {
                while (query.NextRow ())
                {
                    try
                    {
                        result.Add (Load (query.GetGuid (qb.ColumnPos ("id"))));
                    }
                    catch
                    {}
                }
            }

            query.Dispose ();
            query = null;
            qb = null;

            return result;
        }