Logo bei Mandator - Todo: Transparent wird zu schwarz beim Speichern
This commit is contained in:
@@ -113,7 +113,7 @@
|
||||
Grid.Column="2"
|
||||
EditValue="{Binding Path=AlterAmStichtag, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsReadOnly="{Binding PermissionCustomerWohnhilfeManage, Mode=OneTime, Converter={StaticResource BoolReverseConverter}, ElementName=root}"
|
||||
Style="{StaticResource BaseNumberTextEdit}"/>
|
||||
Style="{StaticResource BaseNumberTextEdit}" />
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0">B1040 Haushaltsgröße</Label>
|
||||
<dxe:TextEdit
|
||||
|
||||
@@ -66,7 +66,21 @@
|
||||
Height="23"
|
||||
Margin="3"
|
||||
Text="{Binding Path=Website, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<Label
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="3"
|
||||
VerticalAlignment="Center">
|
||||
Webseite
|
||||
</Label>
|
||||
<dxe:ImageEdit
|
||||
x:Name="ImageEdit"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
MaxHeight="200"
|
||||
Margin="3"
|
||||
EditValue="{Binding Logo.ImageSource, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<GroupBox
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
|
||||
@@ -41,6 +43,16 @@ namespace BeWo.ViewModel
|
||||
return (pMember == null && pNewValue != null) || (pMember != null && !pMember.Equals(pNewValue));
|
||||
}
|
||||
|
||||
protected bool AreDifferent<T>(object pMember, object pNewValue)
|
||||
{
|
||||
if(pMember is IEnumerable<T> l1 && pNewValue is IEnumerable<T> l2)
|
||||
{
|
||||
return !Enumerable.SequenceEqual(l1, l2);
|
||||
}
|
||||
|
||||
return AreDifferent(pMember, pNewValue);
|
||||
}
|
||||
|
||||
protected bool AreEqual(object x, object y)
|
||||
{
|
||||
NullCompareResult lResult = Utils.NullCompare(x, y);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
@@ -6,80 +7,97 @@ using BS.Shared.DataContracts;
|
||||
|
||||
namespace BeWo.ViewModel
|
||||
{
|
||||
public class ImageVM : AbstractDCMapperVM<ImageDC>
|
||||
{
|
||||
private string _Filename;
|
||||
private string _Fullname;
|
||||
private byte[] _Original;
|
||||
private byte[] _MediumThumbnail;
|
||||
private byte[] _SmallThumbnail;
|
||||
public class ImageVM : AbstractDCMapperVM<ImageDC>
|
||||
{
|
||||
private string _Filename;
|
||||
private string _Fullname;
|
||||
private byte[] _Original;
|
||||
private byte[] _MediumThumbnail;
|
||||
private byte[] _SmallThumbnail;
|
||||
private BitmapImage _BitmapImage;
|
||||
private ImageSource _ImageSource;
|
||||
|
||||
public ImageVM() : this(new ImageDC())
|
||||
{
|
||||
public ImageVM() : this(new ImageDC())
|
||||
{
|
||||
|
||||
}
|
||||
public ImageVM(ImageDC dc) : base(dc, dc.Oid == null)
|
||||
{
|
||||
}
|
||||
public ImageVM(ImageDC dc) : base(dc, dc.Oid == null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public string Filename
|
||||
{
|
||||
get { return _Filename; }
|
||||
set
|
||||
{
|
||||
if (!AreDifferent(_Filename, value))
|
||||
return;
|
||||
public string Filename
|
||||
{
|
||||
get { return _Filename; }
|
||||
set
|
||||
{
|
||||
if (!AreDifferent(_Filename, value))
|
||||
return;
|
||||
|
||||
_Filename = value;
|
||||
StoreDirtyInformation(AreDifferent(DataContract.Filename, value), nameof(Filename));
|
||||
FirePropertyChanged(nameof(Filename));
|
||||
}
|
||||
}
|
||||
public string Fullname
|
||||
{
|
||||
get { return _Fullname; }
|
||||
set
|
||||
{
|
||||
if (!AreDifferent(_Fullname, value))
|
||||
return;
|
||||
_Filename = value;
|
||||
StoreDirtyInformation(AreDifferent(DataContract.Filename, value), nameof(Filename));
|
||||
FirePropertyChanged(nameof(Filename));
|
||||
}
|
||||
}
|
||||
public string Fullname
|
||||
{
|
||||
get { return _Fullname; }
|
||||
set
|
||||
{
|
||||
if (!AreDifferent(_Fullname, value))
|
||||
return;
|
||||
|
||||
_Fullname = value;
|
||||
StoreDirtyInformation(AreDifferent(DataContract.Fullname, value), nameof(Fullname));
|
||||
FirePropertyChanged(nameof(Fullname));
|
||||
}
|
||||
}
|
||||
public byte[] Original
|
||||
{
|
||||
get { return _Original; }
|
||||
set
|
||||
{
|
||||
if (!AreDifferent(_Original, value))
|
||||
return;
|
||||
_Fullname = value;
|
||||
StoreDirtyInformation(AreDifferent(DataContract.Fullname, value), nameof(Fullname));
|
||||
FirePropertyChanged(nameof(Fullname));
|
||||
}
|
||||
}
|
||||
public byte[] Original
|
||||
{
|
||||
get { return _Original; }
|
||||
set
|
||||
{
|
||||
if (!AreDifferent<byte>(_Original, value))
|
||||
return;
|
||||
|
||||
_Original = value;
|
||||
StoreDirtyInformation(AreDifferent(DataContract.Original, value), nameof(Original));
|
||||
FirePropertyChanged(nameof(Original));
|
||||
FirePropertyChanged(nameof(BitmapImage));
|
||||
}
|
||||
}
|
||||
_Original = value;
|
||||
StoreDirtyInformation(AreDifferent<byte>(DataContract.Original, value), nameof(Original));
|
||||
FirePropertyChanged(nameof(Original));
|
||||
FirePropertyChanged(nameof(BitmapImage));
|
||||
}
|
||||
}
|
||||
public ImageSource ImageSource
|
||||
{
|
||||
get { return _ImageSource ?? Utils.CreateBitmapImageFromByteArray(Original); }
|
||||
set
|
||||
{
|
||||
if (!AreDifferent(ImageSource, value))
|
||||
return;
|
||||
|
||||
public BitmapImage BitmapImage => Utils.CreateBitmapImageFromByteArray(Original);
|
||||
Original = Utils.CreateByteArrayFromImageSource(value);
|
||||
_ImageSource = value;
|
||||
FirePropertyChanged(nameof(ImageSource));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void InitByDataContract(ImageDC pDataContract)
|
||||
{
|
||||
_Filename = pDataContract.Filename;
|
||||
_Fullname = pDataContract.Fullname;
|
||||
_Original = pDataContract.Original;
|
||||
}
|
||||
public BitmapImage BitmapImage => Utils.CreateBitmapImageFromByteArray(Original);
|
||||
|
||||
protected override ImageDC MapToDataContract(ImageDC pDataContract, bool doCommit)
|
||||
{
|
||||
pDataContract.Filename = _Filename;
|
||||
pDataContract.Fullname = _Fullname;
|
||||
pDataContract.Original = _Original;
|
||||
protected override void InitByDataContract(ImageDC pDataContract)
|
||||
{
|
||||
_Filename = pDataContract.Filename;
|
||||
_Fullname = pDataContract.Fullname;
|
||||
_Original = pDataContract.Original;
|
||||
_MediumThumbnail = pDataContract.MediumThumbnail;
|
||||
_SmallThumbnail = pDataContract.SmallThumbnail;
|
||||
}
|
||||
|
||||
return pDataContract;
|
||||
}
|
||||
}
|
||||
protected override ImageDC MapToDataContract(ImageDC pDataContract, bool doCommit)
|
||||
{
|
||||
pDataContract.Filename = _Filename;
|
||||
pDataContract.Fullname = _Fullname;
|
||||
pDataContract.Original = _Original;
|
||||
|
||||
return pDataContract;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ namespace BeWo.ViewModel
|
||||
private string _Bic;
|
||||
private string _IBAN;
|
||||
private CompactEmployeeDC _SoziotherapieAnsprechpartner;
|
||||
private ImageVM _Logo;
|
||||
|
||||
public MandatorVM(IList<InvoiceNumberVM> invoiceNumberList, MandatorDC pDC) : base(pDC, true)
|
||||
{
|
||||
@@ -460,7 +461,7 @@ namespace BeWo.ViewModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return (base.IsDirty || _InvoiceNumberList.Any(vm => vm.IsDirty));
|
||||
return (base.IsDirty || _InvoiceNumberList.Any(vm => vm.IsDirty) || Logo.IsDirty);
|
||||
}
|
||||
}
|
||||
public string Apikey
|
||||
@@ -561,7 +562,6 @@ namespace BeWo.ViewModel
|
||||
FirePropertyChanged(nameof(IBAN));
|
||||
}
|
||||
}
|
||||
|
||||
public CompactEmployeeDC SoziotherapieAnsprechpartner
|
||||
{
|
||||
get { return _SoziotherapieAnsprechpartner; }
|
||||
@@ -576,6 +576,16 @@ namespace BeWo.ViewModel
|
||||
FirePropertyChanged(nameof(SoziotherapieAnsprechpartner));
|
||||
}
|
||||
}
|
||||
public ImageVM Logo
|
||||
{
|
||||
get { return _Logo ?? (_Logo = new ImageVM()); }
|
||||
|
||||
set
|
||||
{
|
||||
_Logo = value;
|
||||
FirePropertyChanged(nameof(Logo));
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanEditIKLeistungserbringer { get; set; }
|
||||
public string CanEditIKLeistungserbringerTooltip { get; set; }
|
||||
@@ -603,6 +613,9 @@ namespace BeWo.ViewModel
|
||||
CanEditIKLeistungserbringerTooltip = pDataContract.CanEditIKLeistungserbringerTooltip;
|
||||
_SoziotherapieAnsprechpartner = pDataContract.SoziotherapieAnsprechpartner;
|
||||
|
||||
if(pDataContract.Logo is object)
|
||||
Logo = new ImageVM(pDataContract.Logo);
|
||||
|
||||
if (_Settings == null)
|
||||
{
|
||||
_TimeUntilUILock = 30;
|
||||
@@ -664,6 +677,8 @@ namespace BeWo.ViewModel
|
||||
pDataContract.BankAccount.Bic = Bic;
|
||||
pDataContract.BankAccount.IBAN = IBAN;
|
||||
pDataContract.SoziotherapieAnsprechpartner = SoziotherapieAnsprechpartner;
|
||||
|
||||
pDataContract.Logo = Logo.CommitToDataContract();
|
||||
|
||||
return pDataContract;
|
||||
}
|
||||
|
||||
@@ -367,6 +367,7 @@ namespace BeWo.Data.Entities
|
||||
}
|
||||
public virtual BankAccount BankAccount { get; set; }
|
||||
public virtual Employee SoziotherapieAnsprechpartner { get; set; }
|
||||
public virtual Image Logo { get; set; }
|
||||
|
||||
protected virtual string GetSettingValue(string key)
|
||||
{
|
||||
|
||||
@@ -31,5 +31,6 @@
|
||||
<property column="IKLeistungserbringer" type="String" name="IKLeistungserbringer" length="16" />
|
||||
<many-to-one name="BankAccount" column="BankAccountOid" class="BeWo.Data.Entities.BankAccount,BeWo.Data" cascade="all-delete-orphan" fetch="join"/>
|
||||
<many-to-one name="SoziotherapieAnsprechpartner" column="SoziotherapieAnsprechpartnerOid" class="BeWo.Data.Entities.Employee,BeWo.Data" cascade="all-delete-orphan" fetch="join"/>
|
||||
<many-to-one name="Logo" column="ImageOid" class="BeWo.Data.Entities.Image,BeWo.Data" cascade="all-delete-orphan" fetch="join"/>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
2
Model/Changes_2024_11_28 Mandator Logo.txt
Normal file
2
Model/Changes_2024_11_28 Mandator Logo.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE `mandator`
|
||||
ADD COLUMN `ImageOid` BIGINT NULL DEFAULT NULL AFTER `SoziotherapieAnsprechpartnerOid`;
|
||||
@@ -47,6 +47,9 @@ namespace BeWo.Service.DCEntityMapper
|
||||
if (from.SoziotherapieAnsprechpartner is object)
|
||||
to.SoziotherapieAnsprechpartner = MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(from.SoziotherapieAnsprechpartner);
|
||||
|
||||
if (from.Logo is object)
|
||||
to.Logo = MapperFactory.ImageDC_Image.MapToNewDC(from.Logo);
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
@@ -72,6 +75,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
|
||||
to.BankAccount = MapperFactory.BankAccountDC_BankAccount.MergeWithEntity(from.BankAccount, to.BankAccount, false);
|
||||
to.SoziotherapieAnsprechpartner = MapperFactory.CompactEmployeeDC_Employee.MergeWithEntity(from.SoziotherapieAnsprechpartner, to.SoziotherapieAnsprechpartner, false);
|
||||
to.Logo = MapperFactory.ImageDC_Image.MergeWithEntity(from.Logo, to.Logo, false);
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Xml.Serialization;
|
||||
using BS.Shared.DataContracts;
|
||||
@@ -517,6 +518,26 @@ namespace BS.Shared.Core
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] CreateByteArrayFromImageSource(ImageSource imageSource)
|
||||
{
|
||||
byte[] bytes = null;
|
||||
var bitmapSource = imageSource as BitmapSource;
|
||||
|
||||
if (bitmapSource != null)
|
||||
{
|
||||
var encoder = new JpegBitmapEncoder();
|
||||
encoder.Frames.Add(BitmapFrame.Create(bitmapSource));
|
||||
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
encoder.Save(stream);
|
||||
bytes = stream.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static Image ResizeImage(Image original, Size size)
|
||||
{
|
||||
var newSize = CalcSize(original.Width, original.Height, size.Width, size.Height);
|
||||
|
||||
@@ -30,5 +30,6 @@ namespace BS.Shared.DataContracts
|
||||
[DataMember] public bool CanEditIKLeistungserbringer { get; set; }
|
||||
[DataMember] public string CanEditIKLeistungserbringerTooltip { get; set; }
|
||||
[DataMember] public CompactEmployeeDC SoziotherapieAnsprechpartner { get; set; }
|
||||
[DataMember] public ImageDC Logo { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user