Merge branch 'master' of http://scddns.f3322.net:13000/sc/Audit_APP
This commit is contained in:
commit
121ff87ef9
4 files changed
+40
-9
No files matched your search
@@ -9,7 +9,7 @@ namespace Models
|
|||||||
public class ProductProvider : IProvider<Product>
|
public class ProductProvider : IProvider<Product>
|
||||||
{
|
{
|
||||||
private readonly TicketEntities db = new TicketEntities();
|
private readonly TicketEntities db = new TicketEntities();
|
||||||
public int Delete(Product t)
|
public int Delete(Product t)//删除
|
||||||
{
|
{
|
||||||
if (t == null) return 0;
|
if (t == null) return 0;
|
||||||
var model = db.Product.ToList().FirstOrDefault(item => t.ProductCode == item.ProductCode);
|
var model = db.Product.ToList().FirstOrDefault(item => t.ProductCode == item.ProductCode);
|
||||||
@@ -19,7 +19,7 @@ namespace Models
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Insert(Product t)
|
public int Insert(Product t)//插入
|
||||||
{
|
{
|
||||||
if (t == null) return 0;
|
if (t == null) return 0;
|
||||||
if (String.IsNullOrEmpty(t.ProductCode)) return 0;
|
if (String.IsNullOrEmpty(t.ProductCode)) return 0;
|
||||||
@@ -33,6 +33,19 @@ namespace Models
|
|||||||
return db.Product.SqlQuery("select * from Product").ToList();//查询
|
return db.Product.SqlQuery("select * from Product").ToList();//查询
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Product> Selects0()
|
||||||
|
{
|
||||||
|
return db.Product.SqlQuery("select * from Product where ProductType = 0").ToList();//查询
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Product> Selects1()
|
||||||
|
{
|
||||||
|
return db.Product.SqlQuery("select * from Product where ProductType = 1").ToList();//查询
|
||||||
|
}
|
||||||
|
public List<Product> Selects2()
|
||||||
|
{
|
||||||
|
return db.Product.SqlQuery("select * from Product where ProductType = 2").ToList();//查询
|
||||||
|
}
|
||||||
public int Update(Product t)
|
public int Update(Product t)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
+4
-4
@@ -88,13 +88,13 @@
|
|||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<!--搜索类型-->
|
<!--搜索类型-->
|
||||||
<RadioButton Content="染料" x:Name="Button_0" GroupName="button" HorizontalAlignment="Left" Height="40" Margin="995,265,0,0"
|
<RadioButton Content="染料" x:Name="Button_0" Click="Radiobutton" HorizontalAlignment="Left" Height="40" Margin="995,265,0,0"
|
||||||
VerticalAlignment="Top" Width="100" FontSize="18" BorderBrush="{x:Null}" Background="{x:Null}" Grid.Column="1"/>
|
VerticalAlignment="Top" Width="100" FontSize="18" BorderBrush="{x:Null}" Background="{x:Null}" Grid.Column="1"/>
|
||||||
<RadioButton Content="助剂" x:Name="Button_1" GroupName="button" HorizontalAlignment="Left" Height="40" Margin="995,305,0,0"
|
<RadioButton Content="助剂" x:Name="Button_1" Click="Radiobutton" HorizontalAlignment="Left" Height="40" Margin="995,305,0,0"
|
||||||
VerticalAlignment="Top" Width="100" FontSize="18" BorderBrush="{x:Null}" Background="{x:Null}" Grid.Column="1"/>
|
VerticalAlignment="Top" Width="100" FontSize="18" BorderBrush="{x:Null}" Background="{x:Null}" Grid.Column="1"/>
|
||||||
<RadioButton Content="粉体助剂" x:Name="Button_2" GroupName="button" HorizontalAlignment="Left" Height="40" Margin="995,345,0,0"
|
<RadioButton Content="粉体助剂" x:Name="Button_2" Click="Radiobutton" HorizontalAlignment="Left" Height="40" Margin="995,345,0,0"
|
||||||
VerticalAlignment="Top" Width="100" FontSize="18" BorderBrush="{x:Null}" Background="{x:Null}" Grid.Column="1"/>
|
VerticalAlignment="Top" Width="100" FontSize="18" BorderBrush="{x:Null}" Background="{x:Null}" Grid.Column="1"/>
|
||||||
<RadioButton Content="全部原料" x:Name="Button_all" GroupName="button" HorizontalAlignment="Left" Height="40" Margin="995,385,0,0"
|
<RadioButton Content="全部原料" x:Name="Button_all" Click="Radiobutton" HorizontalAlignment="Left" Height="40" Margin="995,385,0,0"
|
||||||
VerticalAlignment="Top" Width="100" FontSize="18" BorderBrush="{x:Null}" Background="{x:Null}" Grid.Column="1" IsChecked="True"/>
|
VerticalAlignment="Top" Width="100" FontSize="18" BorderBrush="{x:Null}" Background="{x:Null}" Grid.Column="1" IsChecked="True"/>
|
||||||
<!--原料代码-->
|
<!--原料代码-->
|
||||||
<TextBox x:Name="stuff_ProductCode" HorizontalAlignment="Left" Height="30" Margin="105,0,0,100" Text=""
|
<TextBox x:Name="stuff_ProductCode" HorizontalAlignment="Left" Height="30" Margin="105,0,0,100" Text=""
|
||||||
|
|||||||
@@ -44,12 +44,25 @@ namespace Audit.View
|
|||||||
e.Row.Header = e.Row.GetIndex() + 1;
|
e.Row.Header = e.Row.GetIndex() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Radiobutton(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
System.Windows.Controls.RadioButton Radiobutton = (sender as System.Windows.Controls.RadioButton);
|
||||||
|
string radiobutton = Radiobutton.Content.ToString();
|
||||||
|
if (radiobutton == "全部原料") Buttontype_sql = -1;
|
||||||
|
if (radiobutton == "染料") Buttontype_sql = 0;
|
||||||
|
if (radiobutton == "助剂") Buttontype_sql = 1;
|
||||||
|
if (radiobutton == "粉体助剂") Buttontype_sql = 2;
|
||||||
|
StuffView.Button_sql = true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 公共变量数组实体
|
/// 公共变量数组实体
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Product product = new Product();//最终存入sql的实体
|
private Product product = new Product();//最终存入sql的实体
|
||||||
private Product product_temp = new Product();//取出自sql的实体缓存
|
private Product product_temp = new Product();//取出自sql的实体缓存
|
||||||
public static Boolean Button_sql = false;
|
public static Boolean Button_sql = false;
|
||||||
|
public static int Buttontype_sql = -1;
|
||||||
|
|
||||||
|
|
||||||
private void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
|
private void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,8 +43,10 @@ namespace Audit.ViewModel
|
|||||||
public StuffViewModel()
|
public StuffViewModel()
|
||||||
{
|
{
|
||||||
products = new ProductProvider().Select();
|
products = new ProductProvider().Select();
|
||||||
DispatcherTimer timer = new DispatcherTimer();//每0.5秒调用一次Tick_Event
|
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
|
||||||
timer.Interval = TimeSpan.FromSeconds(0.1);
|
{
|
||||||
|
Interval = TimeSpan.FromSeconds(0.1)
|
||||||
|
};
|
||||||
timer.Tick += Tick_Event;
|
timer.Tick += Tick_Event;
|
||||||
timer.Start();
|
timer.Start();
|
||||||
}
|
}
|
||||||
@@ -53,7 +55,10 @@ namespace Audit.ViewModel
|
|||||||
{
|
{
|
||||||
if (StuffView.Button_sql == true)//获取按钮状态
|
if (StuffView.Button_sql == true)//获取按钮状态
|
||||||
{
|
{
|
||||||
Product = new ProductProvider().Select();//扫描数据库
|
if (StuffView.Buttontype_sql == -1) Product = new ProductProvider().Select();
|
||||||
|
if (StuffView.Buttontype_sql == 0) Product = new ProductProvider().Selects0();
|
||||||
|
if (StuffView.Buttontype_sql == 1) Product = new ProductProvider().Selects1();
|
||||||
|
if (StuffView.Buttontype_sql == 2) Product = new ProductProvider().Selects2();
|
||||||
StuffView.Button_sql = false;//清除按钮状态
|
StuffView.Button_sql = false;//清除按钮状态
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user