- Neuen SystemController erstellt als Endpunkt um System Infos abzufragen (z.B. genutzte Lizenzanzahl)
82 lines
2.4 KiB
C#
82 lines
2.4 KiB
C#
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Service.AI;
|
|
using BeWo.Service.ServiceImplementations;
|
|
using BeWoPlanerMobil.Service;
|
|
using BS.Shared;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.ServiceModel.Syndication;
|
|
using System.Web.Mvc;
|
|
using System.Xml;
|
|
|
|
namespace BeWoPlanerMobil.Controllers
|
|
{
|
|
public class SystemController : Controller
|
|
{
|
|
protected static readonly log4net.ILog Log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
public string Index()
|
|
{
|
|
return "Das ist die <b>Default</b> Aktion... Sie haben hier nix verloren;-)";
|
|
}
|
|
|
|
|
|
|
|
[System.Web.Http.HttpPost]
|
|
public JsonResult GetLicenseCount(string k)
|
|
{
|
|
try
|
|
{
|
|
|
|
|
|
var apikey = Request["API-KEY"];
|
|
|
|
#if DEBUG
|
|
k = "demo"; // Test mit Autismus Köln Bonn
|
|
apikey = "SfTexuvxVGhNNyASiy43AnWa97VDcDsULyRTfxuWNC3YbNyLhzk48O7Hfzs7PNiy";
|
|
#endif
|
|
if (k == null)
|
|
{
|
|
return Json("99", JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
MobileSessionFacade.Tenant = k;
|
|
|
|
var isKundennummerVorhanden = ASPHibernateSessionManager.ConfigureHibernateSessionForWebService();
|
|
|
|
if (isKundennummerVorhanden)
|
|
{
|
|
//var operationsServiceImp = new OperationsServiceImp();
|
|
|
|
//var mandator = operationsServiceImp.GetMandator2(false);
|
|
|
|
//if (mandator.Apikey == apikey)
|
|
//{
|
|
|
|
Response.AddHeader("Content-Type", "application/json"); //; charset=utf8
|
|
|
|
|
|
var employees = DAOFactory.GenericDAO.GetAllActive<Employee>();
|
|
var appUser = DAOFactory.GenericDAO.GetAllActive<ApplicationUser>();
|
|
|
|
|
|
return Json(new { success = true, employee_count = employees.Count, user_count = appUser.Count }, JsonRequestBehavior.AllowGet);
|
|
//}
|
|
}
|
|
|
|
return Json(new { success = false }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Json(new { success = false, message = "Error: " + ex.Message }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|