This commit is contained in:
Vitaliy
2017-01-09 13:25:52 +03:00
parent a9f4f0f297
commit 6ead62af6e
98 changed files with 12058 additions and 72 deletions

View File

@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="JetFrames.AppleJobs.Editor.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings>
<add name="Default" providerName="MySql.Data.MySqlClient" connectionString="server=138.201.230.158;user id=admin_applejobs;pwd=dPARP0etzx;database=admin_applejobs_dev;CharSet=utf8;" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v13.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider></providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data><userSettings>
<JetFrames.AppleJobs.Editor.Properties.Settings>
<setting name="Grid01LayoutX" serializeAs="String">
<value>0</value>
</setting>
<setting name="Grid01LayoutY" serializeAs="String">
<value>0</value>
</setting>
<setting name="Grid01LayoutWidth" serializeAs="String">
<value>NaN</value>
</setting>
<setting name="Grid01LayoutHeight" serializeAs="String">
<value>NaN</value>
</setting>
<setting name="Grid02LayoutX" serializeAs="String">
<value>100</value>
</setting>
<setting name="Grid03LayoutX" serializeAs="String">
<value>200</value>
</setting>
<setting name="Grid04LayoutX" serializeAs="String">
<value>300</value>
</setting>
<setting name="Grid02LayoutY" serializeAs="String">
<value>100</value>
</setting>
<setting name="Grid03LayoutY" serializeAs="String">
<value>200</value>
</setting>
<setting name="Grid04LayoutY" serializeAs="String">
<value>300</value>
</setting>
<setting name="Grid02LayoutWidth" serializeAs="String">
<value>NaN</value>
</setting>
<setting name="Grid03LayoutWidth" serializeAs="String">
<value>NaN</value>
</setting>
<setting name="Grid04LayoutWidth" serializeAs="String">
<value>NaN</value>
</setting>
<setting name="Grid02LayoutHeight" serializeAs="String">
<value>NaN</value>
</setting>
<setting name="Grid03LayoutHeight" serializeAs="String">
<value>NaN</value>
</setting>
<setting name="Grid04LayoutHeight" serializeAs="String">
<value>NaN</value>
</setting>
<setting name="Grid01Expanded" serializeAs="String">
<value>True</value>
</setting>
<setting name="Grid02Expanded" serializeAs="String">
<value>True</value>
</setting>
<setting name="Grid03Expanded" serializeAs="String">
<value>True</value>
</setting>
<setting name="Grid04Expanded" serializeAs="String">
<value>True</value>
</setting>
<setting name="ZoomPadX" serializeAs="String">
<value>0</value>
</setting>
<setting name="ZoomPadY" serializeAs="String">
<value>0</value>
</setting>
<setting name="Zoom" serializeAs="String">
<value>1</value>
</setting>
<setting name="Grid05Expanded" serializeAs="String">
<value>True</value>
</setting>
<setting name="Grid05LayoutX" serializeAs="String">
<value>400</value>
</setting>
<setting name="Grid05LayoutY" serializeAs="String">
<value>0</value>
</setting>
<setting name="Grid05LayoutWidth" serializeAs="String">
<value>NaN</value>
</setting>
<setting name="Grid05LayoutHeight" serializeAs="String">
<value>NaN</value>
</setting>
</JetFrames.AppleJobs.Editor.Properties.Settings>
</userSettings>
</configuration>

View File

@@ -0,0 +1,14 @@
<Application x:Class="JetFrames.AppleJobs.Editor.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/brightsharp;component/generic.xaml" />
</ResourceDictionary.MergedDictionaries>
<local:ViewModelLocator x:Key="ViewModelLocator" />
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace JetFrames.AppleJobs.Editor
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
}
public static ViewModelLocator Locator { get { return (ViewModelLocator)Current.TryFindResource("ViewModelLocator"); } }
}
}

View File

@@ -0,0 +1,27 @@
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<ModelJob>)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();
}
}
}

View File

