Exemplo n.º 1
0
        public BaseListModel <Producer> GetPart(int startRow = 1)
        {
            var connection    = oracleComponent.GetOpenConnection();
            var baseListModel = new BaseListModel <Producer>
            {
                Entities      = GetList(oracleComponent.CommandForGetPart(connection, "Producers", startRow)),
                EntitiesCount = oracleComponent.GetRowsCount(connection, "Producers")
            };

            connection.Dispose();
            return(baseListModel);
        }
Exemplo n.º 2
0
        public List <ActiveOrderView> GetActiveOrdersView()
        {
            var connection = oracleComponent.GetOpenConnection();
            var command    = oracleComponent.GetCommand(connection, "select * from ActiveOrdersView", CommandType.Text);
            OracleDataReader dataReader = command.ExecuteReader();
            var activeOrderViewList     = new List <ActiveOrderView>();

            while (dataReader.Read())
            {
                activeOrderViewList.Add(new ActiveOrderView
                {
                    UserId     = dataReader.GetInt32(0),
                    FirstName  = dataReader.GetString(1),
                    LastName   = dataReader.GetString(2),
                    MiddleName = dataReader.GetString(3),
                    OrderDate  = dataReader.GetDateTime(4),
                    ShipDate   = dataReader.GetDateTime(5),
                    Adress     = dataReader.GetString(6)
                });
            }

            dataReader.Close();
            connection.Dispose();
            return(activeOrderViewList);
        }
Exemplo n.º 3
0
        public List <ProductViewModel> FindProducts(string searchString)
        {
            var connection = oracleComponent.GetOpenConnection();

            searchString = "%" + searchString + "%";
            var command = oracleComponent.GetCommand(connection, "select * from ProductsFullInfo where name like :searchString or producer like :searchString", CommandType.Text);

            oracleComponent.AddParameter(command, "searchString", OracleDbType.Varchar2, searchString);
            OracleDataReader dataReader = command.ExecuteReader();
            var productViewModelList    = new List <ProductViewModel>();

            while (dataReader.Read())
            {
                productViewModelList.Add(new ProductViewModel
                {
                    Id          = dataReader.GetInt32(0),
                    Name        = dataReader.GetString(1),
                    Producer    = dataReader.GetString(2),
                    Description = dataReader.GetString(3),
                    Category    = dataReader.GetString(4),
                    Subcategory = dataReader.GetString(5),
                    Price       = dataReader.GetInt32(6),
                    Quantity    = dataReader.GetInt32(7)
                });
            }

            dataReader.Close();
            connection.Dispose();
            return(productViewModelList);
        }
Exemplo n.º 4
0
        public string GetDiff(int?firstId, int?secondId)
        {
            var connection = oracleComponent.GetOpenConnection();
            var command    = oracleComponent.GetCommand(connection, "Comparison", CommandType.StoredProcedure);

            oracleComponent.AddParameter(command, "FirstId", OracleDbType.Int32, firstId);
            oracleComponent.AddParameter(command, "SecondId", OracleDbType.Int32, secondId);
            oracleComponent.AddOutParameter(command, "Differences", OracleDbType.Varchar2, "");
            command.ExecuteNonQuery();
            return(command.Parameters["Differences"]?.Value?.ToString());
        }