update new Table in sql und änderungen dementsprechend

This commit is contained in:
Waldi
2016-11-16 15:46:13 +01:00
parent c0b61d7376
commit 6dfc2d9228
18 changed files with 373 additions and 63 deletions

View File

@@ -592,6 +592,7 @@
<Compile Include="ViewModel\CustomerAPPCodeVM.cs" />
<Compile Include="ViewModel\EmployeeAPPCodeVM.cs" />
<Compile Include="ViewModel\ChatMessageVM.cs" />
<Compile Include="ViewModel\ChatMediaMessageVM.cs" />
<Compile Include="ViewModel\ListViewModel\BargeldkassenListVM.cs" />
<Compile Include="ViewModel\ListViewModel\MedRecordListVM.cs" />
<Compile Include="ViewModel\ListViewModel\SupportConceptApprovalPeriodEmployeeRelListVM.cs" />

View File

@@ -65,45 +65,45 @@ namespace BeWo.View
public UserVM ViewModel { get; set; }
public int abr = 0;
protected TcpClient tcpClient;
private TcpClient tcpClient;
protected CollectionView view;
private CollectionView view;
protected ChatEmojisView emojiView = null;
private ChatEmojisView emojiView = null;
protected List<KontaktlistBuilder> ita = new List<KontaktlistBuilder>();
protected List<long> oidspeicher = new List<long>();
protected List<string> teamdc = new List<string>();
protected PropertyGroupDescription groupDescription;
protected bool isOnFocus = false;
private List<KontaktlistBuilder> ita = new List<KontaktlistBuilder>();
private List<long> oidspeicher = new List<long>();
private List<string> teamdc = new List<string>();
private PropertyGroupDescription groupDescription;
private bool isOnFocus = false;
private bool SendtoServerFailes = false;
//Neu Sound und Datei Versende gedöns usw...
//protected WaveIn waveSource = null;
//protected WaveFileWriter waveFile = null;
protected SoundPlayer simpleSound = null;
protected Form form1 = null;
protected ChatProgressBarView progressView = null;
//private WaveIn waveSource = null;
//private WaveFileWriter waveFile = null;
private SoundPlayer simpleSound = null;
private Form form1 = null;
private ChatProgressBarView progressView = null;
//protected IWavePlayer waveOutDevice = null;
//protected AudioFileReader audioFileReader = null;
//Für anzeige MEhr Anzeigen wen mehr als 20 items Vorhanden
protected int itemGrenze = 5;
protected List<string> aktuelleChatMessageIDListe = new List<string>();
protected List<string> aktuelleChatMessageIDListeforTeam = new List<string>();
private int itemGrenze = 10;
private List<string> aktuelleChatMessageIDListe = new List<string>();
private List<string> aktuelleChatMessageIDListeforTeam = new List<string>();
private bool WeitereNachrichtSchalter = false;
//versuch oder | probieren geht über studieren
protected Dictionary<string, byte[]> SoundZwischenSpeicher = new Dictionary<string, byte[]>();
protected Dictionary<string, byte[]> BildZwischenSpeicher = new Dictionary<string, byte[]>();
protected Dictionary<string, byte[]> DokumentZwischenSpeicher = new Dictionary<string, byte[]>();
private Dictionary<string, byte[]> SoundZwischenSpeicher = new Dictionary<string, byte[]>();
private Dictionary<string, byte[]> BildZwischenSpeicher = new Dictionary<string, byte[]>();
private Dictionary<string, byte[]> DokumentZwischenSpeicher = new Dictionary<string, byte[]>();
public Dictionary<string, string> Speicherpfad = new Dictionary<string, string>();
protected bool sortLabelSwitch = false;
private bool sortLabelSwitch = false;
protected ContextMenu context;
private ContextMenu context;
public ChatView(String nameinf, String Chatinf, TcpClient tcpClient)
{
@@ -1246,8 +1246,7 @@ namespace BeWo.View
s.CreateNewChatMessagesDC(senderoid, empfangid, message, istZugestellt, empfangid,
guid.ToString()));
aktuelleChatMessageIDListeforTeam.Add(guid.ToString());
aktuelleChatMessageIDListeforTeam.Add(guid.ToString());
}
else
{
@@ -1257,8 +1256,6 @@ namespace BeWo.View
guid.ToString()));
aktuelleChatMessageIDListe.Add(guid.ToString());
}
}
catch (InvalidOperationException e)
{
@@ -2035,7 +2032,6 @@ namespace BeWo.View
{
}
}
else
{
@@ -2131,16 +2127,17 @@ namespace BeWo.View
Chat.Items[index] = kontaktmessage;
//Von der Datenbank aus die Daten Rausholen.
//messagedc.ChatMessagesOid, sender und empfänger oid
Chat.Items.Refresh();
}
private void WeitereNachrichten_OnMouse(object sender, MouseButtonEventArgs e)
{
long senderoid, empfaengeroid;

View File

@@ -0,0 +1,85 @@
using BS.Shared.DataContracts;
using System;
namespace BeWo.ViewModel
{
public class ChatMediaMessageVM : AbstractDCMapperVM<ChatMediaMessageDC>
{
//public static string PropertyName_ChatMessageOid = "ChatMessageOid";
public static string PropertyName_Media = "Media";
public static string PropertyName_ImageThumpNail = "ImageThumpNail";
private byte[] _media;
private byte[] _imageThumpNail;
private long? _chatMessageOid;
public ChatMediaMessageVM(ChatMediaMessageDC pDC)
: base(pDC, true)
{
}
public virtual byte[] Media
{
get { return _media; }
set
{
if (AreDifferent(_media, value))
{
_media = value;
}
}
}
public virtual byte[] ImageThumpNail
{
get { return _imageThumpNail; }
set
{
if (AreDifferent(_imageThumpNail, value))
{
_imageThumpNail = value;
}
}
}
public virtual long? ChatMessageOid
{
get
{
return this._chatMessageOid;
}
set
{
if (AreDifferent(_chatMessageOid, value))
{
_chatMessageOid = value;
}
}
}
protected override void InitByDataContract(ChatMediaMessageDC pDataContract)
{
_chatMessageOid = pDataContract.ChatMessageOid;
_imageThumpNail = pDataContract.ImageThumpNail;
_media = pDataContract.Media;
}
protected override ChatMediaMessageDC MapToDataContract(ChatMediaMessageDC pDataContract, bool doCommit)
{
pDataContract.ChatMessageOid = _chatMessageOid;
pDataContract.ImageThumpNail = _imageThumpNail;
pDataContract.Media = _media;
return pDataContract;
}
}
}

View File

@@ -1794,5 +1794,13 @@ namespace BeWo.Data.Access
return c.List<ChatMessage>();
}
}
public IList<ChatMediaMessage> GetChatMediaMessagesForChatMessage(long chatMessageOid)
{
var c = CreateCriteriaIsActive<ChatMediaMessage>()
.Add(Restrictions.Eq(ChatMediaMessage.PropertyName_ChatMessageOid, chatMessageOid));
return c.List<ChatMediaMessage>();
}
}
}