@@ -0,0 +1,334 @@
using BrightSharp.Mvvm;
using System.Collections.Generic;
using System.Linq;
using AppleJobs.Data;
using AppleJobs.Data.Models.ModelsJobs;
using System.Windows.Input;
using BrightSharp.Commands;
using System.Data.Entity;
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;
namespace JetFrames.AppleJobs.Editor
{
public class EditorViewModel : ObservableObject
{
private AppleJobsContext context;
public EditorViewModel(AppleJobsContext context)
{
this.context = context;
}
public string Name { get; set; }
public string Email { get; set; }
List<Model> _models;
public IEnumerable<Model> Models
{
get
{
return _models ?? (_models = context.Models.ToList());
}
}
List<ModelCategory> _categories;
public IEnumerable<ModelCategory> Categories
{
get
{
return _categories ?? (_categories = context.ModelCategories.ToList());
}
}
public void OnLoaded()
{
}
public bool CanAdd(object item)
{
if (item is ModelJobPriceTemplate)
{
var mjpt = (ModelJobPriceTemplate)item;
return mjpt.Customers_Id != default(int) &&
mjpt.ModelJobs_Id != default(int);
}
else if (item is ModelJob)
{
var mj = (ModelJob)item;
return !string.IsNullOrWhiteSpace(mj.Name) &&
mj.Models_Id != default(int);
}
else if (item is Model)
{
var m = (Model)item;
return !string.IsNullOrWhiteSpace(m.Name) &&
m.ModelCategories_Id != default(int);
}
else if (item is ModelCategory)
{
var mc = (ModelCategory)item;
return !string.IsNullOrWhiteSpace(mc.Name);
}
return true;
}
List<ModelJobPriceTemplate> _modelJobPriceTemplates;
public IEnumerable<ModelJobPriceTemplate> ModelJobPriceTemplates
{
get
{
if (ModelJobs == null) throw new InvalidOperationException();
return _modelJobPriceTemplates ?? (_modelJobPriceTemplates = context.ModelJobPriceTemplates.ToList());
}
}
List<ModelJob> _modelJobs;
public IEnumerable<ModelJob> ModelJobs
{
get
{
return _modelJobs ?? (_modelJobs = context.ModelJobs.ToList());
}
}
List<Order> _orders;
public IEnumerable<Order> Orders
{
get
{
return _orders ?? (_orders = context.Orders.Take(1000).ToList());
}
}
List<OrderStatus> _orderStatuses;
public IEnumerable<OrderStatus> OrderStatuses
{
get
{
return _orderStatuses ?? (_orderStatuses = context.OrderStatuses.ToList());
}
}
List<Accessories> _accessories;
public IEnumerable<Accessories> Accessories
{
get
{
return _accessories ?? (_accessories = context.Accessories.ToList());
}
}
List<Employee> _employees;
public IEnumerable<Employee> Employees
{
get
{
return _employees ?? (_employees = context.Employees.ToList());
}
}
public ICommand SaveCommand
{
get
{
return new AsyncCommand(p =>
{
var dg = (Keyboard.FocusedElement as UIElement).FindAncestor<DataGrid>();
if (dg != null)
{
dg.CommitEdit(DataGridEditingUnit.Row, true);
}
return context.SaveChangesAsync();
})
.OnComplete(() => ShowMessage("Сохранено"))
.OnFail(ex => ShowMessage("Ошибка при сохранении.", "Red"));
}
}
public ICommand RefreshCommand
{
get
{
return new RelayCommand(p =>
{
_categories = null;
_modelJobPriceTemplates = null;
_models = null;
_modelJobs = null;
_accessories = null;
_employees = null;
_orders = null;
_orderStatuses = null;
foreach (var entity in context.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
RaisePropertyChanged(nameof(Categories));
RaisePropertyChanged(nameof(ModelJobPriceTemplates));
RaisePropertyChanged(nameof(Models));
RaisePropertyChanged(nameof(ModelJobs));
RaisePropertyChanged(nameof(Accessories));
RaisePropertyChanged(nameof(Employees));
RaisePropertyChanged(nameof(Orders));
RaisePropertyChanged(nameof(OrderStatuses));
ShowMessage("Обновлено из базы данных");
OnLoaded();
});
}
}
public ICommand AddNewPriceTemplateCommand
{
get
{
return new RelayCommand(p =>
{
var vm = new NewPriceTemplateVm(Models, ModelJobs, ModelJobPriceTemplates, CreateNewModelJobPriceTemplate);
var dialog = new 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
{
return new RelayCommand<int>(mId =>
{
var view = (CollectionViewSource)Application.Current.MainWindow.FindResource("modelJobsViewSource");
view.View.Filter = o =>
{
var mj = (ModelJob)o;
return mj.Models_Id == mId;
};
});
}
}
public ICommand ModelJobDropDownUnLoadedCommand
{
get
{
return new RelayCommand(p =>
{
var cb = (ComboBox)p;
cb.ItemsSource = null;
var view = (CollectionViewSource)Application.Current.MainWindow.FindResource("modelJobsViewSource");
view.View.Filter = null;
});
}
}
public bool DeleteEntity(object entity, bool promt)
{
if (entity != null && (entity.GetType().IsPublic || entity is IEnumerable))
{
if (promt)
if (MessageBox.Show("Удалить?", "Подтверждение", MessageBoxButton.OKCancel, MessageBoxImage.Question) != MessageBoxResult.OK)
return true;
if (entity is IEnumerable)
foreach (var item in (IEnumerable)entity)
DeleteEntityInt(item);
else
DeleteEntityInt(entity);
}
return false;
}
private void DeleteEntityInt(object entity)
{
var currentState = context.Entry(entity).State;
if (currentState == EntityState.Added)
{
context.Entry(entity).State = EntityState.Detached;
}
else if (currentState != EntityState.Detached)
{
context.Entry(entity).State = EntityState.Deleted;
}
}
public void AddEntity(object entity)
{
if (entity != null)
{
context.Entry(entity).State = EntityState.Added;
}
}
#region Message
private string _message;
public string Message
{
get { return _message; }
set { _message = value; RaisePropertyChanged(nameof(Message)); }
}
private string _messageForeground;
public string MessageForeground
{
get { return _messageForeground; }
set { _messageForeground = value; RaisePropertyChanged(nameof(MessageForeground)); }
}
private string _messageAnimationState;
public string MessageAnimationState
{
get { return _messageAnimationState; }
set { _messageAnimationState = value; RaisePropertyChanged(nameof(MessageAnimationState)); }
}
private void ShowMessage(string message, string foreground = "DarkGreen")
{
Message = message;
MessageForeground = foreground;
MessageAnimationState = ""; MessageAnimationState = "New";
}
#endregion
}
}

View File

@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FD3E36B5-444A-4115-B288-6C924BEA0BD3}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>JetFrames.AppleJobs.Editor</RootNamespace>
<AssemblyName>JetFrames.AppleJobs.Editor</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.AspNet.Identity.EntityFramework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.1\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Expression.Interactions, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.Entity.6.9.9\lib\net45\MySql.Data.Entity.EF6.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Converters\ModelFilterConverter.cs" />
<Compile Include="EditorViewModel.cs" />
<Compile Include="Settings.cs" />
<Compile Include="ViewModelLocator.cs" />
<Compile Include="ViewModels\NewPriceTemplateVm.cs" />
<Compile Include="Views\ModelCategories.xaml.cs">
<DependentUpon>ModelCategories.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ModelJobPriceTemplates.xaml.cs">
<DependentUpon>ModelJobPriceTemplates.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ModelJobs.xaml.cs">
<DependentUpon>ModelJobs.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Models.xaml.cs">
<DependentUpon>Models.xaml</DependentUpon>
</Compile>
<Compile Include="Views\NewPriceTemplateDialog.xaml.cs">
<DependentUpon>NewPriceTemplateDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Orders.xaml.cs">
<DependentUpon>Orders.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Views\ModelCategories.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ModelJobPriceTemplates.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ModelJobs.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Models.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\NewPriceTemplateDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Orders.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>PublicSettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AppleJobs.Data\AppleJobs.Data.csproj">
<Project>{b4695c76-31ff-4bf1-9dc6-1bc62d374091}</Project>
<Name>AppleJobs.Data</Name>
</ProjectReference>
<ProjectReference Include="..\BrightSharp\BrightSharp.csproj">
<Project>{acc3c556-f8e4-4f2a-a23d-8e8749679a1b}</Project>
<Name>BrightSharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,117 @@
<Window x:Class="JetFrames.AppleJobs.Editor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:int="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:conv="clr-namespace:JetFrames.AppleJobs.Editor.Converters"
xmlns:view="clr-namespace:JetFrames.AppleJobs.Editor.Views"
xmlns:local="clr-namespace:JetFrames.AppleJobs.Editor"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:bs="http://schemas.brightsharp.com/developer"
mc:Ignorable="d"
Title="MainWindow" Height="700" Width="1000">
<Window.Resources>
<conv:ModelFilterConverter x:Key="ModelFilterConverter" />
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Menu VerticalAlignment="Top">
<MenuItem Header="Данные">
<MenuItem Header="Обновить" Command="{Binding Editor.RefreshCommand}" />
</MenuItem>
<MenuItem Header="Сайт"></MenuItem>
<MenuItem Header="Сохранить" Command="{Binding Editor.SaveCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}}"></MenuItem>
<TextBlock IsHitTestVisible="False" Text="{Binding Editor.Message}" Foreground="{Binding Editor.MessageForeground}" Opacity="0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding Editor.MessageAnimationState}" Value="New">
<DataTrigger.EnterActions>
<BeginStoryboard Name="NewAnimation">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity">
<LinearDoubleKeyFrame KeyTime="0:0:0" Value="0" />
<LinearDoubleKeyFrame KeyTime="0:0:.3" Value="1" />
<LinearDoubleKeyFrame KeyTime="0:0:4" Value="1" />
<LinearDoubleKeyFrame KeyTime="0:0:5" Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Menu>
<TabControl Grid.Row="1" SelectionChanged="TabControl_SelectionChanged" DataContext="{x:Null}">
<TabItem Header="Категории моделей">
<Grid>
<TextBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="200">
<bs:MarkupExtensionProperties.Header>Фильтрация</bs:MarkupExtensionProperties.Header>
<i:Interaction.Behaviors>
<bs:FilterDefaultViewTextBoxBehavior ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Categories}" />
</i:Interaction.Behaviors>
</TextBox>
<view:ModelCategories Margin="0,50,0,0" />
</Grid>
</TabItem>
<TabItem Header="Модели">
<Grid>
<TextBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="200">
<bs:MarkupExtensionProperties.Header>Фильтрация</bs:MarkupExtensionProperties.Header>
<i:Interaction.Behaviors>
<bs:FilterDefaultViewTextBoxBehavior ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Models}" />
</i:Interaction.Behaviors>
</TextBox>
<view:Models Margin="0,50,0,0" />
</Grid>
</TabItem>
<TabItem Header="Виды работ">
<Grid>
<TextBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="200">
<bs:MarkupExtensionProperties.Header>Фильтрация</bs:MarkupExtensionProperties.Header>
<i:Interaction.Behaviors>
<bs:FilterDefaultViewTextBoxBehavior ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.ModelJobs}" />
</i:Interaction.Behaviors>
</TextBox>
<view:ModelJobs Margin="0,50,0,0" />
</Grid>
</TabItem>
<TabItem Header="Расценки">
<Grid>
<TextBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="200">
<bs:MarkupExtensionProperties.Header>Фильтрация</bs:MarkupExtensionProperties.Header>
<i:Interaction.Behaviors>
<bs:FilterDefaultViewTextBoxBehavior ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.ModelJobPriceTemplates}" />
</i:Interaction.Behaviors>
</TextBox>
<Button VerticalAlignment="Top" HorizontalAlignment="Left" Command="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.AddNewPriceTemplateCommand}">+Добавить</Button>
<view:ModelJobPriceTemplates Margin="0,50,0,0" />
</Grid>
</TabItem>
<TabItem Header="Заказы">
<Grid>
<TextBox VerticalAlignment="Top" HorizontalAlignment="Right" Width="200">
<bs:MarkupExtensionProperties.Header>Фильтрация</bs:MarkupExtensionProperties.Header>
<i:Interaction.Behaviors>
<bs:FilterDefaultViewTextBoxBehavior ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Orders}" />
</i:Interaction.Behaviors>
</TextBox>
<view:Orders Margin="0,50,0,0" />
</Grid>
</TabItem>
</TabControl>
</Grid>
</Window>

