93 lines
2.4 KiB
C#
93 lines
2.4 KiB
C#
using BeWoPlanerMobil.Models;
|
|
using BeWoPlanerMobil.Service;
|
|
using DevExpress.Web.Internal.XmlProcessor;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
|
|
namespace BeWoPlanerMobil.Controllers
|
|
{
|
|
public class PersonController : AbstractBaseController
|
|
{
|
|
public PersonController() { }
|
|
|
|
private PersonModel _Model;
|
|
|
|
public PersonModel Model
|
|
{
|
|
get
|
|
{
|
|
if(!MobileSessionFacade.IsUserLoggedIn())
|
|
{
|
|
Logout();
|
|
return null;
|
|
}
|
|
|
|
if(_Model is null)
|
|
{
|
|
_Model = new PersonModel();
|
|
|
|
InitModel(_Model);
|
|
InitViewModel();
|
|
}
|
|
|
|
return _Model;
|
|
}
|
|
}
|
|
|
|
[Authorize]
|
|
public ActionResult Person(long? id)
|
|
{
|
|
try
|
|
{
|
|
if(!MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
|
|
{
|
|
return Logout();
|
|
}
|
|
|
|
if(id.HasValue)
|
|
{
|
|
LoadPersonToModel(id);
|
|
}
|
|
}
|
|
catch(Exception exception)
|
|
{
|
|
Log.Info("Exception: " + exception.Message + "\n" + exception.StackTrace);
|
|
if(exception.InnerException != null)
|
|
{
|
|
Log.Info("\n\nInnerException: " + exception.InnerException.Message + "\n" + exception.InnerException.StackTrace);
|
|
}
|
|
|
|
throw;
|
|
}
|
|
|
|
return View(Model);
|
|
}
|
|
|
|
private void InitViewModel()
|
|
{
|
|
if(!MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
|
|
{
|
|
Logout();
|
|
return;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void LoadPersonToModel(long? personOid)
|
|
{
|
|
if(personOid is null || (personOid.Value > 0 && false == Model.Persons.Any(p => p.PersonOid.Equals(personOid.Value))))
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
public override string SaveCollapsibleStatus(bool isOpen, string identifier)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
} |