This commit is contained in:
Waldi
2016-11-21 11:20:47 +01:00
parent d21ee5da2b
commit 6cfe3975b9
4 changed files with 81 additions and 29 deletions

View File

@@ -1007,7 +1007,7 @@ namespace BeWo.View
var guid = Guid.NewGuid();
byte[] outStream = a.GetDataStream(BeWoApp.LoggedOnUser.Employee.PersonOid, 0,
BeWoApp.LoggedOnUser.LoginName, abc, identi, BeWoApp.Tenant, false, true, guid.ToString());
BeWoApp.LoggedOnUser.LoginName, abc, identi, BeWoApp.Tenant, false, true, guid.ToString(),0,null);
serverStream.Write(outStream, 0, outStream.Length);
serverStream.Flush();
@@ -1234,11 +1234,11 @@ namespace BeWo.View
if (type == ChatType.Team)
{
outStream = a.GetDataStream(BeWoApp.LoggedOnUser.Employee.PersonOid, empfängeroid, BeWoApp.LoggedOnUser.LoginName, msg, DataIdentifier.Team, BeWoApp.Tenant, false,true,guid.ToString());
outStream = a.GetDataStream(BeWoApp.LoggedOnUser.Employee.PersonOid, empfängeroid, BeWoApp.LoggedOnUser.LoginName, msg, DataIdentifier.Team, BeWoApp.Tenant, false,true,guid.ToString(),0,null);
}
else
{
outStream = a.GetDataStream(BeWoApp.LoggedOnUser.Employee.PersonOid, empfängeroid, BeWoApp.LoggedOnUser.LoginName, msg, 0, BeWoApp.Tenant, false, true, guid.ToString());
outStream = a.GetDataStream(BeWoApp.LoggedOnUser.Employee.PersonOid, empfängeroid, BeWoApp.LoggedOnUser.LoginName, msg, 0, BeWoApp.Tenant, false, true, guid.ToString(),0,null);
}
serverStream.Write(outStream, 0, outStream.Length);
@@ -1927,15 +1927,17 @@ namespace BeWo.View
byte[] outStream;
byte[] mdatei = Utils.ReadFully(istream);
var guid = Guid.NewGuid();
if (type == ChatType.Team)
{
outStream = a.GetDataStream(BeWoApp.LoggedOnUser.Employee.PersonOid, empfängeroid, BeWoApp.LoggedOnUser.LoginName, filename, DataIdentifier.Team, BeWoApp.Tenant, false, true, guid.ToString()/*,sound,doku,bild*/); // 3 werte
outStream = a.GetDataStream(BeWoApp.LoggedOnUser.Employee.PersonOid, empfängeroid, BeWoApp.LoggedOnUser.LoginName, filename, DataIdentifier.Team, BeWoApp.Tenant, false, true, guid.ToString(), mediatyp, mdatei);
}
else
{
outStream = a.GetDataStream(BeWoApp.LoggedOnUser.Employee.PersonOid, empfängeroid, BeWoApp.LoggedOnUser.LoginName, filename, 0, BeWoApp.Tenant, false, true, guid.ToString()/*,sound,doku,bild*/ );
outStream = a.GetDataStream(BeWoApp.LoggedOnUser.Employee.PersonOid, empfängeroid, BeWoApp.LoggedOnUser.LoginName, filename, 0, BeWoApp.Tenant, false, true, guid.ToString(), mediatyp, mdatei);
}
serverStream.Write(outStream, 0, outStream.Length);

View File