View File

@@ -0,0 +1,50 @@
using AppleJobs.Data.Models.ModelsJobs;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace JetFrames.AppleJobs.Editor
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
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 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);
}
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;
}
}
}

View File

@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("JetFrames.AppleJobs.Editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JetFrames.AppleJobs.Editor")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace JetFrames.AppleJobs.Editor.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("JetFrames.AppleJobs.Editor.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,362 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace JetFrames.AppleJobs.Editor.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
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;
}
}
}
}

View File

@@ -0,0 +1,90 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="JetFrames.AppleJobs.Editor.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="Grid01LayoutX" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="Grid01LayoutY" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="Grid01LayoutWidth" Type="System.Double" Scope="User">
<Value Profile="(Default)">NaN</Value>
</Setting>
<Setting Name="Grid01LayoutHeight" Type="System.Double" Scope="User">
<Value Profile="(Default)">NaN</Value>
</Setting>
<Setting Name="Grid02LayoutX" Type="System.Double" Scope="User">
<Value Profile="(Default)">100</Value>
</Setting>
<Setting Name="Grid03LayoutX" Type="System.Double" Scope="User">
<Value Profile="(Default)">200</Value>
</Setting>
<Setting Name="Grid04LayoutX" Type="System.Double" Scope="User">
<Value Profile="(Default)">300</Value>
</Setting>
<Setting Name="Grid02LayoutY" Type="System.Double" Scope="User">
<Value Profile="(Default)">100</Value>
</Setting>
<Setting Name="Grid03LayoutY" Type="System.Double" Scope="User">
<Value Profile="(Default)">200</Value>
</Setting>
<Setting Name="Grid04LayoutY" Type="System.Double" Scope="User">
<Value Profile="(Default)">300</Value>
</Setting>
<Setting Name="Grid02LayoutWidth" Type="System.Double" Scope="User">
<Value Profile="(Default)">NaN</Value>
</Setting>
<Setting Name="Grid03LayoutWidth" Type="System.Double" Scope="User">
<Value Profile="(Default)">NaN</Value>
</Setting>
<Setting Name="Grid04LayoutWidth" Type="System.Double" Scope="User">
<Value Profile="(Default)">NaN</Value>
</Setting>
<Setting Name="Grid02LayoutHeight" Type="System.Double" Scope="User">
<Value Profile="(Default)">NaN</Value>
</Setting>
<Setting Name="Grid03LayoutHeight" Type="System.Double" Scope="User">
<Value Profile="(Default)">NaN</Value>
</Setting>
<Setting Name="Grid04LayoutHeight" Type="System.Double" Scope="User">
<Value Profile="(Default)">NaN</Value>
</Setting>
<Setting Name="Grid01Expanded" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="Grid02Expanded" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="Grid03Expanded" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="Grid04Expanded" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="ZoomPadX" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="ZoomPadY" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="Zoom" Type="System.Double" Scope="User">
<Value Profile="(Default)">1</Value>
</Setting>
<Setting Name="Grid05Expanded" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="Grid05LayoutX" Type="System.Double" Scope="User">
<Value Profile="(Default)">400</Value>
</Setting>
<Setting Name="Grid05LayoutY" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="Grid05LayoutWidth" Type="System.Double" Scope="User">
<Value Profile="(Default)">NaN</Value>
</Setting>
<Setting Name="Grid05LayoutHeight" Type="System.Double" Scope="User">
<Value Profile="(Default)">NaN</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@@ -0,0 +1,28 @@
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.
}
}
}