View File

@@ -157,6 +157,7 @@
<Compile Include="Entities\CustomerAPPCode.cs" />
<Compile Include="Entities\EmployeeAPPCode.cs" />
<Compile Include="Entities\ChatMessage.cs" />
<Compile Include="Entities\ChatMediaMessage.cs" />
<Compile Include="Entities\MedRecord.cs" />
<Compile Include="Entities\SupportConceptApprovalPeriod2Employee.cs" />
<Compile Include="Entities\Wohnheimbuchung2Employee.cs" />
@@ -550,6 +551,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="ICD10\icd10gm2012syst_claml_20110923.xml" />
<EmbeddedResource Include="Mappings\ChatMediaMessage.hbm.xml">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Mappings\ChatMessage.hbm.xml">
<SubType>Designer</SubType>
</EmbeddedResource>

View File

@@ -0,0 +1,66 @@
using System;
using BS.Shared;
namespace BeWo.Data.Entities
{
public class ChatMediaMessage : BeWoEntityBase
{
public static string PropertyName_ChatMessageOid = "ChatMessageOid";
public static string PropertyName_Media = "Media";
public static string PropertyName_ImageThumpNail = "ImageThumpNail";
private byte[] _Media;
private byte[] _ImageThumpNail;
private long? _ChatMessageOid;
public ChatMediaMessage()
{
_Tid = TableID.ChatMediaMessage;
}
public virtual byte[] Media
{
get { return _Media; }
set
{
if (AreDifferent(_Media, value))
{
_Media = value;
}
}
}
public virtual byte[] ImageThumpNail
{
get { return _ImageThumpNail; }
set
{
if (AreDifferent(_ImageThumpNail, value))
{
_ImageThumpNail = value;
}
}
}
public virtual long? ChatMessageOid
{
get { return _ChatMessageOid; }
set
{
if (AreDifferent(_ChatMessageOid, value))
{
_ChatMessageOid = value;
}
}
}
}
}

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using BS.Shared;
namespace BeWo.Data.Entities
@@ -21,14 +22,10 @@ namespace BeWo.Data.Entities
public static string PropertyName_MessageId = "MessageId";
public static string PropertyName_MediaDatei = "MediaDatei";
public static string PropertyName_MediaTyp = "MediaTyp";
private byte[] _ChatText;
private byte[] _MediaDatei;
private int _MediaTyp;
private long? _EmpfaengerPersonOid;
@@ -75,18 +72,6 @@ namespace BeWo.Data.Entities
}
}
public virtual byte[] MediaDatei
{
get { return _MediaDatei; }
set
{
if (AreDifferent(_MediaDatei, value))
{
_MediaDatei = value;
}
}
}
public virtual DateTime Uhrzeit
{
@@ -178,5 +163,6 @@ namespace BeWo.Data.Entities
}
}
}
}
}

