helper0912 1.0.0
dotnet add package helper0912 --version 1.0.0
NuGet\Install-Package helper0912 -Version 1.0.0
<PackageReference Include="helper0912" Version="1.0.0" />
paket add helper0912 --version 1.0.0
#r "nuget: helper0912, 1.0.0"
// Install helper0912 as a Cake Addin
#addin nuget:?package=helper0912&version=1.0.0
// Install helper0912 as a Cake Tool
#tool nuget:?package=helper0912&version=1.0.0
using EO.WebBrowser.DOM; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using WpfApp8.model; using Window = System.Windows.Window;
namespace WpfApp8 { /// <summary> /// Логика взаимодействия для CatalogWindow.xaml /// </summary> public partial class CatalogWindow : Window { private List<Apartments> apartments; private readonly HotelManagementEntities db;
public CatalogWindow()
{
InitializeComponent();
db = new HotelManagementEntities();
LoadApartments();
}
private void LoadApartments()
{
apartments = db.Apartments.ToList();
lvApartments.ItemsSource = apartments;
}
private void btnSort_Click(object sender, RoutedEventArgs e)
{
string sortBy = (cmbSortBy.SelectedItem as ComboBoxItem)?.Content.ToString();
switch (sortBy)
{
case "Room Number":
apartments = apartments.OrderBy(a => a.RoomNumber).ToList();
break;
case "Category":
apartments = apartments.OrderBy(a => a.Category).ToList();
break;
case "Price":
apartments = apartments.OrderBy(a => a.PricePerNight).ToList();
break;
default:
break;
}
lvApartments.ItemsSource = apartments;
}
private void btnSearch_Click(object sender, RoutedEventArgs e)
{
string searchText = txtSearch.Text.ToLower();
if (!string.IsNullOrWhiteSpace(searchText))
{
apartments = apartments.Where(a => a.RoomNumber.ToLower().Contains(searchText)).ToList();
}
lvApartments.ItemsSource = apartments;
}
private void CalculateDiscountedPrice(Apartments apartment)
{
double discountedPrice = (double)(apartment.PricePerNight * (1 - (apartment.Discount / 100)));
}
private void txtSearch_TextChanged(object sender, TextChangedEventArgs e)
{
}
private void Button_Click(object sender, RoutedEventArgs e)
{
apartments = db.Apartments.ToList();
lvApartments.ItemsSource = apartments;
}
}
}
<Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="10">
<Image Width="34" Source="resurse/лого.gif">
<Image.OpacityMask>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
</Image.OpacityMask>
</Image>
<TextBlock Text="Sort by:" FontWeight="Bold" VerticalAlignment="Center"/>
<ComboBox x:Name="cmbSortBy" SelectedIndex="0" Margin="5">
<ComboBoxItem Content="Room Number"/>
<ComboBoxItem Content="Category"/>
<ComboBoxItem Content="Price"/>
</ComboBox>
<Button Content="Sort" Click="btnSort_Click" Margin="5"/>
<TextBox x:Name="txtSearch" Width="200" Margin="5" TextChanged="txtSearch_TextChanged" />
<Button Content="Search" Click="btnSearch_Click" Margin="5" />
<Button Content="Button" Width="45" Margin="0,0,0,5" Click="Button_Click"/>
</StackPanel>
<ScrollViewer Grid.Row="1">
<ListView Grid.Row="1" x:Name="lvApartments" Margin="0,10" Background="AliceBlue" Height="337">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding ImageUrl}" Width="100" Height="100" Margin="5"/>
<StackPanel>
<TextBlock Text="{Binding RoomNumber}" FontWeight="Bold"/>
<TextBlock Text="{Binding Category}"/>
<TextBlock Text="{Binding PricePerNight}"/>
<TextBlock Text="{Binding Discount}"/>
<TextBlock Text="{Binding Description}"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ScrollViewer>
</Grid>
</Window>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 88 | 5/24/2024 |