@@ -1444,7 +1444,7 @@ namespace BeWo.View
var a = new Packet();
var guid = Guid.NewGuid();
var outStream = a.GetDataStream(BeWoApp.LoggedOnUser.Employee.PersonOid, 0, BeWoApp.LoggedOnUser.LoginName, formattedMacAddress, DataIdentifier.Login, BeWoApp.Tenant, false, true, guid.ToString());
var outStream = a.GetDataStream(BeWoApp.LoggedOnUser.Employee.PersonOid, 0, BeWoApp.LoggedOnUser.LoginName, formattedMacAddress, DataIdentifier.Login, BeWoApp.Tenant, false, true, guid.ToString(),0,null);
serverStream.Write(outStream, 0, outStream.Length);
serverStream.Flush();
@@ -1584,13 +1584,32 @@ namespace BeWo.View
case DataIdentifier.Message:
UebergebeNachricht(paket.ChatMessage, person[0].FirstName,persoid);
if (paket.MediaTyp == 0)
{
UebergebeNachricht(paket.ChatMessage, person[0].FirstName, persoid);
}
else
{
//Bearbeite weil übergebe Speziall message
UebergebeNachricht(paket.ChatMessage, person[0].FirstName, persoid);
}
break;
case DataIdentifier.Team:
UebergebeTeamNachricht(paket.ChatMessage, person[0].FirstName +" "+ person[0].LastName,paket.RecipientPersonOid);
if (paket.MediaTyp == 0)
{
UebergebeTeamNachricht(paket.ChatMessage, person[0].FirstName + " " + person[0].LastName,
paket.RecipientPersonOid);
}
else
{
//Bearbeite weil speziall ms.
UebergebeTeamNachricht(paket.ChatMessage, person[0].FirstName + " " + person[0].LastName,
paket.RecipientPersonOid);
}
break;
}

View File

