Bessere Sortierung der Chatnachrichten
This commit is contained in:
@@ -6,8 +6,6 @@ using System.Text;
|
||||
using System.Web.Services;
|
||||
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.ServiceContracts;
|
||||
using BeWo.Service.ServiceImplementations;
|
||||
|
||||
@@ -17,6 +15,7 @@ using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BeWoPlanerAndroid
|
||||
@@ -37,6 +36,11 @@ namespace BeWoPlanerAndroid
|
||||
[WebMethod(EnableSession = true)]
|
||||
public string Login(string pTenant, string pUsername, string pPassword)
|
||||
{
|
||||
if(!SoapHibernateSessionManager.TenantExists(pTenant))
|
||||
{
|
||||
return LoginFailReason.WrongTenant.ToString();
|
||||
}
|
||||
|
||||
MobileSessionFacade.Tenant = pTenant;
|
||||
Tenant = pTenant;
|
||||
|
||||
@@ -53,12 +57,12 @@ namespace BeWoPlanerAndroid
|
||||
|
||||
if (user == null || !DAOFactory.SearchDAO.CheckIfEmployeeIsAllowedToChat(user.Employee.Person.Oid.Value))
|
||||
{
|
||||
return null;
|
||||
return LoginFailReason.Unauthorized.ToString();
|
||||
}
|
||||
|
||||
if(!DAOFactory.UserDAO.CheckPassword(user, pPassword))
|
||||
{
|
||||
return null;
|
||||
return LoginFailReason.WrongCredentials.ToString();
|
||||
}
|
||||
|
||||
MobileSessionFacade.LoggedInUser = user;
|
||||
@@ -66,7 +70,7 @@ namespace BeWoPlanerAndroid
|
||||
return user.Employee.Oid.Value + ";" + user.Employee.Person.FirstNameLastName + ";" + user.LoginName + ";" + user.Employee.Person.Oid.Value;
|
||||
}
|
||||
|
||||
return null;
|
||||
return LoginFailReason.Unknown.ToString();
|
||||
}
|
||||
|
||||
[WebMethod(EnableSession = true)]
|
||||
@@ -102,16 +106,25 @@ namespace BeWoPlanerAndroid
|
||||
|
||||
var jsonMessages = new List<ChatMessageForJson>();
|
||||
|
||||
var messages = DAOFactory.SearchDAO.FindAllChatMessagesForAndroid(pSenderPersonOid, pRecipientPersonOid, exceptions, pIsForTeam).DoForEach(dfe => jsonMessages.Add(new ChatMessageForJson(dfe.EmpfängerPersonOid, dfe.SenderPersonOid, dfe.IsDelivered, dfe.IstGelesen, dfe.TeamOid, dfe.ChatText, dfe.Uhrzeit, dfe.Oid, dfe.InsTs)));
|
||||
var messages = DAOFactory.SearchDAO.FindAllChatMessagesForAndroid(pSenderPersonOid, pRecipientPersonOid, exceptions, pIsForTeam).DoForEach(dfe => jsonMessages.Add(new ChatMessageForJson(dfe.EmpfaengerPersonOid, dfe.SenderPersonOid, dfe.IsDelivered, dfe.IstGelesen, dfe.TeamOid, dfe.ChatText, dfe.Uhrzeit, dfe.Oid, dfe.InsTs)));
|
||||
|
||||
return JsonConvert.SerializeObject(jsonMessages);
|
||||
}
|
||||
|
||||
//[WebMethod(EnableSession = true)]
|
||||
//public string GetAllUnreadMessages()
|
||||
//{
|
||||
|
||||
//}
|
||||
[WebMethod(EnableSession = true)]
|
||||
public string GetAllUnreadMessages()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
[WebMethod(EnableSession = true)]
|
||||
public string GetNewestMessages(long pRecipientPersonOid)
|
||||
{
|
||||
var jsonMessages = new List<ChatMessageForJson>();
|
||||
var liste = DAOFactory.SearchDAO.FindNewestChatMessages(pRecipientPersonOid).DoForEach(dfe => jsonMessages.Add(new ChatMessageForJson(dfe.EmpfaengerPersonOid, dfe.SenderPersonOid, dfe.IsDelivered, dfe.IstGelesen, dfe.TeamOid, dfe.ChatText, dfe.Uhrzeit, dfe.Oid, dfe.InsTs)));
|
||||
|
||||
return JsonConvert.SerializeObject(jsonMessages);
|
||||
}
|
||||
|
||||
[WebMethod(EnableSession = true)]
|
||||
public string GetServerAddressByToken(string pToken)
|
||||
|
||||
@@ -124,5 +124,15 @@ namespace BeWoPlanerAndroid.Service
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool TenantExists(string pTenant)
|
||||
{
|
||||
var path2config = HttpContext.Current.Server.MapPath("");
|
||||
|
||||
path2config = Path.Combine(path2config, ConfigurationManager.AppSettings.Get("MultitenancyPath"));
|
||||
path2config = Path.Combine(path2config, pTenant + ".config");
|
||||
|
||||
return File.Exists(path2config);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user