View File

@@ -0,0 +1,33 @@
using AppleJobs.Data;
using BrightSharp.Mvvm;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data.Entity.Core.EntityClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JetFrames.AppleJobs.Editor
{
public class ViewModelLocator
{
AppleJobsContext context;
public ViewModelLocator()
{
if (ObservableObject.IsInDesignTime)
{
context = new AppleJobsContext("server=138.201.230.158;user id=admin_applejobs;pwd=dPARP0etzx;database=admin_applejobs_dev;CharSet=utf8;");
}
else
{
context = new AppleJobsContext();
}
Editor = new EditorViewModel(context);
}
public EditorViewModel Editor { get; private set; }
public Properties.Settings Settings { get { return Properties.Settings.Default; } }
}
}

View File

@@ -0,0 +1,64 @@
using AppleJobs.Data.Models.ModelsJobs;
using BrightSharp.Commands;
using BrightSharp.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Input;
namespace JetFrames.AppleJobs.Editor.ViewModels
{
public class NewPriceTemplateVm : ObservableObject
{
private readonly IEnumerable<ModelJobPriceTemplate> modelJobPriceTemplates;
private readonly IEnumerable<ModelJob> modelJobs;
public NewPriceTemplateVm(IEnumerable<Model> models, IEnumerable<ModelJob> modelJobs, IEnumerable<ModelJobPriceTemplate> modelJobPriceTemplates,
Action<NewPriceTemplateVm> createFunc)
{
this.modelJobs = modelJobs;
this.modelJobPriceTemplates = modelJobPriceTemplates;
Models = models;
CreateCommand = new RelayCommand(p => { createFunc?.Invoke(this); RaisePropertyChanged(nameof(FreeModelJobs)); }, p => SelectedModelJob != null);
}
private Model _selectedModel;
public Model SelectedModel
{
get { return _selectedModel; }
set { _selectedModel = value; RaisePropertyChanged(nameof(SelectedModel)); RaisePropertyChanged(nameof(FreeModelJobs)); }
}
public IEnumerable<Model> Models { get; private set; }
public IEnumerable<ModelJob> FreeModelJobs
{
get
{
if (SelectedModel == null) return null;
var res = modelJobs.Where(mj => mj.Model.Id == SelectedModel.Id && modelJobPriceTemplates.All(p => p.ModelJobs_Id != mj.Id));
return res;
}
}
private ModelJob _selectedModelJob;
public ModelJob SelectedModelJob
{
get { return _selectedModelJob; }
set { _selectedModelJob = value; RaisePropertyChanged(nameof(SelectedModelJob)); }
}
private int? _newPrice;
public int? NewPrice
{
get { return _newPrice; }
set { _newPrice = value; RaisePropertyChanged(nameof(NewPrice)); }
}
public ICommand CreateCommand
{
get; set;
}
}
}

