├── .gitattributes ├── .gitignore ├── Banner ├── Banner.csproj ├── BannerModule.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── ViewModels │ └── BannerViewModel.cs ├── Views │ ├── BannerView.xaml │ └── BannerView.xaml.cs └── app.config ├── Customers ├── Add │ ├── CustomerAddView.xaml │ ├── CustomerAddView.xaml.cs │ └── CustomerAddViewModel.cs ├── Customers.csproj ├── CustomersModule.cs ├── List │ ├── CustomerListView.xaml │ ├── CustomerListView.xaml.cs │ └── CustomerListViewModel.cs └── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── DAL_LocalDb ├── App.config ├── DAL_LocalDb.csproj ├── LocalDbContext.cs ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── Dashboard ├── CustomerStatistics │ ├── CustomerStatsView.xaml │ ├── CustomerStatsView.xaml.cs │ └── CustomerStatsViewModel.cs ├── Dashboard.csproj ├── DashboardModule.cs ├── EmployeeStatistics │ ├── EmployeeStatsView.xaml │ ├── EmployeeStatsView.xaml.cs │ └── EmployeeStatsViewModel.cs ├── Main │ ├── DashboardView.xaml │ ├── DashboardView.xaml.cs │ └── DashboardViewModel.cs ├── OrderStatistics │ ├── OrderStatsView.xaml │ ├── OrderStatsView.xaml.cs │ └── OrdersStatViewModel.cs ├── ProductStatistics │ ├── ProductStatsView.xaml │ ├── ProductStatsView.xaml.cs │ └── ProductsStatViewModel.cs └── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Employees ├── Add │ ├── EmployeeAddView.xaml │ ├── EmployeeAddView.xaml.cs │ └── EmployeeAddViewModel.cs ├── Employees.csproj ├── EmployeesModule.cs ├── Events │ ├── OnEmployeeAddEvent.cs │ ├── OnEmployeeCompleted.cs │ ├── OnEmployeeEditEvent.cs │ └── OnEmployeeSelectedEvent.cs ├── List │ ├── EmployeeListView.xaml │ ├── EmployeeListView.xaml.cs │ └── EmployeeListViewModel.cs └── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Entities ├── Entities.csproj ├── EntitiesModule.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── ViewModels │ └── ManageEntityViewModel.cs └── Views │ ├── ManageEntityView.xaml │ └── ManageEntityView.xaml.cs ├── Infrastructure ├── Base │ ├── NavigationAwareViewModelBase.cs │ └── ViewModelBase.cs ├── Behaviours │ └── SfDataGridHelper.cs ├── Converters │ └── BoolToDropdownConverter.cs ├── Events │ └── OnNavigatedToEvent.cs ├── Extensions │ └── StringExtensions.cs ├── GlobalCommands.cs ├── Infrastructure.csproj ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── RegionNames.cs ├── UserControls │ ├── HeaderedContentControl.xaml │ └── HeaderedContentControl.xaml.cs └── packages.config ├── OMS.sln ├── OMS ├── App.config ├── App.xaml ├── App.xaml.cs ├── App_Data │ ├── NORTHWND.MDF │ └── northwnd.ldf ├── Assets │ └── Styles.xaml ├── Bootstrapper.cs ├── OMS.csproj ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ ├── Settings.settings │ └── app.manifest ├── Reports │ └── OrderReport.rdlc ├── SplashScreen.jpg ├── ViewModels │ ├── ContentViewModel.cs │ └── MainWindowViewModel.cs └── Views │ ├── ContentView.xaml │ ├── ContentView.xaml.cs │ ├── MainWindow.xaml │ └── MainWindow.xaml.cs ├── Oms.Model ├── Category.cs ├── Customer.cs ├── CustomerDemographic.cs ├── Employee.cs ├── Oms.Model.csproj ├── Order.cs ├── Order_Details.cs ├── Product.cs ├── Properties │ └── AssemblyInfo.cs ├── Region.cs ├── Shipper.cs ├── Supplier.cs └── Territory.cs ├── Orders ├── CommonTypes │ └── ProductInOrder.cs ├── Events │ ├── NewOrderCreated.cs │ └── OrderDataCreated.cs ├── Main │ ├── OrderManageView.xaml │ ├── OrderManageView.xaml.cs │ └── OrderManageViewModel.cs ├── Orders.csproj ├── OrdersModule.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── DataSources │ │ └── Orders.ViewModels.InvoiceViewModel.datasource │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Reports │ └── OrderReport.rdlc ├── ViewModels │ ├── CreateViewModel.cs │ ├── InvoiceViewModel.cs │ └── JournalViewModel.cs └── Views │ ├── CreateView.xaml │ ├── CreateView.xaml.cs │ ├── InvoiceView.xaml │ ├── InvoiceView.xaml.cs │ ├── JournalView.xaml │ └── JournalView.xaml.cs ├── Products ├── Add │ ├── ProductAddView.xaml │ ├── ProductAddView.xaml.cs │ └── ProductAddViewModel.cs ├── Events │ ├── OnProductAddEvent.cs │ ├── OnProductCompleted.cs │ ├── OnProductEditEvent.cs │ └── OnProductSelectedEvent.cs ├── List │ ├── ProductListView.xaml │ ├── ProductListView.xaml.cs │ └── ProductListViewModel.cs ├── Products.csproj ├── ProductsModule.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings └── Validators │ └── ProductValidator.cs ├── README.md ├── Screenshots ├── DashboardDark.PNG └── DashboardLight.PNG └── _config.yml /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Banner/Banner.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8E8B6C15-64AE-4BD5-B38B-25F9473DC287} 8 | library 9 | Properties 10 | Banner 11 | Banner 12 | v4.6.1 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | PackageReference 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 4.0 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | Code 55 | 56 | 57 | True 58 | True 59 | Resources.resx 60 | 61 | 62 | True 63 | Settings.settings 64 | True 65 | 66 | 67 | 68 | BannerView.xaml 69 | 70 | 71 | ResXFileCodeGenerator 72 | Resources.Designer.cs 73 | 74 | 75 | 76 | SettingsSingleFileGenerator 77 | Settings.Designer.cs 78 | 79 | 80 | 81 | 82 | 83 | 84 | 2.4.1.1101 85 | 86 | 87 | 88 | 89 | 90 | Designer 91 | MSBuild:Compile 92 | 93 | 94 | 95 | 96 | {84709585-62A4-419C-B0D9-56B2BC8149A1} 97 | Dashboard 98 | 99 | 100 | {8a7d988c-b192-4d03-8f8b-1f35c9855fb3} 101 | Infrastructure 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /Banner/BannerModule.cs: -------------------------------------------------------------------------------- 1 | using Banner.Views; 2 | using Prism.Modularity; 3 | using Prism.Regions; 4 | using System; 5 | using Infrastructure; 6 | using Microsoft.Practices.Unity; 7 | using Prism.Unity; 8 | 9 | namespace Banner 10 | { 11 | public class BannerModule : IModule 12 | { 13 | private IRegionManager _regionManager; 14 | private IUnityContainer _container; 15 | 16 | public BannerModule(IUnityContainer container, IRegionManager regionManager) 17 | { 18 | _container = container; 19 | _regionManager = regionManager; 20 | } 21 | 22 | public void Initialize() 23 | { 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Banner/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("Banner")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("Banner")] 15 | [assembly: AssemblyCopyright("Copyright © 2017")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | 57 | -------------------------------------------------------------------------------- /Banner/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Banner.Properties 12 | { 13 | using System; 14 | 15 | 16 | /// 17 | /// A strongly-typed resource class, for looking up localized strings, etc. 18 | /// 19 | // This class was auto-generated by the StronglyTypedResourceBuilder 20 | // class via a tool like ResGen or Visual Studio. 21 | // To add or remove a member, edit your .ResX file then rerun ResGen 22 | // with the /str option, or rebuild your VS project. 23 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 24 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 25 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 26 | internal class Resources 27 | { 28 | 29 | private static global::System.Resources.ResourceManager resourceMan; 30 | 31 | private static global::System.Globalization.CultureInfo resourceCulture; 32 | 33 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 34 | internal Resources() 35 | { 36 | } 37 | 38 | /// 39 | /// Returns the cached ResourceManager instance used by this class. 40 | /// 41 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 42 | internal static global::System.Resources.ResourceManager ResourceManager 43 | { 44 | get 45 | { 46 | if (object.ReferenceEquals(resourceMan, null)) 47 | { 48 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Banner.Properties.Resources", typeof(Resources).Assembly); 49 | resourceMan = temp; 50 | } 51 | return resourceMan; 52 | } 53 | } 54 | 55 | /// 56 | /// Overrides the current thread's CurrentUICulture property for all 57 | /// resource lookups using this strongly typed resource class. 58 | /// 59 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 60 | internal static global::System.Globalization.CultureInfo Culture 61 | { 62 | get 63 | { 64 | return resourceCulture; 65 | } 66 | set 67 | { 68 | resourceCulture = value; 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Banner/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Banner.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 29 | public bool IsDark { 30 | get { 31 | return ((bool)(this["IsDark"])); 32 | } 33 | set { 34 | this["IsDark"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("BlueGrey")] 41 | public string PaletteColor { 42 | get { 43 | return ((string)(this["PaletteColor"])); 44 | } 45 | set { 46 | this["PaletteColor"] = value; 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Banner/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | False 7 | 8 | 9 | BlueGrey 10 | 11 | 12 | -------------------------------------------------------------------------------- /Banner/ViewModels/BannerViewModel.cs: -------------------------------------------------------------------------------- 1 | using Prism.Commands; 2 | using Prism.Mvvm; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Dashboard.Main; 9 | using Infrastructure; 10 | using Prism.Regions; 11 | using Infrastructure.Base; 12 | using Infrastructure.Events; 13 | using MaterialDesignColors; 14 | using Prism.Events; 15 | using MaterialDesignThemes.Wpf; 16 | using Banner.Properties; 17 | 18 | namespace Banner.ViewModels 19 | { 20 | public class BannerViewModel : ViewModelBase 21 | { 22 | private readonly IRegionManager _regionManager; 23 | private PaletteHelper helper =new PaletteHelper(); 24 | 25 | public BannerViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) 26 | { 27 | Title = "Orders Management System"; 28 | _regionManager = regionManager; 29 | NavigateHomeCommand = new DelegateCommand(NavigateHome); 30 | ChangePaletteCommand = new DelegateCommand(ChangePalete); 31 | ChangeThemeCommand = new DelegateCommand(ChangeTheme); 32 | 33 | IsDarkTheme = Settings.Default.IsDark; 34 | ChangeTheme(IsDarkTheme); 35 | 36 | ChangePalete(Settings.Default.PaletteColor); 37 | 38 | eventAggregator.GetEvent().Subscribe(title => State = title); 39 | } 40 | #region Commands 41 | public DelegateCommand NavigateHomeCommand { get; set; } 42 | private void NavigateHome() 43 | { 44 | var contentRegion = _regionManager.Regions[RegionNames.ContentRegion]; 45 | while (contentRegion.NavigationService.Journal.CanGoBack) 46 | { 47 | contentRegion.NavigationService.Journal.GoBack(); 48 | } 49 | } 50 | 51 | public DelegateCommand ChangePaletteCommand { get; set; } 52 | private void ChangePalete(string color) 53 | { 54 | helper = new PaletteHelper(); 55 | var swatches = new SwatchesProvider().Swatches; 56 | helper.ReplacePrimaryColor(swatches.FirstOrDefault(s => s.Name == color.ToLower())); 57 | Settings.Default.PaletteColor = color; 58 | Settings.Default.Save(); 59 | } 60 | 61 | public DelegateCommand ChangeThemeCommand { get; set; } 62 | private void ChangeTheme(bool? isDark) 63 | { 64 | Settings.Default.IsDark = isDark.Value; 65 | Settings.Default.Save(); 66 | 67 | this.IsDarkTheme = isDark.Value; 68 | 69 | helper.SetLightDark(isDark.Value); 70 | } 71 | #endregion 72 | 73 | #region Bindable properties 74 | 75 | private bool? isDarkTheme; 76 | public bool? IsDarkTheme 77 | { 78 | get => isDarkTheme.Value; 79 | set => SetProperty(ref isDarkTheme, value); 80 | } 81 | 82 | #endregion 83 | 84 | private string _state; 85 | public string State 86 | { 87 | get => _state; 88 | set => SetProperty(ref _state, value); 89 | } 90 | 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Banner/Views/BannerView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Banner.Views 17 | { 18 | /// 19 | /// Interaction logic for BannerView.xaml 20 | /// 21 | public partial class BannerView : UserControl 22 | { 23 | public BannerView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Banner/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | False 12 | 13 | 14 | BlueGrey 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Customers/Add/CustomerAddView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using Microsoft.Practices.Unity; 16 | 17 | namespace Customers.Add 18 | { 19 | /// 20 | /// Interaction logic for CustomerAddView.xaml 21 | /// 22 | public partial class CustomerAddView : UserControl 23 | { 24 | public CustomerAddView(IUnityContainer unityContainer) 25 | { 26 | InitializeComponent(); 27 | this.DataContext = unityContainer.Resolve(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Customers/Add/CustomerAddViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Infrastructure.Base; 7 | using Prism.Events; 8 | using Prism.Regions; 9 | 10 | namespace Customers.Add 11 | { 12 | public class CustomerAddViewModel : NavigationAwareViewModelBase 13 | { 14 | public CustomerAddViewModel() 15 | { 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Customers/CustomersModule.cs: -------------------------------------------------------------------------------- 1 | using Prism.Modularity; 2 | using Prism.Regions; 3 | using System; 4 | using Customers.Add; 5 | using Customers.List; 6 | using Microsoft.Practices.Unity; 7 | using Prism.Unity; 8 | using Infrastructure; 9 | 10 | namespace Customers 11 | { 12 | public class CustomersModule : IModule 13 | { 14 | private IRegionManager _regionManager; 15 | private IUnityContainer _container; 16 | 17 | public CustomersModule(IUnityContainer container, IRegionManager regionManager) 18 | { 19 | _container = container; 20 | _regionManager = regionManager; 21 | } 22 | 23 | public void Initialize() 24 | { 25 | _container.RegisterTypeForNavigation(); 26 | _container.RegisterTypeForNavigation(); 27 | 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Customers/List/CustomerListView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using Microsoft.Practices.Unity; 16 | 17 | namespace Customers.List 18 | { 19 | /// 20 | /// Interaction logic for CustomerListView.xaml 21 | /// 22 | public partial class CustomerListView : UserControl 23 | { 24 | public CustomerListView(IUnityContainer unityContainer) 25 | { 26 | InitializeComponent(); 27 | this.DataContext = unityContainer.Resolve(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Customers/List/CustomerListViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using DAL_LocalDb; 8 | using Infrastructure.Base; 9 | using Prism.Events; 10 | using Prism.Regions; 11 | 12 | namespace Customers.List 13 | { 14 | public class CustomerListViewModel : NavigationAwareViewModelBase 15 | { 16 | IEventAggregator _eventAggregator; 17 | LocalDbContext _context; 18 | //IEnumerable customers; 19 | 20 | public CustomerListViewModel(LocalDbContext context, IEventAggregator eventAggregator) 21 | { 22 | Title = "CUSTOMERS VIEW (- Under construction -)"; 23 | _context = context; 24 | _eventAggregator = eventAggregator; 25 | 26 | } 27 | #region Bindable properties 28 | 29 | ObservableCollection _customers; 30 | public ObservableCollection Customers 31 | { 32 | get { return _customers; } 33 | set => SetProperty(ref _customers, value); 34 | } 35 | Customer _selectedCustomer; 36 | public Customer SelectedCustomer 37 | { 38 | get => _selectedCustomer; 39 | set 40 | { 41 | SetProperty(ref _selectedCustomer, value); 42 | } 43 | } 44 | #endregion 45 | 46 | #region Navigation events 47 | 48 | public override void OnNavigatedTo(NavigationContext navigationContext) 49 | { 50 | base.OnNavigatedTo(navigationContext); 51 | Customers = new ObservableCollection(_context.Customers); 52 | } 53 | public override void OnNavigatedFrom(NavigationContext navigationContext) 54 | { 55 | base.OnNavigatedFrom(navigationContext); 56 | } 57 | public override bool IsNavigationTarget(NavigationContext navigationContext) 58 | { 59 | return base.IsNavigationTarget(navigationContext); 60 | } 61 | #endregion 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Customers/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("Customers")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("Customers")] 15 | [assembly: AssemblyCopyright("Copyright © 2017")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | 57 | -------------------------------------------------------------------------------- /Customers/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Customers.Properties 12 | { 13 | using System; 14 | 15 | 16 | /// 17 | /// A strongly-typed resource class, for looking up localized strings, etc. 18 | /// 19 | // This class was auto-generated by the StronglyTypedResourceBuilder 20 | // class via a tool like ResGen or Visual Studio. 21 | // To add or remove a member, edit your .ResX file then rerun ResGen 22 | // with the /str option, or rebuild your VS project. 23 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 24 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 25 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 26 | internal class Resources 27 | { 28 | 29 | private static global::System.Resources.ResourceManager resourceMan; 30 | 31 | private static global::System.Globalization.CultureInfo resourceCulture; 32 | 33 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 34 | internal Resources() 35 | { 36 | } 37 | 38 | /// 39 | /// Returns the cached ResourceManager instance used by this class. 40 | /// 41 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 42 | internal static global::System.Resources.ResourceManager ResourceManager 43 | { 44 | get 45 | { 46 | if (object.ReferenceEquals(resourceMan, null)) 47 | { 48 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Customers.Properties.Resources", typeof(Resources).Assembly); 49 | resourceMan = temp; 50 | } 51 | return resourceMan; 52 | } 53 | } 54 | 55 | /// 56 | /// Overrides the current thread's CurrentUICulture property for all 57 | /// resource lookups using this strongly typed resource class. 58 | /// 59 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 60 | internal static global::System.Globalization.CultureInfo Culture 61 | { 62 | get 63 | { 64 | return resourceCulture; 65 | } 66 | set 67 | { 68 | resourceCulture = value; 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Customers/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Customers.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Customers/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /DAL_LocalDb/App.config: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /DAL_LocalDb/DAL_LocalDb.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D495FB75-828D-44FF-B363-79383614BFC2} 8 | Library 9 | Properties 10 | DAL_LocalDb 11 | DAL_LocalDb 12 | v4.6.1 13 | 512 14 | true 15 | publish\ 16 | true 17 | Disk 18 | false 19 | Foreground 20 | 7 21 | Days 22 | false 23 | false 24 | true 25 | 0 26 | 1.0.0.%2a 27 | false 28 | false 29 | true 30 | 31 | 32 | true 33 | full 34 | false 35 | bin\Debug\ 36 | DEBUG;TRACE 37 | prompt 38 | 4 39 | 40 | 41 | pdbonly 42 | true 43 | bin\Release\ 44 | TRACE 45 | prompt 46 | 4 47 | 48 | 49 | false 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll 58 | 59 | 60 | ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | {f582e30b-f9c2-4569-8061-1345b493693c} 84 | Oms.Model 85 | 86 | 87 | 88 | 89 | False 90 | Microsoft .NET Framework 4.6.1 %28x86 and x64%29 91 | true 92 | 93 | 94 | False 95 | .NET Framework 3.5 SP1 96 | false 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /DAL_LocalDb/LocalDbContext.cs: -------------------------------------------------------------------------------- 1 | namespace DAL_LocalDb 2 | { 3 | using System; 4 | using System.Data.Entity; 5 | using System.ComponentModel.DataAnnotations.Schema; 6 | using System.Linq; 7 | 8 | public partial class LocalDbContext : DbContext 9 | { 10 | public LocalDbContext() 11 | : base("name=LocalDbContext") 12 | { 13 | } 14 | 15 | public virtual DbSet Categories { get; set; } 16 | public virtual DbSet CustomerDemographics { get; set; } 17 | public virtual DbSet Customers { get; set; } 18 | public virtual DbSet Employees { get; set; } 19 | public virtual DbSet Order_Details { get; set; } 20 | public virtual DbSet Orders { get; set; } 21 | public virtual DbSet Products { get; set; } 22 | public virtual DbSet Region { get; set; } 23 | public virtual DbSet Shippers { get; set; } 24 | public virtual DbSet Suppliers { get; set; } 25 | public virtual DbSet Territories { get; set; } 26 | 27 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 28 | { 29 | modelBuilder.Entity() 30 | .Property(e => e.CustomerTypeID) 31 | .IsFixedLength(); 32 | 33 | modelBuilder.Entity() 34 | .HasMany(e => e.Customers) 35 | .WithMany(e => e.CustomerDemographics) 36 | .Map(m => m.ToTable("CustomerCustomerDemo").MapLeftKey("CustomerTypeID").MapRightKey("CustomerID")); 37 | 38 | modelBuilder.Entity() 39 | .Property(e => e.CustomerID) 40 | .IsFixedLength(); 41 | 42 | modelBuilder.Entity() 43 | .HasMany(e => e.Employees1) 44 | .WithOptional(e => e.Employees2) 45 | .HasForeignKey(e => e.ReportsTo); 46 | 47 | modelBuilder.Entity() 48 | .HasMany(e => e.Territories) 49 | .WithMany(e => e.Employees) 50 | .Map(m => m.ToTable("EmployeeTerritories").MapLeftKey("EmployeeID").MapRightKey("TerritoryID")); 51 | 52 | modelBuilder.Entity() 53 | .Property(e => e.UnitPrice) 54 | .HasPrecision(19, 4); 55 | 56 | modelBuilder.Entity() 57 | .Property(e => e.CustomerID) 58 | .IsFixedLength(); 59 | 60 | modelBuilder.Entity() 61 | .Property(e => e.Freight) 62 | .HasPrecision(19, 4); 63 | 64 | modelBuilder.Entity() 65 | .HasMany(e => e.Order_Details) 66 | .WithRequired(e => e.Orders) 67 | .WillCascadeOnDelete(false); 68 | 69 | modelBuilder.Entity() 70 | .Property(e => e.UnitPrice) 71 | .HasPrecision(19, 4); 72 | 73 | modelBuilder.Entity() 74 | .HasMany(e => e.Order_Details) 75 | .WithRequired(e => e.Products) 76 | .WillCascadeOnDelete(false); 77 | 78 | modelBuilder.Entity() 79 | .Property(e => e.RegionDescription) 80 | .IsFixedLength(); 81 | 82 | modelBuilder.Entity() 83 | .HasMany(e => e.Territories) 84 | .WithRequired(e => e.Region) 85 | .WillCascadeOnDelete(false); 86 | 87 | modelBuilder.Entity() 88 | .HasMany(e => e.Orders) 89 | .WithOptional(e => e.Shippers) 90 | .HasForeignKey(e => e.ShipVia); 91 | 92 | modelBuilder.Entity() 93 | .Property(e => e.TerritoryDescription) 94 | .IsFixedLength(); 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /DAL_LocalDb/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DAL_LocalDb")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("DAL_LocalDb")] 13 | [assembly: AssemblyCopyright("Copyright © 2018")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d495fb75-828d-44ff-b363-79383614bfc2")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DAL_LocalDb/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Dashboard/CustomerStatistics/CustomerStatsView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using Microsoft.Practices.Unity; 16 | 17 | namespace Dashboard.CustomerStatistics 18 | { 19 | /// 20 | /// Interaction logic for CustomersStat.xaml 21 | /// 22 | public partial class CustomerStatsView : UserControl 23 | { 24 | public CustomerStatsView(IUnityContainer container) 25 | { 26 | InitializeComponent(); 27 | this.DataContext = container.Resolve(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Dashboard/CustomerStatistics/CustomerStatsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Infrastructure; 8 | using Infrastructure.Base; 9 | using Prism.Commands; 10 | using Prism.Regions; 11 | using DAL_LocalDb; 12 | using System.Data.Entity; 13 | 14 | namespace Dashboard.CustomerStatistics 15 | { 16 | public class CustomerStatsViewModel : ViewModelBase 17 | { 18 | LocalDbContext _context; 19 | readonly List customers; 20 | readonly List orders; 21 | readonly List orderDetails; 22 | 23 | 24 | public CustomerStatsViewModel(LocalDbContext context) 25 | { 26 | Title = "Customers"; 27 | _context = context; 28 | 29 | _context.Customers.Load(); 30 | customers = _context.Customers.ToList(); 31 | 32 | _context.Orders.Load(); 33 | orders = _context.Orders.Local.ToList(); 34 | 35 | _context.Order_Details.Load(); 36 | orderDetails = _context.Order_Details.ToList(); 37 | 38 | // SELECT top(10) 39 | // COUNT(CustomerID), Country 40 | // FROM[NORTHWIND].[dbo].[Customers] 41 | // GROUP BY Country ORDER BY COUNT(CustomerID) DESC 42 | 43 | //projection on CustomerByCountryObject 44 | CustomerByCountryGroups = 45 | new List(customers.GroupBy(c => c.Country). 46 | Select(g => new CustomerByCountryObject { Country = g.Key, Quantity = g.Count() })); 47 | 48 | //SELECT TOP 10 49 | //Customers.CompanyName, SUM([Order Details].UnitPrice * [Order Details].Quantity) AS Purchaces 50 | //FROM 51 | //[Orders] INNER JOIN[Order Details] ON[Order Details].OrderID = Orders.OrderID 52 | //INNER JOIN Customers ON Customers.CustomerID = Orders.CustomerID 53 | //GROUP BY Customers.CompanyName 54 | //order by Purchaces DESC 55 | 56 | var CustomersAndOrders = 57 | orders.Join(orderDetails, 58 | or => or.OrderID, 59 | det => det.OrderID, 60 | (or, det) => new { or.CustomerID, det.UnitPrice, det.Quantity }) 61 | .Join(customers, 62 | o => o.CustomerID, 63 | cust => cust.CustomerID, 64 | (or, cust) => new { name = cust.CompanyName, price = or.UnitPrice * or.Quantity }); 65 | 66 | //projection on PurchasingByCustomerGroups 67 | this.PurchasingByCustomerGroups = 68 | new List(CustomersAndOrders.GroupBy(c => c.name) 69 | .Select(g=> new PurchasingByCustomerObject {Name=g.Key, SumPurchasing=g.Sum(c=>c.price) }) 70 | .OrderByDescending(p=>p.SumPurchasing) 71 | .Take(10)); 72 | 73 | } 74 | public class CustomerByCountryObject 75 | { 76 | public int Quantity { get; set; } 77 | public string Country { get; set; } 78 | } 79 | public List CustomerByCountryGroups { get; set; } 80 | 81 | public class PurchasingByCustomerObject 82 | { 83 | public string Name { get; set; } 84 | public decimal SumPurchasing { get; set; } 85 | } 86 | public List PurchasingByCustomerGroups { get; set; } 87 | 88 | 89 | 90 | 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Dashboard/DashboardModule.cs: -------------------------------------------------------------------------------- 1 | using Dashboard.Main; 2 | using Prism.Modularity; 3 | using Prism.Regions; 4 | using Microsoft.Practices.Unity; 5 | using Prism.Unity; 6 | using Dashboard.OrderStatistics; 7 | using Infrastructure; 8 | 9 | namespace Dashboard 10 | { 11 | public class DashboardModule : IModule 12 | { 13 | private readonly IRegionManager _regionManager; 14 | private readonly IUnityContainer _container; 15 | 16 | public DashboardModule(IUnityContainer container, IRegionManager regionManager) 17 | { 18 | _container = container; 19 | _regionManager = regionManager; 20 | } 21 | 22 | public void Initialize() 23 | { 24 | _container.RegisterTypeForNavigation("DashboardView"); 25 | 26 | _regionManager.RequestNavigate(RegionNames.ContentRegion, "DashboardView"); 27 | //_regionManager.RegisterViewWithRegion(RegionNames.ContentRegion, typeof(DashboardView)); 28 | 29 | _regionManager.RegisterViewWithRegion(RegionNames.CustomersStatRegion, typeof(CustomerStatistics.CustomerStatsView)); 30 | _regionManager.RegisterViewWithRegion(RegionNames.ProductsStatRegion, typeof(ProductStatistics.ProductStatsView)); 31 | _regionManager.RegisterViewWithRegion(RegionNames.EmployeesStatRegion, typeof(EmployeeStatistics.EmployeeStatsView)); 32 | _regionManager.RegisterViewWithRegion(RegionNames.OrdersStatRegion, typeof(OrderStatistics.OrderStatsView)); 33 | } 34 | 35 | } 36 | } -------------------------------------------------------------------------------- /Dashboard/EmployeeStatistics/EmployeeStatsView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using Microsoft.Practices.Unity; 16 | 17 | namespace Dashboard.EmployeeStatistics 18 | { 19 | /// 20 | /// Interaction logic for EmployeesStat.xaml 21 | /// 22 | public partial class EmployeeStatsView : UserControl 23 | { 24 | public EmployeeStatsView(IUnityContainer unityContainer) 25 | { 26 | InitializeComponent(); 27 | this.DataContext = unityContainer.Resolve(); 28 | 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Dashboard/EmployeeStatistics/EmployeeStatsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Infrastructure.Base; 7 | using DAL_LocalDb; 8 | using System.Data.Entity; 9 | 10 | namespace Dashboard.EmployeeStatistics 11 | { 12 | public class EmployeeStatsViewModel : ViewModelBase 13 | { 14 | LocalDbContext _context; 15 | 16 | readonly List orders; 17 | readonly List orderDetails; 18 | readonly List employees; 19 | 20 | public EmployeeStatsViewModel(LocalDbContext context) 21 | { 22 | Title = "Employees"; 23 | _context = context; 24 | 25 | //get data for all queries 26 | _context.Orders.Load(); 27 | orders = _context.Orders.Local.ToList(); 28 | 29 | _context.Order_Details.Load(); 30 | orderDetails = _context.Order_Details.ToList(); 31 | 32 | _context.Employees.Load(); 33 | employees = _context.Employees.Local.ToList(); 34 | 35 | //query for SalesByEmployeeGroups 36 | var EmployeesAndOrders = 37 | employees.Join(orders, 38 | emp => emp.EmployeeID, 39 | ord => ord.EmployeeID, 40 | (emp, ord) => new { LastName = emp.LastName, OrderId = ord.OrderID }). 41 | Join(orderDetails, 42 | emp => emp.OrderId, 43 | det => det.OrderID, 44 | (emp, det) => new { name = emp.LastName, sale = det.UnitPrice * det.Quantity }); 45 | 46 | //projection on SalesByEmployeeObject 47 | this.SalesByEmployeeGroups = 48 | new List(EmployeesAndOrders.GroupBy(c => c.name). 49 | Select(g => new SalesByEmployeeObject { LastName = g.Key, SumOfSale = g.Sum(c => c.sale) }).OrderBy(g => g.SumOfSale)); 50 | } 51 | 52 | public class SalesByEmployeeObject 53 | { 54 | public string LastName { get; set; } 55 | public decimal SumOfSale { get; set; } 56 | } 57 | private List _salesByEmployeeGroups; 58 | public List SalesByEmployeeGroups 59 | { 60 | get => _salesByEmployeeGroups; 61 | set => SetProperty(ref _salesByEmployeeGroups, value); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Dashboard/Main/DashboardView.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Dashboard/Main/DashboardView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using Microsoft.Practices.Unity; 16 | 17 | namespace Dashboard.Main 18 | { 19 | /// 20 | /// Interaction logic for DashboardView.xaml 21 | /// 22 | public partial class DashboardView : UserControl 23 | { 24 | public DashboardView(IUnityContainer unityContainer) 25 | { 26 | InitializeComponent(); 27 | this.DataContext = unityContainer.Resolve(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Dashboard/Main/DashboardViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Infrastructure.Base; 7 | using Prism.Events; 8 | using Prism.Regions; 9 | 10 | namespace Dashboard.Main 11 | { 12 | public class DashboardViewModel : NavigationAwareViewModelBase 13 | { 14 | public DashboardViewModel(IEventAggregator eventAggregator) : base(eventAggregator) 15 | { 16 | Title = "Dashboard"; 17 | } 18 | 19 | public override void OnNavigatedTo(NavigationContext navigationContext) 20 | { 21 | base.OnNavigatedTo(navigationContext); 22 | UpdateBannerTitle(Title); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Dashboard/OrderStatistics/OrderStatsView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using Microsoft.Practices.Unity; 16 | 17 | namespace Dashboard.OrderStatistics 18 | { 19 | /// 20 | /// Interaction logic for OrdersStat.xaml 21 | /// 22 | public partial class OrderStatsView : UserControl 23 | { 24 | public OrderStatsView(IUnityContainer unityContainer) 25 | { 26 | InitializeComponent(); 27 | this.DataContext = unityContainer.Resolve(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Dashboard/ProductStatistics/ProductStatsView.xaml: -------------------------------------------------------------------------------- 1 |  14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 29 | 34 |