Skip to content

Commit

Permalink
Last changes: tarif exporting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Qwerty committed Jan 12, 2017
1 parent fd11c84 commit d1638d1
Show file tree
Hide file tree
Showing 28 changed files with 1,031 additions and 493 deletions.
27 changes: 20 additions & 7 deletions WpfApp/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<!-- <system.data>-->
<!-- <DbProviderFactories>-->
<!-- <remove invariant="System.Data.SqlServerCe.4.0" />-->
<!-- <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />-->
<!-- </DbProviderFactories>-->
<!-- </system.data>-->
<!-- <system.data>-->
<!-- <DbProviderFactories>-->
<!-- <remove invariant="System.Data.SqlServerCe.4.0" />-->
<!-- <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />-->
<!-- </DbProviderFactories>-->
<!-- </system.data>-->
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
Expand All @@ -31,6 +31,19 @@
</connectionStrings>
<appSettings>
<add key="WebcamPath" value="webcam/Camera.exe" />
<add key="SettingsFilesEncoding" value="UTF-8"/>
<add key="SettingsFilesEncoding" value="UTF-8" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
1 change: 1 addition & 0 deletions WpfApp/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<framework:ViewViewModelPair View="View/ChangeGroupGroupTypeWindow.xaml" ViewModel="viewModel:ChangeGroupGroupTypeViewModel"/>
<framework:ViewViewModelPair View="View/SaveOrRepealParentChangesDialog.xaml" ViewModel="viewModel:SaveOrRepealParentChangesViewModel"/>
<framework:ViewViewModelPair View="View/AddExpenseWindow.xaml" ViewModel="viewModel:AddExpenseViewModel"/>
<framework:ViewViewModelPair View="View/ChangeDebtWindow.xaml" ViewModel="viewModel:ChangeDebtViewModel"/>
</x:Array>
<!-- </framework:ViewViewModelPairs.Pairs>-->
</framework:ViewViewModelPairs>
Expand Down
11 changes: 11 additions & 0 deletions WpfApp/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Configuration;
using System.IO;
using System.Windows;
using Microsoft.Win32;
using NLog;
using WpfApp.Framework;
using WpfApp.Settings;
Expand Down Expand Up @@ -64,5 +65,15 @@ public static void EnsureAllDirectories()
Directory.CreateDirectory(AppFilePaths.PersonImages);
Logger.Trace("Directories was created");
}


public static SaveFileDialog GetDocumentSaveFileDialog(string fileName)
{
if (_documentSaveFileDialog == null)
_documentSaveFileDialog = new SaveFileDialog { Filter = "Word|*.docx" };
_documentSaveFileDialog.FileName = fileName;
return _documentSaveFileDialog;
}
private static SaveFileDialog _documentSaveFileDialog;
}
}
6 changes: 6 additions & 0 deletions WpfApp/Framework/Core/DirtyPropertyChangeNotifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,11 @@ public void StopTracking()
public event Action<string> RemovedDirty;
public event PropertyChangedEventHandler PropertyChanged;
public event Action DirtyCountChanged;

public bool WasPropertyChanged(string propertyName)
{
object value;
return _dirtyValues.TryGetValue(propertyName, out value) && _firstValues[propertyName] != value;
}
}
}
2 changes: 1 addition & 1 deletion WpfApp/Framework/Core/ViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public object this[string key]
get
{
object result;
return _data.TryGetValue(key, out result) ? result : /*this[key] =*/ defaultValue; // save current defaultValue if not exists
return _data.TryGetValue(key, out result) ? result : this[key] = defaultValue; // save current defaultValue if not exists
}
set { this[key] = value; } // for Mode=TwoWay
}
Expand Down
6 changes: 1 addition & 5 deletions WpfApp/Framework/ViewViewModelPair.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using WpfApp.Framework.Core;
Expand Down Expand Up @@ -38,11 +37,8 @@ private void StartLifeCycle(Window window, ViewModelBase viewModel, Pipe pipe)