View File

@@ -0,0 +1,18 @@
<UserControl x:Class="JetFrames.AppleJobs.Editor.Views.ModelCategories"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<DataGrid CommandManager.PreviewCanExecute="DataGrid_PreviewCanExecute" ItemsSource="{Binding Editor.Categories}"
InitializingNewItem="DataGrid_InitializingNewItem"
AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name, ValidatesOnNotifyDataErrors=True}" Header="Название" Width="100" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,27 @@
using System.Windows.Controls;
using System.Windows.Input;
namespace JetFrames.AppleJobs.Editor.Views
{
/// <summary>
/// Interaction logic for ModelCategories.xaml
/// </summary>
public partial class ModelCategories : UserControl
{
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);
}
}
}

View File

@@ -0,0 +1,29 @@
<UserControl x:Class="JetFrames.AppleJobs.Editor.Views.ModelJobPriceTemplates"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}"
d:DesignHeight="300" d:DesignWidth="774">
<Grid>
<DataGrid CommandManager.PreviewCanExecute="DataGrid_PreviewCanExecute" ItemsSource="{Binding Editor.ModelJobPriceTemplates}"
CanUserAddRows="False" AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding ModelJob.Name}" Header="Работа" Width="120" SortMemberPath="ModelJob.Name"
ClipboardContentBinding="{Binding ModelJob.Name}"
IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding ModelJob.Model.Name}" Header="Модель" Width="120" SortMemberPath="ModelJob.Model.Name"
ClipboardContentBinding="{Binding ModelJob.Model.Name}"
IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding ModelJob.Model.ModelCategory.Name}"
IsReadOnly="True" Header="Категория" Width="120" SortMemberPath="ModelJob.Model.ModelCategory.Name"
ClipboardContentBinding="{Binding ModelJob.Model.ModelCategory.Name}" />
<DataGridTextColumn Binding="{Binding Price, TargetNullValue=''}" Header="Цена" Width="100" ClipboardContentBinding="{Binding Price}" />
<DataGridCheckBoxColumn Binding="{Binding IsPriceFrom}" Header="Цена от" Width="80"
EditingElementStyle="{StaticResource {x:Type CheckBox}}" ClipboardContentBinding="{Binding IsPriceFrom}" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,32 @@
using AppleJobs.Data.Models.ModelsJobs;
using System.Windows.Controls;
using System.Windows.Input;
namespace JetFrames.AppleJobs.Editor.Views
{
/// <summary>
/// Interaction logic for ModelJobPriceTemplates.xaml
/// </summary>
public partial class ModelJobPriceTemplates : UserControl
{
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);
}
}
}

