diff --git a/AppleJobs.Data/AppleJobs.Data.csproj b/AppleJobs.Data/AppleJobs.Data.csproj index 3a02a15..99a68b9 100644 --- a/AppleJobs.Data/AppleJobs.Data.csproj +++ b/AppleJobs.Data/AppleJobs.Data.csproj @@ -77,8 +77,10 @@ + + - + diff --git a/AppleJobs.Data/AppleJobsContext.cs b/AppleJobs.Data/AppleJobsContext.cs index 25a699d..f9118f1 100644 --- a/AppleJobs.Data/AppleJobsContext.cs +++ b/AppleJobs.Data/AppleJobsContext.cs @@ -1,8 +1,10 @@ -using AppleJobs.Data.Models; +using AppleJobs.Data.Models.Articles; +using AppleJobs.Data.Models.Common; +using AppleJobs.Data.Models.Inventory; using AppleJobs.Data.Models.ModelsJobs; +using AppleJobs.Data.Models.Orders; using Microsoft.AspNet.Identity.EntityFramework; using MySql.Data.Entity; -using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity; namespace AppleJobs.Data @@ -41,6 +43,13 @@ namespace AppleJobs.Data #endregion + #region Articles / News + + public DbSet News { get; set; } + public DbSet NewsCategories { get; set; } + + #endregion + public AppleJobsContext(string connection = "Default") : base(connection) { } diff --git a/AppleJobs.Data/Models/Articles/News.cs b/AppleJobs.Data/Models/Articles/News.cs new file mode 100644 index 0000000..ca71eb9 --- /dev/null +++ b/AppleJobs.Data/Models/Articles/News.cs @@ -0,0 +1,25 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace AppleJobs.Data.Models.Articles +{ + [Table("ApjNews")] + public class News + { + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } + public string Title { get; set; } + public string Content { get; set; } + public int OrderIndex { get; set; } + public int CharCount { get; set; } + public DateTime Date { get; set; } + public string State { get; set; } + public int CategoryId { get; set; } + + [ForeignKey(nameof(CategoryId))] + public virtual NewsCategory NewsCategory { get; set; } + + public string FilterString { get { return string.Join(",", Title, Content, OrderIndex, CharCount, Date, State, NewsCategory.CategoryDescription); } } + } +} diff --git a/AppleJobs.Data/Models/Articles/NewsCategory.cs b/AppleJobs.Data/Models/Articles/NewsCategory.cs new file mode 100644 index 0000000..7e30bec --- /dev/null +++ b/AppleJobs.Data/Models/Articles/NewsCategory.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace AppleJobs.Data.Models.Articles +{ + [Table("ApjNewsCategory")] + public class NewsCategory + { + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } + public string CategoryName { get; set; } + public string CategoryDescription { get; set; } + + } +} diff --git a/AppleJobs.Data/Models/Customer.cs b/AppleJobs.Data/Models/Common/Customer.cs similarity index 89% rename from AppleJobs.Data/Models/Customer.cs rename to AppleJobs.Data/Models/Common/Customer.cs index 690d2e7..40eed64 100644 --- a/AppleJobs.Data/Models/Customer.cs +++ b/AppleJobs.Data/Models/Common/Customer.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace AppleJobs.Data.Models.ModelsJobs +namespace AppleJobs.Data.Models.Common { public class Customer { @@ -10,5 +10,6 @@ namespace AppleJobs.Data.Models.ModelsJobs public string Name { get; set; } public string Code { get; set; } public string MainEmail { get; set; } + } } diff --git a/AppleJobs.Data/Models/Inventory/Accessories.cs b/AppleJobs.Data/Models/Inventory/Accessories.cs index be9f2ed..129c80f 100644 --- a/AppleJobs.Data/Models/Inventory/Accessories.cs +++ b/AppleJobs.Data/Models/Inventory/Accessories.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace AppleJobs.Data.Models +namespace AppleJobs.Data.Models.Inventory { public class Accessories { diff --git a/AppleJobs.Data/Models/Inventory/Employee.cs b/AppleJobs.Data/Models/Inventory/Employee.cs index cddaf4d..1516625 100644 --- a/AppleJobs.Data/Models/Inventory/Employee.cs +++ b/AppleJobs.Data/Models/Inventory/Employee.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace AppleJobs.Data.Models +namespace AppleJobs.Data.Models.Inventory { public class Employee { diff --git a/AppleJobs.Data/Models/ModelsJobs/Model.cs b/AppleJobs.Data/Models/ModelsJobs/Model.cs index 2146ff5..c988b03 100644 --- a/AppleJobs.Data/Models/ModelsJobs/Model.cs +++ b/AppleJobs.Data/Models/ModelsJobs/Model.cs @@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace AppleJobs.Data.Models.ModelsJobs { + [TsModel] public class Model { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] diff --git a/AppleJobs.Data/Models/ModelsJobs/ModelCategory.cs b/AppleJobs.Data/Models/ModelsJobs/ModelCategory.cs index 3d3ca20..6fd9234 100644 --- a/AppleJobs.Data/Models/ModelsJobs/ModelCategory.cs +++ b/AppleJobs.Data/Models/ModelsJobs/ModelCategory.cs @@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace AppleJobs.Data.Models.ModelsJobs { + [TsModel] public class ModelCategory { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] diff --git a/AppleJobs.Data/Models/ModelsJobs/ModelJob.cs b/AppleJobs.Data/Models/ModelsJobs/ModelJob.cs index 0ecd89f..863a509 100644 --- a/AppleJobs.Data/Models/ModelsJobs/ModelJob.cs +++ b/AppleJobs.Data/Models/ModelsJobs/ModelJob.cs @@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace AppleJobs.Data.Models.ModelsJobs { + [TsModel] public class ModelJob { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] diff --git a/AppleJobs.Data/Models/ModelsJobs/ModelJobPriceTemplate.cs b/AppleJobs.Data/Models/ModelsJobs/ModelJobPriceTemplate.cs index 8430e9d..14078c9 100644 --- a/AppleJobs.Data/Models/ModelsJobs/ModelJobPriceTemplate.cs +++ b/AppleJobs.Data/Models/ModelsJobs/ModelJobPriceTemplate.cs @@ -1,8 +1,10 @@ -using System.ComponentModel.DataAnnotations; +using AppleJobs.Data.Models.Common; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace AppleJobs.Data.Models.ModelsJobs { + [TsModel] public class ModelJobPriceTemplate { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] diff --git a/AppleJobs.Data/Models/Orders/Order.cs b/AppleJobs.Data/Models/Orders/Order.cs index ca6a356..c539a6a 100644 --- a/AppleJobs.Data/Models/Orders/Order.cs +++ b/AppleJobs.Data/Models/Orders/Order.cs @@ -1,9 +1,11 @@ -using AppleJobs.Data.Models.ModelsJobs; +using AppleJobs.Data.Models.Common; +using AppleJobs.Data.Models.Inventory; +using AppleJobs.Data.Models.ModelsJobs; using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace AppleJobs.Data.Models +namespace AppleJobs.Data.Models.Orders { [TsModel] public class OrderView @@ -60,12 +62,14 @@ namespace AppleJobs.Data.Models public bool? IsDrive { get; set; } public int? Price { get; set; } + #region ForeignKeys public int OrderStatuses_Id { get; set; } public int Models_Id { get; set; } public int? ModelJobs_Id { get; set; } public int Customers_Id { get; set; } public int? Accessories_Id { get; set; } public int? Employees_Id { get; set; } + #endregion [ForeignKey(nameof(OrderStatuses_Id))] @@ -90,14 +94,8 @@ namespace AppleJobs.Data.Models { get { - return string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}", - Contact, Comment, DateCreated, DateClosed, DateUpdated, - OrderStatus?.Name, - Model.FilterString, - JobModel.FilterString, - Customer?.Name, - Accessories?.Name, - Employee?.Name); + return string.Join(",", Contact, Comment, DateCreated, DateClosed, DateUpdated, + OrderStatus?.Name, Model.FilterString, JobModel.FilterString, Customer?.Name, Accessories?.Name, Employee?.Name, Price); } } } diff --git a/AppleJobs.Data/Models/Orders/OrderCategory.cs b/AppleJobs.Data/Models/Orders/OrderCategory.cs index 8910a62..e6596ec 100644 --- a/AppleJobs.Data/Models/Orders/OrderCategory.cs +++ b/AppleJobs.Data/Models/Orders/OrderCategory.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace AppleJobs.Data.Models +namespace AppleJobs.Data.Models.Orders { [TsModel] public class OrderCategory diff --git a/AppleJobs.Data/Models/Orders/OrderStatus.cs b/AppleJobs.Data/Models/Orders/OrderStatus.cs index 3f3004a..190f14b 100644 --- a/AppleJobs.Data/Models/Orders/OrderStatus.cs +++ b/AppleJobs.Data/Models/Orders/OrderStatus.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace AppleJobs.Data.Models +namespace AppleJobs.Data.Models.Orders { [TsModel] [Table("OrderStatuses")] diff --git a/BrightSharp/Behaviors/FiterGridTextBoxBehavior.cs b/BrightSharp/Behaviors/FiterGridTextBoxBehavior.cs index 350765e..108e337 100644 --- a/BrightSharp/Behaviors/FiterGridTextBoxBehavior.cs +++ b/BrightSharp/Behaviors/FiterGridTextBoxBehavior.cs @@ -17,7 +17,8 @@ namespace BrightSharp.Behaviors { timer.Tick += Timer_Tick; FilterDelay = TimeSpan.FromSeconds(1); - IgnoreCase = null; + IgnoreCase = null; //Case sensitive if any char upper case + FilterStringPropertyName = "FilterString"; } @@ -36,7 +37,7 @@ namespace BrightSharp.Behaviors } } - + public string FilterStringPropertyName { get; set; } public bool HasFilterText { @@ -59,12 +60,12 @@ namespace BrightSharp.Behaviors public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(FilterDefaultViewTextBoxBehavior), new PropertyMetadata(null)); - + public bool? IgnoreCase { get; set; } private Predicate GetDefaultFilter(Type filterItemType) { Func dataFunc; - var pInfo = filterItemType.GetProperty("FilterString"); + var pInfo = filterItemType.GetProperty(FilterStringPropertyName); if (pInfo == null) { dataFunc = (x) => string.Join(",", filterItemType.GetProperties().Where(p => !p.Name.EndsWith("Id")).Select(p => (p.GetValue(x, null) ?? string.Empty).ToString())); diff --git a/BrightSharp/Generic.xaml b/BrightSharp/Generic.xaml index 298342c..6f3a9c2 100644 --- a/BrightSharp/Generic.xaml +++ b/BrightSharp/Generic.xaml @@ -9,10 +9,6 @@ - - False - - 1 3 diff --git a/JetFrames.AppleJobs.Editor/App.config b/JetFrames.AppleJobs.Editor/App.config index dac58c0..82297ec 100644 --- a/JetFrames.AppleJobs.Editor/App.config +++ b/JetFrames.AppleJobs.Editor/App.config @@ -21,99 +21,13 @@ - + + - + - - - - 0 - - - 0 - - - NaN - - - NaN - - - 100 - - - 200 - - - 300 - - - 100 - - - 200 - - - 300 - - - NaN - - - NaN - - - NaN - - - NaN - - - NaN - - - NaN - - - True - - - True - - - True - - - True - - - 0 - - - 0 - - - 1 - - - True - - - 400 - - - 0 - - - NaN - - - NaN - - - + \ No newline at end of file diff --git a/JetFrames.AppleJobs.Editor/App.xaml.cs b/JetFrames.AppleJobs.Editor/App.xaml.cs index 756f554..d486a3c 100644 --- a/JetFrames.AppleJobs.Editor/App.xaml.cs +++ b/JetFrames.AppleJobs.Editor/App.xaml.cs @@ -13,12 +13,6 @@ namespace JetFrames.AppleJobs.Editor /// public partial class App : Application { - protected override void OnStartup(StartupEventArgs e) - { - - base.OnStartup(e); - } - public static ViewModelLocator Locator { get { return (ViewModelLocator)Current.TryFindResource("ViewModelLocator"); } } } } diff --git a/JetFrames.AppleJobs.Editor/Converters/ModelFilterConverter.cs b/JetFrames.AppleJobs.Editor/Converters/ModelFilterConverter.cs deleted file mode 100644 index 2c5cca8..0000000 --- a/JetFrames.AppleJobs.Editor/Converters/ModelFilterConverter.cs +++ /dev/null @@ -1,27 +0,0 @@ -using AppleJobs.Data.Models.ModelsJobs; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Data; - -namespace JetFrames.AppleJobs.Editor.Converters -{ - public class ModelFilterConverter : IMultiValueConverter - { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) - { - var initCollection = (IEnumerable)values[0]; - var modelJob = (ModelJob)values[1]; - if (modelJob == null) return initCollection; - return initCollection.Where(mj => mj.Models_Id == modelJob.Models_Id); - } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/JetFrames.AppleJobs.Editor/EditorViewModel.cs b/JetFrames.AppleJobs.Editor/EditorViewModel.cs index 47acdbc..011f356 100644 --- a/JetFrames.AppleJobs.Editor/EditorViewModel.cs +++ b/JetFrames.AppleJobs.Editor/EditorViewModel.cs @@ -10,11 +10,12 @@ using System.Windows; using BrightSharp.Extensions; using System.Windows.Controls; using System.Windows.Data; -using System; -using AppleJobs.Data.Models; -using JetFrames.AppleJobs.Editor.Views; using JetFrames.AppleJobs.Editor.ViewModels; using System.Collections; +using AppleJobs.Data.Models.Articles; +using AppleJobs.Data.Models.Orders; +using AppleJobs.Data.Models.Inventory; +using System.ComponentModel; namespace JetFrames.AppleJobs.Editor { @@ -27,31 +28,59 @@ namespace JetFrames.AppleJobs.Editor this.context = context; } - public string Name { get; set; } - public string Email { get; set; } + #region Data Properties List _models; - public IEnumerable Models - { - get - { - return _models ?? (_models = context.Models.ToList()); - } - } + public IEnumerable Models { get { return GetSingleton(ref _models, context.Models); } } List _categories; - public IEnumerable Categories + public IEnumerable Categories { get { return GetSingleton(ref _categories, context.ModelCategories); } } + private List _news; + public IEnumerable News { get { return GetSingleton(ref _news, context.News); } } + private List _newsCategories; + public IEnumerable NewsCategories { get { return GetSingleton(ref _newsCategories, context.NewsCategories); } } + List _modelJobPriceTemplates; + public IEnumerable ModelJobPriceTemplates { get { - return _categories ?? (_categories = context.ModelCategories.ToList()); + context.ModelJobs.Count(); + return GetSingleton(ref _modelJobPriceTemplates, context.ModelJobPriceTemplates); } } + List _modelJobs; + public IEnumerable ModelJobs { get { return GetSingleton(ref _modelJobs, context.ModelJobs); } } + List _orders; + public IEnumerable Orders { get { return GetSingleton(ref _orders, context.Orders.OrderByDescending(o => o.DateCreated).Take(2000)); } } + List _orderStatuses; + public IEnumerable OrderStatuses { get { return GetSingleton(ref _orderStatuses, context.OrderStatuses); } } + List _accessories; + public IEnumerable Accessories { get { return GetSingleton(ref _accessories, context.Accessories); } } + List _employees; + public IEnumerable Employees { get { return GetSingleton(ref _employees, context.Employees); } } - public void OnLoaded() + #endregion + + #region Initialize Grid + + public static void InitGrid(DataGrid dg) { - + CommandManager.AddPreviewCanExecuteHandler(dg, DataGridPreviewCanExecute); + dg.InitializingNewItem += DataGridInitializingNewItem; + } + private static void DataGridPreviewCanExecute(object sender, CanExecuteRoutedEventArgs e) + { + if (e.Command == DataGrid.DeleteCommand) + e.Handled = App.Locator.Editor.DeleteEntity(((DataGrid)sender).SelectedItems, true); } + private static void DataGridInitializingNewItem(object sender, InitializingNewItemEventArgs e) + { + App.Locator.Editor.AddEntity(e.NewItem); + } + + #endregion + + #region Commands public bool CanAdd(object item) { if (item is ModelJobPriceTemplate) @@ -80,60 +109,6 @@ namespace JetFrames.AppleJobs.Editor return true; } - List _modelJobPriceTemplates; - public IEnumerable ModelJobPriceTemplates - { - get - { - if (ModelJobs == null) throw new InvalidOperationException(); - return _modelJobPriceTemplates ?? (_modelJobPriceTemplates = context.ModelJobPriceTemplates.ToList()); - } - } - - List _modelJobs; - public IEnumerable ModelJobs - { - get - { - return _modelJobs ?? (_modelJobs = context.ModelJobs.ToList()); - } - } - - List _orders; - public IEnumerable Orders - { - get - { - return _orders ?? (_orders = context.Orders.Take(1000).ToList()); - } - } - List _orderStatuses; - public IEnumerable OrderStatuses - { - get - { - return _orderStatuses ?? (_orderStatuses = context.OrderStatuses.ToList()); - } - } - - List _accessories; - public IEnumerable Accessories - { - get - { - return _accessories ?? (_accessories = context.Accessories.ToList()); - } - } - - List _employees; - public IEnumerable Employees - { - get - { - return _employees ?? (_employees = context.Employees.ToList()); - } - } - public ICommand SaveCommand { get @@ -181,7 +156,6 @@ namespace JetFrames.AppleJobs.Editor RaisePropertyChanged(nameof(Orders)); RaisePropertyChanged(nameof(OrderStatuses)); ShowMessage("Обновлено из базы данных"); - OnLoaded(); }); } } @@ -192,43 +166,28 @@ namespace JetFrames.AppleJobs.Editor { return new RelayCommand(p => { - var vm = new NewPriceTemplateVm(Models, ModelJobs, ModelJobPriceTemplates, CreateNewModelJobPriceTemplate); - var dialog = new NewPriceTemplateDialog + var vm = new NewPriceTemplateVm(Models, ModelJobs, ModelJobPriceTemplates, viewModel => + { + var item = new ModelJobPriceTemplate + { + Price = viewModel.NewPrice, + Customers_Id = 1, + ModelJobs_Id = viewModel.SelectedModelJob.Id, + IsPriceFrom = true + }; + _modelJobPriceTemplates.Add(item); + context.Entry(item).State = EntityState.Added; + CollectionViewSource.GetDefaultView(ModelJobPriceTemplates).Refresh(); + }); + var dialog = new Views.NewPriceTemplateDialog { DataContext = vm, Owner = Application.Current.MainWindow }; - if (dialog.ShowDialog() == true) - { - CreateNewModelJobPriceTemplate(vm); - } }); } } - private void CreateNewModelJobPriceTemplate(NewPriceTemplateVm vm) - { - var item = new ModelJobPriceTemplate - { - Price = vm.NewPrice, - Customers_Id = 1, - ModelJobs_Id = vm.SelectedModelJob.Id, - IsPriceFrom = true - }; - _modelJobPriceTemplates.Add(item); - context.Entry(item).State = EntityState.Added; - CollectionViewSource.GetDefaultView(ModelJobPriceTemplates).Refresh(); - } - - private object _currentRow; - - public object CurrentRow - { - get { return _currentRow; } - set { _currentRow = value; RaisePropertyChanged(nameof(CurrentRow)); } - } - - public ICommand ModelJobDropDownLoadedCommand { get @@ -260,6 +219,8 @@ namespace JetFrames.AppleJobs.Editor } } + #endregion + public bool DeleteEntity(object entity, bool promt) { if (entity != null && (entity.GetType().IsPublic || entity is IEnumerable)) @@ -291,11 +252,21 @@ namespace JetFrames.AppleJobs.Editor } } - public void AddEntity(object entity) + public void AddEntity(object newItem) { - if (entity != null) + if (newItem != null) { - context.Entry(entity).State = EntityState.Added; + if (newItem is Order) + { + var mjpt = (Order)newItem; + mjpt.Customers_Id = 1; + } + if (newItem is ModelJobPriceTemplate) + { + var mjpt = (ModelJobPriceTemplate)newItem; + mjpt.Customers_Id = 1; + } + context.Entry(newItem).State = EntityState.Added; } } @@ -330,5 +301,16 @@ namespace JetFrames.AppleJobs.Editor } #endregion + + private static IEnumerable GetSingleton(ref List entities, IQueryable query) where T : class + { + if (entities != null) return entities; + entities = query.ToList(); + + var view = CollectionViewSource.GetDefaultView(entities) as IEditableCollectionView; + if (view != null) view.NewItemPlaceholderPosition = NewItemPlaceholderPosition.AtBeginning; + + return entities; + } } } diff --git a/JetFrames.AppleJobs.Editor/JetFrames.AppleJobs.Editor.csproj b/JetFrames.AppleJobs.Editor/JetFrames.AppleJobs.Editor.csproj index 74e8f8c..efab0b3 100644 --- a/JetFrames.AppleJobs.Editor/JetFrames.AppleJobs.Editor.csproj +++ b/JetFrames.AppleJobs.Editor/JetFrames.AppleJobs.Editor.csproj @@ -82,11 +82,12 @@ MSBuild:Compile Designer - - + + Accessories.xaml + ModelCategories.xaml @@ -102,6 +103,12 @@ NewPriceTemplateDialog.xaml + + News.xaml + + + NewsCategories.xaml + Orders.xaml @@ -117,6 +124,10 @@ MainWindow.xaml Code + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -137,6 +148,14 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -180,7 +199,9 @@ BrightSharp - + + + + + + + + + + + + + + + diff --git a/JetFrames.AppleJobs.Editor/MainWindow.xaml.cs b/JetFrames.AppleJobs.Editor/MainWindow.xaml.cs index eadf379..f2a94cd 100644 --- a/JetFrames.AppleJobs.Editor/MainWindow.xaml.cs +++ b/JetFrames.AppleJobs.Editor/MainWindow.xaml.cs @@ -1,50 +1,34 @@ -using AppleJobs.Data.Models.ModelsJobs; -using System.ComponentModel; +using BrightSharp; using System.Windows; using System.Windows.Controls; -using System.Windows.Input; namespace JetFrames.AppleJobs.Editor { - /// - /// Interaction logic for MainWindow.xaml - /// public partial class MainWindow : Window { public MainWindow() { - DataContext = App.Locator; InitializeComponent(); - Loaded += (s, e) => App.Locator.Editor.OnLoaded(); } - private void DataGrid_PreviewCanExecute(object sender, CanExecuteRoutedEventArgs e) - { - var dg = (DataGrid)sender; - if (e.Command == DataGrid.DeleteCommand) - e.Handled = App.Locator.Editor.DeleteEntity(dg.SelectedValue, true); + private void MenuItem_Click(object sender, RoutedEventArgs e) + { + ThemeManager.Theme = (ColorThemes)((FrameworkElement)e.OriginalSource).DataContext; } - private void DataGrid_InitializingNewItem(object sender, InitializingNewItemEventArgs e) + private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs e) { - if (e.NewItem is ModelJobPriceTemplate) + var item = (TreeViewItem)e.NewValue; + var tabitem = (TabItem)item.Tag; + if (tabitem != null) { - var mjpt = (ModelJobPriceTemplate)e.NewItem; - mjpt.Customers_Id = 1; + if (!tabs.Items.Contains(tabitem)) + { + tabs.Items.Add(tabitem); + } + tabs.SelectedItem = tabitem; } - App.Locator.Editor.AddEntity(e.NewItem); - } - - protected override void OnClosing(CancelEventArgs e) - { - Properties.Settings.Default.Save(); - base.OnClosing(e); - } - - private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - ((TabItem)((TabControl)sender).SelectedItem).DataContext = App.Locator; } } } diff --git a/JetFrames.AppleJobs.Editor/Properties/Settings.Designer.cs b/JetFrames.AppleJobs.Editor/Properties/Settings.Designer.cs index 6732eed..9fc9388 100644 --- a/JetFrames.AppleJobs.Editor/Properties/Settings.Designer.cs +++ b/JetFrames.AppleJobs.Editor/Properties/Settings.Designer.cs @@ -22,341 +22,5 @@ namespace JetFrames.AppleJobs.Editor.Properties { return defaultInstance; } } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0")] - public double Grid01LayoutX { - get { - return ((double)(this["Grid01LayoutX"])); - } - set { - this["Grid01LayoutX"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0")] - public double Grid01LayoutY { - get { - return ((double)(this["Grid01LayoutY"])); - } - set { - this["Grid01LayoutY"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("NaN")] - public double Grid01LayoutWidth { - get { - return ((double)(this["Grid01LayoutWidth"])); - } - set { - this["Grid01LayoutWidth"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("NaN")] - public double Grid01LayoutHeight { - get { - return ((double)(this["Grid01LayoutHeight"])); - } - set { - this["Grid01LayoutHeight"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("100")] - public double Grid02LayoutX { - get { - return ((double)(this["Grid02LayoutX"])); - } - set { - this["Grid02LayoutX"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("200")] - public double Grid03LayoutX { - get { - return ((double)(this["Grid03LayoutX"])); - } - set { - this["Grid03LayoutX"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("300")] - public double Grid04LayoutX { - get { - return ((double)(this["Grid04LayoutX"])); - } - set { - this["Grid04LayoutX"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("100")] - public double Grid02LayoutY { - get { - return ((double)(this["Grid02LayoutY"])); - } - set { - this["Grid02LayoutY"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("200")] - public double Grid03LayoutY { - get { - return ((double)(this["Grid03LayoutY"])); - } - set { - this["Grid03LayoutY"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("300")] - public double Grid04LayoutY { - get { - return ((double)(this["Grid04LayoutY"])); - } - set { - this["Grid04LayoutY"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("NaN")] - public double Grid02LayoutWidth { - get { - return ((double)(this["Grid02LayoutWidth"])); - } - set { - this["Grid02LayoutWidth"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("NaN")] - public double Grid03LayoutWidth { - get { - return ((double)(this["Grid03LayoutWidth"])); - } - set { - this["Grid03LayoutWidth"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("NaN")] - public double Grid04LayoutWidth { - get { - return ((double)(this["Grid04LayoutWidth"])); - } - set { - this["Grid04LayoutWidth"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("NaN")] - public double Grid02LayoutHeight { - get { - return ((double)(this["Grid02LayoutHeight"])); - } - set { - this["Grid02LayoutHeight"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("NaN")] - public double Grid03LayoutHeight { - get { - return ((double)(this["Grid03LayoutHeight"])); - } - set { - this["Grid03LayoutHeight"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("NaN")] - public double Grid04LayoutHeight { - get { - return ((double)(this["Grid04LayoutHeight"])); - } - set { - this["Grid04LayoutHeight"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool Grid01Expanded { - get { - return ((bool)(this["Grid01Expanded"])); - } - set { - this["Grid01Expanded"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool Grid02Expanded { - get { - return ((bool)(this["Grid02Expanded"])); - } - set { - this["Grid02Expanded"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool Grid03Expanded { - get { - return ((bool)(this["Grid03Expanded"])); - } - set { - this["Grid03Expanded"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool Grid04Expanded { - get { - return ((bool)(this["Grid04Expanded"])); - } - set { - this["Grid04Expanded"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0")] - public double ZoomPadX { - get { - return ((double)(this["ZoomPadX"])); - } - set { - this["ZoomPadX"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0")] - public double ZoomPadY { - get { - return ((double)(this["ZoomPadY"])); - } - set { - this["ZoomPadY"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("1")] - public double Zoom { - get { - return ((double)(this["Zoom"])); - } - set { - this["Zoom"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool Grid05Expanded { - get { - return ((bool)(this["Grid05Expanded"])); - } - set { - this["Grid05Expanded"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("400")] - public double Grid05LayoutX { - get { - return ((double)(this["Grid05LayoutX"])); - } - set { - this["Grid05LayoutX"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0")] - public double Grid05LayoutY { - get { - return ((double)(this["Grid05LayoutY"])); - } - set { - this["Grid05LayoutY"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("NaN")] - public double Grid05LayoutWidth { - get { - return ((double)(this["Grid05LayoutWidth"])); - } - set { - this["Grid05LayoutWidth"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("NaN")] - public double Grid05LayoutHeight { - get { - return ((double)(this["Grid05LayoutHeight"])); - } - set { - this["Grid05LayoutHeight"] = value; - } - } } } diff --git a/JetFrames.AppleJobs.Editor/Properties/Settings.settings b/JetFrames.AppleJobs.Editor/Properties/Settings.settings index 4e5b8df..8e615f2 100644 --- a/JetFrames.AppleJobs.Editor/Properties/Settings.settings +++ b/JetFrames.AppleJobs.Editor/Properties/Settings.settings @@ -1,90 +1,5 @@  - + - - - 0 - - - 0 - - - NaN - - - NaN - - - 100 - - - 200 - - - 300 - - - 100 - - - 200 - - - 300 - - - NaN - - - NaN - - - NaN - - - NaN - - - NaN - - - NaN - - - True - - - True - - - True - - - True - - - 0 - - - 0 - - - 1 - - - True - - - 400 - - - 0 - - - NaN - - - NaN - - + \ No newline at end of file diff --git a/JetFrames.AppleJobs.Editor/Settings.cs b/JetFrames.AppleJobs.Editor/Settings.cs deleted file mode 100644 index be6c31a..0000000 --- a/JetFrames.AppleJobs.Editor/Settings.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace JetFrames.AppleJobs.Editor.Properties { - - - // This class allows you to handle specific events on the settings class: - // The SettingChanging event is raised before a setting's value is changed. - // The PropertyChanged event is raised after a setting's value is changed. - // The SettingsLoaded event is raised after the setting values are loaded. - // The SettingsSaving event is raised before the setting values are saved. - public sealed partial class Settings { - - public Settings() { - // // To add event handlers for saving and changing settings, uncomment the lines below: - // - // this.SettingChanging += this.SettingChangingEventHandler; - // - // this.SettingsSaving += this.SettingsSavingEventHandler; - // - } - - private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { - // Add code to handle the SettingChangingEvent event here. - } - - private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { - // Add code to handle the SettingsSaving event here. - } - } -} diff --git a/JetFrames.AppleJobs.Editor/ViewModelLocator.cs b/JetFrames.AppleJobs.Editor/ViewModelLocator.cs index b2377b6..350a8ed 100644 --- a/JetFrames.AppleJobs.Editor/ViewModelLocator.cs +++ b/JetFrames.AppleJobs.Editor/ViewModelLocator.cs @@ -27,7 +27,6 @@ namespace JetFrames.AppleJobs.Editor } public EditorViewModel Editor { get; private set; } - - public Properties.Settings Settings { get { return Properties.Settings.Default; } } + } } diff --git a/JetFrames.AppleJobs.Editor/Views/Accessories.xaml b/JetFrames.AppleJobs.Editor/Views/Accessories.xaml new file mode 100644 index 0000000..d0fca06 --- /dev/null +++ b/JetFrames.AppleJobs.Editor/Views/Accessories.xaml @@ -0,0 +1,17 @@ + + + + + + + + + diff --git a/JetFrames.AppleJobs.Editor/Views/Accessories.xaml.cs b/JetFrames.AppleJobs.Editor/Views/Accessories.xaml.cs new file mode 100644 index 0000000..793063b --- /dev/null +++ b/JetFrames.AppleJobs.Editor/Views/Accessories.xaml.cs @@ -0,0 +1,27 @@ +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.Navigation; +using System.Windows.Shapes; + +namespace JetFrames.AppleJobs.Editor.Views +{ + public partial class Accessories : UserControl + { + public Accessories() + { + InitializeComponent(); + EditorViewModel.InitGrid(dg); + } + + } +} diff --git a/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml b/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml index a8148c9..2667c13 100644 --- a/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml +++ b/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml @@ -7,8 +7,7 @@ mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}" d:DesignHeight="300" d:DesignWidth="300"> - diff --git a/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml.cs b/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml.cs index 2b5f7f4..5c838ee 100644 --- a/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml.cs +++ b/JetFrames.AppleJobs.Editor/Views/ModelCategories.xaml.cs @@ -11,17 +11,7 @@ namespace JetFrames.AppleJobs.Editor.Views public ModelCategories() { InitializeComponent(); - } - - private void DataGrid_PreviewCanExecute(object sender, CanExecuteRoutedEventArgs e) - { - if (e.Command == DataGrid.DeleteCommand) - e.Handled = App.Locator.Editor.DeleteEntity(((DataGrid)sender).SelectedItems, true); - } - - private void DataGrid_InitializingNewItem(object sender, InitializingNewItemEventArgs e) - { - App.Locator.Editor.AddEntity(e.NewItem); + EditorViewModel.InitGrid(dg); } } } diff --git a/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml b/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml index 0bf3678..d935e4b 100644 --- a/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml +++ b/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml @@ -7,7 +7,7 @@ mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}" d:DesignHeight="300" d:DesignWidth="774"> - + ClipboardContentBinding="{Binding IsPriceFrom}" /> diff --git a/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml.cs b/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml.cs index dfb9dd8..b5a41e2 100644 --- a/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml.cs +++ b/JetFrames.AppleJobs.Editor/Views/ModelJobPriceTemplates.xaml.cs @@ -1,6 +1,4 @@ -using AppleJobs.Data.Models.ModelsJobs; -using System.Windows.Controls; -using System.Windows.Input; +using System.Windows.Controls; namespace JetFrames.AppleJobs.Editor.Views { @@ -12,21 +10,7 @@ namespace JetFrames.AppleJobs.Editor.Views public ModelJobPriceTemplates() { InitializeComponent(); - } - private void DataGrid_PreviewCanExecute(object sender, CanExecuteRoutedEventArgs e) - { - if (e.Command == DataGrid.DeleteCommand) - e.Handled = App.Locator.Editor.DeleteEntity(((DataGrid)sender).SelectedItems, true); - } - - private void DataGrid_InitializingNewItem(object sender, InitializingNewItemEventArgs e) - { - if (e.NewItem is ModelJobPriceTemplate) - { - var mjpt = (ModelJobPriceTemplate)e.NewItem; - mjpt.Customers_Id = 1; - } - App.Locator.Editor.AddEntity(e.NewItem); + EditorViewModel.InitGrid(dg); } } } diff --git a/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml b/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml index ea5dd9e..a82d71b 100644 --- a/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml +++ b/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml @@ -7,16 +7,16 @@ mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}" d:DesignHeight="300" d:DesignWidth="527"> - + ClipboardContentBinding="{Binding Model.Name}" + ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Models}" + DisplayMemberPath="Name" Header="Модель" Width="120" SortMemberPath="Model.Name" + EditingElementStyle="{StaticResource {x:Type ComboBox}}"/> diff --git a/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml.cs b/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml.cs index 4f90342..a912f5f 100644 --- a/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml.cs +++ b/JetFrames.AppleJobs.Editor/Views/ModelJobs.xaml.cs @@ -23,16 +23,7 @@ namespace JetFrames.AppleJobs.Editor.Views public ModelJobs() { InitializeComponent(); - } - private void DataGrid_PreviewCanExecute(object sender, CanExecuteRoutedEventArgs e) - { - if (e.Command == DataGrid.DeleteCommand) - e.Handled = App.Locator.Editor.DeleteEntity(((DataGrid)sender).SelectedItems, true); - } - - private void DataGrid_InitializingNewItem(object sender, InitializingNewItemEventArgs e) - { - App.Locator.Editor.AddEntity(e.NewItem); + EditorViewModel.InitGrid(dg); } } } diff --git a/JetFrames.AppleJobs.Editor/Views/Models.xaml b/JetFrames.AppleJobs.Editor/Views/Models.xaml index 85ebe60..e1d9f5c 100644 --- a/JetFrames.AppleJobs.Editor/Views/Models.xaml +++ b/JetFrames.AppleJobs.Editor/Views/Models.xaml @@ -7,15 +7,15 @@ mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}" d:DesignHeight="300" d:DesignWidth="300"> - + + ClipboardContentBinding="{Binding ModelCategory.Name}" + ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Categories}" + DisplayMemberPath="Name" Header="Категория" Width="120" SortMemberPath="ModelCategory.Name" + EditingElementStyle="{StaticResource {x:Type ComboBox}}" /> diff --git a/JetFrames.AppleJobs.Editor/Views/Models.xaml.cs b/JetFrames.AppleJobs.Editor/Views/Models.xaml.cs index 91734ed..241b4f7 100644 --- a/JetFrames.AppleJobs.Editor/Views/Models.xaml.cs +++ b/JetFrames.AppleJobs.Editor/Views/Models.xaml.cs @@ -23,16 +23,7 @@ namespace JetFrames.AppleJobs.Editor.Views public Models() { InitializeComponent(); - } - private void DataGrid_PreviewCanExecute(object sender, CanExecuteRoutedEventArgs e) - { - if (e.Command == DataGrid.DeleteCommand) - e.Handled = App.Locator.Editor.DeleteEntity(((DataGrid)sender).SelectedItems, true); - } - - private void DataGrid_InitializingNewItem(object sender, InitializingNewItemEventArgs e) - { - App.Locator.Editor.AddEntity(e.NewItem); + EditorViewModel.InitGrid(dg); } } } diff --git a/JetFrames.AppleJobs.Editor/Views/NewPriceTemplateDialog.xaml b/JetFrames.AppleJobs.Editor/Views/NewPriceTemplateDialog.xaml index 5e148d9..a429eaa 100644 --- a/JetFrames.AppleJobs.Editor/Views/NewPriceTemplateDialog.xaml +++ b/JetFrames.AppleJobs.Editor/Views/NewPriceTemplateDialog.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor.Views" - WindowStartupLocation="CenterScreen" + WindowStartupLocation="CenterScreen" ResizeMode="NoResize" mc:Ignorable="d" WindowStyle="ToolWindow" ShowInTaskbar="False" Title="Новая расценка" Height="239" Width="324"> diff --git a/JetFrames.AppleJobs.Editor/Views/News.xaml b/JetFrames.AppleJobs.Editor/Views/News.xaml new file mode 100644 index 0000000..05619c1 --- /dev/null +++ b/JetFrames.AppleJobs.Editor/Views/News.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + diff --git a/JetFrames.AppleJobs.Editor/Views/News.xaml.cs b/JetFrames.AppleJobs.Editor/Views/News.xaml.cs new file mode 100644 index 0000000..a8afa14 --- /dev/null +++ b/JetFrames.AppleJobs.Editor/Views/News.xaml.cs @@ -0,0 +1,17 @@ +using System.Windows.Controls; +using System.Windows.Input; + +namespace JetFrames.AppleJobs.Editor.Views +{ + /// + /// Interaction logic for News.xaml + /// + public partial class News : UserControl + { + public News() + { + InitializeComponent(); + EditorViewModel.InitGrid(dg); + } + } +} diff --git a/JetFrames.AppleJobs.Editor/Views/NewsCategories.xaml b/JetFrames.AppleJobs.Editor/Views/NewsCategories.xaml new file mode 100644 index 0000000..eaf7361 --- /dev/null +++ b/JetFrames.AppleJobs.Editor/Views/NewsCategories.xaml @@ -0,0 +1,19 @@ + + + + + + + + + + + diff --git a/JetFrames.AppleJobs.Editor/Views/NewsCategories.xaml.cs b/JetFrames.AppleJobs.Editor/Views/NewsCategories.xaml.cs new file mode 100644 index 0000000..30d57e7 --- /dev/null +++ b/JetFrames.AppleJobs.Editor/Views/NewsCategories.xaml.cs @@ -0,0 +1,28 @@ +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.Navigation; +using System.Windows.Shapes; + +namespace JetFrames.AppleJobs.Editor.Views +{ + /// + /// Interaction logic for NewsCategories.xaml + /// + public partial class NewsCategories : UserControl + { + public NewsCategories() + { + InitializeComponent(); + } + } +} diff --git a/JetFrames.AppleJobs.Editor/Views/Orders.xaml b/JetFrames.AppleJobs.Editor/Views/Orders.xaml index 27ddeb5..94a7dc9 100644 --- a/JetFrames.AppleJobs.Editor/Views/Orders.xaml +++ b/JetFrames.AppleJobs.Editor/Views/Orders.xaml @@ -5,26 +5,27 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor.Views" mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}" - d:DesignHeight="300" d:DesignWidth="1084"> + d:DesignHeight="300" d:DesignWidth="1204"> - + - + @@ -42,12 +43,40 @@ + ClipboardContentBinding="{Binding Accessories.Name}" + EditingElementStyle="{StaticResource {x:Type ComboBox}}" Header="Инвентарь" Width="120" /> + Header="Мастер" Width="120" /> + + + + + + + + + + + + + + + + + diff --git a/JetFrames.AppleJobs.Editor/Views/Orders.xaml.cs b/JetFrames.AppleJobs.Editor/Views/Orders.xaml.cs index 0c3efc8..e79c7d6 100644 --- a/JetFrames.AppleJobs.Editor/Views/Orders.xaml.cs +++ b/JetFrames.AppleJobs.Editor/Views/Orders.xaml.cs @@ -1,5 +1,6 @@ using AppleJobs.Data.Models; using AppleJobs.Data.Models.ModelsJobs; +using AppleJobs.Data.Models.Orders; using System.Windows.Controls; using System.Windows.Input; @@ -13,21 +14,8 @@ namespace JetFrames.AppleJobs.Editor.Views public Orders() { InitializeComponent(); + EditorViewModel.InitGrid(dg); } - private void DataGrid_PreviewCanExecute(object sender, CanExecuteRoutedEventArgs e) - { - if (e.Command == DataGrid.DeleteCommand) - e.Handled = App.Locator.Editor.DeleteEntity(((DataGrid)sender).SelectedItems, true); - } - - private void DataGrid_InitializingNewItem(object sender, InitializingNewItemEventArgs e) - { - if (e.NewItem is Order) - { - var mjpt = (Order)e.NewItem; - mjpt.Customers_Id = 1; - } - App.Locator.Editor.AddEntity(e.NewItem); - } + } }