bug fixing

This commit is contained in:
Waldi
2016-11-15 13:35:31 +01:00
parent ea041bf9bc
commit 76635bc62b
6 changed files with 117 additions and 22 deletions

View File

@@ -1201,6 +1201,10 @@ namespace BeWo.ServiceProxy
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/ICustomerService/FindAllChatMessagesFromTeamBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
System.Collections.Generic.List<BS.Shared.DataContracts.ChatMessageDC> FindAllChatMessagesFromTeam(long senderOid, long teamEmpfangOid, int maxNachrichten);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ICustomerService/CountChatMessages", ReplyAction="http://tempuri.org/ICustomerService/CountChatMessagesResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/ICustomerService/CountChatMessagesBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
int CountChatMessages(int aktuelleAnzahl, long senderoid, long empfangoid, bool isTeam);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ICustomerService/GetNextChatMessages", ReplyAction="http://tempuri.org/ICustomerService/GetNextChatMessagesResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/ICustomerService/GetNextChatMessagesBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
System.Collections.Generic.List<BS.Shared.DataContracts.ChatMessageDC> GetNextChatMessages(long senderOid, long EmpfangOid, bool isteam, System.Collections.Generic.List<string> messageIds, int maxMessage);
@@ -1930,6 +1934,11 @@ namespace BeWo.ServiceProxy
return base.Channel.FindAllChatMessagesFromTeam(senderOid, teamEmpfangOid, maxNachrichten);
}
public int CountChatMessages(int aktuelleAnzahl, long senderoid, long empfangoid, bool isTeam)
{
return base.Channel.CountChatMessages(aktuelleAnzahl, senderoid, empfangoid, isTeam);
}
public System.Collections.Generic.List<BS.Shared.DataContracts.ChatMessageDC> GetNextChatMessages(long senderOid, long EmpfangOid, bool isteam, System.Collections.Generic.List<string> messageIds, int maxMessage)
{
return base.Channel.GetNextChatMessages(senderOid, EmpfangOid, isteam, messageIds, maxMessage);

View File

@@ -92,6 +92,8 @@ namespace BeWo.View
protected List<string> aktuelleChatMessageIDListe = new List<string>();
protected 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[]>();
@@ -1218,8 +1220,7 @@ namespace BeWo.View
MessageBox.Show("Der Server Stehet Zurzeit nicht zur verfügung. \nDie Nachrichten werden dennoch zur Datenbank übermittelt.", "Info", MessageBoxButton.OK);
SendtoServerFailes = true;
}
SaveChatMessageinDB(BeWoApp.LoggedOnUser.Employee.PersonOid, empfängeroid, msg, false, type);
SaveChatMessageinDB(BeWoApp.LoggedOnUser.Employee.PersonOid, empfängeroid, msg, false, type);
}
}
catch (Exception xe)
@@ -1239,13 +1240,25 @@ namespace BeWo.View
var guid = Guid.NewGuid();
if (type == ChatType.Team)
{
ServiceFacade.DoOperationsServiceSync(s => s.CreateNewChatMessagesDC(senderoid, empfangid, message, istZugestellt, empfangid,guid.ToString()));
{
ServiceFacade.DoOperationsServiceSync(
s =>
s.CreateNewChatMessagesDC(senderoid, empfangid, message, istZugestellt, empfangid,
guid.ToString()));
aktuelleChatMessageIDListeforTeam.Add(guid.ToString());
}
else
{
ServiceFacade.DoOperationsServiceSync(s => s.CreateNewChatMessagesDC(senderoid, empfangid, message, istZugestellt, 0, guid.ToString()));
{
ServiceFacade.DoOperationsServiceSync(
s =>
s.CreateNewChatMessagesDC(senderoid, empfangid, message, istZugestellt, 0,
guid.ToString()));
aktuelleChatMessageIDListe.Add(guid.ToString());
}
}
catch (InvalidOperationException e)
{
@@ -1906,7 +1919,7 @@ namespace BeWo.View
}
}
//fertig
private void SaveChatSpeziallMessageinDB(ChatType type, long senderoid, long empfangid, string message, bool istZugestellt, int mediatype, Stream upload)
{
UploadChatPackage chatpack;
@@ -1915,10 +1928,12 @@ namespace BeWo.View
if (type == ChatType.Team)
{
chatpack = new UploadChatPackage(empfangid, istZugestellt, mediatype, message,guid.ToString() ,senderoid, empfangid, upload);
aktuelleChatMessageIDListeforTeam.Add(guid.ToString());
}
else
{
chatpack = new UploadChatPackage(empfangid, istZugestellt, mediatype, message,guid.ToString(), senderoid, 0, upload);
aktuelleChatMessageIDListe.Add(guid.ToString());
}
try
@@ -1974,6 +1989,8 @@ namespace BeWo.View
private void OpenDokument_OnClick(object sender, RoutedEventArgs e)
{
//in diesem Bereich die Datei Runterladen
var btn = sender as System.Windows.Controls.Button;
//Process myProcess = new Process();
@@ -2121,6 +2138,9 @@ namespace BeWo.View
Chat.Items.Refresh();
}
private void WeitereNachrichten_OnMouse(object sender, MouseButtonEventArgs e)
{
long senderoid, empfaengeroid;
@@ -2132,7 +2152,7 @@ namespace BeWo.View
empfaengeroid = chatlist[0].EmpfängerPersonOid ?? 0;
List<ChatMessageDC> newitems;
if (chatlist[0].TeamOid == 0 || chatlist[0].TeamOid == null)
{
newitems =
@@ -2161,6 +2181,13 @@ namespace BeWo.View
aktuelleChatMessageIDListeforTeam.Add(item.MessageId);
}
var zahl = ServiceFacade.DoCustomerServiceSync(
s =>
s.CountChatMessages(aktuelleChatMessageIDListeforTeam.Count,senderoid,empfaengeroid,true));
if (zahl == 0)
WeitereNachrichtSchalter = true;
ShowTeamMessageInChat(newitems,false);
}
else{
@@ -2171,6 +2198,14 @@ namespace BeWo.View
aktuelleChatMessageIDListe.Add(item.MessageId);
}
var zahl = ServiceFacade.DoCustomerServiceSync(
s =>
s.CountChatMessages(aktuelleChatMessageIDListe.Count, senderoid, empfaengeroid,false));
if (zahl == 0)
WeitereNachrichtSchalter = true;
ShowMessageInChat(newitems, false,chatlist[0].SenderPersonOid,chatlist[0].EmpfängerPersonOid);
}
}
@@ -2181,6 +2216,17 @@ namespace BeWo.View
if(itemprop.MessagePersonOid == 0)
Chat.Items.RemoveAt(0);
}
if (WeitereNachrichtSchalter)
{
var itemprop = (KontakMessageBuilder)Chat.Items[0];
if (itemprop.MessagePersonOid == 0)
Chat.Items.RemoveAt(0);
WeitereNachrichtSchalter = false;
}
}
#region ChatMessagebuilder
@@ -2205,7 +2251,7 @@ namespace BeWo.View
}
else
{
Chat.Items.Add(new KontakMessageBuilder("", "------------------------ Keine weiteren Nachrichten Verfügbar -----------------------", "", 0, false, false, null));
//Chat.Items.Add(new KontakMessageBuilder("", "------------------------ Keine weiteren Nachrichten Verfügbar -----------------------", "", 0, false, false, null));
}
}
@@ -2463,7 +2509,7 @@ namespace BeWo.View
}
}
#endregion
#region ChatTeamMessageBuilder
@@ -2489,9 +2535,9 @@ namespace BeWo.View
}
else
{
Chat.Items.Add(new KontakMessageBuilder("",
/* Chat.Items.Add(new KontakMessageBuilder("",
"------------------------ Keine weiteren Nachrichten Verfügbar -----------------------",
"", 0, false, false, null));
"", 0, false, false, null));*/
}
}
@@ -2506,7 +2552,6 @@ namespace BeWo.View
x.Sort();
var person = ServiceFacade.DoCustomerServiceSync(s => s.GetPersonsById(x));
foreach (var anzeige in allTeamItems)
@@ -2572,7 +2617,6 @@ namespace BeWo.View
Chat.Items.Add(builder);
}
}
}
else
{

View File

@@ -1540,12 +1540,10 @@ namespace BeWo.Data.Access
Restrictions.Eq(ChatMessage.PropertyName_EmpfaengerPersonOid, empfaengerOid)),
Restrictions.And(
Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, empfaengerOid),
Restrictions.Eq(ChatMessage.PropertyName_EmpfaengerPersonOid, senderOid))));
c.Add(Restrictions.IsNull(ChatMessage.PropertyName_TeamOid));
c.AddOrder(Order.Desc(ChatMessage.PropertyName_Uhrzeit));
c.SetMaxResults(maxNachrichten);
Restrictions.Eq(ChatMessage.PropertyName_EmpfaengerPersonOid, senderOid))))
.Add(Restrictions.IsNull(ChatMessage.PropertyName_TeamOid))
.AddOrder(Order.Desc(ChatMessage.PropertyName_Uhrzeit))
.SetMaxResults(maxNachrichten);
return c.List<ChatMessage>();
}
@@ -1578,6 +1576,39 @@ namespace BeWo.Data.Access
return c.List<ChatMessage>();
}
public int CountChatMessages(int aktuelleZahl, long senderOid, long empfaengerOid,bool isTeam)
{
//Zähle hier alle ChatMessages
int xc;
if (!isTeam)
{
xc =
Session.QueryOver<ChatMessage>()
.Where(
message =>
message.SenderPersonOid == senderOid && message.EmpfaengerPersonOid == empfaengerOid ||
message.SenderPersonOid == empfaengerOid && message.EmpfaengerPersonOid == senderOid)
.RowCount();
}
else
{
xc =
Session.QueryOver<ChatMessage>()
.Where(
message =>
message.TeamOid == empfaengerOid)
.RowCount();
}
int ergebnis = xc - aktuelleZahl;
if (ergebnis < 0)
ergebnis = 0;
return ergebnis;
}
public IEnumerable<ChatMessage> FindAllChatMessagesFromTeam(long senderOid, long teamOid, int messlateZahl)
{
var c = CreateCriteriaIsActive<ChatMessage>()

View File

@@ -597,6 +597,10 @@ namespace BeWo.Service.ServiceContracts
[OperationContract]
List<ChatMessageDC> FindAllChatMessagesFromTeam(long senderOid, long teamEmpfangOid, int maxNachrichten);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
int CountChatMessages(int aktuelleAnzahl, long senderoid, long empfangoid, bool isTeam);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
List<ChatMessageDC> GetNextChatMessages(long senderOid, long EmpfangOid, bool isteam, List<string> messageIds, int maxMessage);

View File

@@ -3204,6 +3204,13 @@ namespace BeWo.Service.ServiceImplementations
}
}
public int CountChatMessages(int aktuelleAnzahl, long senderoid, long empfangoid, bool isTeam)
{
var anzahl = DAOFactory.SearchDAO.CountChatMessages(aktuelleAnzahl,senderoid,empfangoid,isTeam);
return anzahl;
}
public List<ChatMessageDC> GetNextChatMessages(long senderOid, long EmpfangOid,bool isteam,List<string> messageIds,int maxMessage )
{
try

View File

@@ -3152,8 +3152,8 @@ namespace BeWo.Service.ServiceImplementations
{
chatMessage.TeamOid = null;
}
DAOFactory.GenericDAO.Insert(chatMessage);
DAOFactory.GenericDAO.Insert(chatMessage);
var ChatMessagesDC = MapperFactory.ChatMessagesDC_ChatMessages.MapToNewDC(chatMessage);