var filter_col = sourceCollection.Where(itemF => itemF.ModelPrinter.Contains(TextPoick.Text) ^ itemF.SkorostPechati.ToString().Contains(TextPoick.Text) ^ itemF.SeriyNomerPrinter.ToString().Contains(TextPoick.Text) ^ itemF.InventarNomerPrinter.ToString().Contains(TextPoick.Text) ^ itemF.ColorOrBW.ToString().Contains(TextPoick.Text));
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 System.Windows.Shapes;
namespace YchetApparatov
{
public partial class AddCabinetWindow : Window
{
private CabinetTable _cabinettable = new CabinetTable();
public AddCabinetWindow(CabinetTable selectedcabinet)
{
InitializeComponent();
if (selectedcabinet != null)
_cabinettable = selectedcabinet;
DataContext = _cabinettable;
}
private void AddNewCabinet(object sender, RoutedEventArgs e)
{
StringBuilder errors = new StringBuilder();
if (string.IsNullOrWhiteSpace(_cabinettable.NomerCabineta.ToString()))
errors.AppendLine("Укажите номер кабинета");
if (errors.Length > 0)
{
MessageBox.Show(errors.ToString());
return;
}
if (_cabinettable.IdCabineta == 0)
{
NormApparatYchetEntities2.GetContext().CabinetTable.Add(_cabinettable);
}
try
{
NormApparatYchetEntities2.GetContext().SaveChanges();
MessageBox.Show("Информация сохранена");
this.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
}
}
<Window x:Class="YchetApparatov.AddCabinetWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:YchetApparatov"
mc:Ignorable="d"
Title="AddCabinetWindow" Height="720" Width="1280">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="788"></ColumnDefinition>
<ColumnDefinition Width="124"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="Номер кабиинета" FontSize="36" HorizontalAlignment="Center" VerticalAlignment="Center" Height="48" Margin="10,70,135,55" Width="644"></TextBlock>
<TextBlock Text="Айди пользователя" Grid.Row="1" FontSize="36" HorizontalAlignment="Center" VerticalAlignment="Center" Height="48" Margin="10,64,28,61" Width="751"/>
<TextBlock Text="Айди комплекта" Grid.Row="2" FontSize="36" HorizontalAlignment="Center" VerticalAlignment="Center" Height="48" Margin="10,60,35,64" Width="744"/>
<TextBox Grid.Column="1" Text="{Binding NomerCabineta}" Margin="0,0,-358,0" FontSize="36"></TextBox>
<TextBox Grid.Column="1" Text="{Binding IdPolzovatel}" Grid.Row="1" Margin="0,0,-358,0" FontSize="36" ></TextBox>
<TextBox Grid.Column="1" Text="{Binding IdComplect}" Grid.Row="2" Margin="0,0,-358,0" FontSize="36" ></TextBox>
<Button Content="Добавить кабинет" HorizontalAlignment="Left" Grid.Row="3" FontSize="36" VerticalAlignment="Top" Click="AddNewCabinet" Width="769" Height="210" Margin="10,10,0,0"/>
</Grid>
</Window>