window.DataContext = viewModel;
window.Loaded += (s, e) => viewModel.OnLoaded();
window.Closing += (s, e) => { e.Cancel = !viewModel.OnFinishing(); };
var sw = new Stopwatch();
sw.Start();
window.Closing += (s, e) => e.Cancel = !viewModel.OnFinishing();
var conf = WindowStateSaver.ConfigureWindow(View.OriginalString, window, viewModel);
sw.Stop();
bool closed = false;
window.Closed += (s, e) =>
{
Expand Down
116 changes: 83 additions & 33 deletions WpfApp/NLog.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -244,32 +244,6 @@
<xs:minLength value="1" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="AspResponse">
<xs:complexContent>
<xs:extension base="Target">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="layout" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="addComments" minOccurs="0" maxOccurs="1" type="xs:boolean" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
<xs:documentation>Name of the target.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="layout" type="SimpleLayoutAttribute">
<xs:annotation>
<xs:documentation>Layout used to format log messages.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="addComments" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates whether to add &lt;!-- --&gt; comments around all written texts.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="AsyncWrapper">
<xs:complexContent>
<xs:extension base="WrapperTargetBase">
Expand Down Expand Up @@ -320,12 +294,18 @@
<xs:extension base="WrapperTargetBase">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="condition" minOccurs="0" maxOccurs="1" type="Condition" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
<xs:documentation>Name of the target.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="condition" type="Condition">
<xs:annotation>
<xs:documentation>Condition expression. Log events who meet this condition will cause a flush on the wrapped target.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Expand Down Expand Up @@ -785,7 +765,7 @@
</xs:attribute>
<xs:attribute name="useTransactions" type="xs:boolean">
<xs:annotation>
<xs:documentation>Obsolete - value will be ignored! The logging code always runs outside of transaction. Gets or sets a value indicating whether to use database transactions. Some replaceDict providers require this.</xs:documentation>
<xs:documentation>Obsolete - value will be ignored! The logging code always runs outside of transaction. Gets or sets a value indicating whether to use database transactions. Some data providers require this.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="installConnectionString" type="SimpleLayoutAttribute">
Expand Down Expand Up @@ -1039,10 +1019,11 @@
<xs:element name="archiveAboveSize" minOccurs="0" maxOccurs="1" type="xs:long" />
<xs:element name="enableArchiveFileCompression" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="maxArchiveFiles" minOccurs="0" maxOccurs="1" type="xs:integer" />
<xs:element name="fileNameKind" minOccurs="0" maxOccurs="1" type="NLog.Targets.FilePathKind" />
<xs:element name="forceManaged" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="archiveFileKind" minOccurs="0" maxOccurs="1" type="NLog.Targets.FilePathKind" />
<xs:element name="cleanupFileName" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="forceManaged" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="fileNameKind" minOccurs="0" maxOccurs="1" type="NLog.Targets.FilePathKind" />
<xs:element name="forceMutexConcurrentWrites" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="writeFooterOnArchivingOnly" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="fileName" minOccurs="0" maxOccurs="1" type="Layout" />
<xs:element name="archiveDateFormat" minOccurs="0" maxOccurs="1" type="xs:string" />
Expand Down Expand Up @@ -1123,9 +1104,9 @@
<xs:documentation>Maximum number of archive files that should be kept.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="fileNameKind" type="NLog.Targets.FilePathKind">
<xs:attribute name="forceManaged" type="xs:boolean">
<xs:annotation>
<xs:documentation>Is the an absolute or relative path?</xs:documentation>
<xs:documentation>Gets or set a value indicating whether a managed file stream is forced, instead of using the native implementation.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="archiveFileKind" type="NLog.Targets.FilePathKind">
Expand All @@ -1138,9 +1119,14 @@
<xs:documentation>Cleanup invalid values in a filename, e.g. slashes in a filename. If set to true, this can impact the performance of massive writes. If set to false, nothing gets written when the filename is wrong.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="forceManaged" type="xs:boolean">
<xs:attribute name="fileNameKind" type="NLog.Targets.FilePathKind">
<xs:annotation>
<xs:documentation>Gets or set a value indicating whether a managed file stream is forced, instead of used the native implementation.</xs:documentation>
<xs:documentation>Is the an absolute or relative path?</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="forceMutexConcurrentWrites" type="xs:boolean">
<xs:annotation>
<xs:documentation>Value indicationg whether file creation calls should be synchronized by a system global mutex.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="writeFooterOnArchivingOnly" type="xs:boolean">
Expand Down Expand Up @@ -1385,6 +1371,32 @@
<xs:enumeration value="NewCredentials" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="LimitingWrapper">
<xs:complexContent>
<xs:extension base="WrapperTargetBase">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="name" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="interval" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="messageLimit" minOccurs="0" maxOccurs="1" type="xs:integer" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
<xs:documentation>Name of the target.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="interval" type="xs:string">
<xs:annotation>
<xs:documentation>Interval in which messages will be written up to the number of messages.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="messageLimit" type="xs:integer">
<xs:annotation>
<xs:documentation>Maximum allowed number of messages written per .</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="LogReceiverService">
<xs:complexContent>
<xs:extension base="Target">
Expand Down Expand Up @@ -2241,10 +2253,14 @@
<xs:element name="includeBOM" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="parameter" minOccurs="0" maxOccurs="unbounded" type="NLog.Targets.MethodCallParameter" />
<xs:element name="encoding" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="escapeDataNLogLegacy" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="escapeDataRfc3986" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="methodName" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="namespace" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="protocol" minOccurs="0" maxOccurs="1" type="NLog.Targets.WebServiceProtocol" />
<xs:element name="url" minOccurs="0" maxOccurs="1" type="xs:anyURI" />
<xs:element name="xmlRoot" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="xmlRootNamespace" minOccurs="0" maxOccurs="1" type="xs:string" />
</xs:choice>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
Expand All @@ -2261,6 +2277,16 @@
<xs:documentation>Encoding.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="escapeDataNLogLegacy" type="xs:boolean">
<xs:annotation>
<xs:documentation>Value whether escaping be done according to the old NLog style (Very non-standard)</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="escapeDataRfc3986" type="xs:boolean">
<xs:annotation>
<xs:documentation>Value whether escaping be done according to Rfc3986 (Supports Internationalized Resource Identifiers - IRIs)</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="methodName" type="xs:string">
<xs:annotation>
<xs:documentation>Web service method name. Only used with Soap.</xs:documentation>
Expand All @@ -2281,6 +2307,16 @@
<xs:documentation>Web service URL.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="xmlRoot" type="xs:string">
<xs:annotation>
<xs:documentation>Name of the root XML element, if POST of XML document chosen. If so, this property must not be null. (see and ).</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="xmlRootNamespace" type="xs:string">
<xs:annotation>
<xs:documentation>(optional) root namespace of the XML document, if POST of XML document chosen. (see and ).</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Expand All @@ -2290,6 +2326,8 @@
<xs:enumeration value="Soap12" />
<xs:enumeration value="HttpPost" />
<xs:enumeration value="HttpGet" />
<xs:enumeration value="JsonPost" />
<xs:enumeration value="XmlPost" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="CompoundLayout">
Expand Down Expand Up @@ -2400,9 +2438,21 @@
<xs:extension base="Layout">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="attribute" minOccurs="0" maxOccurs="unbounded" type="NLog.Layouts.JsonAttribute" />
<xs:element name="excludeProperties" minOccurs="0" maxOccurs="1" type="xs:string" />
<xs:element name="includeAllProperties" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="renderEmptyObject" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="suppressSpaces" minOccurs="0" maxOccurs="1" type="xs:boolean" />
</xs:choice>
<xs:attribute name="excludeProperties" type="xs:string">
<xs:annotation>
<xs:documentation>List of property names to exclude when is true</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="includeAllProperties" type="xs:boolean">
<xs:annotation>
<xs:documentation>Option to include all properties from the log events</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="renderEmptyObject" type="xs:boolean">
<xs:annotation>
<xs:documentation>Option to render the empty object value {}</xs:documentation>
Expand Down
15 changes: 14 additions & 1 deletion WpfApp/Settings/AppFilePaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ private static string GetDocumentName(string document, int childId)

public static string GetTakingChildTemplatePath() => GetDocumentName("taking_child");

public static string GetOrderOfAdmissionFileName(Child child) => GetDocumentName("order_of_admission", child.Id);
public static string GetOrderOfAdmissionFileName(Child child) =>
string.Format(MyDocumentSettings.FilenameOfDocumentsAndTemplates["order_of_admission"][1], child.Id, string.Empty);
public static string GetOrderOfAdmissionFileName(Child child, DateTime enterDate) =>
string.Format(MyDocumentSettings.FilenameOfDocumentsAndTemplates["order_of_admission"][1], child.Id, "_" + enterDate.ToString(OtherSettings.DateFormat));
public static string GetOrderOfAdmissionTemplatePath() => GetDocumentName("order_of_admission");
Expand Down Expand Up @@ -80,6 +81,18 @@ public static string GetGroupTypeChangedFileName() =>
MyDocumentSettings.FilenameOfDocumentsAndTemplates["group_type_changed"][1];
public static string GetGroupTypeChangedTemplatePath() => GetDocumentName("group_type_changed");

public static string GetChildListFileName() =>
MyDocumentSettings.FilenameOfDocumentsAndTemplates["child_list"][1];
public static string GetChildListTemplatePath() => GetDocumentName("child_list");

public static string GetPaymentListFileName() =>
MyDocumentSettings.FilenameOfDocumentsAndTemplates["payment_list"][1];
public static string GetPaymentListTemplatePath() => GetDocumentName("payment_list");

public static string GetTarifChangeFileName(Child child) =>
string.Format(MyDocumentSettings.FilenameOfDocumentsAndTemplates["tarif_change"][1], child.Id, DateTime.Now.ToString(OtherSettings.DateFormat));
public static string GetTarifChangeTemplatePath() => GetDocumentName("tarif_change");


static AppFilePaths()
{
Expand Down
Loading

0 comments on commit d1638d1

Please sign in to comment.