diff --git a/Models/DyelotsBulkedRecipeProvider.cs b/Models/DyelotsBulkedRecipeProvider.cs index c18d254..94fdff8 100644 --- a/Models/DyelotsBulkedRecipeProvider.cs +++ b/Models/DyelotsBulkedRecipeProvider.cs @@ -8,6 +8,8 @@ namespace Models { public class DyelotsBulkedRecipeProvider : IProvider { + private BatchDyeingCentralEntities db = new BatchDyeingCentralEntities(); + public int Delete(DyelotsBulkedRecipe t) { throw new NotImplementedException(); diff --git a/Models/DyelotsProvider.cs b/Models/DyelotsProvider.cs index 4f9fdd8..bb1fa4c 100644 --- a/Models/DyelotsProvider.cs +++ b/Models/DyelotsProvider.cs @@ -8,19 +8,31 @@ namespace Models { public class DyelotsProvider : IProvider { + private BatchDyeingCentralEntities db = new BatchDyeingCentralEntities(); + public int Delete(Dyelots t) { - throw new NotImplementedException(); + if (t == null) return 0; + var model = db.Dyelots.ToList().FirstOrDefault(item => t.Dyelot == item.Dyelot); + if (model == null) return 0; + db.Dyelots.Remove(model); + int count = db.SaveChanges(); + return count; } public int Insert(Dyelots t) { - throw new NotImplementedException(); + if (t == null) return 0; + if (String.IsNullOrEmpty(t.Dyelot)) return 0; + db.Dyelots.Add(t); + int count = db.SaveChanges(); + return count; + } public List Select() { - throw new NotImplementedException(); + return db.Dyelots.ToList(); } public int Update(Dyelots t) diff --git a/Models/MachinesProvider.cs b/Models/MachinesProvider.cs index aba9ea5..837b115 100644 --- a/Models/MachinesProvider.cs +++ b/Models/MachinesProvider.cs @@ -8,6 +8,8 @@ namespace Models { public class MachinesProvider : IProvider { + private BatchDyeingCentralEntities db = new BatchDyeingCentralEntities(); + public int Delete(Machines t) { throw new NotImplementedException(); diff --git a/View/QueryView.xaml b/View/QueryView.xaml index 2f4f53e..33559f9 100644 --- a/View/QueryView.xaml +++ b/View/QueryView.xaml @@ -17,7 +17,7 @@ - + diff --git a/View/StatisticsView.xaml b/View/StatisticsView.xaml index 0b47b0e..5a88a7a 100644 --- a/View/StatisticsView.xaml +++ b/View/StatisticsView.xaml @@ -34,7 +34,7 @@ Text="{TemplateBinding Content}" FontFamily="Fonts/#FontAwesome" HorizontalAlignment="Center" - Width="40" FontSize="20" Margin="0,5,0,0"/> + Width="80" FontSize="20" Margin="0,5,0,0"/> @@ -59,8 +59,9 @@ - - + + + diff --git a/ViewModel/QueryViewModel.cs b/ViewModel/QueryViewModel.cs index b86127a..108b7af 100644 --- a/ViewModel/QueryViewModel.cs +++ b/ViewModel/QueryViewModel.cs @@ -1,5 +1,8 @@ -using System; +using GalaSoft.MvvmLight; +using Models; +using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,7 +12,30 @@ namespace Audit.ViewModel /// /// QueryViewModel /// - public class QueryViewModel + public class QueryViewModel: ViewModelBase { + private List dyelots = new List(); + /// + /// 所有工单 + /// + public List Dyelots + { + get + { + return dyelots; + } + set + { + dyelots = value; + RaisePropertyChanged(); + } + } + /// + /// + /// + public QueryViewModel() + { + dyelots = new DyelotsProvider().Select(); + } } }