View File

@@ -21,8 +21,7 @@
<property name="IstGelesen" column="IstGelesen" />
<property name="TeamOid" column="TeamOid" />
<property name="MessageId" column="MessageId" />
<property name="MediaDatei" column="MediaDatei" />
<property name="MediaTyp" column="MediaTyp" />
<property name="MediaTyp" column="MediaTyp" />
</class>
</hibernate-mapping>

View File

@@ -0,0 +1,26 @@
CREATE TABLE `1234567890`.`chatmediamessage` (
`Oid` BIGINT(19) NULL AUTO_INCREMENT COMMENT '',
`ChatMessageOid` BIGINT(19) NULL COMMENT '',
`Tid` INT(10) NULL COMMENT '',
`Notice` VARCHAR(1024) NULL COMMENT '',
`InsTs` DATETIME NULL COMMENT '',
`InsUser` VARCHAR(1024) NULL COMMENT '',
`Version` BIGINT(19) NULL COMMENT '',
`UdpUser` VARCHAR(256) NULL COMMENT '',
`isActive` TINYINT(4) NULL COMMENT '',
`SystemEntryID` INT(10) NULL COMMENT '',
`Media` LONGBLOB NULL DEFAULT NULL COMMENT '',
`ImageThumpNail` LONGBLOB NULL DEFAULT NULL COMMENT '',
PRIMARY KEY (`Oid`) COMMENT '');
ALTER TABLE `1234567890`.`chatmediamessage`
ADD INDEX `ChatMessage_IDX` (`ChatMessageOid` ASC) COMMENT '';
ALTER TABLE `1234567890`.`chatmessages`
DROP COLUMN `MediaDatei`;

View File

@@ -0,0 +1,39 @@
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BS.Shared.Core;
using BS.Shared.DataContracts;
namespace BeWo.Service.DCEntityMapper
{
public class ChatMediaMessageDC_ChatMediaMessage : AbstractIDCEntityMapper<ChatMediaMessage, ChatMediaMessageDC>
{
public override ChatMediaMessageDC MergeWithDC(ChatMediaMessage pEntity, ChatMediaMessageDC pDataContract)
{
pDataContract.ChatMessageOid = pEntity.ChatMessageOid;
pDataContract.ImageThumpNail = pEntity.ImageThumpNail;
pDataContract.Media = pEntity.Media;
return pDataContract;
}
public override ChatMediaMessage MergeWithEntity(ChatMediaMessageDC pDataContract, ChatMediaMessage pEntity)
{
pEntity.ChatMessageOid = pDataContract.ChatMessageOid;
pEntity.Media = pDataContract.Media;
pEntity.ImageThumpNail = Utils.ErstelleThumbnail(pDataContract.ImageThumpNail, 200, 200);
return pEntity;
}
protected override bool AreDCAndEntityEqual(ChatMediaMessageDC pDC, ChatMediaMessage pEntity)
{
if (pDC.ChatMediaMessageOid == null )
{
return false;
}
return pDC.ChatMediaMessageOid == pEntity.Oid;
}
}
}

View File