View File

@@ -0,0 +1,26 @@
<UserControl x:Class="JetFrames.AppleJobs.Editor.Views.ModelJobs"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}"
d:DesignHeight="300" d:DesignWidth="527">
<Grid>
<DataGrid CommandManager.PreviewCanExecute="DataGrid_PreviewCanExecute" ItemsSource="{Binding Editor.ModelJobs}"
InitializingNewItem="DataGrid_InitializingNewItem"
AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name}" Header="Название" Width="150" />
<DataGridComboBoxColumn SelectedValueBinding="{Binding Model}"
ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Models}"
DisplayMemberPath="Name" Header="Модель" Width="120" SortMemberPath="Model.Name"
EditingElementStyle="{StaticResource {x:Type ComboBox}}"/>
<DataGridTextColumn Binding="{Binding Description}" Header="Описание" Width="200" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,38 @@
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
{
/// <summary>
/// Interaction logic for ModelJobs.xaml
/// </summary>
public partial class ModelJobs : UserControl
{
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);
}
}
}

View File

@@ -0,0 +1,22 @@
<UserControl x:Class="JetFrames.AppleJobs.Editor.Views.Models"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<DataGrid CommandManager.PreviewCanExecute="DataGrid_PreviewCanExecute"
ItemsSource="{Binding Editor.Models}"
AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}" InitializingNewItem="DataGrid_InitializingNewItem">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name}" Header="Модель" Width="120" />
<DataGridComboBoxColumn SelectedValueBinding="{Binding ModelCategory, ValidatesOnExceptions=True}"
ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Categories}"
DisplayMemberPath="Name" Header="Категория" Width="120" SortMemberPath="ModelCategory.Name"
EditingElementStyle="{StaticResource {x:Type ComboBox}}" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,38 @@
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
{
/// <summary>
/// Interaction logic for Models.xaml
/// </summary>
public partial class Models : UserControl
{
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);
}
}
}