@@ -3017,11 +3017,10 @@ namespace BeWo.Service.ServiceImplementations
try
{
EmployeeAPPCode newCode = new EmployeeAPPCode();
newCode.EmployeeCode = ErzeugeZufallsCode();
newCode.EmployeeCode = ErzeugeZufallsCode(1);
newCode.EmployeeOid = employeeOid;
newCode.EmployeeCodeGenDate = DateTime.Now;
var x = DAOFactory.SearchDAO.FindAllEmployeeAppCodes(employeeOid);
int ischatAktive = 0;
@@ -3034,6 +3033,9 @@ namespace BeWo.Service.ServiceImplementations
break;
}
var code = x.Last().EmployeeCode;
DeletZufallsCode(code);
newCode.IsChatAktiv = ischatAktive;
newCode.NotfallStatement = notfallstate;
@@ -3099,21 +3101,23 @@ namespace BeWo.Service.ServiceImplementations
try
{
CustomerAPPCode newCode = new CustomerAPPCode();
newCode.CustomerCode = ErzeugeZufallsCode();
newCode.CustomerCode = ErzeugeZufallsCode(2);
newCode.CustomerOid = customerOid;
newCode.CustomerCodeGenDate = DateTime.Now;
var x = DAOFactory.SearchDAO.FindAllCustomerAppCodes(customerOid);
int ischatAktive = 0;
foreach (var item in x)
{
ischatAktive = item.IsChatAktiv;
break;
}
var code = x.Last().CustomerCode;
DeletZufallsCode(code);
newCode.IsChatAktiv = ischatAktive;
DAOFactory.GenericDAO.Insert(newCode);
@@ -3182,11 +3186,8 @@ namespace BeWo.Service.ServiceImplementations
{
items.IsChatAktiv = 0;
//Lösche hier den aktuellen Code
}
}
}
DAOFactory.GenericDAO.Update(customercode);
}
catch (Exception e)
@@ -3211,14 +3212,29 @@ namespace BeWo.Service.ServiceImplementations
}
}
public string ErzeugeZufallsCode()
public void DeletZufallsCode(string code)
{
try
{
using (WebClient client = new WebClient())
{
var x = client.DownloadData("https://bewoplaner.beyondsoft.de/appvoucher.php?Action=DELETE&Voucher="+code+"&ajfho374873hfklasjf9012z44ublfkhao894zuu2ebmsadvuw48=tzrghvcjgr8t975gjliuoe8s89zdsgjb32h3qae7t");
}
}
catch (Exception e)
{
throw Utils.CreateBeWoFaultException(e);
}
}
public string ErzeugeZufallsCode(int appType)
{
String[] resultArray;
using (WebClient client = new WebClient())
{
byte[] response = client.DownloadData("https://bewoplaner.beyondsoft.de/appvoucher.php?k=1234567890&Action=CREATE&AppType=1&ajfho374873hfklasjf9012z44ublfkhao894zuu2ebmsadvuw48=tzrghvcjgr8t975gjliuoe8s89zdsgjb32h3qae7t");
byte[] response = client.DownloadData("https://bewoplaner.beyondsoft.de/appvoucher.php?k=1234567890&Action=CREATE&AppType=" + appType + "&ajfho374873hfklasjf9012z44ublfkhao894zuu2ebmsadvuw48=tzrghvcjgr8t975gjliuoe8s89zdsgjb32h3qae7t");
String result = System.Text.Encoding.ASCII.GetString(response);

View File

@@ -3,6 +3,7 @@ using System.Diagnostics;
using System.Globalization;
using System.Net.Sockets;
using System.Text;
using BS.Shared.Extensions;
namespace BS.Shared
{
@@ -15,9 +16,7 @@ namespace BS.Shared
public long RecipientPersonOid { get; set; }
public DataIdentifier DataIdentifier { get; set; }
public string ChatMessage { get; set; }
public byte[] SoundDatei { get; set; }
public byte[] DokumentenDatei { get; set; }
public byte[] BildDatei { get; set; }
public byte[] MediaDatei { get; set; }
public DateTime MessageTimeStamp { get; set; }
public string Tenant { get; set; }
public bool IsDelivered { get; set; }
@@ -25,6 +24,7 @@ namespace BS.Shared
public long ClientseitigeOid { get; set; }
public bool IsEmployee { get; set; }
public string MessageId { get; set; }
public int MediaTyp { get; set; }
public byte[] DataBuffer = new byte[1024];
@@ -45,6 +45,7 @@ namespace BS.Shared
Tenant = "";
IsEmployee = pIsEmployee;
MessageId = "";
MediaTyp = 0;
}
public Packet()
@@ -53,6 +54,7 @@ namespace BS.Shared
ChatMessage = "";
Tenant = "";
ClientName = "";
MediaTyp = 0;
}
public void GetData(string message)
@@ -73,9 +75,8 @@ namespace BS.Shared
Tenant = gesplittet[7];
var isEmployeeString = gesplittet[8];
MessageId = gesplittet[9];
//var SoundDateiAsString = gesplittet[10];
//var DokumentenDateiAsString = gesplittet[11];
//var BildDateiAsString = gesplittet[12];
var mediatypString = gesplittet[10];
var mediaDateiSring = gesplittet[11];
DataIdentifier = (DataIdentifier) Convert.ToInt32(chatIdentifierString);
@@ -85,6 +86,20 @@ namespace BS.Shared
ClientseitigeOid = Convert.ToInt64(clientseitigeOidString);
IsEmployee = Convert.ToInt32(isEmployeeString) == 1;
if (!mediatypString.IsNullOrEmpty())
{
MediaTyp = Convert.ToInt32(mediatypString);
}
else
{
MediaTyp = 0;
}
if (!mediaDateiSring.IsNullOrEmpty())
{
MediaDatei = Convert.FromBase64String(mediaDateiSring);
}
var chatNameLength = Convert.ToInt32(chatNameLengthString);
var chatMessageLength = Convert.ToInt32(chatMessageLengthString);
@@ -120,12 +135,12 @@ namespace BS.Shared
}
public byte[] GetDataStream(long senderPersonOid, long empfaengerPersonoid, string clientName, string message, DataIdentifier dataIdentifier, string tenant, bool isDelivered, bool IsEmploye, string Messageid)
public byte[] GetDataStream(long senderPersonOid, long empfaengerPersonoid, string clientName, string message, DataIdentifier dataIdentifier, string tenant, bool isDelivered, bool IsEmploye, string Messageid,int mediatyp,byte[]mediaDatei)
{
//Bewo-Client spezialisiert
var result = "";
result += senderPersonOid + ";" + empfaengerPersonoid + ";" + clientName.Length + ";" + message.Length + ";" + (int)dataIdentifier + ";" + 0 + ";" + 0 + ";" + tenant + ";" + (IsEmploye ? 1 : 0) + ";" + Messageid + ";" + clientName + message + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "" + (isDelivered ? 1 : 0);
result += senderPersonOid + ";" + empfaengerPersonoid + ";" + clientName.Length + ";" + message.Length + ";" + (int)dataIdentifier + ";" + 0 + ";" + 0 + ";" + tenant + ";" + (IsEmploye ? 1 : 0) + ";" + Messageid + ";" + clientName + message + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "" + (isDelivered ? 1 : 0) + ";" + mediatyp + ";" + Convert.ToBase64String(mediaDatei);
return Encoding.UTF8.GetBytes(result);
}