@@ -15,10 +15,9 @@ namespace BeWo.Service.DCEntityMapper
pDataContract.IsDelivered = pEntity.IsDelivered;
pDataContract.IstGelesen = pEntity.IstGelesen;
pDataContract.TeamOid = pEntity.TeamOid;
pDataContract.MessageId = pEntity.MessageId;
pDataContract.MediaDatei = pEntity.MediaDatei;
pDataContract.MessageId = pEntity.MessageId;
pDataContract.MediaTyp = pEntity.MediaTyp;
pDataContract.ChatMessagesOid = pEntity.Oid;
return pDataContract;
}
@@ -32,9 +31,10 @@ namespace BeWo.Service.DCEntityMapper
pEntity.ChatText = System.Text.Encoding.Default.GetBytes(pDataContract.ChatText);
pEntity.IstGelesen = pDataContract.IstGelesen;
pEntity.TeamOid = pDataContract.TeamOid;
pEntity.MessageId = pDataContract.MessageId;
pEntity.MediaDatei = pDataContract.MediaDatei;
pEntity.MessageId = pDataContract.MessageId;
pEntity.MediaTyp = pDataContract.MediaTyp;
pEntity.Oid = pDataContract.ChatMessagesOid;
return pEntity;
}

View File

@@ -47,6 +47,8 @@ namespace BeWo.Service.DCEntityMapper
private static ChatMessageDC_ChatMessage _ChatMessageDC_ChatMessage;
private static ChatMediaMessageDC_ChatMediaMessage _ChatMediaMessageDC_ChatMediaMessage;
private static CompactOrganisationDC_Organisation _CompactOrganisationDC_Organisation;
private static CompactPersonDC_Person _CompactPersonDC_Person;
@@ -527,6 +529,14 @@ namespace BeWo.Service.DCEntityMapper
}
}
public static ChatMediaMessageDC_ChatMediaMessage ChatMediaMessagesDC_ChatMediaMessages
{
get
{
return _ChatMediaMessageDC_ChatMediaMessage ?? (_ChatMediaMessageDC_ChatMediaMessage = new ChatMediaMessageDC_ChatMediaMessage());
}
}
public static EmployeeAPPCodeDC_EmployeeAPPCode EmployeeAPPCodeDC_EmployeeAPPCode
{
get

View File

@@ -212,6 +212,7 @@
<Compile Include="DCEntityMapper\CustomerAPPCodeDC_CustomerAPPCode.cs" />
<Compile Include="DCEntityMapper\EmployeeAPPCodeDC_EmployeeAPPCode.cs" />
<Compile Include="DCEntityMapper\ChatMessageDC_ChatMessage.cs" />
<Compile Include="DCEntityMapper\ChatMediaMessageDC_ChatMediaMessage.cs" />
<Compile Include="DCEntityMapper\MedRecordDC_MedRecord.cs" />
<Compile Include="DCEntityMapper\SignatureDC_Signature.cs" />
<Compile Include="DCEntityMapper\SupportConceptApprovalPeriodEmployeeRelDC_SupportConceptApprovalPeriod2Employee.cs" />

View File

@@ -3182,7 +3182,19 @@ namespace BeWo.Service.ServiceImplementations
{
var messages = DAOFactory.SearchDAO.FindAllChatMessages(senderOid, empfaengerOid, maxNachricht);
return MapperFactory.ChatMessagesDC_ChatMessages.MapToNewDCs(messages);
var dcList = MapperFactory.ChatMessagesDC_ChatMessages.MapToNewDCs(messages);
foreach (var msg in dcList)
{
var cmm = DAOFactory.SearchDAO.GetChatMediaMessagesForChatMessage(msg.ChatMessagesOid.Value);
if (cmm.Count > 0)
{
msg.MediaDatei = cmm[0].ImageThumpNail;
}
}
return dcList;
}
catch (Exception e)
{
@@ -3196,7 +3208,19 @@ namespace BeWo.Service.ServiceImplementations
{
var messages = DAOFactory.SearchDAO.FindAllChatMessagesFromTeam(senderOid, teamEmpfangOid,maxNachrichten);
return MapperFactory.ChatMessagesDC_ChatMessages.MapToNewDCs(messages);
var dcList = MapperFactory.ChatMessagesDC_ChatMessages.MapToNewDCs(messages);
foreach (var msg in dcList)
{
var cmm = DAOFactory.SearchDAO.GetChatMediaMessagesForChatMessage(msg.ChatMessagesOid.Value);
if (cmm.Count > 0)
{
msg.MediaDatei = cmm[0].ImageThumpNail;
}
}
return dcList;
}
catch (Exception e)
{
@@ -3220,13 +3244,37 @@ namespace BeWo.Service.ServiceImplementations
//empfangoid == teamempfang oid
var messages = DAOFactory.SearchDAO.FindNextChatMessages(senderOid, EmpfangOid ,maxMessage,messageIds,true);
return MapperFactory.ChatMessagesDC_ChatMessages.MapToNewDCs(messages);
var dcList = MapperFactory.ChatMessagesDC_ChatMessages.MapToNewDCs(messages);
foreach (var msg in dcList)
{
var cmm = DAOFactory.SearchDAO.GetChatMediaMessagesForChatMessage(msg.ChatMessagesOid.Value);
if (cmm.Count > 0)
{
msg.MediaDatei = cmm[0].ImageThumpNail;
}
}
return dcList;
}
else
{
var messages = DAOFactory.SearchDAO.FindNextChatMessages(senderOid, EmpfangOid, maxMessage,messageIds,false);
return MapperFactory.ChatMessagesDC_ChatMessages.MapToNewDCs(messages);
var dcList = MapperFactory.ChatMessagesDC_ChatMessages.MapToNewDCs(messages);
foreach (var msg in dcList)
{
var cmm = DAOFactory.SearchDAO.GetChatMediaMessagesForChatMessage(msg.ChatMessagesOid.Value);
if (cmm.Count > 0)
{
msg.MediaDatei = cmm[0].ImageThumpNail;
}
}
return dcList;
}
}
catch (Exception e)

View File

@@ -182,15 +182,14 @@ namespace BeWo.Service.ServiceImplementations
SenderPersonOid = istream.senderOid,
Uhrzeit = DateTime.Now,
IsDelivered = istream.isDeliverd,
ChatText = Encoding.UTF8.GetBytes(istream.message),
MediaDatei = BS.Shared.Core.Utils.ReadFully(istream.Stream),
ChatText = Encoding.UTF8.GetBytes(istream.message),
MediaTyp = istream.mediatype,
IstGelesen = 0,
MessageId = istream.messageid
};
istream.Stream.Close();
istream.Stream.Dispose();
if (istream.teamid != 0)
{
@@ -203,6 +202,23 @@ namespace BeWo.Service.ServiceImplementations
DAOFactory.GenericDAO.Insert(chatMessage);
byte[] ThImage = null;
if (istream.mediatype == 1)
{
ThImage = BS.Shared.Core.Utils.ReadFully(istream.Stream);
}
var chatMediaMessage = new ChatMediaMessage
{
Media = BS.Shared.Core.Utils.ReadFully(istream.Stream),
ImageThumpNail = ThImage,
ChatMessageOid = chatMessage.Oid
};
DAOFactory.GenericDAO.Insert(chatMediaMessage);
istream.Stream.Close();
istream.Stream.Dispose();
var result = MapperFactory.ChatMessagesDC_ChatMessages.MapToNewDC(chatMessage);
result.MediaDatei = null;

View File

@@ -120,7 +120,8 @@ namespace BS.Shared
FinanzDokumente = 113,
Bargeldkasse = 114,
MedRecord = 115,
ChatMessage = 116
ChatMessage = 116,
ChatMediaMessage = 117
}
public enum SystemEntryID

View File

@@ -0,0 +1,22 @@
using System;
using System.Runtime.Serialization;
namespace BS.Shared.DataContracts
{
[DataContract]
public class ChatMediaMessageDC : IDataContract
{
[DataMember]
public long? ChatMediaMessageOid { get; set; }
[DataMember]
public long? ChatMessageOid { get; set; }
[DataMember]
public byte[] Media { get; set; }
[DataMember]
public byte[] ImageThumpNail { get; set; }
}
}

View File

@@ -169,6 +169,7 @@
<Compile Include="DataContracts\CustomerAPPCodeDC.cs" />
<Compile Include="DataContracts\EmployeeAPPCodeDC.cs" />
<Compile Include="DataContracts\ChatMessageDC.cs" />
<Compile Include="DataContracts\ChatMediaMessageDC.cs" />
<Compile Include="DataContracts\MedRecordDC.cs" />
<Compile Include="DataContracts\SupportConceptApprovalPeriodEmployeeRelDC.cs" />
<Compile Include="DataContracts\WohnheimbuchungEmployeeRelationDC.cs" />