View File

@@ -0,0 +1,29 @@
<Window x:Class="JetFrames.AppleJobs.Editor.Views.NewPriceTemplateDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
mc:Ignorable="d" WindowStyle="ToolWindow" ShowInTaskbar="False" Title="Новая расценка"
Height="239" Width="324">
<Grid>
<DockPanel Margin="10" LastChildFill="False">
<Label DockPanel.Dock="Top">Модель*</Label>
<ComboBox DockPanel.Dock="Top" Name="modCb" VerticalAlignment="Top" ItemsSource="{Binding Models}" SelectedItem="{Binding SelectedModel, Mode=OneWayToSource}"
DisplayMemberPath="Name" />
<Label DockPanel.Dock="Top">Работа*</Label>
<ComboBox DockPanel.Dock="Top" DisplayMemberPath="Name" VerticalAlignment="Top" ItemsSource="{Binding FreeModelJobs}" SelectedItem="{Binding SelectedModelJob}" />
<Label DockPanel.Dock="Top">Цена (руб)</Label>
<TextBox DockPanel.Dock="Top" Text="{Binding NewPrice, TargetNullValue=''}"></TextBox>
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="Создать" Margin="5,5,0,5" IsDefault="True" Padding="20,7" Command="{Binding CreateCommand}" />
<Button Content="Закрыть" Margin="5,5,0,5" IsCancel="True" Padding="7" />
</StackPanel>
</DockPanel>
</Grid>
</Window>

