diff --git a/BeWo/DebugConfig.cs b/BeWo/DebugConfig.cs index 90b48f5b2..36a72145f 100644 --- a/BeWo/DebugConfig.cs +++ b/BeWo/DebugConfig.cs @@ -161,9 +161,9 @@ namespace BeWo AutoLogin = true, SelectView = UIContext.Finance, SelectIndex = 7, - DefaultLoginUsername = "m1", - DefaultLoginPassword = "bewobewo", - DefaultProfilename = "5000000000", + //DefaultLoginUsername = "m1", + //DefaultLoginPassword = "bewobewo", + //DefaultProfilename = "5000000000", EnableAutoRemoteDebugging = true }); diff --git a/BeWo/View/Detail/Accounting/InvoiceOverview.xaml b/BeWo/View/Detail/Accounting/InvoiceOverview.xaml index 76e26dd54..26e0c0ee5 100644 --- a/BeWo/View/Detail/Accounting/InvoiceOverview.xaml +++ b/BeWo/View/Detail/Accounting/InvoiceOverview.xaml @@ -81,7 +81,8 @@ Margin="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" - DataSource="{Binding VMList}"> + DataSource="{Binding VMList}" + SelectedItem="{Binding SelectedVM}"> (); - - if (vm is null) - { - MessageBox.Show("vm is null"); - return; - } - - var invoice_base_oid = vm.DataContract.InvoiceBaseOid ?? -1; - var invoice_type = (int)vm.DataContract.Type; - var report_link = vm.ReportLink; - - ServiceFacade.DoAccountingEnhancedServiceAsnyc>( - x => x.GetXRechnung(invoice_base_oid, invoice_type, report_link), - response => - { - if (response.Success) - { - BeWoApp.MainControl.WindowService.ShowERechnungWindow(new MemoryStream(response.Data)); - } - else - { - MessageBox.Show(response.ToErrorString()); - } - } - ); - } } } \ No newline at end of file diff --git a/BeWo/ViewModel/ListViewModel/InvoiceBaseListVM.cs b/BeWo/ViewModel/ListViewModel/InvoiceBaseListVM.cs index ff518b4ef..fe696ddaa 100644 --- a/BeWo/ViewModel/ListViewModel/InvoiceBaseListVM.cs +++ b/BeWo/ViewModel/ListViewModel/InvoiceBaseListVM.cs @@ -1,55 +1,51 @@ using System.Collections.Generic; using System.ComponentModel; +using System.IO; using System.Linq; +using System.Windows; using BeWo.ServiceProxy; using BS.Shared.Core; using BS.Shared.DataContracts; using BS.Shared.Extensions; +using DevExpress.Mvvm; using DevExpress.Xpf.Layout.Core; namespace BeWo.ViewModel.ListViewModel { public class InvoiceBaseListVM : AbstractDCListMapperVM { - #region Constants and Fields - public static string PropertyName_DateTimeSpanFilter = "DateTimeSpanFilter"; public static string PropertyName_FilterResultAmountSum = "FilterResultAmountSum"; public static string PropertyName_FilterResultAmountNotPaidSum = "FilterResultAmountNotPaidSum"; private DateTimeSpan _DateTimeSpanFilter; - private BindingList _FilteredInvoices; - #endregion - - #region Constructors and Destructors - public InvoiceBaseListVM(List pDCs) : base(pDCs) { - this.VMList.ListChanged += (s, e) => this.FirePropertyChanged(PropertyName_FilterResultAmountSum); - this.VMList.ListChanged += (s, e) => this.FirePropertyChanged(PropertyName_FilterResultAmountNotPaidSum); - } + VMList.ListChanged += (s, e) => FirePropertyChanged(PropertyName_FilterResultAmountSum); + VMList.ListChanged += (s, e) => FirePropertyChanged(PropertyName_FilterResultAmountNotPaidSum); - #endregion + bool canExecute() => SelectedVM is object && true; + ShowXRechnungCommand = new DelegateCommand(ShowXRechnung, canExecute); + } - - #region Properties + public DelegateCommand ShowXRechnungCommand { get; set; } - public DateTimeSpan DateTimeSpanFilter + public DateTimeSpan DateTimeSpanFilter { get { - return this._DateTimeSpanFilter; + return _DateTimeSpanFilter; } set { - if (this.AreDifferent(this._DateTimeSpanFilter, value)) + if (AreDifferent(_DateTimeSpanFilter, value)) { - this._DateTimeSpanFilter = value; - this.FirePropertyChanged(PropertyName_DateTimeSpanFilter); + _DateTimeSpanFilter = value; + FirePropertyChanged(PropertyName_DateTimeSpanFilter); } } @@ -59,7 +55,7 @@ namespace BeWo.ViewModel.ListViewModel { get { - return this.VMList.Sum(e => e.TotalAmount); + return VMList.Sum(e => e.TotalAmount); } } public decimal? FilterResultAmountNotPaidSum @@ -67,32 +63,51 @@ namespace BeWo.ViewModel.ListViewModel get { decimal? sum = 0.0m; - foreach (var item in this.VMList) + foreach (var item in VMList) sum += item.IsPaid ? item.TotalAmount : 0; return FilterResultAmountSum - sum; } } + public void ShowXRechnung() + { + var invoice_base_oid = SelectedVM.DataContract.InvoiceBaseOid ?? -1; + var invoice_type = (int)SelectedVM.DataContract.Type; + var report_link = SelectedVM.ReportLink; - #endregion + ServiceFacade.DoAccountingEnhancedServiceAsnyc( + x => x.GetXRechnung(invoice_base_oid, invoice_type, report_link), + response => + { + if (response.Success) + { + BeWoApp.MainControl.WindowService.ShowERechnungWindow(new MemoryStream(response.Data)); + } + else + { + MessageBox.Show(response.ToErrorString()); + } + } + ); + } internal void UpdateList(IList dcList) { - this.VMList.Clear(); - this.VMList.AddRange(dcList.Select(CreateVM)); + VMList.Clear(); + VMList.AddRange(dcList.Select(CreateVM)); - this.FirePropertyChanged(PropertyName_FilterResultAmountSum); - this.FirePropertyChanged(PropertyName_FilterResultAmountNotPaidSum); + FirePropertyChanged(PropertyName_FilterResultAmountSum); + FirePropertyChanged(PropertyName_FilterResultAmountNotPaidSum); } internal void UpdateList(IList vmList) { - this.VMList.Clear(); - this.VMList.AddRange(vmList); + VMList.Clear(); + VMList.AddRange(vmList); - this.FirePropertyChanged(PropertyName_FilterResultAmountSum); - this.FirePropertyChanged(PropertyName_FilterResultAmountNotPaidSum); + FirePropertyChanged(PropertyName_FilterResultAmountSum); + FirePropertyChanged(PropertyName_FilterResultAmountNotPaidSum); } } } \ No newline at end of file diff --git a/Host/Host.csproj.user b/Host/Host.csproj.user index 774d39de2..b740a7d0a 100644 --- a/Host/Host.csproj.user +++ b/Host/Host.csproj.user @@ -1,4 +1,4 @@ - + C:\Projects\Bewo\BeWo - Main\Host\Properties\PublishProfiles\FolderProfile.pubxml diff --git a/Host/Web.Deploy.config b/Host/Web.Deploy.config index 173e195f3..b3d7e124c 100644 --- a/Host/Web.Deploy.config +++ b/Host/Web.Deploy.config @@ -16,7 +16,7 @@ - + @@ -27,6 +27,10 @@ + + + + @@ -65,6 +69,7 @@ + @@ -174,6 +179,9 @@ + + + @@ -289,6 +297,7 @@ + @@ -332,7 +341,7 @@ - + diff --git a/Host/Web.config b/Host/Web.config index a22b80705..1081210ac 100644 --- a/Host/Web.config +++ b/Host/Web.config @@ -391,11 +391,11 @@ - - - - - + + + + + \ No newline at end of file diff --git a/Service/Core/FileLogger.cs b/Service/Core/FileLogger.cs index 4590aae10..2c8df497e 100644 --- a/Service/Core/FileLogger.cs +++ b/Service/Core/FileLogger.cs @@ -22,7 +22,7 @@ namespace BeWo.Service.Core public FileLogger(string filePath, LogLevel minimumLevel = LogLevel.Debug) { if(filePath == null) throw new ArgumentNullException(nameof(filePath)); - if(!File.Exists(filePath)) throw new BeWoInvalidOperationException(AppError.LoggerFileDoNotExist); + if(!Directory.Exists(Path.GetDirectoryName(filePath))) throw new BeWoInvalidOperationException(AppError.LoggerPathDoNotExist); _filePath = filePath; _minimumLevel = minimumLevel; diff --git a/Service/Core/ServiceHelper.cs b/Service/Core/ServiceHelper.cs index 956598193..310062aec 100644 --- a/Service/Core/ServiceHelper.cs +++ b/Service/Core/ServiceHelper.cs @@ -13,8 +13,8 @@ namespace BeWo.Service.Core public static class ServiceHelper { public static FileLogger CoreLogger { get; } = new FileLogger(MergedConfig.GetSetting(WebConfigSetting.ServiceLogFilePath)); - public static FileLogger WCFErrorLogger { get; } = new FileLogger(MergedConfig.GetSetting(WebConfigSetting.ServiceLogFilePath)); - public static FileLogger JsonErrorLogger { get; } = new FileLogger(MergedConfig.GetSetting(WebConfigSetting.ServiceLogFilePath)); + public static FileLogger WCFErrorLogger { get; } = new FileLogger(MergedConfig.GetSetting(WebConfigSetting.WCFErrorLogFilePath)); + public static FileLogger JsonErrorLogger { get; } = new FileLogger(MergedConfig.GetSetting(WebConfigSetting.JsonErrorLogFilePath)); public static Tuple GetInterfaceAndMethodWCF(Message request, IClientChannel channel) { diff --git a/Service/Core/ServiceValidator.cs b/Service/Core/ServiceValidator.cs index e514342c0..ab98892fb 100644 --- a/Service/Core/ServiceValidator.cs +++ b/Service/Core/ServiceValidator.cs @@ -48,10 +48,10 @@ namespace BeWo.Service.Core if (authentification is null) return; - if (authentification.IPAddressList is IPAddressList ipAddressList && ipAddressList != default) + if (authentification.IPAddressList is IPAddressList ipAddressList && ipAddressList != IPAddressList.None) ValidateIP(ref request, channel, ipAddressList); - if (authentification.ApiKeyName is WebSecretConfigSetting secret && secret != default) + if (authentification.ApiKeyName is WebSecretConfigSetting secret && secret != WebSecretConfigSetting.None) ValidateMethodApiKey(ref request, channel, secret); } diff --git a/Shared/Core/AppError.cs b/Shared/Core/AppError.cs index 89b4c999d..282aee297 100644 --- a/Shared/Core/AppError.cs +++ b/Shared/Core/AppError.cs @@ -31,10 +31,22 @@ namespace BS.Shared.Core } - //public static readonly AppError Example = new AppError("Code", "Message"); + // Muster: + // - public static readonly AppError Example = new AppError("Code", "Message"); + // - Usage: var error = AppError.Example; + // Oder mit Abhängigkeit: + // - public static Func ExampleFunc = (obj1, obj2, ...) => new AppError(...); + // - Usage: var error = AppError.ExampleFunc(obj1, obj2, ...); + + /// + /// Tenant ist in Anfrage null oder unbekannt + /// public static AppError MultitenancyOperationTenantUnknown => new AppError("SERV.HLP.10001", "Tenant unbekannt"); - public static AppError LoggerFileDoNotExist => new AppError("SERV.LOG.10001", "Server falsch konfiguriert"); + /// + /// Logger Ordner kann nicht gefunden werden. Hinweis: Web.config + /// + public static AppError LoggerPathDoNotExist => new AppError("SERV.LOG.10002", "Server falsch konfiguriert"); public static AppError FileNameInvalidChar => new AppError("DATA.LFS.60001", "Fehler beim Speichern"); public static AppError FileNameNotEqFilePath => new AppError("DATA.LFS.60002", "Fehler beim Speichern");