Example #1
0
        public InventoryItemDTO GetInventoryItem(Guid id)
        {
            InventoryItemDTO dto = null;
            Within.Transaction(_connectionString, transaction =>
            {
                const string commandText = "SELECT Name, Description, Count, IsActive, Version FROM InventoryItems WHERE AggregateId = @aggregateId";
                using (var command = new SqlCommand(commandText, transaction.Connection, transaction))
                {
                    command.Parameters.Add(new SqlParameter("@aggregateId", id));
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader != null && reader.Read())
                        {
                            dto = new InventoryItemDTO
                                      {
                                          Id = id,
                                          Version = (int)reader["Version"],
                                          Name = (string)reader["Name"],
                                          Description = (string)reader["Description"],
                                          Count = (int)reader["Count"],
                                          Active = (bool)reader["IsActive"],
                                      };
                        }
                    }
                }
            });

            return dto;
        }
Example #2
0
        public InventoryItemForm(InventoryItemDTO inventoryItemDTO, IBus bus)
        {
            _inventoryItemDTO = inventoryItemDTO;
            _bus = bus;

            InitializeComponent();

            InitializeUI();
        }
 void ShowItem(InventoryItemDTO dto)
 {
     new InventoryItemForm(dto, _bus).Show();
 }