View File

@@ -0,0 +1,12 @@
using System.Windows;
namespace JetFrames.AppleJobs.Editor.Views
{
public partial class NewPriceTemplateDialog : Window
{
public NewPriceTemplateDialog()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,55 @@
<UserControl x:Class="JetFrames.AppleJobs.Editor.Views.Orders"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
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"
mc:Ignorable="d" d:DataContext="{StaticResource ViewModelLocator}"
d:DesignHeight="300" d:DesignWidth="1084">
<Grid>
<DataGrid CommandManager.PreviewCanExecute="DataGrid_PreviewCanExecute" ItemsSource="{Binding Editor.Orders}"
InitializingNewItem="DataGrid_InitializingNewItem"
AlternatingRowBackground="{DynamicResource AlternatingRowBackgroundBrush}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Contact}" Header="Контакт" Width="200" />
<DataGridComboBoxColumn ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.OrderStatuses}"
SelectedValueBinding="{Binding OrderStatus}"
DisplayMemberPath="Name" SortMemberPath="OrderStatus.Name" ClipboardContentBinding="{Binding Name}"
EditingElementStyle="{StaticResource {x:Type ComboBox}}" Header="Статус" Width="80" />
<DataGridComboBoxColumn SelectedValueBinding="{Binding Model, UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Models}"
DisplayMemberPath="Name" Header="Модель" Width="120" SortMemberPath="Model.Name"
EditingElementStyle="{StaticResource {x:Type ComboBox}}"/>
<DataGridTextColumn Binding="{Binding Comment}" Header="Коментарий" Width="100" />
<DataGridCheckBoxColumn Binding="{Binding IsFast}" Header="Быстро" Width="60" />
<DataGridCheckBoxColumn Binding="{Binding IsDrive}" Header="Доставка" Width="60" />
<DataGridTextColumn Binding="{Binding Price}" Header="Цена" Width="80" />
<DataGridTemplateColumn Header="Работа" Width="80" ClipboardContentBinding="{Binding JobModel.Name}" SortMemberPath="JobModel.Name">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding JobModel.Name}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Model.ModelJobs}" DisplayMemberPath="Name"
SelectedItem="{Binding JobModel, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
<DataGridComboBoxColumn SelectedValueBinding="{Binding Accessories}"
ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Accessories}"
DisplayMemberPath="Name" SortMemberPath="Accessories.Name"
EditingElementStyle="{StaticResource {x:Type ComboBox}}" Header="Инвентарь" Width="80" />
<DataGridComboBoxColumn SelectedValueBinding="{Binding Employee}"
ItemsSource="{Binding Source={StaticResource ViewModelLocator}, Path=Editor.Employees}"
DisplayMemberPath="Name" SortMemberPath="Employee.Name"
EditingElementStyle="{StaticResource {x:Type ComboBox}}"
Header="Мастер" Width="80" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,33 @@
using AppleJobs.Data.Models;
using AppleJobs.Data.Models.ModelsJobs;
using System.Windows.Controls;
using System.Windows.Input;
namespace JetFrames.AppleJobs.Editor.Views
{
/// <summary>
/// Interaction logic for Orders.xaml
/// </summary>
public partial class Orders : UserControl
{
public Orders()
{
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 Order)
{
var mjpt = (Order)e.NewItem;
mjpt.Customers_Id = 1;
}
App.Locator.Editor.AddEntity(e.NewItem);
}
}
}

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.1.0" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net452" />
<package id="MySql.Data" version="6.9.9" targetFramework="net452" />
<package id="MySql.Data.Entity" version="6.9.9" targetFramework="net452" />
</packages>