Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            SQL s = new SQL();

            s.SelectStatement.Select(Products.ProductID, Products.ProductName)
            .From(DBTables.Products)
            .InnerJoin(DBTables.Categories)
            .On(Categories.CategoryID).Equal(Products.CategoryID)
            .Where(Products.Discontinued).Equal("'true'");
            TSelect sel = new TSelect();

            sel.Select(Products.ProductID, Products.ProductName)
            .From(DBTables.Products)
            .Where(Products.ProductName).Like("p%");
            s.Intersect(sel);

            Console.WriteLine(s.ToString());
            Console.WriteLine("--------------------------------");
            List <string> errors = s.Parse();

            if (errors != null && errors.Count > 0)
            {
                foreach (var error in errors)
                {
                    Console.WriteLine("*{0}", error);
                }
            }
            else
            {
                Console.WriteLine("No Errors");
            }
            Console.WriteLine("--------------------------------");
        }
            public ValueTask<bool> OnNextAsync(T value)
            {
                var sval = _selector(value);
                if (hasLastValue && _comparer.Equals(sval, lastValue))
                    return new ValueTask<bool>(true);

                hasLastValue = true;
                lastValue = sval;

                return _observer.OnNextAsync(value);
            }
Ejemplo n.º 3
0
        internal static Expression <Func <TSource, TDest> > GetExpression <TSelect, TSource, TDest>()
            where TSelect : ISelectExpression <TSource, TDest>, new()
        {
            Expression <Func <TSource, TDest> > result;

            if (!SelectResolver.TryGetFromCache(out result))
            {
                var resolver = new TSelect();
                Register(resolver);

                result = SelectResolver.GetExternalExpression <TSource, TDest>();
            }

            return(result);
        }
Ejemplo n.º 4
0
        internal static List <TSelect> Get_Transactions()
        {
            List <TSelect> info = new List <TSelect>();

            using (OracleConnection connection = new OracleConnection(Environment.Constant.Oracle.oracle_cs)) {
                string        query = $"select * from table (proceficator.get_transaction_lifepay)";
                OracleCommand cmd   = new OracleCommand(query, connection);
                connection.Open();
                try {
                    using (OracleDataReader reader = cmd.ExecuteReader()) {
                        while (reader.Read())
                        {
                            Transaction t = new Transaction {
                                id            = reader.GetIntValue("utrnno"),
                                approval      = reader.GetStringValue("approval"),
                                pan           = reader.GetStringValue("pan"),
                                created       = reader.GetDateTimeOffsetValue("created"),
                                amount        = reader.GetDecimalValue("amount"),
                                rrn           = reader.GetStringValue("rrn"),
                                payment_id    = reader.GetOptionalIntValue("payment_id"),
                                mid_rfi       = reader.GetStringValue("mid_rfi"),
                                tid_vtb       = reader.GetStringValue("tid_vtb"),
                                cancel_code   = reader.GetStringValue("cancel_code"),
                                client_id     = reader.GetStringValue("client_id"),
                                tid_rfi       = reader.GetStringValue("tid_rfi"),
                                bank_acquirer = reader.GetStringValue("bank_acquirer"),
                                command       = reader.GetStringValue("command")
                            };

                            Queue q = new Queue {
                                id          = reader.GetIntValue("id_queue"),
                                utrnno      = reader.GetIntValue("utrnno"),
                                reversal    = reader.GetIntValue("reversal"),
                                id_api_user = reader.GetIntValue("id_api_user")
                            };

                            UserConfig c = new UserConfig {
                                method  = reader.GetEnumValue <HttpMethod>("method"),
                                uri     = reader.GetStringValue("uri"),
                                headers = reader.GetDictionary <string, string>("headers")
                            };

                            TSelect ts = new TSelect {
                                transaction = t,
                                queue       = q,
                                config      = c
                            };

                            info.Add(ts);
                        }
                        connection.Close();
                        return(info);
                    }
                } catch (OracleException e) {
                    if (e.ErrorCode == -20001)
                    {
                        throw new Exception(e.Message);
                    }
                    else
                    {
                        Console.Out.WriteLine("OracleException: {0}: {1}", Tool.GetCurrentMethod(), e.Message);
                        throw new Exception("An error occurred during the operation 'Get_Transactions'");
                    }
                }
            }
        }