Überarbeitung Mok Session Handling

This commit is contained in:
Christian
2025-06-11 22:56:25 +02:00
parent 76f8107537
commit c95dad72bf
86 changed files with 2629 additions and 2553 deletions

View File

@@ -43,12 +43,12 @@
<TargetCulture>de-DE</TargetCulture>
<ProductName>BeWoPlaner</ProductName>
<PublisherName>ownSoft GmbH</PublisherName>
<MinimumRequiredVersion>2.0.1.265</MinimumRequiredVersion>
<MinimumRequiredVersion>2.0.1.266</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<TrustUrlParameters>true</TrustUrlParameters>
<ApplicationRevision>266</ApplicationRevision>
<ApplicationRevision>267</ApplicationRevision>
<ApplicationVersion>2.0.1.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>

View File

@@ -635,6 +635,7 @@ namespace BeWo
//IsInDeveloperMode = false;
AppSettings.ModuleAiEnabled = true;
AppSettings.ModuleAiSettingsEnabled = false;
AppSettings.IsSchedulerAllowed = true;
#endif
AppSettings.ShowDatevFields = showDatevFields;

View File

@@ -24,10 +24,10 @@ namespace BeWo.Services
public void ShowAiConversationWindow(UIContext uIContext, Dictionary<TableID, long[]> bewoObjects, long? reference_oid = null)
{
#if !DEBUG
BeWoApp.ShowInfoMessage("Diese Funktion befindet sich in der Testphase.");
return;
#endif
//#if !DEBUG
// BeWoApp.ShowInfoMessage("Diese Funktion befindet sich in der Testphase.");
// return;
//#endif
ShowWindowDialog(
cf => cf.GetAiConversationControl(uIContext, bewoObjects, reference_oid),
@@ -35,10 +35,10 @@ namespace BeWo.Services
}
public void ShowAiConversationModalViewWindow(UIContext uIContext, Dictionary<TableID, long[]> bewoObjects, long? reference_oid = null)
{
#if !DEBUG
BeWoApp.ShowInfoMessage("Diese Funktion befindet sich in der Testphase.");
return;
#endif
//#if !DEBUG
// BeWoApp.ShowInfoMessage("Diese Funktion befindet sich in der Testphase.");
// return;
//#endif
ShowModalViewWindow(cf => cf.GetAiConversationControl(uIContext, bewoObjects, reference_oid),
(wf, ctrl) => wf.GetAiModalViewWindow(uIContext, ctrl));

View File

@@ -1,19 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<appSettings>
<add key="ServerName" value="app3.bewoplaner.de"/>
<add key="ConnectionStringServer" value="127.0.0.1"/>
<add key="ConnectionStringUserId" value="root"/>
<add key="ConnectionStringPassword" value="root"/>
<add key="ConnectionStringPort" value="2206"/>
<add key="MultitenancyPath" value="..\Multitenancy\Configs"/>
<add key="CreateScriptsFolderPath" value="CreateScripts\"/>
<add key="InsertScriptName" value="inserts.sql"/>
<add key="CreateScriptName" value="create_Empty_MySQL.sql"/>
<add key="ChangesScriptName" value="Changes_alle_fuer_neue_db.sql"/>
<add key="LogFilePath" value="Logs\"/>
<add key="ServerName" value="app7.bewoplaner.de" />
<add key="ConnectionStringServer" value="127.0.0.1" />
<add key="ConnectionStringUserId" value="root" />
<add key="ConnectionStringPassword" value="root" />
<add key="ConnectionStringPort" value="2206" />
<add key="MultitenancyPath" value="..\Multitenancy\Configs" />
<add key="CreateScriptsFolderPath" value="CreateScripts\" />
<add key="InsertScriptName" value="inserts.sql" />
<add key="CreateScriptName" value="create_Empty_MySQL.sql" />
<add key="ChangesScriptName" value="Changes_alle_fuer_neue_db.sql" />
<add key="LogFilePath" value="Logs\" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -37,16 +37,45 @@
<ApplicationIcon>bdt.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="MySql.Data">
<HintPath>..\..\Lib\MySql.Data.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="MySqlConnector, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d33d3e53aa5f8c92, processorArchitecture=MSIL">
<HintPath>..\packages\MySqlConnector.2.4.0\lib\net471\MySqlConnector.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />

View File

@@ -4,7 +4,7 @@ using System.Data;
using System.IO;
using BeWoDatabaseTerminator.Security;
using BeWoDatabaseTerminator.Utils;
using MySql.Data.MySqlClient;
using MySqlConnector;
namespace BeWoDatabaseTerminator.MySql
{
@@ -118,6 +118,7 @@ namespace BeWoDatabaseTerminator.MySql
{
try
{
return;
_Connection.Open();
var command = new MySqlCommand($"DROP SCHEMA IF EXISTS `{schemaName}`;", _Connection);

View File

@@ -96,6 +96,7 @@ namespace BeWoDatabaseTerminator
private static async Task Main(string[] args)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
PinCertificate();
@@ -281,9 +282,9 @@ namespace BeWoDatabaseTerminator
private static async Task ActivateDatabase(string tenant, ContractStatus contractStatus)
{
var connectionString = $"Server={_ConnectionStringServer};Password={_ConnectionStringPassword};User ID={_ConnectionStringUserID};Port={_ConnectionStringPort}";
//connectionString += ";Charset=utf8mb4";
var isExisting = new MySqlHelper(connectionString).CheckForDatabase(tenant);
var configFilePath = Path.Combine(_MultitenancyPath, $"{tenant}.config");
// Config-Datei existiert bereits

View File

@@ -1,4 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.2" targetFramework="net472" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="8.0.2" targetFramework="net472" />
<package id="MySqlConnector" version="2.4.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net481" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="8.0.1" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>

View File

@@ -310,13 +310,22 @@
<Compile Include="Controllers\ReportViewerController.cs" />
<Compile Include="Controllers\SchedulerController.cs" />
<Compile Include="Models\AbstractModel.cs" />
<Compile Include="Models\SchedulerSessionModel.cs" />
<Compile Include="Models\MainSessionModel.cs" />
<Compile Include="Models\ReportSessionModel .cs" />
<Compile Include="Models\ReportViewerSessionModel.cs" />
<Compile Include="Models\CustomerSessionModel.cs" />
<Compile Include="Models\CustomerModel.cs" />
<Compile Include="Models\DebuggingToolsModel.cs" />
<Compile Include="Models\DevExpressSchedulerModel.cs" />
<Compile Include="Models\ExternalSignatureModel.cs" />
<Compile Include="Models\ISessionModel.cs" />
<Compile Include="Models\ReportModel.cs" />
<Compile Include="Models\ReportViewerModel.cs" />
<Compile Include="Models\SchedulerModel.cs" />
<Compile Include="Util\DcToMokMapper.cs" />
<Compile Include="Util\MokMandator.cs" />
<Compile Include="Util\MokSettings.cs" />
<Compile Include="Util\AppointmentListItem.cs" />
<Compile Include="Util\BeWoLoginState.cs" />
<Compile Include="Util\BootstrapTreeViewItem.cs" />
@@ -357,6 +366,7 @@
<Compile Include="Util\ReferenceNumberWithNotice.cs" />
<Compile Include="Util\ReportUtils\ConfirmationReceiptObject.cs" />
<Compile Include="Util\ReportUtils\Quittierungsbelegsunterschriftenobjekt.cs" />
<Compile Include="Util\ReportUtils\QuittierungsbelegsReportSettings.cs" />
<Compile Include="Util\ReportUtils\ReportTimeFrame.cs" />
<Compile Include="Util\ServiceRecord2Validation.cs" />
<Compile Include="Util\SignatureUtils.cs" />

View File

@@ -9,7 +9,7 @@
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<ProjectView>ShowAllFiles</ProjectView>
<ProjectView>ProjectFiles</ProjectView>
<WebStackScaffolding_ViewDialogWidth>600</WebStackScaffolding_ViewDialogWidth>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>

View File

@@ -2,9 +2,13 @@
using System.Diagnostics;
using System.Web.Mvc;
using System.Web.Security;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceContracts;
using BeWoPlanerMobil.Models;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
@@ -30,6 +34,8 @@ namespace BeWoPlanerMobil.Controllers
public static readonly string IsSessionTimedOut = "isSessionTimedOut";
private UserDC loggedInUserDc = null;
private EmployeeDC loggedInEmployeeDC = null;
protected ActionResult Logout()
{
@@ -45,9 +51,60 @@ namespace BeWoPlanerMobil.Controllers
return RedirectToActionPermanent("Index", "Login", new {tenant = MobileSessionFacade.Tenant});
}
protected UserDC GetUser()
protected virtual void InitModel(AbstractModel model)
{
return UserService.LoadUser(MobileSessionFacade.LoggedInUser.Oid.Value);
model.LoggedInUser = LoggedInUser;
model.LoggedInEmployee = LoggedInEmployee;
model.Mandator = Mandator;
if (model.SessionModel != null)
{
String sessionkey = model.GetType().Name;
if (Session[sessionkey] is null)
{
Session[sessionkey] = model.SessionModel;
}
else
{
model.SessionModel = (ISessionModel)Session[sessionkey];
}
}
}
protected UserDC LoggedInUser
{
get
{
if (loggedInUserDc == null)
{
var user = DAOFactory.GenericDAO.LoadByID<ApplicationUser>(MobileSessionFacade.LoggedInUserOid.Value);
loggedInUserDc = MapperFactory.UserDC_User.MapToNewDC(user);
loggedInEmployeeDC = MapperFactory.EmployeeDC_Employee.MapToNewDC(user.Employee);
}
return loggedInUserDc;
}
}
protected EmployeeDC LoggedInEmployee
{
get
{
if (loggedInEmployeeDC == null)
{
var tmp = LoggedInUser; //Sets employee
}
return loggedInEmployeeDC;
}
}
protected MokMandator Mandator
{
get
{
return MobileSessionFacade.Mandator;
}
}
protected override void OnActionExecuting(ActionExecutingContext filterContext)
@@ -62,12 +119,13 @@ namespace BeWoPlanerMobil.Controllers
{
get
{
var timeUntilUILock = BS.Shared.Settings.ApplicationSettings.TimeUntilUILock;
//var timeUntilUILock = BS.Shared.Settings.ApplicationSettings.TimeUntilUILock;
if(timeUntilUILock > 0 && System.Web.HttpContext.Current.Session.Timeout > timeUntilUILock)
{
return timeUntilUILock;
}
//if(timeUntilUILock > 0 && System.Web.HttpContext.Current.Session.Timeout > timeUntilUILock)
//{
// return timeUntilUILock;
//}
//var mokSessionTimeout = UserSettingsUtils.GetSettingValueAsInteger(Mandator.Settings, SettingsKeys.MoKSessionTimeout, 20);
return System.Web.HttpContext.Current.Session.Timeout;
}
@@ -76,15 +134,14 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult UpdateApplicationSettings(string pKey, string pValue)
{
var userSettings = GetUser().Settings;
var userSettings = LoggedInUser.Settings;
UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, pKey, pValue, userSettings);
var loggedInUser = GetUser();
if(loggedInUser?.UserOid.HasValue ?? false)
if(LoggedInUser?.UserOid.HasValue ?? false)
{
UserService.UpdateUserSettings(loggedInUser.UserOid.Value, userSettings);
UserService.UpdateUserSettings(LoggedInUser.UserOid.Value, userSettings);
}
return RedirectToAction("Main");
@@ -93,11 +150,11 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public void UpdateUserSettingsWithoutReload(string key, string value)
{
var userSettings = GetUser().Settings;
var userSettings = LoggedInUser.Settings;
UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, key, value, userSettings);
var loggedInUser = GetUser();
var loggedInUser = LoggedInUser;
if(loggedInUser?.UserOid.HasValue ?? false)
{

View File

@@ -20,6 +20,10 @@ namespace BeWoPlanerMobil.Controllers
{
public class CustomerController : ReportBaseController
{
public CustomerController()
{
}
private CustomerModel _Model;
public CustomerModel Model
{
@@ -31,20 +35,33 @@ namespace BeWoPlanerMobil.Controllers
return null;
}
if (((CustomerModel) Session[ModelSessionConstants.CustomerModelKey])?.Employee is null)
if (_Model == null)
{
_Model = new CustomerModel{Employee = MobileSessionFacade.LoggedInEmployee};
Session[ModelSessionConstants.CustomerModelKey] = _Model;
}
else
{
_Model = (CustomerModel)Session[ModelSessionConstants.CustomerModelKey];
_Model = new CustomerModel();
InitModel(_Model);
InitViewModel();
}
//if (((CustomerModel) Session[ModelSessionConstants.CustomerModelKey])?.LoggedInEmployee is null)
//{
// _Model = new CustomerModel();
// InitModel(_Model);
// Session[ModelSessionConstants.CustomerModelKey] = _Model;
//}
//else
//{
// _Model = (CustomerModel)Session[ModelSessionConstants.CustomerModelKey];
//}
return _Model;
}
}
[Authorize]
public ActionResult Customer(long? id)
{
@@ -55,12 +72,6 @@ namespace BeWoPlanerMobil.Controllers
return Logout();
}
var customerFilter = MobileUserSettingsUtils.GetSettingValueAsEnum(AbstractModel.UserSettings, SettingsKeys.CustomerFilterCustomers, CustomerFilterEnum.MyCustomer);
Model.SelectedCustomerFilter = customerFilter;
InitViewModel();
if(id.HasValue)
{
LoadCustomerToModel(id);
@@ -82,27 +93,70 @@ namespace BeWoPlanerMobil.Controllers
private void InitViewModel()
{
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
if(!MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
{
Logout();
return;
}
if(Model.Employee?.EmployeeOid.HasValue ?? false)
if (Model.LoggedInEmployee?.EmployeeOid.HasValue ?? false)
{
Model.Customers = EmployeeService.GetActiveCustomersForEmployee(Model.Employee.EmployeeOid.Value, Model.SelectedCustomerFilter).OrderBy(customer => customer.LastName).ToList();
Model.Customers = EmployeeService.GetActiveCustomersForEmployee(Model.LoggedInEmployee.EmployeeOid.Value, Model.SelectedCustomerFilter).OrderBy(customer => customer.LastName).ToList();
}
else
{
Model.Customers = new List<CompactCustomerDC>();
}
if(AbstractModel.IsAllowedToSeeMedikamentenliste)
if (Model.CustomerSessionModel.SelectedCustomerOid.HasValue)
{
Model.SelectedCustomer = CustomerService.LoadCustomer(Model.CustomerSessionModel.SelectedCustomerOid.Value);
}
if (Model.IsAllowedToSeeMedikamentenliste)
{
Model.ReportTypes = new List<CustomerReportType> { CustomerReportType.Medikamentenliste, CustomerReportType.Bedarfsmedikation, CustomerReportType.Historie };
}
Model.AllAbsenceReasons = AbstractModel.HasRightToViewCustomerAbsenceTimes ? CustomerService.GetAllAbsenceReasons() : new List<AbsenceReasonDC>();
Model.AllAbsenceReasons = Model.HasRightToViewCustomerAbsenceTimes ? CustomerService.GetAllAbsenceReasons() : new List<AbsenceReasonDC>();
if (Model.CustomerSessionModel.SelectedAbsenceTimeOid.HasValue && Model.SelectedCustomer != null)
{
Model.SelectedAbsenceTime = Model.SelectedCustomer.AbsenceTimes.FirstOrDefault(absenceTime => absenceTime.AbsenceTimeOid.HasValue && absenceTime.AbsenceTimeOid.Value.Equals(Model.CustomerSessionModel.SelectedAbsenceTimeOid.Value));
}
ReloadBargeldkassen();
if (Model.CustomerSessionModel.SelectedBargeldkasseOid.HasValue && Model.Bargeldkassen != null)
{
Model.SelectedBargeldkasse = Model.Bargeldkassen.FirstOrDefault(bargeldkasse => bargeldkasse.BargeldkassenOid.HasValue && bargeldkasse.BargeldkassenOid.Value.Equals(Model.CustomerSessionModel.SelectedBargeldkasseOid.Value));
}
if (Model.CustomerSessionModel.SelectedBargeldtransaktionOid.HasValue)
{
var kassenbuch = GetBargeldkasseByTransaktionsOid(Model.CustomerSessionModel.SelectedBargeldtransaktionOid.Value);
var zahlung = kassenbuch?.Bargeldtransaktionen.FirstOrDefault(bargeldtransaktion => bargeldtransaktion.BargeldtransaktionOid.Equals(Model.CustomerSessionModel.SelectedBargeldtransaktionOid.Value));
Model.SelectedBargeldtransaktion = zahlung;
}
if (Model.SelectedCustomer != null)
{
Model.FolderTree = OperationsService.GetFolderTree(TableID.Customer, Model.SelectedCustomer.CustomerOid.Value);
Model.ICD10Diagnosen = OperationsService.GetDiagiosisStringsForICD10Codes(Model.SelectedCustomer.ICD10DiagnosisCodes);
}
var customerFilter = MobileUserSettingsUtils.GetSettingValueAsEnum(Model.UserSettings, SettingsKeys.CustomerFilterCustomers, CustomerFilterEnum.MyCustomer);
Model.SelectedCustomerFilter = customerFilter;
}
private void LoadCustomerToModel(long? customerOid)
@@ -112,31 +166,30 @@ namespace BeWoPlanerMobil.Controllers
return;
}
if(customerOid == -1)
if (customerOid == -1)
{
Model.SelectedCustomer = null;
Model.SelectedCustomerOid = null;
Model.FolderTree = null;
Model.ICD10Diagnosen = null;
Model.Bargeldkassen = new List<BargeldkassenDC>();
Model.BargeldtransaktionshistoryEntries = new List<BargeldtransaktionshistoryDC>();
Model.TransaktionsOid2HasHistoryEntries = new Dictionary<long, bool>();
Model.SelectedBargeldtransaktion = null;
Model.CustomerSessionModel.ResetValues();
//Model.SelectedCustomer = null;
//Model.SelectedCustomerOid = null;
//Model.SelectedAbsenceTimeOid = null;
//Model.SelectedAbsenceReason = null;
//Model.FolderTree = null;
//Model.ICD10Diagnosen = null;
//Model.Bargeldkassen = new List<BargeldkassenDC>();
//Model.BargeldtransaktionshistoryEntries = new List<BargeldtransaktionshistoryDC>();
//Model.TransaktionsOid2HasHistoryEntries = new Dictionary<long, bool>();
//Model.SelectedBargeldtransaktion = null;
}
else
{
Model.FolderTree = OperationsService.GetFolderTree(TableID.Customer, customerOid.Value);
Model.SelectedCustomerOid = customerOid;
var customer = CustomerService.LoadCustomer(customerOid.Value);
if(!(customer is null))
if (Model.SelectedCustomerOid.HasValue && Model.SelectedCustomerOid != customerOid)
{
Model.ICD10Diagnosen = OperationsService.GetDiagiosisStringsForICD10Codes(customer.ICD10DiagnosisCodes);
Model.CustomerSessionModel.ResetValues();
}
Model.SelectedCustomer = customer;
ReloadBargeldkassen();
Model.SelectedCustomerOid = customerOid;
}
}
@@ -146,7 +199,7 @@ namespace BeWoPlanerMobil.Controllers
{
try
{
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
if(!MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer"))
{
TempData[TempDataConstants.DoLogoutKey] = true;
return Logout();
@@ -295,7 +348,7 @@ namespace BeWoPlanerMobil.Controllers
ObjectOid = Model.SelectedCustomerOid,
BinaryData = fileData,
FileAttachmentType = FileAttachmentType.NotSpecified,
InsertedBy = $"{Model.Employee.FirstName} {Model.Employee.LastName}",
InsertedBy = $"{Model.LoggedInEmployee.FirstName} {Model.LoggedInEmployee.LastName}",
InsertedOn = DateTime.Now
};
@@ -409,7 +462,7 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
var isAllowedToEdit = MobileSessionFacade.LoggedInUser.CheckForAtLeastOneRight(new List<UserRightType> { UserRightType.CustomerView_Edit, UserRightType.EditAll });
var isAllowedToEdit = LoggedInUser.CheckForAtLeastOneRight(new List<UserRightType> { UserRightType.CustomerView_Edit, UserRightType.EditAll });
if(isAllowedToEdit && Model.SelectedCustomer != null)
{
@@ -557,7 +610,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult ShowMedList(int reportType)
{
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer") || !AbstractModel.IsAllowedToSeeMedikamentenliste)
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer") || !Model.IsAllowedToSeeMedikamentenliste)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("BeWoReportPartial", Model);
@@ -573,7 +626,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult ShowHistoricalMedList(long medListOid)
{
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer") || !AbstractModel.IsAllowedToSeeMedikamentenliste)
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer") || !Model.IsAllowedToSeeMedikamentenliste)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("BeWoReportPartial", Model);
@@ -589,7 +642,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult DeleteHistoricalMedList(long medListOid)
{
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer") || !AbstractModel.IsAllowedToSeeMedikamentenliste)
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer") || !Model.IsAllowedToSeeMedikamentenliste)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("CustomerMedListPartial", Model);
@@ -702,9 +755,10 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
var selectedBargeldkasse = Model.Bargeldkassen.FirstOrDefault(bargeldkasse => bargeldkasse.BargeldkassenOid.HasValue && bargeldkasse.BargeldkassenOid.Value.Equals(oid));
//var selectedBargeldkasse = Model.Bargeldkassen.FirstOrDefault(bargeldkasse => bargeldkasse.BargeldkassenOid.HasValue && bargeldkasse.BargeldkassenOid.Value.Equals(oid));
Model.SelectedBargeldkasse = selectedBargeldkasse;
//Model.SelectedBargeldkasse = selectedBargeldkasse;
Model.SelectedBargeldkasseOid = oid;
return LeerzeichenFuerGetMethoden;
}
@@ -718,7 +772,8 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
Model.SelectedBargeldkasse = null;
//Model.SelectedBargeldkasse = null;
Model.SelectedBargeldkasseOid = null;
return LeerzeichenFuerGetMethoden;
}
@@ -732,7 +787,7 @@ namespace BeWoPlanerMobil.Controllers
return PartialView("CustomerBargeldkassenFormPartial", Model);
}
Model.SelectedBargeldkasse = null;
Model.SelectedBargeldkasseOid = null;
Model.SelectedAuszahlungsintervall = 0;
return PartialView("CustomerBargeldkassenFormPartial", Model);
@@ -747,6 +802,7 @@ namespace BeWoPlanerMobil.Controllers
return PartialView("CustomerBargeldkassenFormPartial", Model);
}
Model.SelectedBargeldkasseOid = bargeldkassenOid;
Model.SelectedBargeldkasse = Model.Bargeldkassen.FirstOrDefault(bargeldkasse => bargeldkasse.BargeldkassenOid.HasValue && bargeldkasse.BargeldkassenOid.Value.Equals(bargeldkassenOid));
if(Model.SelectedBargeldkasse != null)
@@ -778,7 +834,7 @@ namespace BeWoPlanerMobil.Controllers
OperationsService.DeactivateBargeldkasse(bargeldkassenOid, bargeldkassenVersion);
ReloadBargeldkassen();
//ReloadBargeldkassen();
return RedirectToActionPermanent("Customer");
}
@@ -796,7 +852,7 @@ namespace BeWoPlanerMobil.Controllers
var name = formCollection["bargeldkassenname"];
var rawAnfangsbestand = formCollection["bargeldkassenanfangsbestand"];
decimal.TryParse(rawAnfangsbestand, out var anfangsbestand);
decimal.TryParse(rawAnfangsbestand.Replace(".", ","), out var anfangsbestand);
var auszahlungsintervall = (Auszahlungsintervall) Model.SelectedAuszahlungsintervall;
@@ -813,7 +869,7 @@ namespace BeWoPlanerMobil.Controllers
OperationsService.InsertNewBargeldkasse(newBargeldkasse);
LoadCustomerToModel(Model.SelectedCustomerOid);
//LoadCustomerToModel(Model.SelectedCustomerOid);
}
else
{
@@ -830,10 +886,11 @@ namespace BeWoPlanerMobil.Controllers
OperationsService.UpdateBargeldkasse(bargeldkasse);
LoadCustomerToModel(Model.SelectedCustomerOid);
//LoadCustomerToModel(Model.SelectedCustomerOid);
}
Model.SelectedBargeldkasse = null;
//Model.SelectedBargeldkasse = null;
Model.SelectedBargeldkasseOid = null;
return RedirectToActionPermanent("Customer");
}
@@ -930,8 +987,9 @@ namespace BeWoPlanerMobil.Controllers
{
Model.SelectedTransaktionsart = (int) zahlung.Zahlungstyp;
}
Model.SelectedBargeldkasse = kassenbuch;
//Model.SelectedBargeldkasse = kassenbuch;
Model.SelectedBargeldkasseOid = kassenbuch.BargeldkassenOid;
return PartialView("CustomerBargeldtransaktionenFormPartial", Model);
}
@@ -961,7 +1019,8 @@ namespace BeWoPlanerMobil.Controllers
Model.SelectedBargeldtransaktion = null;
Model.SelectedTransaktionsart = 0;
Model.SelectedBargeldkasse = Model.Bargeldkassen.FirstOrDefault(bk => bk.BargeldkassenOid.HasValue && bk.BargeldkassenOid.Equals(bargeldkassenOid));
Model.SelectedBargeldkasseOid = bargeldkassenOid;
//Model.SelectedBargeldkasse = Model.Bargeldkassen.FirstOrDefault(bk => bk.BargeldkassenOid.HasValue && bk.BargeldkassenOid.Equals(bargeldkassenOid));
return PartialView("CustomerBargeldtransaktionenFormPartial", Model);
}
@@ -1027,7 +1086,7 @@ namespace BeWoPlanerMobil.Controllers
OperationsService.UpdateBargeldkasse(bargeldkasse);
Model.SelectedBargeldkasse = null;
Model.SelectedBargeldkasseOid = null;
ReloadBargeldkassen();
@@ -1069,7 +1128,7 @@ namespace BeWoPlanerMobil.Controllers
return PartialView("CustomerBargeldkassen", Model);
}
ReloadBargeldkassen();
// ReloadBargeldkassen();
return PartialView("CustomerBargeldkassen", Model);
}
@@ -1125,7 +1184,7 @@ namespace BeWoPlanerMobil.Controllers
OperationsService.UpdateBargeldkasse(bargeldkasse);
}
ReloadBargeldkassen();
//ReloadBargeldkassen();
return PartialView("CustomerBargeldkassen", Model);
}
@@ -1170,7 +1229,7 @@ namespace BeWoPlanerMobil.Controllers
OperationsService.DeleteBargeldtransaktionSignature(signatureOid.Value);
OperationsService.UpdateBargeldkasse(bargeldkasse);
ReloadBargeldkassen();
//ReloadBargeldkassen();
}
return PartialView("CustomerBargeldkassen", Model);
@@ -1276,7 +1335,7 @@ namespace BeWoPlanerMobil.Controllers
LoadCustomerToModel(customer.CustomerOid);
Model.SelectedAbsenceTime = null;
Model.SelectedAbsenceReason = -1;
Model.SelectedAbsenceReasonOid = -1;
return RedirectToActionPermanent("Customer", new { id = customer.CustomerOid });
}
@@ -1305,8 +1364,8 @@ namespace BeWoPlanerMobil.Controllers
//return "Es ist ein Fehler bei der Auswahl der zu bearbeitenden Abwesenheit aufgetreten.<br />Bitte wenden Sie sich an Ihren Systemadministrator.";
}
Model.SelectedAbsenceTime = selectedAbsenceTime;
Model.SelectedAbsenceReason = selectedAbsenceTime.Reason.AbsenceReasonOid;
Model.SelectedAbsenceTimeOid = absenceTimeOid;
Model.SelectedAbsenceReasonOid = selectedAbsenceTime.Reason.AbsenceReasonOid;
//return LeerzeichenFuerGetMethoden;
return RedirectToActionPermanent("Customer", Model);
@@ -1322,8 +1381,8 @@ namespace BeWoPlanerMobil.Controllers
return "Es ist ein Fehler bei der Auswahl der zu bearbeitenden Abwesenheit aufgetreten.<br />Bitte wenden Sie sich an Ihren Systemadministrator.";
}
Model.SelectedAbsenceTime = selectedAbsenceTime;
Model.SelectedAbsenceReason = selectedAbsenceTime.Reason.AbsenceReasonOid;
Model.SelectedAbsenceTimeOid = absenceTimeOid;
Model.SelectedAbsenceReasonOid = selectedAbsenceTime.Reason.AbsenceReasonOid;
return LeerzeichenFuerGetMethoden;
}
@@ -1342,8 +1401,8 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public string DeselectAbsenceTime()
{
Model.SelectedAbsenceTime = null;
Model.SelectedAbsenceReason = -1;
Model.SelectedAbsenceTimeOid = null;
Model.SelectedAbsenceReasonOid = -1;
return LeerzeichenFuerGetMethoden;
}

View File

@@ -18,16 +18,23 @@ namespace BeWoPlanerMobil.Controllers
return null;
}
if(((DebuggingToolsModel)Session[ModelSessionConstants.DebuggingToolsModelKey])?.Employee == null)
if (_Model == null)
{
_Model = new DebuggingToolsModel { Employee = MobileSessionFacade.LoggedInEmployee };
Session[ModelSessionConstants.DebuggingToolsModelKey] = _Model;
}
else
{
_Model = (DebuggingToolsModel) Session[ModelSessionConstants.DebuggingToolsModelKey];
_Model = new DebuggingToolsModel();
InitModel(_Model);
}
//if (((DebuggingToolsModel)Session[ModelSessionConstants.DebuggingToolsModelKey])?.LoggedInEmployee is null)
//{
// _Model = new DebuggingToolsModel();
// InitModel(_Model);
// Session[ModelSessionConstants.DebuggingToolsModelKey] = _Model;
//}
//else
//{
// _Model = (DebuggingToolsModel) Session[ModelSessionConstants.DebuggingToolsModelKey];
//}
return _Model;
}
}

View File

@@ -22,15 +22,21 @@ namespace BeWoPlanerMobil.Controllers
return null;
}
if (((DevExpressSchedulerModel)Session["DevExpressSchedulerModel"])?.Employee == null)
if (_Model == null)
{
_Model = new DevExpressSchedulerModel { Employee = MobileSessionFacade.LoggedInEmployee };
Session["DevExpressSchedulerModel"] = _Model;
}
else
{
_Model = (DevExpressSchedulerModel)Session["DevExpressSchedulerModel"];
_Model = new DevExpressSchedulerModel();
InitModel(_Model);
}
//if (((DevExpressSchedulerModel)Session["DevExpressSchedulerModel"])?.LoggedInEmployee is null)
//{
// _Model = new DevExpressSchedulerModel();
// InitModel(_Model);
// Session["DevExpressSchedulerModel"] = _Model;
//}
//else
//{
// _Model = (DevExpressSchedulerModel)Session["DevExpressSchedulerModel"];
//}
return _Model;
}
@@ -46,7 +52,7 @@ namespace BeWoPlanerMobil.Controllers
var appointments = KalenderService.LoadFilteredAppointments(
true,
Model?.Employee?.EmployeeOid ?? 1,
Model?.LoggedInEmployee?.EmployeeOid ?? 1,
DateTime.Today.AddDays(-60),
DateTime.Today.AddDays(60),
new List<long>(),

View File

@@ -31,16 +31,22 @@ namespace BeWoPlanerMobil.Controllers
{
get
{
if((ExternalSignatureModel) Session["ExternalSignatureModel"] is null)
if (_Model == null)
{
_Model = new ExternalSignatureModel();
Session["ExternalSignatureModel"] = _Model;
}
else
{
_Model = (ExternalSignatureModel) Session["ExternalSignatureModel"];
}
//if((ExternalSignatureModel) Session["ExternalSignatureModel"] is null)
//{
// _Model = new ExternalSignatureModel();
// Session["ExternalSignatureModel"] = _Model;
//}
//else
//{
// _Model = (ExternalSignatureModel) Session["ExternalSignatureModel"];
//}
return _Model ?? new ExternalSignatureModel();
}
}

View File

@@ -52,16 +52,16 @@ namespace BeWoPlanerMobil.Controllers
}
}
Log.Info($"LoginController.Index(): Loggedin User: {MobileSessionFacade.LoggedInUser.LoginName}");
var user = LoggedInUser;
Log.Info($"LoginController.Index(): Loggedin User: {user.LoginName}");
MobileSessionFacade.Mandator = OperationsService.GetMandator();
MobileSessionFacade.Mandator = DcToMokMapper.CreateMandator(OperationsService.GetMandator());
var viewServiceRecords = AbstractModel.HasRightToSeeServiceRecords;//AbstractModel.CheckRight(UserRightType.ServiceRecordView_View);
var viewAll = AbstractModel.CheckRight(UserRightType.ViewAll);
var user = UserService.LoadUser(MobileSessionFacade.LoggedInUser.Oid.Value);
var userGroups = user.UserGroups;
var viewServiceRecords = user.HasRight(UserRightType.ServiceRecordView_View) && user.HasRight(UserRightType.ServiceRecordView_Create);
var viewAll = user.HasRight(UserRightType.ViewAll);
//if(!MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecordView_View))) &&
// !MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ViewAll))))
if(!viewServiceRecords && !viewAll)
@@ -72,7 +72,7 @@ namespace BeWoPlanerMobil.Controllers
return View("Index");
}
FormsAuthentication.SetAuthCookie(MobileSessionFacade.LoggedInUser.LoginName, true);
FormsAuthentication.SetAuthCookie(LoggedInUser.LoginName, true);
ViewData[LoginErrorIndex] = string.Empty;
var keks = new HttpCookie(MobileSessionFacade.CookieName) { Value = MobileSessionFacade.Tenant, Expires = DateTime.Now.AddDays(1) };
@@ -124,11 +124,11 @@ namespace BeWoPlanerMobil.Controllers
Log.Info($"LoginController.Index(): Login failed! Tenant = {MobileSessionFacade.Tenant}");
//ViewData[LoginErrorIndex] = Request.Browser.Browser.Equals("InternetExplorer") ?
// "Dieser Browser ist nicht mit dem mobilen BeWoPlaner kompatibel. Bitte benutzen Sie einen anderen Browser als den Internet Explorer." :
// "Die Anmeldung ist fehlgeschlagen. Bitte überprüfen Sie Benutzername und Passwort.";
ViewData[LoginErrorIndex] = Request.Browser.Browser.Equals("InternetExplorer") ?
"Dieser Browser ist nicht mit dem mobilen BeWoPlaner kompatibel. Bitte benutzen Sie einen anderen Browser als den Internet Explorer." :
"Die Anmeldung ist fehlgeschlagen. Bitte überprüfen Sie Benutzername und Passwort.";
return View("Index");
return View("Index");
}
catch(Exception e)
{

File diff suppressed because it is too large Load Diff

View File

@@ -14,6 +14,7 @@ using System.Linq;
using System.Text;
using System.Web.Mvc;
using BeWo.Service.Plugins;
using DevExpress.XtraReports.UI;
// Controller des Quittierungsbelegsmoduls
@@ -33,20 +34,83 @@ namespace BeWoPlanerMobil.Controllers
return null;
}
if(((ReportModel) Session[ModelSessionConstants.ReportModelKey])?.Employee is null)
if (_Model == null)
{
_Model = new ReportModel {Employee = MobileSessionFacade.LoggedInEmployee, ReportCreator = GetReportCreator()};
Session[ModelSessionConstants.ReportModelKey] = _Model;
}
else
{
_Model = (ReportModel) Session[ModelSessionConstants.ReportModelKey];
_Model = new ReportModel { ReportCreator = GetReportCreator() };
InitModel(_Model);
InitViewModel();
}
//if (((ReportModel) Session[ModelSessionConstants.ReportModelKey])?.LoggedInEmployee is null)
//{
// _Model = new ReportModel {ReportCreator = GetReportCreator()};
// InitModel(_Model);
// Session[ModelSessionConstants.ReportModelKey] = _Model;
//}
//else
//{
// _Model = (ReportModel) Session[ModelSessionConstants.ReportModelKey];
//}
return _Model;
}
}
private void InitViewModel()
{
var month = DateTime.Today.Month;
var year = DateTime.Today.Year;
var first = new DateTime(year, month, 1).AddMonths(-1);
var last = first.AddMonths(1).AddDays(-1);
Model.SelectedYear = Model.SelectedYear ?? first.Year;
Model.SelectedMonth = Model.SelectedMonth ?? first.Month;
Model.SelectedStartDay = Model.SelectedStartDay ?? first.Day;
Model.SelectedEndDay = Model.SelectedEndDay ?? last.Day;
InitFilterCombo();
Model.Customers.Clear();
Model.Customers = CustomerService.GetAllActiveCustomersForEmployee();
Model.Employees = EmployeeService.GetActiveCompactEmployeesForEmployee(LoggedInEmployee.EmployeeOid.Value);
Model.ServiceCategories = OperationsService.GetAllServiceCategories();
Model.Organisations = CustomerService.GetAllCostBearerCompact();
Model.Organisations.Sort((x, y) => string.Compare(x.Name, y.Name, StringComparison.CurrentCulture));
Model.AllTeams = EmployeeService.GetAllActiveCompactTeamsForEmployee(LoggedInEmployee.EmployeeOid.Value);
Model.Dokutypes = ValueListService.GetAllValueListEntrysByType(ValueListEntryType.DocumentType);
if (Model.Dokutypes != null)
{
Model.Dokutypes = Model.Dokutypes.OrderBy(s => s.ValueListEntryOid).ToArray();
}
if (Model.SelectedCustomerOid.HasValue)
{
Model.SelectedCustomer = Model.Customers.FirstOrDefault(customer => customer.CustomerOid == Model.SelectedCustomerOid.Value);
}
if (Model.SelectedEmployeeOid.HasValue)
{
Model.SelectedEmployee = Model.Employees.FirstOrDefault(employee => employee.EmployeeOid.Equals(Model.SelectedEmployeeOid.Value));
}
if (Model.SelectedTeamOid.HasValue)
{
Model.SelectedTeam = Model.AllTeams.FirstOrDefault(team => team.TeamOid == Model.SelectedTeamOid.Value);
}
if (Model.SelectedOrganisationOid.HasValue)
{
Model.SelectedOrganisation= Model.Organisations.FirstOrDefault(organisation => organisation.OrganisationOid.Equals(Model.SelectedOrganisationOid.Value));
}
if (Model.SelectedServiceCategoryOid.HasValue)
{
Model.SelectedServiceCategory = Model.ServiceCategories.FirstOrDefault(serviceCategory => serviceCategory.ServiceCategoryOid == Model.SelectedServiceCategoryOid.Value);
}
}
private static AbstractReportCreator GetReportCreator()
{
var creator = PluginLoader.FindClass<DefaultReportCreator>();
@@ -68,7 +132,7 @@ namespace BeWoPlanerMobil.Controllers
return Logout();
}
if(!AbstractModel.HasRightToViewQuittierungsbelege)
if(!_Model.HasRightToViewQuittierungsbelege)
{
return RedirectToActionPermanent("Main", "Main");
}
@@ -82,12 +146,12 @@ namespace BeWoPlanerMobil.Controllers
{
try
{
if(!MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer") || Model?.Employee?.EmployeeOid is null)
if(!MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer") || Model?.LoggedInEmployee?.EmployeeOid is null)
{
return Logout();
}
if(!AbstractModel.HasRightToViewQuittierungsbelege)
if(!Model.HasRightToViewQuittierungsbelege)
{
return RedirectToActionPermanent("Main", "Main");
}
@@ -98,36 +162,7 @@ namespace BeWoPlanerMobil.Controllers
return Logout();
}
var month = DateTime.Today.Month;
var year = DateTime.Today.Year;
var first = new DateTime(year, month, 1).AddMonths(-1);
var last = first.AddMonths(1).AddDays(-1);
Model.SelectedYear = Model.SelectedYear ?? first.Year;
Model.SelectedMonth = Model.SelectedMonth ?? first.Month;
Model.SelectedStartDay = Model.SelectedStartDay ?? first.Day;
Model.SelectedEndDay = Model.SelectedEndDay ?? last.Day;
InitFilterCombo();
Model.Customers.Clear();
Model.Customers = CustomerService.GetAllActiveCustomersForEmployee();
Model.Employees = EmployeeService.GetActiveCompactEmployeesForEmployee(MobileSessionFacade.LoggedInCompactEmployee.EmployeeOid);
Model.ServiceCategories = OperationsService.GetAllServiceCategories();
Model.Organisations = CustomerService.GetAllCostBearerCompact();
Model.Organisations.Sort((x, y) => string.Compare(x.Name, y.Name, StringComparison.CurrentCulture));
Model.AllTeams = EmployeeService.GetAllActiveCompactTeamsForEmployee(MobileSessionFacade.LoggedInEmployee.EmployeeOid);
Model.Dokutypes = ValueListService.GetAllValueListEntrysByType(ValueListEntryType.DocumentType);
if(Model.Dokutypes != null)
{
Model.Dokutypes = Model.Dokutypes.OrderBy(s => s.ValueListEntryOid).ToArray();
}
}
catch(Exception e)
{
@@ -143,9 +178,9 @@ namespace BeWoPlanerMobil.Controllers
var filterList = new List<QbFilterItem>();
var hasRightToViewCustomers = AbstractModel.CheckForAtLeastOneRight(new[] { UserRightType.CustomerView_View, UserRightType.ViewAll });
var hasRightToViewCustomers = Model.CheckForAtLeastOneRight(new[] { UserRightType.CustomerView_View, UserRightType.ViewAll });
var hasRightToViewMyTeams = AbstractModel.CheckForAtLeastOneRight(new[] { UserRightType.Customer_ViewMyTeams, UserRightType.ViewAll });
var hasRightToViewMyTeams = Model.CheckForAtLeastOneRight(new[] { UserRightType.Customer_ViewMyTeams, UserRightType.ViewAll });
if(hasRightToViewCustomers)
{
@@ -160,14 +195,14 @@ namespace BeWoPlanerMobil.Controllers
filterList.Add(new QbFilterItem(QBFilterEnum.MeineKlienten));
filterList.Add(new QbFilterItem(QBFilterEnum.KlientenAuswahl));
if(AbstractModel.CheckRight(UserRightType.TeamView_ViewMyTeams) && false == AbstractModel.CheckRight(UserRightType.TeamView_ViewAll))
if(Model.CheckRight(UserRightType.TeamView_ViewMyTeams) && false == Model.CheckRight(UserRightType.TeamView_ViewAll))
{
if(hasRightToViewMyTeams)
{
filterList.Add(new QbFilterItem(QBFilterEnum.TeamAuswahl));
}
}
else if(AbstractModel.CheckRight(UserRightType.TeamView_ViewAll))
else if(Model.CheckRight(UserRightType.TeamView_ViewAll))
{
if(hasRightToViewCustomers)
{
@@ -286,9 +321,9 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
if(Model.SelectedEmployee is null && (Model.Employee?.EmployeeOid.HasValue ?? false))
if(Model.SelectedEmployee is null && (Model.LoggedInEmployee?.EmployeeOid.HasValue ?? false))
{
return $"{Model.Employee.LastNameFirstName}_{Model.Employee.EmployeeOid.Value}";
return $"{Model.LoggedInEmployee.LastNameFirstName}_{Model.LoggedInEmployee.EmployeeOid.Value}";
}
return $"{Model.SelectedEmployee.DetailDescription}_{Model.SelectedEmployee.EmployeeOid}";
@@ -303,6 +338,7 @@ namespace BeWoPlanerMobil.Controllers
}
Model.SelectedCustomer = Model.Customers.FirstOrDefault(customer => customer.CustomerOid == customerOid);
Model.SelectedCustomerOid = customerOid;
return Model.SelectedCustomer?.DetailDescription ?? LeerzeichenFuerGetMethoden;
}
@@ -316,7 +352,7 @@ namespace BeWoPlanerMobil.Controllers
}
Model.SelectedTeam = Model.AllTeams.FirstOrDefault(team => team.TeamOid == teamOid);
Model.SelectedTeamOid = teamOid;
return Model.SelectedTeam?.DetailDescription ?? string.Empty;
}
@@ -386,12 +422,24 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
var isParsingSuccessful2 = long.TryParse(organisationOidStr, out var organisationOid);
var isParsingSuccessful3 = long.TryParse(categoryOidStr, out var categoryOid);
Model.SelectedOrganisationOid = null;
Model.SelectedServiceCategoryOid = null;
Model.SelectedOrganisation = isParsingSuccessful2 ? Model.Organisations.FirstOrDefault(organisation => organisation.OrganisationOid.Equals(organisationOid)) : null;
if (long.TryParse(organisationOidStr, out var organisationOid))
{
Model.SelectedOrganisationOid = organisationOid;
}
if (long.TryParse(categoryOidStr, out var categoryOid))
{
Model.SelectedServiceCategoryOid = categoryOid;
}
Model.SelectedServiceCategory = isParsingSuccessful3 ? OperationsService.LoadServiceCategory(categoryOid) : null;
//Model.SelectedOrganisation = isParsingSuccessful2 ? Model.Organisations.FirstOrDefault(organisation => organisation.OrganisationOid.Equals(organisationOid)) : null;
//Model.SelectedServiceCategory = isParsingSuccessful3 ? OperationsService.LoadServiceCategory(categoryOid) : null;
return LeerzeichenFuerGetMethoden;
}
@@ -407,6 +455,7 @@ namespace BeWoPlanerMobil.Controllers
Model.IsForSelectedEmployeesOnly = isForSelectedEmployeeOnly ?? false;
Model.SelectedEmployee = employeeOid.HasValue ? Model.Employees.FirstOrDefault(employee => employee.EmployeeOid.Equals(employeeOid.Value)) : null;
Model.SelectedEmployeeOid = employeeOid;
return LeerzeichenFuerGetMethoden;
}
@@ -421,6 +470,7 @@ namespace BeWoPlanerMobil.Controllers
}
Model.SelectedEmployee = employeeOid.HasValue ? Model.Employees.FirstOrDefault(employee => employee.EmployeeOid.Equals(employeeOid)) : null;
Model.SelectedEmployeeOid = employeeOid;
return Model.SelectedEmployee?.DetailDescription ?? LeerzeichenFuerGetMethoden;
}
@@ -438,6 +488,7 @@ namespace BeWoPlanerMobil.Controllers
Model.SelectedOrganisation = organisationOid.HasValue && Model.IsForSelectedCostbearersOnly ?
Model.Organisations.FirstOrDefault(organisation => organisation.OrganisationOid.Equals(organisationOid)) :
null;
Model.SelectedOrganisationOid = organisationOid;
return LeerzeichenFuerGetMethoden;
}
@@ -452,6 +503,7 @@ namespace BeWoPlanerMobil.Controllers
}
Model.SelectedOrganisation = organisationOid.HasValue ? Model.Organisations.FirstOrDefault(organisation => organisation.OrganisationOid.Equals(organisationOid)) : null;
Model.SelectedOrganisationOid = organisationOid;
return Model.SelectedOrganisation?.DetailDescription ?? LeerzeichenFuerGetMethoden;
}
@@ -468,6 +520,7 @@ namespace BeWoPlanerMobil.Controllers
Model.IsForSelectedCategoryOnly = isForSelectedServiceCategoryOnly ?? false;
Model.SelectedServiceCategory = serviceCategoryOid.HasValue && Model.IsForSelectedCategoryOnly ? Model.ServiceCategories.FirstOrDefault(serviceCategory => serviceCategory.ServiceCategoryOid == serviceCategoryOid) : null;
Model.SelectedServiceCategoryOid = serviceCategoryOid;
return LeerzeichenFuerGetMethoden;
}
@@ -485,6 +538,7 @@ namespace BeWoPlanerMobil.Controllers
{
Model.SelectedServiceCategory = Model.ServiceCategories.FirstOrDefault(serviceCategory => serviceCategory.ServiceCategoryOid == serviceCategoryOid);
}
Model.SelectedServiceCategoryOid = serviceCategoryOid;
return LeerzeichenFuerGetMethoden;
}
@@ -512,7 +566,7 @@ namespace BeWoPlanerMobil.Controllers
var selectedFilterEnum = (QBFilterEnum) filterEnumValue;
Model.SelectedFilterItem = new QbFilterItem(selectedFilterEnum);
Model.SelectedFilterItemId = selectedFilterEnum;
if(selectedFilterEnum != QBFilterEnum.KlientenAuswahl || Model.SelectedCustomer != null)
{
@@ -523,7 +577,7 @@ namespace BeWoPlanerMobil.Controllers
if(!(customer is null))
{
Model.SelectedCustomer = customer;
Model.SelectedCustomerOid = customer.CustomerOid;
}
return LeerzeichenFuerGetMethoden;
@@ -582,9 +636,9 @@ namespace BeWoPlanerMobil.Controllers
{
var temp = csr.ServiceRecords.Where(sr => sr.ServiceRecordOid.HasValue && !serviceRecordOidsWithSignature.Contains(sr.ServiceRecordOid.Value));
if(!AbstractModel.HasRightToProvideEmployeeSignatureForOthers)
if(!Model.HasRightToProvideEmployeeSignatureForOthers)
{
temp = temp.Where(sr => sr.Employee.Equals(MobileSessionFacade.LoggedInCompactEmployee));
temp = temp.Where(sr => sr.Employee.Equals(LoggedInUser.Employee));
}
csr.ServiceRecords.Clear();
@@ -613,9 +667,9 @@ namespace BeWoPlanerMobil.Controllers
var filteredServiceRecords = new List<ServiceRecordDC>();
if(!isCustomerSig && !AbstractModel.HasRightToProvideEmployeeSignatureForOthers)
if(!isCustomerSig && !Model.HasRightToProvideEmployeeSignatureForOthers)
{
filteredServiceRecords = serviceRecords.Where(sr => sr.Employee.Equals(MobileSessionFacade.LoggedInCompactEmployee)).ToList();
filteredServiceRecords = serviceRecords.Where(sr => sr.Employee.Equals(LoggedInUser.Employee)).ToList();
}
else
{
@@ -626,7 +680,7 @@ namespace BeWoPlanerMobil.Controllers
{
ServiceRecords = filteredServiceRecords,
CustomerOid = isCustomerSig ? (long?) customerOid : null,
Employee = isCustomerSig ? null : MobileSessionFacade.LoggedInCompactEmployee,
Employee = isCustomerSig ? null : LoggedInUser.Employee,
SignatureImage = base64SignatureString,
SignatureType = signatureType,
TimeSpanString = timeSpanString
@@ -751,14 +805,14 @@ namespace BeWoPlanerMobil.Controllers
var info = formCollection["deleteCustomerSignaturesInfo"];
if(AbstractModel.HasRightToDeleteReceiptSignatures)
if(Model.HasRightToDeleteReceiptSignatures)
{
DeleteSignatures(info, true);
}
LoadPaginatedQbEntries(Model.CurrentQbEntryPage);
return RedirectToActionPermanent("InitReports");
return RedirectToAction("InitReports");
}
[Authorize]
@@ -773,20 +827,20 @@ namespace BeWoPlanerMobil.Controllers
var info = formCollection["deleteEmployeeSignatureInfo"];
if(AbstractModel.HasRightToDeleteReceiptSignatures)
if(Model.HasRightToDeleteReceiptSignatures)
{
DeleteSignatures(info, false);
}
LoadPaginatedQbEntries(Model.CurrentQbEntryPage);
return RedirectToActionPermanent("InitReports");
return RedirectToAction("InitReports");
}
[Authorize]
private void DeleteSignatures(string guid, bool isCustomerSignature)
{
if(Model is null || !AbstractModel.HasRightToDeleteReceiptSignatures)
if(Model is null || !Model.HasRightToDeleteReceiptSignatures)
{
return;
}
@@ -843,13 +897,13 @@ namespace BeWoPlanerMobil.Controllers
Model.SelectedConfirmationReceiptSignatures = ConvertSignatureDCsToSignatureObjects(signatures);
var customerName = obj.CustomerName;
var employeeName = MobileSessionFacade.LoggedInCompactEmployee.SimpleDescription;
var employeeName = LoggedInUser.Employee.SimpleDescription;
var serviceRecordCount = 0;
if(isEmployee)
{
serviceRecordCount = AbstractModel.HasRightToProvideEmployeeSignatureForOthers ? obj.Items.Count : obj.Items.Count(x => x.EmployeeOid.Equals(Model.Employee.EmployeeOid));
serviceRecordCount = Model.HasRightToProvideEmployeeSignatureForOthers ? obj.Items.Count : obj.Items.Count(x => x.EmployeeOid.Equals(LoggedInEmployee.EmployeeOid));
}
else
{
@@ -863,38 +917,39 @@ namespace BeWoPlanerMobil.Controllers
return PartialView("ConfirmationReceiptSignaturePartial", Model);
}
[Authorize]
public ActionResult LoadReportToModel()
{
if(Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("QuittierungsbelegsPreviewPartial");
}
//[Authorize]
//public ActionResult LoadReportToModel()
//{
// if(Model is null)
// {
// TempData[TempDataConstants.DoLogoutKey] = true;
// return PartialView("QuittierungsbelegsPreviewPartial");
// }
var month = Model.SelectedMonth ?? DateTime.Now.AddMonths(-1).Month;
var year = Model.SelectedYear ?? DateTime.Now.Year;
var customerOid = Model.SelectedCustomerOid;
var teamOid = Model.SelectedTeamOid;
var employeeOid = Model.SelectedEmployeeOid;
var organisationOid = Model.SelectedOrganisationOid;
var serviceCategoryOid = Model.SelectedServiceCategoryOid;
var startDate = Model.SelectedStartDay ?? 1;
// var month = Model.SelectedMonth ?? DateTime.Now.AddMonths(-1).Month;
// var year = Model.SelectedYear ?? DateTime.Now.Year;
// var customerOid = Model.SelectedCustomerOid;
// var teamOid = Model.SelectedTeamOid;
// var employeeOid = Model.SelectedEmployeeOid;
// var organisationOid = Model.SelectedOrganisationOid;
// var serviceCategoryOid = Model.SelectedServiceCategoryOid;
// var startDate = Model.SelectedStartDay ?? 1;
var date = new DateTime(year, month, startDate);
// var date = new DateTime(year, month, startDate);
var endDate = Model.SelectedEndDay ?? date.GetLastOfMonth().Day;
var filterType = Model.SelectedFilterItem;
// var endDate = Model.SelectedEndDay ?? date.GetLastOfMonth().Day;
// var filterType = Model.SelectedFilterItem;
Model.QuittierungsbelegsReportObject = Model.ReportCreator.CreateServiceOverviewReportNew(month, year, filterType.FilterEnum, customerOid, teamOid, employeeOid, organisationOid, serviceCategoryOid, startDate, endDate, false);
// Model.QuittierungsbelegsReportObject = Model.ReportCreator.CreateServiceOverviewReportNew(month, year, filterType.FilterEnum, customerOid, teamOid, employeeOid, organisationOid, serviceCategoryOid, startDate, endDate, false);
return PartialView("QuittierungsbelegsPreviewPartial", Model);
}
// return PartialView("QuittierungsbelegsPreviewPartial", Model);
//}
[Authorize]
public string ResetQuittierungsbeleg()
{
Model.QuittierungsbelegsReportObject = null;
Model.QuittierungsbelegsReportSettings = null;
Model.QuittierungsbelegsReport = null;
return LeerzeichenFuerGetMethoden;
}
@@ -909,28 +964,61 @@ namespace BeWoPlanerMobil.Controllers
return Logout();
}
var month = Model.SelectedMonth ?? DateTime.Now.AddMonths(-1).Month;
var year = Model.SelectedYear ?? DateTime.Now.Year;
var customerOid = Model.SelectedCustomerOid;
var teamOid = Model.SelectedTeamOid;
var employeeOid = Model.SelectedEmployeeOid;
var organisationOid = Model.SelectedOrganisationOid;
var serviceCategoryOid = Model.SelectedServiceCategoryOid;
var startDate = Model.SelectedStartDay ?? 1;
var reportSettings = new QuittierungsbelegsReportSettings();
var date = new DateTime(year, month, startDate);
reportSettings.Month = Model.SelectedMonth ?? DateTime.Now.AddMonths(-1).Month;
reportSettings.Year = Model.SelectedYear ?? DateTime.Now.Year;
reportSettings.CustomerOid = Model.SelectedCustomerOid;
reportSettings.TeamOid = Model.SelectedTeamOid;
reportSettings.EmployeeOid = Model.SelectedEmployeeOid;
reportSettings.OrganisationOid = Model.SelectedOrganisationOid;
reportSettings.ServiceCategoryOid = Model.SelectedServiceCategoryOid;
reportSettings.StartDay = Model.SelectedStartDay ?? 1;
var endDate = Model.SelectedEndDay ?? date.GetLastOfMonth().Day;
var filterType = Model.SelectedFilterItem;
var date = new DateTime(reportSettings.Year, reportSettings.Month, reportSettings.StartDay);
var report = Model.ReportCreator.CreateServiceOverviewReportNew(month, year, filterType.FilterEnum, customerOid, teamOid, employeeOid, organisationOid, serviceCategoryOid, startDate, endDate, false);
reportSettings.EndDay = Model.SelectedEndDay ?? date.GetLastOfMonth().Day;
reportSettings.FilterEnum = Model.SelectedFilterItem.FilterEnum;
Model.QuittierungsbelegsReportSettings = reportSettings;
//var report = Model.ReportCreator.CreateServiceOverviewReportNew(month, year, filterType.FilterEnum, customerOid, teamOid, employeeOid, organisationOid, serviceCategoryOid, startDate, endDate, false);
//report.ExportOptions.PrintPreview.DefaultFileName = CreateFileName();
//report.DisplayName = CreateFileName();
return RedirectToAction("InitReports");
}
[Authorize]
public ActionResult CreateQuittierungsbelegsReport()
{
if (Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("QuittierungsbelegsPreviewPartial");
}
Model.QuittierungsbelegsReport = CreateQuittierungsbelegsReportFromSettings();
return PartialView("QuittierungsbelegsPreviewPartial", Model);
}
private XtraReport CreateQuittierungsbelegsReportFromSettings()
{
if (Model.QuittierungsbelegsReportSettings == null)
{
return null;
}
var s = Model.QuittierungsbelegsReportSettings;
var report = Model.ReportCreator.CreateServiceOverviewReportNew(s.Month, s.Year, s.FilterEnum, s.CustomerOid, s.TeamOid, s.EmployeeOid, s.OrganisationOid, s.ServiceCategoryOid, s.StartDay, s.EndDay, false);
report.ExportOptions.PrintPreview.DefaultFileName = CreateFileName();
report.DisplayName = CreateFileName();
Model.QuittierungsbelegsReportObject = report;
return RedirectToActionPermanent("InitReports");
return report;
}
private string CreateFileName()
@@ -1040,6 +1128,7 @@ namespace BeWoPlanerMobil.Controllers
else
{
Model.SelectedCustomer = null;
Model.SelectedCustomerOid = null;
}
if(Model.SelectedFilterItem.FilterEnum == QBFilterEnum.TeamAuswahl)
@@ -1058,6 +1147,7 @@ namespace BeWoPlanerMobil.Controllers
else
{
Model.SelectedTeam = null;
Model.SelectedTeamOid = null;
}
var reportTimeFrame = GetReportTimeFrame();
@@ -1154,15 +1244,15 @@ namespace BeWoPlanerMobil.Controllers
employeeSignatureState = SignatureState.All;
}
if(!AbstractModel.HasRightToProvideEmployeeSignatureForOthers)
if(!Model.HasRightToProvideEmployeeSignatureForOthers)
{
// Prüfen, ob alle eigenen ServiceRecords unterschrieben sind
var ownServiceRecordOids = new List<long>();
reportObjects.DoForEach(reportObject => ownServiceRecordOids.AddRangeIfElementsNotIn(reportObject.Services.Where(serviceDetail => serviceDetail.EmployeeOid.Equals(Model.Employee.EmployeeOid)).Select(serviceDetail => serviceDetail.ServiceRecordOid)));
reportObjects.DoForEach(reportObject => ownServiceRecordOids.AddRangeIfElementsNotIn(reportObject.Services.Where(serviceDetail => serviceDetail.EmployeeOid.Equals(LoggedInEmployee.EmployeeOid)).Select(serviceDetail => serviceDetail.ServiceRecordOid)));
// Prüfen, ob Einträge von anderen Mitarbeitern existieren
var serviceRecordOidsFromOtherEmployees = new List<long>();
reportObjects.DoForEach(reportObject => serviceRecordOidsFromOtherEmployees.AddRangeIfElementsNotIn(reportObject.Services.Where(serviceDetail => !serviceDetail.EmployeeOid.Equals(Model.Employee.EmployeeOid)).Select(serviceDetail => serviceDetail.ServiceRecordOid)));
reportObjects.DoForEach(reportObject => serviceRecordOidsFromOtherEmployees.AddRangeIfElementsNotIn(reportObject.Services.Where(serviceDetail => !serviceDetail.EmployeeOid.Equals(LoggedInEmployee.EmployeeOid)).Select(serviceDetail => serviceDetail.ServiceRecordOid)));
var areAllForeignEntriesSigned = serviceRecordOidsFromOtherEmployees.All(srOid => serviceRecordOidsWithSignature.ContainsValueAtKey(SignatureType.Employee, srOid));
var areAllOwnEntriesSigned = ownServiceRecordOids.All(srOid => serviceRecordOidsWithSignature.ContainsValueAtKey(SignatureType.Employee, srOid));
@@ -1253,10 +1343,10 @@ namespace BeWoPlanerMobil.Controllers
employeeOids.AddIfNotIn(serviceDetail.EmployeeOid);
}
if(!AbstractModel.HasRightToProvideEmployeeSignatureForOthers)
if(!Model.HasRightToProvideEmployeeSignatureForOthers)
{
var serviceRecordOidsFromOtherEmployees = reportObject.Services.Where(serviceDetail => !serviceDetail.EmployeeOid.Equals(Model.Employee.EmployeeOid)).Select(serviceDetail => serviceDetail.ServiceRecordOid).ToList();
var ownServiceRecordOids = reportObject.Services.Where(serviceDetail => serviceDetail.EmployeeOid.Equals(Model.Employee.EmployeeOid)).Select(serviceDetail => serviceDetail.ServiceRecordOid).ToList();
var serviceRecordOidsFromOtherEmployees = reportObject.Services.Where(serviceDetail => !serviceDetail.EmployeeOid.Equals(LoggedInEmployee.EmployeeOid)).Select(serviceDetail => serviceDetail.ServiceRecordOid).ToList();
var ownServiceRecordOids = reportObject.Services.Where(serviceDetail => serviceDetail.EmployeeOid.Equals(LoggedInEmployee.EmployeeOid)).Select(serviceDetail => serviceDetail.ServiceRecordOid).ToList();
var areAllForeignEntriesSigned = serviceRecordOidsFromOtherEmployees.All(srOid => serviceRecordOidsWithSignature.ContainsValueAtKey(SignatureType.Employee, srOid));
var areAllOwnEntriesSigned = ownServiceRecordOids.All(srOid => serviceRecordOidsWithSignature.ContainsValueAtKey(SignatureType.Employee, srOid));

View File

@@ -33,29 +33,30 @@ namespace BeWoPlanerMobil.Controllers
return null;
}
if(((ReportViewerModel)Session[ModelSessionConstants.ReportViewerModelKey])?.Employee is null)
if (_Model == null)
{
_Model = new ReportViewerModel { Employee = MobileSessionFacade.LoggedInEmployee, ReportCreator = GetReportCreator() };
Session[ModelSessionConstants.ReportViewerModelKey] = _Model;
}
else
{
_Model = (ReportViewerModel)Session[ModelSessionConstants.ReportViewerModelKey];
_Model = new ReportViewerModel { ReportCreator = GetReportCreator() };
InitModel(_Model);
InitViewModel();
}
//if (((ReportViewerModel)Session[ModelSessionConstants.ReportViewerModelKey])?.LoggedInEmployee is null)
//{
// _Model = new ReportViewerModel { ReportCreator = GetReportCreator() };
// Session[ModelSessionConstants.ReportViewerModelKey] = _Model;
//}
//else
//{
// _Model = (ReportViewerModel)Session[ModelSessionConstants.ReportViewerModelKey];
//}
return _Model;
}
}
[Authorize]
public ActionResult ReportViewer()
private void InitViewModel()
{
if(Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return Logout();
}
Model.Report = null;
var month = DateTime.Today.Month;
@@ -67,27 +68,39 @@ namespace BeWoPlanerMobil.Controllers
Model.AllEmployees = AbstractModel.HasRightMitarbeiterstundenkontoViewAll
? EmployeeService.GetAllActiveEmployeesCompact()
: new List<CompactEmployeeDC> { MobileSessionFacade.LoggedInCompactEmployee };
Model.AllEmployees = Model.HasRightMitarbeiterstundenkontoViewAll
? EmployeeService.GetAllActiveEmployeesCompact()
: new List<CompactEmployeeDC> { LoggedInUser.Employee };
// Alle Teams darf man nur sehen, wenn man das Recht "HasRightMitarbeiterstundenkontoViewAll" hat.
// Hat man weder das Recht "HasRightMitarbeiterstundenkontoViewAll" noch "HasRightMitarbeiterstundenkontoViewTeams", sieht man die Teams gar nicht.
// Hat man das Recht "HasRightMitarbeiterstundenkontoViewTeams", aber nicht das Recht "HasRightMitarbeiterstundenkontoViewAll", sieht man nur die Teams, deren Teamleiter man ist.
Model.AllTeams = AbstractModel.HasRightMitarbeiterstundenkontoViewAll
? EmployeeService.GetAllActiveCompactTeamsForEmployee(MobileSessionFacade.LoggedInEmployee.EmployeeOid)
: EmployeeService.FindLeadingCompactTeamsOfEmployee(MobileSessionFacade.LoggedInCompactEmployee.EmployeeOid);
Model.AllTeams = Model.HasRightMitarbeiterstundenkontoViewAll
? EmployeeService.GetAllActiveCompactTeamsForEmployee(LoggedInEmployee.EmployeeOid)
: EmployeeService.FindLeadingCompactTeamsOfEmployee(LoggedInUser.Employee.EmployeeOid);
if(false == AbstractModel.HasRightMitarbeiterstundenkontoViewAll || Model.SelectedEmployee is null)
if (false == Model.HasRightMitarbeiterstundenkontoViewAll || Model.SelectedEmployeeOid is null)
{
Model.SelectedEmployee = MobileSessionFacade.LoggedInCompactEmployee;
Model.SelectedEmployeeOid = LoggedInUser.Employee.EmployeeOid;
}
if (Model.SelectedEmployeeOid.HasValue)
{
Model.SelectedEmployee = Model.AllEmployees.FirstOrDefault(employee => employee.EmployeeOid.Equals(Model.SelectedEmployeeOid.Value));
}
if (Model.SelectedTeamOid.HasValue)
{
Model.SelectedTeam = Model.AllTeams.FirstOrDefault(team => team.TeamOid.Equals(Model.SelectedTeamOid.Value));
}
Model.ReportTypes = new List<SelectListItem>();
#if DEBUG
if(AbstractModel.HasRightToViewReports)
if (Model.HasRightToViewReports)
{
Model.ReportTypes.Add(new SelectListItem
{
@@ -100,15 +113,20 @@ namespace BeWoPlanerMobil.Controllers
Model.Queries = QueryService.GetAllQueriesOfType(QueryType.Public);
if (Model.SelectedQueryOid.HasValue)
{
Model.SelectedQuery = Model.Queries.FirstOrDefault(q => q.Oid.Equals(Model.SelectedQueryOid.Value));
}
var names2ValueListEntryTypes = new Dictionary<string, ValueListEntryType>();
foreach(var query in Model.Queries.Where(q => q.Parameter?.Any() ?? false))
foreach (var query in Model.Queries.Where(q => q.Parameter?.Any() ?? false))
{
foreach(var parameter in query.Parameter.Where(p => p.ParamType == QueryParameterType.ValueListEntryType))
foreach (var parameter in query.Parameter.Where(p => p.ParamType == QueryParameterType.ValueListEntryType))
{
var parameterName = parameter.Name;
if(!(parameterName?.Contains("_") ?? false))
if (!(parameterName?.Contains("_") ?? false))
{
continue;
}
@@ -118,12 +136,12 @@ namespace BeWoPlanerMobil.Controllers
var name = name2Type[0];
var type = name2Type[1];
if(!int.TryParse(type, out var typeEnumInt))
if (!int.TryParse(type, out var typeEnumInt))
{
continue;
}
var valueListEntryType = (ValueListEntryType) typeEnumInt;
var valueListEntryType = (ValueListEntryType)typeEnumInt;
names2ValueListEntryTypes.AddIfNotIn(new KeyValuePair<string, ValueListEntryType>(name, valueListEntryType));
}
}
@@ -135,9 +153,9 @@ namespace BeWoPlanerMobil.Controllers
Model.ValueListEntryTypes2ValueListEntries.AddOrUpdateValueInDictionary(valueListEntry.Type, valueListEntry);
});
if(Model.Employee?.EmployeeOid.HasValue ?? false)
if (Model.LoggedInEmployee?.EmployeeOid.HasValue ?? false)
{
Model.SupportConcepts = EmployeeService.GetActiveSupportConceptsForEmployee(Model.Employee.EmployeeOid, CustomerFilterEnum.All);
Model.SupportConcepts = EmployeeService.GetActiveSupportConceptsForEmployee(Model.LoggedInEmployee.EmployeeOid, CustomerFilterEnum.All);
}
else
{
@@ -146,9 +164,9 @@ namespace BeWoPlanerMobil.Controllers
Model.SupportConcepts.DoForEach(sc => Model.CostBearer2SupportConceptRels.AddRangeIfElementsNotIn(sc.CostBearerRelations));
if(Model.SelectedCostBearer2SupportConceptRelListObject is null)
if (Model.SelectedCostBearer2SupportConceptRelListObject is null)
{
Model.SelectedCostBearer2SupportConceptRelListObject = Model.CostBearer2SupportConceptRelListObjects.FirstOrDefault(f => f.CostBearer2SupportConceptOid == "-1") ?? Model.CostBearer2SupportConceptRelListObjects.First();
Model.SelectedCostBearer2SupportConceptRelListObject = Model.CostBearer2SupportConceptRelListObjects.FirstOrDefault(f => f.CostBearer2SupportConceptOid == -1) ?? Model.CostBearer2SupportConceptRelListObjects.First();
}
Model.AllOrganisationForQuery = CustomerService.GetAllActiveOrganisationsCompact();
@@ -156,12 +174,12 @@ namespace BeWoPlanerMobil.Controllers
Model.AllServiceCategoriesForQueries = OperationsService.GetAllServiceCategories();
}
#endif
if(AbstractModel.HasRightToViewMitarbeiterstundenkonto)
if (Model.HasRightToViewMitarbeiterstundenkonto)
{
Model.ReportTypes.Add(new SelectListItem
{
@@ -178,6 +196,18 @@ namespace BeWoPlanerMobil.Controllers
#if DEBUG
//Model.SelectedReportType = ReportType.Berichte;
#endif
}
[Authorize]
public ActionResult ReportViewer()
{
if(Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return Logout();
}
return View(Model);
}
@@ -198,7 +228,7 @@ namespace BeWoPlanerMobil.Controllers
{
try
{
if(Model?.Employee?.EmployeeOid is null || reportOid is null)
if(Model?.LoggedInEmployee?.EmployeeOid is null || reportOid is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("BeWoReportPartial");
@@ -216,7 +246,7 @@ namespace BeWoPlanerMobil.Controllers
Model.SelectedQuery = selectedQuery;
var dcid = $"{MobileSessionFacade.Tenant}queryeoid{Model.Employee.EmployeeOid.Value}";
var dcid = $"{MobileSessionFacade.Tenant}queryeoid{Model.LoggedInEmployee.EmployeeOid.Value}";
var queryResult = QueryService.ExecuteQuery(selectedQuery.Oid, null);
@@ -249,7 +279,7 @@ namespace BeWoPlanerMobil.Controllers
{
try
{
if(Model?.Employee?.EmployeeOid is null || reportOid is null)
if(Model?.LoggedInEmployee?.EmployeeOid is null || reportOid is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("BerichteFormPartialView");
@@ -318,7 +348,7 @@ namespace BeWoPlanerMobil.Controllers
private string GetSiteOfOrigin()
{
if(Model?.Employee?.EmployeeOid is null)
if(Model?.LoggedInEmployee?.EmployeeOid is null)
{
return null;
}
@@ -361,6 +391,7 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
Model.SelectedEmployeeOid = employeeOid;
Model.SelectedEmployee = Model.AllEmployees.FirstOrDefault(employee => employee.EmployeeOid.Equals(employeeOid.Value));
return Model.SelectedEmployee?.DetailDescription ?? LeerzeichenFuerGetMethoden;
@@ -381,6 +412,7 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
Model.SelectedTeamOid = teamOid;
Model.SelectedTeam = Model.AllTeams.FirstOrDefault(team => team.TeamOid.Equals(teamOid.Value));
return Model.SelectedTeam?.DetailDescription ?? LeerzeichenFuerGetMethoden;
@@ -389,7 +421,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult LoadMitarbeiterstundenkonto(int ansicht, int month, int year, bool all, bool isEmployee)
{
if(Model?.Employee?.EmployeeOid is null)
if(Model?.LoggedInEmployee?.EmployeeOid is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("BeWoReportPartial");
@@ -397,13 +429,14 @@ namespace BeWoPlanerMobil.Controllers
var teamOids = new List<long>();
var employeeOid = Model.SelectedEmployeeOid;
var oid = isEmployee ? employeeOid ?? Model.Employee.EmployeeOid.Value : Model.SelectedTeamOid;
var oid = isEmployee ? employeeOid ?? Model.LoggedInEmployee.EmployeeOid.Value : Model.SelectedTeamOid;
if(isEmployee)
{
teamOids = null;
employeeOid = oid;
if(all || false == AbstractModel.HasRightMitarbeiterstundenkontoViewAll)
if(all || false == Model.HasRightMitarbeiterstundenkontoViewAll)
{
employeeOid = null;
}
@@ -413,16 +446,18 @@ namespace BeWoPlanerMobil.Controllers
employeeOid = oid;
}
if(false == AbstractModel.HasRightMitarbeiterstundenkontoViewAll)
if(false == Model.HasRightMitarbeiterstundenkontoViewAll)
{
employeeOid = Model.Employee.EmployeeOid;
employeeOid = Model.LoggedInEmployee.EmployeeOid;
}
}
else
{
employeeOid = null;
var teamOid = oid;
if(all || (!AbstractModel.HasRightMitarbeiterstundenkontoViewAll && !AbstractModel.HasRightMitarbeiterstundenkontoViewTeams))
if(all || (!Model.HasRightMitarbeiterstundenkontoViewAll && !Model.HasRightMitarbeiterstundenkontoViewTeams))
{
teamOid = null;
}
@@ -723,7 +758,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult ExecuteQuery()
{
if(Model?.Employee?.EmployeeOid is null)
if(Model?.LoggedInEmployee?.EmployeeOid is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
@@ -748,7 +783,7 @@ namespace BeWoPlanerMobil.Controllers
}
}
var dcid = $"{MobileSessionFacade.Tenant}queryeoid{Model.Employee.EmployeeOid.Value}";
var dcid = $"{MobileSessionFacade.Tenant}queryeoid{Model.LoggedInEmployee.EmployeeOid.Value}";
var queryResult = QueryService.ExecuteQuery(query.Oid, paramList);

View File

@@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web.Mvc;
using BeWoPlanerMobil.Models;
@@ -32,35 +34,37 @@ namespace BeWoPlanerMobil.Controllers
return null;
}
if (((SchedulerModel) Session[ModelSessionConstants.SchedulerModelKey])?.Employee is null)
if (_Model == null)
{
_Model = new SchedulerModel { Employee = MobileSessionFacade.LoggedInEmployee };
Session[ModelSessionConstants.SchedulerModelKey] = _Model;
}
else
{
_Model = (SchedulerModel) Session[ModelSessionConstants.SchedulerModelKey];
_Model = new SchedulerModel();
InitModel(_Model);
InitViewModel();
}
//if (((SchedulerModel) Session[ModelSessionConstants.SchedulerModelKey])?.LoggedInEmployee is null)
//{
// _Model = new SchedulerModel();
// InitModel(_Model);
// Session[ModelSessionConstants.SchedulerModelKey] = _Model;
//}
//else
//{
// _Model = (SchedulerModel) Session[ModelSessionConstants.SchedulerModelKey];
//}
return _Model;
}
}
[Authorize]
public ActionResult Scheduler()
private void InitViewModel()
{
if(Model is null || !MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer") || !AbstractModel.IsAllowedToSeeScheduler)
{
return Logout();
}
if(AbstractModel.HasRightToInsertRessourceAppointments || AbstractModel.HasRightToViewAllResourceAppointments)
if (Model.HasRightToInsertRessourceAppointments || Model.HasRightToViewAllResourceAppointments)
{
var allResources = KalenderService.GetAllResources().OrderBy(r => r.Name).ToList();
var categories2Resources = new Dictionary<ValueListEntryDC, List<ResourceDC>>();
foreach(var category in allResources.Select(resource => resource.ResourceCategory))
foreach (var category in allResources.Select(resource => resource.ResourceCategory))
{
categories2Resources.AddOrUpdateValueInDictionary(category, allResources.Where(resource => resource.ResourceCategory.Equals(category)).OrderBy(r => r.Name).ToList());
}
@@ -68,35 +72,107 @@ namespace BeWoPlanerMobil.Controllers
Model.ResourceCategories2Resources = categories2Resources.OrderBy(kvp => kvp.Key.DisplayName).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
}
if(Model?.Employee?.EmployeeOid.HasValue ?? false)
if (Model?.LoggedInEmployee?.EmployeeOid.HasValue ?? false)
{
var compactEmployee = EmployeeService.GetActiveCompactEmployeeWithOid(Model.Employee.EmployeeOid.Value);
var compactEmployee = EmployeeService.GetActiveCompactEmployeeWithOid(Model.LoggedInEmployee.EmployeeOid.Value);
Model.MyTeamEmployees = EmployeeService.GetAllTeamMember(compactEmployee).OrderBy(employee => employee.LastName).ToList();
}
else if(!(Model is null))
else if (!(Model is null))
{
Model.MyTeamEmployees = new List<CompactEmployeeDC>();
}
if(AbstractModel.HasRightToViewTeams && (Model?.Employee?.EmployeeOid.HasValue ?? false))
if (Model.HasRightToViewTeams && (Model?.LoggedInEmployee?.EmployeeOid.HasValue ?? false))
{
Model.MyTeams = EmployeeService.GetAllActiveCompactTeamsForEmployee(Model.Employee.EmployeeOid.Value).OrderBy(team => team.Name).ToList();
Model.MyTeams = EmployeeService.GetAllActiveCompactTeamsForEmployee(Model.LoggedInEmployee.EmployeeOid.Value).OrderBy(team => team.Name).ToList();
}
if(!(Model is null))
if (!(Model is null))
{
Model.TeamMemberCustomerOids = EmployeeService.LoadTeamsRelatedCustomerOids(MobileSessionFacade.LoggedInCompactEmployee.EmployeeOid);
Model.TeamMemberCustomerOids = EmployeeService.LoadTeamsRelatedCustomerOids(LoggedInUser.Employee.EmployeeOid);
}
if (Model.HasRightToViewCustomerSelectionInScheduler)
{
Model.AllCustomers = CustomerService.GetAllActiveCompactCustomers().OrderBy(customer => customer.LastName).ToList();
}
if (Model.HasRightToViewEmployeeAppointments)
{
Model.AllEmployees = EmployeeService.GetAllActiveEmployeesCompact().OrderBy(employee => employee.LastName).ToList();
}
//LoadAppointmentsForDate();
if (Model.SelectedAppointmentOid.HasValue)
{
if (Model.Appointments == null)
{
LoadAppointmentsForDate();
}
Model.SelectedAppointment = Model.Appointments.FirstOrDefault(app => app.SchedulerAppointmentOid.HasValue && app.SchedulerAppointmentOid.Value == Model.SelectedAppointmentOid.Value);
}
SetHasResourcesEmployeesOrCustomers();
UpdateSelectedObjects();
}
private void UpdateSelectedObjects()
{
//mache aus dem Ressourcenkategorien Dictionary eine flache Liste:
var list = new List<ResourceDC>();
Model.ResourceCategories2Resources.Values.DoForEach(l => l.DoForEach(s => list.AddIfNotIn(s)));
Model.SelectedEmployees = Model.AllEmployees.Where(employee => Model.SelectedEmployeeOids.Contains(employee.EmployeeOid)).ToList();
Model.SelectedCustomers = Model.AllCustomers.Where(customer => Model.SelectedCustomerOids.Contains(customer.CustomerOid)).ToList();
Model.SelectedResources = list.Where(resource => resource.ResourceOid.HasValue && Model.SelectedResourceOids.Contains(resource.ResourceOid.Value)).ToList();
Model.SelectedEmployeesForFiltering = Model.AllEmployees.Where(employee => Model.SelectedEmployeeOidsForFiltering.Contains(employee.EmployeeOid)).ToList();
Model.SelectedCustomersForFiltering = Model.AllCustomers.Where(customer => Model.SelectedCustomerOidsForFiltering.Contains(customer.CustomerOid)).ToList();
Model.SelectedResourcesForFiltering = list.Where(resource => resource.ResourceOid.HasValue && Model.SelectedResourceOidsForFiltering.Contains(resource.ResourceOid.Value)).ToList();
Model.SelectedEmployeesForIntervalFinder = Model.AllEmployees.Where(employee => Model.SelectedEmployeeOidsForIntervalFinder.Contains(employee.EmployeeOid)).ToList();
Model.SelectedCustomersForIntervalFinder = Model.AllCustomers.Where(customer => Model.SelectedCustomerOidsForIntervalFinder.Contains(customer.CustomerOid)).ToList();
Model.SelectedResourcesForIntervalFinder = list.Where(resource => resource.ResourceOid.HasValue && Model.SelectedResourceOidsForIntervalFinder.Contains(resource.ResourceOid.Value)).ToList();
}
// ToDo: Überarbeiten? Es kam das Ansehen hinzu
private void SetHasResourcesEmployeesOrCustomers()
{
var isOwnAppointment = !Model.IsInEditMode || Model.SelectedAppointment?.Originator.EmployeeOid == LoggedInEmployee.EmployeeOid;
var v1 = Model.HasRightToInsertEmployeeAppointments || Model.IsInEditMode && Model.HasRightToEditEmployeeAppointments;
var v2 = Model.HasRightToInsertRessourceAppointments || Model.IsInEditMode && Model.HasRightToEditResourceAppointments;
if (Model.IsInEditMode && !isOwnAppointment)
{
v2 = Model.HasRightToEditOthersResourceAppointments;
}
var v3 = Model.HasRightToInsertCustomerAppointments || Model.IsInEditMode && Model.HasRightToEditCustomerAppointments;
Model.HasResourcesEmployeesOrCustomers = v1 || v2 || v3;
}
[Authorize]
public ActionResult Scheduler()
{
if(!MobileSessionFacade.IsUserLoggedIn() || Request.Browser.Browser.Equals("InternetExplorer") || !Model.IsAllowedToSeeScheduler)
{
return Logout();
}
LoadAppointmentsForDate();
return View(Model);
}
private void LoadAppointmentsForDate()
{
if(Model?.Employee.EmployeeOid is null)
if(Model?.LoggedInEmployee.EmployeeOid is null)
{
return;
}
@@ -119,16 +195,16 @@ namespace BeWoPlanerMobil.Controllers
end = sunday;
}
var selectedCustomers = Model.SelectedCustomersForFiltering?.Select(s => s.CustomerOid).ToList() ?? new List<long>();
var selectedEmployees = Model.SelectedEmployeesForFiltering?.Select(s => s.EmployeeOid).ToList() ?? new List<long>();
var selectedResources = Model.SelectedResourcesForFiltering?.Where(w => w.ResourceOid.HasValue).Select(s => s.ResourceOid.Value).ToList() ?? new List<long>();
var selectedCustomers = Model.SelectedCustomerOidsForFiltering;
var selectedEmployees = Model.SelectedEmployeeOidsForFiltering.Clone(); //Wird soinst im KalenderService geändert
var selectedResources = Model.SelectedResourceOidsForFiltering;
var appointments = KalenderService.LoadFilteredAppointmentsMitAufgaben(AbstractModel.HasRightToViewEmployeeAppointments, Model.Employee.EmployeeOid.Value, start.Date, end, selectedEmployees, selectedCustomers, selectedResources, false, false, false, false, true, true).ToList();
var appointments = KalenderService.LoadFilteredAppointmentsMitAufgaben(Model.HasRightToViewEmployeeAppointments, Model.LoggedInEmployee.EmployeeOid.Value, start.Date, end, selectedEmployees, selectedCustomers, selectedResources, false, false, false, false, true, true).ToList();
// Private Termine
foreach(var appointment in appointments.Where(a => a.IsPrivate))
{
if(appointment.Originator.Equals(MobileSessionFacade.LoggedInCompactEmployee) || appointment.EmployeeList.Any(e2a => e2a.Employee.Equals(MobileSessionFacade.LoggedInCompactEmployee)))
if(appointment.Originator.Equals(LoggedInUser.Employee) || appointment.EmployeeList.Any(e2a => e2a.Employee.Equals(LoggedInUser.Employee)))
{
continue;
}
@@ -142,17 +218,17 @@ namespace BeWoPlanerMobil.Controllers
var tasks = appointments.Where(w => w.IsTask && w.CompletedDate is null).ToList();
// Nur eigene Kliententermine ansehen
if(!AbstractModel.HasRightToViewCustomerAppointments)
if(!Model.HasRightToViewCustomerAppointments)
{
appointments = appointments.Where(a => a.CustomerList.All(c => MobileSessionFacade.LoggedInEmployee.RelatedCustomers.Any(rc => rc.Customer.Equals(c)))).ToList();
appointments = appointments.Where(a => a.CustomerList.All(c => LoggedInEmployee.RelatedCustomers.Any(rc => rc.Customer.Equals(c)))).ToList();
}
if(!AbstractModel.HasRightToViewAllResourceAppointments)
if(!Model.HasRightToViewAllResourceAppointments)
{
appointments = appointments.Where(a => a.ResourceList.Count == 0).ToList();
}
if(!AbstractModel.IsAllowedToSeeCustomers)
if(!Model.IsAllowedToSeeCustomers)
{
appointments = appointments.Where(a => a.CustomerList.Count == 0).ToList();
}
@@ -189,19 +265,31 @@ namespace BeWoPlanerMobil.Controllers
holySweetFlyingFuck.OrderByDescending(appointment => appointment.IsTask).ThenBy(appointment => appointment.StartDate).ToList() :
holySweetFlyingFuck.Where(w => w.IsTask is false).OrderBy(appointment => appointment.StartDate).ToList();
Model.WeekViewObject = new WeekViewObject(Model.Appointments, Model.SelectedDate.GetInSameCalendarWeek(DayOfWeek.Monday), Model.Employee);
UpdateAppointmentListItems();
if(AbstractModel.HasRightToViewCustomerSelectionInScheduler)
Model.WeekViewObject = new WeekViewObject(Model.Appointments, Model.SelectedDate.GetInSameCalendarWeek(DayOfWeek.Monday), Model.LoggedInEmployee);
}
private void UpdateAppointmentListItems()
{
var md5 = new MD5CryptoServiceProvider();
var list = new List<AppointmentListItem>();
foreach (var appointment in Model.Appointments)
{
//Model.AllCustomers = EmployeeService.GetActiveCompactCustomersForEmployee(Model.Employee.EmployeeOid).OrderBy(o => o.DetailDescription).ToList();
Model.AllCustomers = CustomerService.GetAllActiveCompactCustomers().OrderBy(customer => customer.LastName).ToList();
String key = String.Format("{0}_{1}", appointment.SchedulerAppointmentOid, appointment.RecurrenceInfo);
String id = BitConverter.ToString(md5.ComputeHash(Encoding.UTF8.GetBytes(key))).Replace("-", "").ToLower();
var listItem = new AppointmentListItem(id, appointment);
list.Add(listItem);
}
if(AbstractModel.HasRightToViewEmployeeAppointments)
{
//Model.AllEmployees = EmployeeService.GetActiveCompactEmployeesForEmployee(Model.Employee.EmployeeOid.Value).OrderBy(o => o.DetailDescription).ToList();
Model.AllEmployees = EmployeeService.GetAllActiveEmployeesCompact().OrderBy(employee => employee.LastName).ToList();
}
Model.AppointmentListItems = list;
}
private static IEnumerable<SchedulerAppointmentDC> CalculateRecurrences(IEnumerable<SchedulerAppointmentDC> appointments, DateTime start, DateTime end, IReadOnlyCollection<RecurrenceInformation> changedOccurrences, IReadOnlyCollection<RecurrenceInformation> deletedOccurrences)
@@ -341,7 +429,7 @@ namespace BeWoPlanerMobil.Controllers
appointmentToInsert.StartDate = startDate;
appointmentToInsert.Subject = subject;
appointmentToInsert.Description = notice;
appointmentToInsert.Originator = MobileSessionFacade.LoggedInCompactEmployee;
appointmentToInsert.Originator = LoggedInUser.Employee;
appointmentToInsert.Location = location;
appointmentToInsert.ActivationType = ActivationTypeId.Active;
appointmentToInsert.IsPrivate = isPrivate;
@@ -376,10 +464,10 @@ namespace BeWoPlanerMobil.Controllers
if(Model != null)
{
Model.IsAllDay = false;
Model.SelectedAppointment = null;
Model.SelectedResources?.Clear();
Model.SelectedCustomers?.Clear();
Model.SelectedEmployees?.Clear();
Model.SelectedAppointmentOid = null;
Model.SelectedResourceOids?.Clear();
Model.SelectedCustomerOids?.Clear();
Model.SelectedEmployeeOids?.Clear();
}
}
@@ -400,7 +488,7 @@ namespace BeWoPlanerMobil.Controllers
if(Model != null)
{
Model.SelectedAppointment = null;
Model.SelectedAppointmentOid = null;
//Model.SelectedResources.Clear();
}
@@ -421,7 +509,7 @@ namespace BeWoPlanerMobil.Controllers
if(!(Model is null))
{
Model.SelectedAppointment = null;
Model.SelectedAppointmentOid = null;
//Model.SelectedResources.Clear();
}
@@ -443,9 +531,9 @@ namespace BeWoPlanerMobil.Controllers
Model.SelectedDate = schedulerDate;
Model.SelectedAppointment = null;
Model.SelectedResources.Clear();
Model.SelectedAppointmentOid = null;
Model.SelectedResourceOids.Clear();
return RedirectToActionPermanent("Scheduler");
}
@@ -471,9 +559,12 @@ namespace BeWoPlanerMobil.Controllers
return RedirectToActionPermanent("Scheduler");
}
Model.SelectedAppointment = Model.Appointments.FirstOrDefault(app => app.SchedulerAppointmentOid.HasValue && app.SchedulerAppointmentOid.Value == appointmentOid);
LoadAppointmentsForDate();
if(Model.SelectedAppointment != null)
Model.SelectedAppointmentOid = appointmentOid;
Model.SelectedAppointment = Model.Appointments.FirstOrDefault(app => app.SchedulerAppointmentOid.HasValue && app.SchedulerAppointmentOid.Value == appointmentOid);
if (Model.SelectedAppointment != null)
{
if(Model.SelectedAppointment.AllDay && Model.SelectedAppointment.EndDate.HasValue)
{
@@ -482,9 +573,9 @@ namespace BeWoPlanerMobil.Controllers
Model.IsAllDay = Model.SelectedAppointment.AllDay;
Model.IsPrivate = Model.SelectedAppointment.IsPrivate;
Model.SelectedResources = Model.SelectedAppointment?.ResourceList ?? new List<ResourceDC>();
Model.SelectedEmployees = Model.SelectedAppointment?.EmployeeList.Select(e2a => e2a.Employee).ToList() ?? new List<CompactEmployeeDC>();
Model.SelectedCustomers = Model.SelectedAppointment?.CustomerList ?? new List<CompactCustomerDC>();
Model.SelectedResourceOids = Model.SelectedAppointment?.ResourceList.Select(r => r.ResourceOid.Value).ToList() ?? new List<long>();
Model.SelectedEmployeeOids = Model.SelectedAppointment?.EmployeeList.Select(e2a => e2a.Employee.EmployeeOid).ToList() ?? new List<long>();
Model.SelectedCustomerOids = Model.SelectedAppointment?.CustomerList.Select(c => c.CustomerOid).ToList() ?? new List<long>();
}
return RedirectToActionPermanent("Scheduler");
@@ -495,14 +586,16 @@ namespace BeWoPlanerMobil.Controllers
{
if(Model != null)
{
Model.SelectedAppointment = null;
Model.SelectedResources.Clear();
Model.SelectedEmployees.Clear();
Model.SelectedCustomers.Clear();
Model.SelectedAppointmentOid = null;
Model.SelectedResourceOids.Clear();
Model.SelectedEmployeeOids.Clear();
Model.SelectedCustomerOids.Clear();
Model.IsAllDay = false;
Model.IsPrivate = false;
}
UpdateSelectedObjects();
return Json(null, JsonRequestBehavior.AllowGet);
}
@@ -516,7 +609,7 @@ namespace BeWoPlanerMobil.Controllers
}
var isOverlapping = false;
var oid = Model.SelectedAppointment?.SchedulerAppointmentOid;
var oid = Model.SelectedAppointmentOid;
var isSuccessfulStartDate = DateTime.TryParseExact(startDateRaw, "dd.MM.yyyy", null, DateTimeStyles.None, out var startDate);
var isSuccessfulStartTime = DateTime.TryParseExact(startTimeRaw, "HH:mm", null, DateTimeStyles.None, out var startTime);
@@ -532,7 +625,7 @@ namespace BeWoPlanerMobil.Controllers
var employeeOidList = Model.SelectedAppointment?.EmployeeList?.Select(employee2Appointment => employee2Appointment.Employee.EmployeeOid).ToList() ?? new List<long>();
var resourceOidList = Model.SelectedResources.Where(resource => resource.ResourceOid.HasValue).Select(resource => resource.ResourceOid.Value).ToList() ?? new List<long>();
var originator = Model.SelectedAppointment?.Originator ?? MobileSessionFacade.LoggedInCompactEmployee;
var originator = Model.SelectedAppointment?.Originator ?? LoggedInUser.Employee;
var recurrenceId = Model.SelectedAppointment?.RecurrenceId ?? string.Empty;
var recurrenceIndex = Model.SelectedAppointment?.RecurrenceIndex ?? 0;
@@ -560,7 +653,7 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
if(!AbstractModel.HasRightToInsertRessourceAppointments)
if(!Model.HasRightToInsertRessourceAppointments)
{
return "Fehler! Sie haben nicht das Recht, Termine mit Ressourcen anzulegen!";
}
@@ -582,7 +675,7 @@ namespace BeWoPlanerMobil.Controllers
dateTimes.EndDate = dateTimes.EndDate.AddDays(1);
}
var info = KalenderService.CheckResourceAvailabilityWithEmployeeInformation(dateTimes.StartDate, dateTimes.EndDate, oidList, Model.SelectedAppointment?.SchedulerAppointmentOid, null);
var info = KalenderService.CheckResourceAvailabilityWithEmployeeInformation(dateTimes.StartDate, dateTimes.EndDate, oidList, Model.SelectedAppointmentOid, null);
var result = string.Empty;
@@ -606,7 +699,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public string HasSelectedAppointment()
{
return JsonConvert.SerializeObject(Model?.SelectedAppointment != null);
return JsonConvert.SerializeObject(Model?.SelectedAppointmentOid.HasValue);
}
[Authorize]
@@ -642,13 +735,13 @@ namespace BeWoPlanerMobil.Controllers
var intervalEndDateString = formCollection["IntervalEnd"].Substring(0, 10);
var intervalEndTimeString = formCollection["IntervalEndTime"];
if(int.TryParse(durationString, out var intervalDuration) && DateTime.TryParse($"{intervalStartDateString} {intervalStartTimeString}", out var intervalStart) && DateTime.TryParse($"{intervalEndDateString} {intervalEndTimeString}", out var intervalEnd) && Model.Employee.EmployeeOid.HasValue)
if(int.TryParse(durationString, out var intervalDuration) && DateTime.TryParse($"{intervalStartDateString} {intervalStartTimeString}", out var intervalStart) && DateTime.TryParse($"{intervalEndDateString} {intervalEndTimeString}", out var intervalEnd) && Model.LoggedInEmployee.EmployeeOid.HasValue)
{
var customerOids = Model.SelectedCustomersForIntervalFinder.Select(customer => customer.CustomerOid).ToList();
var employeeOids = Model.SelectedEmployeesForIntervalFinder.Select(employee => employee.EmployeeOid).ToList();
var resourceOids = Model.SelectedResourcesForIntervalFinder.Where(resource => resource.ResourceOid.HasValue).Select(r => r.ResourceOid.Value).ToList();
var customerOids = Model.SelectedCustomerOidsForIntervalFinder.Clone();
var employeeOids = Model.SelectedEmployeeOidsForIntervalFinder.Clone();
var resourceOids = Model.SelectedResourceOidsForIntervalFinder.Clone();
Model.FreeIntervals = KalenderService.FindAppointmentsInRangeForIntervalFinder(intervalDuration, intervalStart, intervalEnd, resourceOids, customerOids, employeeOids, Model.Employee.EmployeeOid.Value);
Model.FreeIntervals = KalenderService.FindAppointmentsInRangeForIntervalFinder(intervalDuration, intervalStart, intervalEnd, resourceOids, customerOids, employeeOids, Model.LoggedInEmployee.EmployeeOid.Value);
Model.IntervalStartDate = intervalStart;
Model.IntervalEndDate = intervalEnd;
@@ -667,9 +760,9 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
var employeeOids = ConvertOidStringToList(oidString);
Model.SelectedEmployeesForIntervalFinder = Model.AllEmployees.Where(employee => employeeOids.Contains(employee.EmployeeOid)).ToList();
Model.SelectedEmployeeOidsForIntervalFinder = ConvertOidStringToList(oidString);
UpdateSelectedObjects();
return JsonConvert.SerializeObject(Model.SelectedEmployeesForIntervalFinder.OrderBy(o => o.DetailDescription));
}
@@ -683,9 +776,8 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
var customerOids = ConvertOidStringToList(oidString);
Model.SelectedCustomersForIntervalFinder = Model.AllCustomers.Where(customer => customerOids.Contains(customer.CustomerOid)).ToList();
Model.SelectedCustomerOidsForIntervalFinder = ConvertOidStringToList(oidString);
UpdateSelectedObjects();
return JsonConvert.SerializeObject(Model.SelectedCustomersForIntervalFinder.OrderBy(o => o.LastNameFirstName));
}
@@ -699,13 +791,9 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
var resourceOidList = ConvertOidStringToList(resourceOids);
var list = new List<ResourceDC>();
Model.ResourceCategories2Resources.Values.DoForEach(l => l.DoForEach(s => list.AddIfNotIn(s)));
Model.SelectedResourcesForIntervalFinder = list.Where(resource => resource.ResourceOid.HasValue && resourceOidList.Contains(resource.ResourceOid.Value)).ToList();
Model.SelectedResourceOidsForIntervalFinder = ConvertOidStringToList(resourceOids);
UpdateSelectedObjects();
return JsonConvert.SerializeObject(Model.SelectedResourcesForIntervalFinder);
}
@@ -726,9 +814,9 @@ namespace BeWoPlanerMobil.Controllers
if(!newValue)
{
Model.SelectedEmployeesForIntervalFinder.Clear();
Model.SelectedCustomersForIntervalFinder.Clear();
Model.SelectedResourcesForIntervalFinder.Clear();
Model.SelectedEmployeeOidsForIntervalFinder.Clear();
Model.SelectedCustomerOidsForIntervalFinder.Clear();
Model.SelectedResourceOidsForIntervalFinder.Clear();
}
return RedirectToActionPermanent("Scheduler");
@@ -766,18 +854,18 @@ namespace BeWoPlanerMobil.Controllers
ActivationType = ActivationTypeId.Active,
IsTask = false,
IsPrivate = false,
Originator = MobileSessionFacade.LoggedInCompactEmployee,
Originator = LoggedInUser.Employee,
StartDate = startDate,
EndDate = endDate
};
Model.SelectedCustomers = Model.SelectedCustomersForIntervalFinder.Clone();
Model.SelectedEmployees = Model.SelectedEmployeesForIntervalFinder.Clone();
Model.SelectedResources = Model.SelectedResourcesForIntervalFinder.Clone();
Model.SelectedCustomerOids = Model.SelectedCustomerOidsForIntervalFinder.Clone();
Model.SelectedEmployeeOids = Model.SelectedEmployeeOidsForIntervalFinder.Clone();
Model.SelectedResourceOids = Model.SelectedResourceOidsForIntervalFinder.Clone();
Model.SelectedCustomersForIntervalFinder.Clear();
Model.SelectedEmployeesForIntervalFinder.Clear();
Model.SelectedResourcesForIntervalFinder.Clear();
Model.SelectedCustomerOidsForIntervalFinder.Clear();
Model.SelectedEmployeeOidsForIntervalFinder.Clear();
Model.SelectedResourceOidsForIntervalFinder.Clear();
Model.IntervalStartDate = null;
Model.IntervalEndDate = null;
@@ -794,6 +882,10 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
Model.SelectedCustomerOidsForIntervalFinder.Clear();
Model.SelectedEmployeeOidsForIntervalFinder.Clear();
Model.SelectedResourceOidsForIntervalFinder.Clear();
Model.SelectedCustomersForIntervalFinder.Clear();
Model.SelectedEmployeesForIntervalFinder.Clear();
Model.SelectedResourcesForIntervalFinder.Clear();
@@ -831,7 +923,7 @@ namespace BeWoPlanerMobil.Controllers
Model.ResourceCategories2Resources.Values.DoForEach(l => l.DoForEach(s => list.AddIfNotIn(s)));
Model.SelectedResourcesForFiltering = list.Where(resource => resource.ResourceOid.HasValue && oidList.Contains(resource.ResourceOid.Value)).ToList();
Model.SelectedResourceOidsForFiltering = oidList;
return JsonConvert.SerializeObject(Model.SelectedResourcesForFiltering);
}
@@ -844,11 +936,9 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
var oidList = ConvertOidStringToList(oidString);
Model.SelectedEmployeeOidsForFiltering = ConvertOidStringToList(oidString);
Model.SelectedEmployeesForFiltering = Model.AllEmployees.Where(employee => oidList.Contains(employee.EmployeeOid)).ToList();
return Model.SelectedEmployeesForFiltering.Count.ToString();
return Model.SelectedEmployeeOidsForFiltering.Count.ToString();
}
[Authorize]
@@ -860,17 +950,15 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
var oidList = ConvertOidStringToList(oidString);
Model.SelectedCustomerOidsForFiltering = ConvertOidStringToList(oidString);
Model.SelectedCustomersForFiltering = Model.AllCustomers.Where(customer => oidList.Contains(customer.CustomerOid)).ToList();
return Model.SelectedCustomersForFiltering.Count.ToString();
return Model.SelectedCustomerOidsForFiltering.Count.ToString();
}
[Authorize]
public ActionResult FetchSelectedEmployeesForPopup()
{
if(Model is null)
if (Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
}
@@ -881,7 +969,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult FetchEmployeeFilteringModalBody()
{
if(Model is null)
if (Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
}
@@ -892,7 +980,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public string SelectTeamForFiltering(string teamOidString)
{
if(Model?.Employee?.EmployeeOid is null)
if(Model?.LoggedInEmployee?.EmployeeOid is null)
{
Logout();
return LeerzeichenFuerGetMethoden;
@@ -900,14 +988,14 @@ namespace BeWoPlanerMobil.Controllers
if(long.TryParse(teamOidString, out var teamOid))
{
var team = EmployeeService.FindTeamByOid(teamOid, Model.Employee.EmployeeOid.Value);
var team = EmployeeService.FindTeamByOid(teamOid, Model.LoggedInEmployee.EmployeeOid.Value);
if(!(team is null))
{
Model.SelectedEmployeesForFiltering.AddRangeIfElementsNotIn(team.Member);
Model.SelectedEmployeeOidsForFiltering.AddRangeIfElementsNotIn(team.Member.Select(m => m.EmployeeOid));
}
}
UpdateSelectedObjects();
return LeerzeichenFuerGetMethoden;
}
@@ -918,7 +1006,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public string SelectTeamForAppointment(string teamOidString)
{
if(Model?.Employee?.EmployeeOid is null)
if(Model?.LoggedInEmployee?.EmployeeOid is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return LeerzeichenFuerGetMethoden;
@@ -931,15 +1019,16 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
var team = EmployeeService.FindTeamByOid(teamOid, Model.Employee.EmployeeOid.Value);
var team = EmployeeService.FindTeamByOid(teamOid, Model.LoggedInEmployee.EmployeeOid.Value);
if(team is null)
{
return LeerzeichenFuerGetMethoden;
}
Model.SelectedEmployees.AddRangeIfElementsNotIn(team.Member);
teamMemberOids.AddRangeIfElementsNotIn(team.Member.Select(member => member.EmployeeOid));
Model.SelectedEmployeeOids.AddRangeIfElementsNotIn(team.Member.Select(m => m.EmployeeOid));
UpdateSelectedObjects();
return LeerzeichenFuerGetMethoden;
}
@@ -954,9 +1043,9 @@ namespace BeWoPlanerMobil.Controllers
return PartialView("SchedulerEmployeeSelectionPartial");
}
var oidList = ConvertOidStringToList(oidString);
Model.SelectedEmployees = Model.AllEmployees.Where(employee => oidList.Contains(employee.EmployeeOid)).ToList();
Model.SelectedEmployeeOids = ConvertOidStringToList(oidString);
UpdateSelectedObjects();
return PartialView("SchedulerEmployeeSelectionPartial", Model);
}
@@ -969,8 +1058,10 @@ namespace BeWoPlanerMobil.Controllers
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("EmployeeSelectionPopupListPartial");
}
Model.SelectedEmployeeOids = isChecked ? Model.AllEmployees.Select(r => r.EmployeeOid).ToList() : new List<long>();
Model.SelectedEmployees = isChecked ? Model.AllEmployees : new List<CompactEmployeeDC>();
UpdateSelectedObjects();
return PartialView("EmployeeSelectionPopupListPartial", Model);
}
@@ -978,7 +1069,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult LoadUpdatedEmployees()
{
if(Model is null)
if (Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("SchedulerEmployeeSelectionPartial");
@@ -990,7 +1081,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult LoadUpdatedEmployeePopupList()
{
if(Model is null)
if (Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("EmployeeSelectionPopupListPartial");
@@ -1012,8 +1103,9 @@ namespace BeWoPlanerMobil.Controllers
Logout();
return PartialView("CustomerSelectionPopupListPartial");
}
Model.SelectedCustomers = isChecked ? Model.AllCustomers : new List<CompactCustomerDC>();
Model.SelectedCustomerOids = isChecked ? Model.AllCustomers.Select(r => r.CustomerOid).ToList() : new List<long>();
UpdateSelectedObjects();
return PartialView("CustomerSelectionPopupListPartial", Model);
}
@@ -1021,7 +1113,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult LoadUpdatedCustomers()
{
if(Model is null)
if (Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("SchedulerCustomerSelectionPartial");
@@ -1033,7 +1125,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult LoadUpdatedCustomerPopupList()
{
if(Model is null)
if (Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("CustomerSelectionPopupListPartial");
@@ -1052,9 +1144,10 @@ namespace BeWoPlanerMobil.Controllers
return PartialView("SchedulerCustomerSelectionPartial");
}
var oidList = ConvertOidStringToList(oidString);
Model.SelectedCustomerOids = ConvertOidStringToList(oidString);
Model.SelectedCustomers = Model.AllCustomers.Where(customer => oidList.Contains(customer.CustomerOid)).ToList();
UpdateSelectedObjects();
return PartialView("SchedulerCustomerSelectionPartial", Model);
}
@@ -1072,7 +1165,7 @@ namespace BeWoPlanerMobil.Controllers
return PartialView("SchedulerResourceSelectionPartial");
}
var oidList = ConvertOidStringToList(oidString);
//var list = new List<ResourceDC>();
@@ -1080,7 +1173,9 @@ namespace BeWoPlanerMobil.Controllers
//Model.SelectedResources = list.Where(resource => resource.ResourceOid.HasValue && oidList.Contains(resource.ResourceOid.Value)).ToList();
Model.SelectedResources = Model.AllResources.Where(resource => resource.ResourceOid.HasValue && oidList.Contains(resource.ResourceOid.Value)).ToList();
Model.SelectedResourceOids = ConvertOidStringToList(oidString);
UpdateSelectedObjects();
return PartialView("SchedulerResourceSelectionPartial", Model);
}
@@ -1094,7 +1189,9 @@ namespace BeWoPlanerMobil.Controllers
return PartialView("ResourceSelectionPopupListPartial");
}
Model.SelectedResources = isChecked ? Model.AllResources : new List<ResourceDC>();
Model.SelectedResourceOids = isChecked ? Model.AllResources.Select(r => r.ResourceOid.Value).ToList() : new List<long>();
UpdateSelectedObjects();
return PartialView("ResourceSelectionPopupListPartial", Model);
}
@@ -1102,7 +1199,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult LoadUpdatedResourcePopupList()
{
if(Model is null)
if (Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("ResourceSelectionPopupListPartial");
@@ -1114,7 +1211,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult LoadUpdatedResources()
{
if(Model is null)
if (Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
return PartialView("SchedulerResourceSelectionPartial");
@@ -1129,7 +1226,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult FetchCustomersForFiltering()
{
if(Model is null)
if (Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
}
@@ -1140,7 +1237,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult FetchCustomerFilteringModalBody()
{
if(Model is null)
if (Model is null)
{
TempData[TempDataConstants.DoLogoutKey] = true;
}
@@ -1174,18 +1271,17 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public string DeleteAppointment(string appointmentIdentifier, bool deleteSeries)
{
if(Model?.Employee?.EmployeeOid is null)
if(Model?.LoggedInEmployee?.EmployeeOid is null)
{
Logout();
return LeerzeichenFuerGetMethoden;
}
if(!Guid.TryParse(appointmentIdentifier, out var identifier))
{
return LeerzeichenFuerGetMethoden;
}
var schedulerAppointment = Model.AppointmentListItems.FirstOrDefault(app => app.Identifier.Equals(identifier))?.SchedulerAppointment;
LoadAppointmentsForDate();
var schedulerAppointment = Model.AppointmentListItems.FirstOrDefault(app => app.Identifier.Equals(appointmentIdentifier))?.SchedulerAppointment;
if(schedulerAppointment is null)
{
@@ -1216,14 +1312,14 @@ namespace BeWoPlanerMobil.Controllers
return LeerzeichenFuerGetMethoden;
}
var teamMemberCustomerOids = EmployeeService.LoadTeamsRelatedCustomerOids(Model.Employee.EmployeeOid.Value);
var teamMemberCustomerOids = EmployeeService.LoadTeamsRelatedCustomerOids(Model.LoggedInEmployee.EmployeeOid.Value);
var customerList = schedulerAppointment.CustomerList;
var employeeList = schedulerAppointment.EmployeeList;
var resourceList = schedulerAppointment.ResourceList;
var originator = schedulerAppointment.Originator;
var isNew = schedulerAppointment.SchedulerAppointmentOid is null;
var loggedOnUser = MobileSessionFacade.LoggedInUserDC;
var loggedOnUser = LoggedInUser;
var isAllowedToDelete = BS.Shared.Core.Utils.CheckSchedulerRights(customerList, resourceList, employeeList, originator, isNew, SchedulerRightsCheckType.Edit, loggedOnUser, teamMemberCustomerOids);
@@ -1287,7 +1383,7 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public string SelectTeamForIntervalFinder(string teamOidString)
{
if(Model?.Employee?.EmployeeOid is null)
if(Model?.LoggedInEmployee?.EmployeeOid is null)
{
Logout();
return LeerzeichenFuerGetMethoden;
@@ -1295,12 +1391,12 @@ namespace BeWoPlanerMobil.Controllers
if(long.TryParse(teamOidString, out var teamOid))
{
var team = EmployeeService.FindTeamByOid(teamOid, Model.Employee.EmployeeOid.Value);
var team = EmployeeService.FindTeamByOid(teamOid, Model.LoggedInEmployee.EmployeeOid.Value);
if(!(team is null))
{
var memberOids = team.Member.Select(member => member.EmployeeOid).ToList();
Model.SelectedEmployeeOidsForIntervalFinder.AddRangeIfElementsNotIn(memberOids);
return JsonConvert.SerializeObject(memberOids);
}
}
@@ -1318,11 +1414,12 @@ namespace BeWoPlanerMobil.Controllers
return Logout();
}
if(!Guid.TryParse(formCollection[FormCollectionConstants.AppointmentIdInputKey], out var identifier))
var identifier = formCollection[FormCollectionConstants.AppointmentIdInputKey];
if (Model.AppointmentListItems == null)
{
return RedirectToActionPermanent("PrepareServiceRecordInsert", "Main");
LoadAppointmentsForDate();
}
var appointmentListItem = Model.AppointmentListItems.FirstOrDefault(f => f.Identifier.Equals(identifier));
if(appointmentListItem is null)
@@ -1332,13 +1429,13 @@ namespace BeWoPlanerMobil.Controllers
var appointment = appointmentListItem.SchedulerAppointment;
var employeeOids = appointment.EmployeeList.Select(employee2Appointment => employee2Appointment.Employee.EmployeeOid).ToList();
if(employeeOids.Count == 0)
{
employeeOids.Add(appointment.Originator.EmployeeOid);
}
//var employeeOids = appointment.EmployeeList.Select(employee2Appointment => employee2Appointment.Employee.EmployeeOid).ToList();
//if(employeeOids.Count == 0)
//{
// employeeOids.Add(appointment.Originator.EmployeeOid);
//}
TempData[TempDataConstants.AppointmentListItemKey] = appointmentListItem;
TempData[TempDataConstants.AppointmentOidKey] = appointmentListItem.SchedulerAppointment?.SchedulerAppointmentOid;
return RedirectToActionPermanent("PrepareServiceRecordInsert", "Main");
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
@@ -12,43 +13,52 @@ namespace BeWoPlanerMobil.Models
{
public class AbstractModel
{
public static bool IsDeleteBtnVisible => CheckRight(UserRightType.ServiceRecordView_Delete);
public bool IsDeleteBtnVisible => CheckRight(UserRightType.ServiceRecordView_Delete);
public static bool IsAllowedToSeeScheduler => MobileSessionFacade.LoggedInUser != null && CheckRight(UserRightType.KalenderAnsehen) || CheckRight(UserRightType.ViewAll);
public bool IsAllowedToSeeScheduler => LoggedInUser != null && CheckRight(UserRightType.KalenderAnsehen) || CheckRight(UserRightType.ViewAll);
public static bool IsAllowedToSeeCustomers => CheckRight(UserRightType.ViewAll) || CheckRight(UserRightType.CustomerView_View) || CheckRight(UserRightType.Customer_ViewMyCustomers);
public bool IsAllowedToSeeCustomers => CheckRight(UserRightType.ViewAll) || CheckRight(UserRightType.CustomerView_View) || CheckRight(UserRightType.Customer_ViewMyCustomers);
public static bool IsEmployeeSelectionVisible => CheckRight(UserRightType.ServiceRecord_AllowCreationForOtherEmployees) || CheckRight(UserRightType.ServiceRecord_AllowCreationForOtherTeamMember);
public bool IsEmployeeSelectionVisible => CheckRight(UserRightType.ServiceRecord_AllowCreationForOtherEmployees) || CheckRight(UserRightType.ServiceRecord_AllowCreationForOtherTeamMember);
public static bool HasRightForGroupBookings => CheckRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking);
public bool HasRightForGroupBookings => CheckRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking);
public static bool HasRightToViewCustomerAppointments => CheckRight(UserRightType.KalenderKliententermineAlleAnsehen) || CheckRight(UserRightType.CustomerView_View) || CheckRight(UserRightType.Customer_ViewMyCustomers) || CheckRight(UserRightType.Customer_ViewMyTeams);
public static bool HasRightToViewEmployeeAppointments => CheckRight(UserRightType.KalenderMitarbeitertermineAnsehen) || CheckRight(UserRightType.ViewAll);
public static bool HasRightToViewAllResourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAnsehen) || CheckRight(UserRightType.ViewAll);
public bool HasRightToViewCustomerAppointments => CheckRight(UserRightType.KalenderKliententermineAlleAnsehen) || CheckRight(UserRightType.CustomerView_View) || CheckRight(UserRightType.Customer_ViewMyCustomers) || CheckRight(UserRightType.Customer_ViewMyTeams);
public bool HasRightToViewEmployeeAppointments => CheckRight(UserRightType.KalenderMitarbeitertermineAnsehen) || CheckRight(UserRightType.ViewAll);
public bool HasRightToViewAllResourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAnsehen) || CheckRight(UserRightType.ViewAll);
public EmployeeDC Employee { get; set; }
public ISessionModel SessionModel { get; internal set; }
public string LoggedInEmplyeeFirstNameLastName => Employee != null ? $"{Employee.FirstName} {Employee.LastName}" : "BeWoPlaner";
public UserDC LoggedInUser { get; set; }
public static bool HasRightToSeeAllSupportConcepts => CheckRight(UserRightType.SupportConcept_ViewAllSupportConcepts) || CheckRight(UserRightType.ViewAll);
public MokMandator Mandator { get; set; }
public static bool HasRightToSeeTextModules => CheckRight(UserRightType.TextbausteineNurEigeneAnsehen) || CheckRight(UserRightType.TextbausteineAlleAnsehen);
public static bool HasRightToSeeOwnTextModules => CheckRight(UserRightType.TextbausteineNurEigeneAnsehen);
public static bool HasRightToSeeGlobalTextModules => CheckRight(UserRightType.TextbausteineAlleAnsehen);
public EmployeeDC LoggedInEmployee { get; set; }
public static bool HasRightToSeeServiceRecords => CheckRight(UserRightType.ServiceRecordView_View) && CheckRight(UserRightType.ServiceRecordView_Create);
public string LoggedInEmplyeeFirstNameLastName => LoggedInEmployee != null ? $"{LoggedInEmployee.FirstName} {LoggedInEmployee.LastName}" : "BeWoPlaner";
public static string TimeOfLastAction { get; set; }
public bool HasRightToSeeAllSupportConcepts => CheckRight(UserRightType.SupportConcept_ViewAllSupportConcepts) || CheckRight(UserRightType.ViewAll);
public static bool HasRightToInsertRessourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAnlegen) || CheckRight(UserRightType.CreateAll);
public bool HasRightToSeeTextModules => CheckRight(UserRightType.TextbausteineNurEigeneAnsehen) || CheckRight(UserRightType.TextbausteineAlleAnsehen);
public bool HasRightToSeeOwnTextModules => CheckRight(UserRightType.TextbausteineNurEigeneAnsehen);
public bool HasRightToSeeGlobalTextModules => CheckRight(UserRightType.TextbausteineAlleAnsehen);
public static bool HasRightToViewQuittierungsbelege
public bool HasRightToSeeServiceRecords => CheckRight(UserRightType.ServiceRecordView_View) && CheckRight(UserRightType.ServiceRecordView_Create);
public static string TimeOfLastAction
{
get { return MobileSessionFacade.TimeOfLastAction; }
set { MobileSessionFacade.TimeOfLastAction = value; }
}
public bool HasRightToInsertRessourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAnlegen) || CheckRight(UserRightType.CreateAll);
public bool HasRightToViewQuittierungsbelege
{
get
{
var mandator = MobileSessionFacade.Mandator;
var showEmployeeSignatureSetting = MobileUtils.GetSettingValue(mandator.Settings, SettingsKeys.ShowSignature);
var showEmployeeSignatureSetting = MobileUtils.GetSettingValue(Mandator.Settings, SettingsKeys.ShowSignature);
#if DEBUG
showEmployeeSignatureSetting = "1";
#endif
@@ -58,40 +68,45 @@ namespace BeWoPlanerMobil.Models
public static bool IsAllowedToSeeSupportConceptFilter
public bool IsAllowedToSeeSupportConceptFilter
{
get
{
var user = MobileSessionFacade.LoggedInUser;
var user = LoggedInUser;
if(user != null)
{
return
user.CheckForAtLeastOneRight(new List<UserRightType> { UserRightType.ViewAll, UserRightType.SupportConcept_ViewAllSupportConcepts }) ||
user.CheckForRight(UserRightType.SupportConcept_ViewMyTeams);
user.HasRight(UserRightType.SupportConcept_ViewMyTeams);
}
return false;
}
}
public static string UserSettings
public string UserSettings
{
get
{
var user = MobileSessionFacade.LoggedInUser;
var user = LoggedInUser;
return user?.SettingList.FirstOrDefault(f => f.Type.Equals(SettingsType.ApplicationSettings))?.Value;
return user?.Settings.FirstOrDefault(f => f.Type.Equals(SettingsType.ApplicationSettings))?.Value;
}
}
public static bool IsAllowedToSeeCustomerFilter => MobileSessionFacade.LoggedInUser?.CheckForAtLeastOneRight(new List<UserRightType> { UserRightType.ViewAll, UserRightType.CustomerView_View, UserRightType.Customer_ViewMyTeams }) ?? false;
public MokSettings MokSettings { get; set; }
public bool IsAllowedToSeeCustomerFilter => LoggedInUser?.CheckForAtLeastOneRight(new List<UserRightType> { UserRightType.ViewAll, UserRightType.CustomerView_View, UserRightType.Customer_ViewMyTeams }) ?? false;
public static bool IsAllowedToSeeMedikamentenliste
public bool IsAllowedToSeeMedikamentenliste
{
get
{
var mandator = MobileSessionFacade.Mandator;
#if DEBUG
return true;
#endif
var mandator = Mandator;
var hasSetting = MobileUtils.GetSettingValue(mandator.Settings, SettingsKeys.ShowMedication) == "1";
@@ -101,55 +116,55 @@ namespace BeWoPlanerMobil.Models
}
}
public static bool CheckRight(UserRightType userRightType)
public bool CheckRight(UserRightType userRightType)
{
return MobileSessionFacade.CheckForUserRight(userRightType);
return LoggedInUser.HasRight(userRightType);
}
public static bool CheckRights(List<UserRightType> userRightTypes)
public bool CheckRights(List<UserRightType> userRightTypes)
{
return userRightTypes.All(MobileSessionFacade.CheckForUserRight);
return userRightTypes.All(LoggedInUser.HasRight);
}
public static bool CheckForAtLeastOneRight(UserRightType[] rights)
public bool CheckForAtLeastOneRight(UserRightType[] rights)
{
return rights.Any(MobileSessionFacade.CheckForUserRight);
return rights.Any(LoggedInUser.HasRight);
}
public static bool HasRightToInsertEmployeeAppointments => CheckRight(UserRightType.KalenderMitarbeitertermineAnlegen) ||
public bool HasRightToInsertEmployeeAppointments => CheckRight(UserRightType.KalenderMitarbeitertermineAnlegen) ||
CheckRight(UserRightType.CreateAll);
public static bool HasRightToEditEmployeeAppointments => CheckRight(UserRightType.KalenderMitarbeitertermineAendern) || CheckRight(UserRightType.EditAll);
public bool HasRightToEditEmployeeAppointments => CheckRight(UserRightType.KalenderMitarbeitertermineAendern) || CheckRight(UserRightType.EditAll);
public static bool HasRightToEditResourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAendern) || CheckRight(UserRightType.EditAll);
public static bool HasRightToEditOthersResourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAndererAendern) || CheckRight(UserRightType.EditAll);
public bool HasRightToEditResourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAendern) || CheckRight(UserRightType.EditAll);
public bool HasRightToEditOthersResourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAndererAendern) || CheckRight(UserRightType.EditAll);
public static bool HasRightToInsertCustomerAppointments => CheckRight(UserRightType.KalenderKliententermineAnlegen) &&
public bool HasRightToInsertCustomerAppointments => CheckRight(UserRightType.KalenderKliententermineAnlegen) &&
(CheckRight(UserRightType.CustomerView_View) ||
CheckRight(UserRightType.Customer_ViewMyCustomers) ||
CheckRight(UserRightType.Customer_ViewMyTeams)) ||
CheckRight(UserRightType.CreateAll);
public static bool HasRightToEditCustomerAppointments => CheckRight(UserRightType.KalenderKliententermineAendern) || CheckRight(UserRightType.EditAll);
public bool HasRightToEditCustomerAppointments => CheckRight(UserRightType.KalenderKliententermineAendern) || CheckRight(UserRightType.EditAll);
public static bool ShowServiceRecordInsertedOn { get; set; }
public bool ShowServiceRecordInsertedOn { get; set; }
public static bool HasRightToViewCustomerSelectionInScheduler => CheckRight(UserRightType.CustomerView_View) || CheckRight(UserRightType.Customer_ViewMyCustomers) || CheckRight(UserRightType.Customer_ViewMyTeams);
public bool HasRightToViewCustomerSelectionInScheduler => CheckRight(UserRightType.CustomerView_View) || CheckRight(UserRightType.Customer_ViewMyCustomers) || CheckRight(UserRightType.Customer_ViewMyTeams);
public static bool HasRightToViewTeams => CheckRight(UserRightType.TeamView_ViewMyTeams) || CheckRight(UserRightType.TeamView_ViewAll);
public bool HasRightToViewTeams => CheckRight(UserRightType.TeamView_ViewMyTeams) || CheckRight(UserRightType.TeamView_ViewAll);
public static bool HasRightForMultiBooking => CheckRight(UserRightType.ServiceRecord_AllowCreatingMultiBooking);
public bool HasRightForMultiBooking => CheckRight(UserRightType.ServiceRecord_AllowCreatingMultiBooking);
public static bool HasRightToDeleteReceiptSignatures => CheckRight(UserRightType.ConfirmationReceiptSignatures_Delete);
public bool HasRightToDeleteReceiptSignatures => CheckRight(UserRightType.ConfirmationReceiptSignatures_Delete);
public static bool HasRightToRateGoals => CheckRight(UserRightType.BewertenInZeiterfassung);
public bool HasRightToRateGoals => CheckRight(UserRightType.BewertenInZeiterfassung);
public static bool HasRightToEditCustomers => CheckRight(UserRightType.CustomerView_Edit);
public bool HasRightToEditCustomers => CheckRight(UserRightType.CustomerView_Edit);
public static bool HasRightMitarbeiterstundenkontoViewAll => CheckRight(UserRightType.Mitarbeiterstundenkonto_ViewAll);
public static bool HasRightMitarbeiterstundenkontoViewTeams => CheckRight(UserRightType.Mitarbeiterstundenkonto_ViewTeams);
public static bool HasRightMitarbeiterstundenkontoViewSelf => CheckRight(UserRightType.Mitarbeiterstundenkonto_ViewSelf);
public bool HasRightMitarbeiterstundenkontoViewAll => CheckRight(UserRightType.Mitarbeiterstundenkonto_ViewAll);
public bool HasRightMitarbeiterstundenkontoViewTeams => CheckRight(UserRightType.Mitarbeiterstundenkonto_ViewTeams);
public bool HasRightMitarbeiterstundenkontoViewSelf => CheckRight(UserRightType.Mitarbeiterstundenkonto_ViewSelf);
public static bool HasRightToViewReports => CheckForAtLeastOneRight(new UserRightType[]
public bool HasRightToViewReports => CheckForAtLeastOneRight(new UserRightType[]
{
UserRightType.ViewAll,
UserRightType.QueryView_View,
@@ -172,7 +187,7 @@ namespace BeWoPlanerMobil.Models
UserRightType.Auswertungen_HilfeplanuebersichtAnsehen
});
public static bool HasRightToViewMitarbeiterstundenkonto
public bool HasRightToViewMitarbeiterstundenkonto
{
get
{
@@ -180,34 +195,34 @@ namespace BeWoPlanerMobil.Models
}
}
public static bool HasRightToViewDiagnosen => CheckRight(UserRightType.Customer_ViewDiagnosis);
public bool HasRightToViewDiagnosen => CheckRight(UserRightType.Customer_ViewDiagnosis);
public static bool HasRightToProvideSingleSignature => CheckRight(UserRightType.Signature_ProvideSingleSignature);
public bool HasRightToProvideSingleSignature => CheckRight(UserRightType.Signature_ProvideSingleSignature);
public static bool HasRightToViewOwnCustomersBargeldkassen => CheckRight(UserRightType.BargeldverwaltungNurEigeneAnsehen);
public bool HasRightToViewOwnCustomersBargeldkassen => CheckRight(UserRightType.BargeldverwaltungNurEigeneAnsehen);
public static bool HasRightToViewAllCustomersBargeldkassen => CheckRight(UserRightType.BargeldverwaltungAnsehen);
public bool HasRightToViewAllCustomersBargeldkassen => CheckRight(UserRightType.BargeldverwaltungAnsehen);
public static bool HasRightToDeleteCustomerBargeldkassen => CheckRight(UserRightType.BargeldverwaltungLoeschen);
public bool HasRightToDeleteCustomerBargeldkassen => CheckRight(UserRightType.BargeldverwaltungLoeschen);
public static bool HasRightToCreateCustomerBargeldkassen => CheckRight(UserRightType.BargeldverwaltungAnlegen);
public bool HasRightToCreateCustomerBargeldkassen => CheckRight(UserRightType.BargeldverwaltungAnlegen);
public static bool HasRightToEditCustomerBargeldkassen => CheckRight(UserRightType.BargeldverwaltungBearbeiten);
public bool HasRightToEditCustomerBargeldkassen => CheckRight(UserRightType.BargeldverwaltungBearbeiten);
public static bool HasRightToViewCustomerAbsenceTimes => CheckRight(UserRightType.Customer_ViewAbsenceTimes);
public bool HasRightToViewCustomerAbsenceTimes => CheckRight(UserRightType.Customer_ViewAbsenceTimes);
public static bool HasRightToProvideEmployeeSignatureForOthers => CheckRight(UserRightType.Signature_ProvideMonthlySignatureByProxy);
public bool HasRightToProvideEmployeeSignatureForOthers => CheckRight(UserRightType.Signature_ProvideMonthlySignatureByProxy);
public static bool HasRightToViewBetreuung => CheckRight(UserRightType.Customer_ViewBetreuung);
public bool HasRightToViewBetreuung => CheckRight(UserRightType.Customer_ViewBetreuung);
public static bool HasRightToViewCustomerDocuments => CheckForAtLeastOneRight(new[] { UserRightType.ViewAll, UserRightType.DokumenteKlienten });
public bool HasRightToViewCustomerDocuments => CheckForAtLeastOneRight(new[] { UserRightType.ViewAll, UserRightType.DokumenteKlienten });
public static string UserMessage { get; set; }
//public string UserMessage { get; set; }
public XtraReport Report { get; set; }
public string ReportName { get; set; }
protected static string GetIsNotApproved(SupportConceptCostBearerRelDC rel)
protected string GetIsNotApproved(SupportConceptCostBearerRelDC rel)
{
var result = string.Empty;
@@ -239,20 +254,20 @@ namespace BeWoPlanerMobil.Models
public Dictionary<string, bool> Collapsibles2IsShown { get; set; } = new Dictionary<string, bool>();
public static bool ShowDifferentQBInterval
public bool ShowDifferentQBInterval
{
get
{
var settingsValue = MobileUtils.GetSettingValue(MobileSessionFacade.Mandator.Settings, SettingsKeys.ShowServicesOverviewHalfOrWholeMonth);
var settingsValue = MobileUtils.GetSettingValue(Mandator.Settings, SettingsKeys.ShowServicesOverviewHalfOrWholeMonth);
return "1" == settingsValue;
}
}
public static bool ShowDistanceField { get; set; }
public bool ShowDistanceField { get; set; }
public static bool ShowBetrag { get; set; }
public bool ShowBetrag { get; set; }
public static string LocalStorageKey => MobileSessionFacade.LoggedInUser is object ? $"bwp_{MobileSessionFacade.Tenant}_{MobileSessionFacade.LoggedInUser.Oid}" : null;
}
}

View File

@@ -15,13 +15,25 @@ namespace BeWoPlanerMobil.Models
{
public class CustomerModel : AbstractModel
{
public CustomerModel()
{
SessionModel = new CustomerSessionModel();
}
public CustomerSessionModel CustomerSessionModel
{
get
{
return SessionModel as CustomerSessionModel;
}
}
[Display(Name = "Klient")]
public long? SelectedCustomerOid { get; set; }
public long? SelectedCustomerOid { get { return CustomerSessionModel.SelectedCustomerOid; } set { CustomerSessionModel.SelectedCustomerOid = value; } }
public CustomerDC SelectedCustomer { get; set; }
public List<CompactCustomerDC> Customers { get; set; }
public IEnumerable<SelectListItem> CustomerListItems
{
get
@@ -38,7 +50,7 @@ namespace BeWoPlanerMobil.Models
public JsonCustomer SelectedJsonCustomer => SelectedCustomer != null ? new JsonCustomer(SelectedCustomer, FolderTree, ICD10Diagnosen) : null;
[Display(Name = "Filter")]
public CustomerFilterEnum SelectedCustomerFilter { get; set; }
public CustomerFilterEnum SelectedCustomerFilter { get { return CustomerSessionModel.SelectedCustomerFilter; } set { CustomerSessionModel.SelectedCustomerFilter = value; } }
public List<SelectListItem> CustomerFilter
{
@@ -46,7 +58,7 @@ namespace BeWoPlanerMobil.Models
{
var result = new List<SelectListItem>();
var user = MobileSessionFacade.LoggedInUser;
var user = LoggedInUser;
const string allCustomers = "Alle Klienten anzeigen";
const string myCustomersOnly = "Nur meine Klienten anzeigen";
@@ -63,12 +75,12 @@ namespace BeWoPlanerMobil.Models
result.Add(new SelectListItem { Text = allCustomers, Value = allCustomersValue });
result.Add(new SelectListItem { Text = myCustomersOnly, Value = myCustomersValue });
if(user.CheckForRight(UserRightType.Customer_ViewMyTeams))
if(user.HasRight(UserRightType.Customer_ViewMyTeams))
{
result.Add(new SelectListItem {Text = myTeamsCustomersOnly, Value = myTeamsCustomersValue });
}
}
else if(user.CheckForRight(UserRightType.Customer_ViewMyTeams))
else if(user.HasRight(UserRightType.Customer_ViewMyTeams))
{
result.Add(new SelectListItem { Text = myCustomersOnly, Value = myCustomersValue });
result.Add(new SelectListItem { Text = myTeamsCustomersOnly, Value = myTeamsCustomersValue });
@@ -84,7 +96,7 @@ namespace BeWoPlanerMobil.Models
public List<CustomerReportType> ReportTypes { get; set; }
[Display(Name = "Bericht")]
public CustomerReportType SelectedReportType { get; set; }
public CustomerReportType SelectedReportType { get { return CustomerSessionModel.SelectedReportType; } set { CustomerSessionModel.SelectedReportType = value; } }
public List<SelectListItem> ReportTypeItems
{
@@ -108,7 +120,7 @@ namespace BeWoPlanerMobil.Models
public List<BargeldkassenDC> Bargeldkassen { get; set; } = new List<BargeldkassenDC>();
[Display(Name = "Kategorie")]
public long? SelectedAbsenceReason { get; set; }
public long? SelectedAbsenceReasonOid { get { return CustomerSessionModel.SelectedAbsenceReasonOid; } set { CustomerSessionModel.SelectedAbsenceReasonOid = value; } }
public List<AbsenceReasonDC> AllAbsenceReasons { get; set; }
@@ -136,12 +148,24 @@ namespace BeWoPlanerMobil.Models
}
}
public long? SelectedAbsenceTimeOid { get { return CustomerSessionModel.SelectedAbsenceTimeOid; } set { CustomerSessionModel.SelectedAbsenceTimeOid = value; } }
public AbsenceTimeDC SelectedAbsenceTime { get; set; }
//{
// get { return selectedAbsenceTime; }
// set
// {
// selectedAbsenceTime = value;
// SelectedAbsenceTimeOid = selectedAbsenceTime != null ? selectedAbsenceTime.AbsenceTimeOid : null;
// }
//}
public long? SelectedBargeldkasseOid { get { return CustomerSessionModel.SelectedBargeldkasseOid; } set { CustomerSessionModel.SelectedBargeldkasseOid = value; } }
public BargeldkassenDC SelectedBargeldkasse { get; set; }
[Display(Name="Auszahlunsintervall")]
public int SelectedAuszahlungsintervall { get; set; }
public int SelectedAuszahlungsintervall { get { return CustomerSessionModel.SelectedAuszahlungsintervall; } set { CustomerSessionModel.SelectedAuszahlungsintervall = value; } }
public List<SelectListItem> Auszahlungsintervalle =>
new List<SelectListItem>
{
@@ -155,11 +179,13 @@ namespace BeWoPlanerMobil.Models
public string BargeldkassenReportName { get; set; }
public XtraReport ZahlungsbelegsReportObject { get; set; }
public long? SelectedBargeldtransaktionOid { get { return CustomerSessionModel.SelectedBargeldtransaktionOid; } set { CustomerSessionModel.SelectedBargeldtransaktionOid = value; } }
public BargeldtransaktionDC SelectedBargeldtransaktion { get; set; }
[Display(Name = "Art")]
public int SelectedTransaktionsart { get; set; }
public int SelectedTransaktionsart { get { return CustomerSessionModel.SelectedTransaktionsart; } set { CustomerSessionModel.SelectedTransaktionsart = value; } }
public List<SelectListItem> Transaktionsarten =>
new List<SelectListItem>
{

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Mvc;
using BeWo.View.Navigation.Filter;
using BeWoPlanerMobil.Controllers;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using DevExpress.XtraReports.UI;
namespace BeWoPlanerMobil.Models
{
[Serializable]
public class CustomerSessionModel : ISessionModel
{
public long? SelectedCustomerOid { get; set; }
public CustomerFilterEnum SelectedCustomerFilter { get; set; }
public CustomerReportType SelectedReportType { get; set; }
public long? SelectedAbsenceReasonOid { get; set; }
public long? SelectedAbsenceTimeOid { get; set; }
public long? SelectedBargeldkasseOid { get; set; }
public int SelectedAuszahlungsintervall { get; set; }
public long? SelectedBargeldtransaktionOid { get; set; }
public int SelectedTransaktionsart { get; set; }
public void ResetValues()
{
SelectedCustomerOid = null;
//SelectedCustomerFilter = CustomerFilterEnum.All;
//SelectedReportType = CustomerReportType.Medikamentenliste;
SelectedAbsenceReasonOid = null;
SelectedAbsenceTimeOid = null;
SelectedBargeldkasseOid = null;
//SelectedAuszahlungsintervall = 0;
SelectedBargeldtransaktionOid = null;
//SelectedTransaktionsart = 0;
}
}
}

View File

@@ -0,0 +1,9 @@
using BeWoPlanerMobil.Service;
namespace BeWoPlanerMobil.Models
{
public interface ISessionModel
{
void ResetValues();
}
}

View File

@@ -19,17 +19,33 @@ namespace BeWoPlanerMobil.Models
{
protected static readonly log4net.ILog Log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public MainModel()
{
SessionModel = new MainSessionModel();
SessionModel.ResetValues();
NewServiceRecord = new ServiceRecordDC();
ShowOnlyOwnSupportConcepts = true;
ErrorWert = 1;
}
public MainSessionModel MainSessionModel
{
get
{
return SessionModel as MainSessionModel;
}
}
public long? SelectedCostBearerSupportConceptRelOid { get; set; }
public bool SessionInitialized { get { return MainSessionModel.SessionInitialized; } set { MainSessionModel.SessionInitialized = value; } }
[Display(Name = "Nur meine Klienten anzeigen")]
public bool ShowOnlyOwnSupportConcepts { get; set; }
public bool ShowOnlyOwnSupportConcepts { get { return MainSessionModel.ShowOnlyOwnSupportConcepts; } set { MainSessionModel.ShowOnlyOwnSupportConcepts = value; } }
[Display(Name = "Nur Klienten meiner Teams anzeigen")]
public bool ShowOnlyMyTeamsSupportConcepts { get; set; }
public CustomerFilterEnum SelectedSupportConceptFilter { get; set; }
public bool ShowOnlyMyTeamsSupportConcepts { get { return MainSessionModel.ShowOnlyMyTeamsSupportConcepts; } set { MainSessionModel.ShowOnlyMyTeamsSupportConcepts = value; } }
public CustomerFilterEnum SelectedSupportConceptFilter { get { return MainSessionModel.SelectedSupportConceptFilter; } set { MainSessionModel.SelectedSupportConceptFilter = value; } }
public List<SelectListItem> SupportConceptFilter
{
@@ -55,7 +71,7 @@ namespace BeWoPlanerMobil.Models
var result = new List<SelectListItem>();
var user = MobileSessionFacade.LoggedInUser;
var user = LoggedInUser;
var alle = new CustomerFilterItem(CustomerFilterEnum.All);
var nurMeine = new CustomerFilterItem(CustomerFilterEnum.MyCustomer);
@@ -73,7 +89,7 @@ namespace BeWoPlanerMobil.Models
{
if(user.CheckForAtLeastOneRight(new List<UserRightType> { UserRightType.ViewAll, UserRightType.SupportConcept_ViewAllSupportConcepts }))
{
if(user.CheckForRight(UserRightType.SupportConcept_ViewMyTeams))
if(user.HasRight(UserRightType.SupportConcept_ViewMyTeams))
{
result.Add(new SelectListItem { Text = allSupportConcepts, Value = allSupportConceptsValue });
result.Add(new SelectListItem { Text = myTeamsSupportConceptsOnly, Value = myTeamsSupportConceptsOnlyValue });
@@ -85,7 +101,7 @@ namespace BeWoPlanerMobil.Models
result.Add(new SelectListItem { Text = mySupportConceptsOnly, Value = mySupportConceptsValue });
}
}
else if(user.CheckForRight(UserRightType.SupportConcept_ViewMyTeams))
else if(user.HasRight(UserRightType.SupportConcept_ViewMyTeams))
{
result.Add(new SelectListItem { Text = myTeamsSupportConceptsOnly, Value = myTeamsSupportConceptsOnlyValue });
result.Add(new SelectListItem { Text = mySupportConceptsOnly, Value = mySupportConceptsValue });
@@ -97,37 +113,25 @@ namespace BeWoPlanerMobil.Models
}
[Display(Name = "Abgelaufene Hilfepläne anzeigen")]
public bool ShowExpiredSupportConcepts { get; set; }
private long? _CostBearer2SupportConceptOid;
public bool ShowExpiredSupportConcepts { get { return MainSessionModel.ShowExpiredSupportConcepts; } set { MainSessionModel.ShowExpiredSupportConcepts = value; } }
[Display(Name = "Hilfeplan")]
public long? CostBearer2SupportConceptOid
{
get => _CostBearer2SupportConceptOid;
public long? SelectedCostBearerSupportConceptOid { get { return MainSessionModel.SelectedCostBearerSupportConceptOid; } set { MainSessionModel.SelectedCostBearerSupportConceptOid = value; } }
public long? SelectedServiceCategoryOid { get { return MainSessionModel.SelectedServiceCategoryOid; } set { MainSessionModel.SelectedServiceCategoryOid = value; } }
set
{
Log.Info($"CostBearer2SupportConceptOid ausgewählt: {value}. Vorher: {_CostBearer2SupportConceptOid}; Benutzer: {MobileSessionFacade.LoggedInUser.LoginName} UserOid: {MobileSessionFacade.LoggedInUser.Oid}");
_CostBearer2SupportConceptOid = value;
}
}
public long? SelectedServiceCategoryOid => SelectedServiceCategory?.ServiceCategoryOid;
public long? SelectedServiceDescriptionOid => SelectedServiceDescription?.ServiceDescriptionOid;
public long? SelectedServiceRecordOid { get; set; }
public long? SelectedServiceDescriptionOid { get { return MainSessionModel.SelectedServiceDescriptionOid; } set { MainSessionModel.SelectedServiceDescriptionOid = value; } }
public bool IsAllowedToDeleteServiceRecord(ServiceRecordDC serviceRecord)
{
var allowed = false;
if(MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecordView_Delete))
if(LoggedInUser.HasRight(UserRightType.ServiceRecordView_Delete))
{
allowed = true;
}
else if(MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowChangeWithin24Hours))
else if(LoggedInUser.HasRight(UserRightType.ServiceRecord_AllowChangeWithin24Hours))
{
if(serviceRecord.InsertedOn.HasValue)
{
@@ -140,7 +144,7 @@ namespace BeWoPlanerMobil.Models
if(allowed && ApplicationSettings.MaxDaysEditServiceRecordsAllowed > 0)
{
if(!MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowEditAfterMaxDaysInNextMonth))
if(!LoggedInUser.HasRight(UserRightType.ServiceRecord_AllowEditAfterMaxDaysInNextMonth))
{
if(serviceRecord.Start.HasValue)
{
@@ -158,7 +162,7 @@ namespace BeWoPlanerMobil.Models
if (allowed && ApplicationSettings.AnzTageZeiterfassErfolgt > 0)
{
if (!MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecordAllowEditAfterMindays))
if (!LoggedInUser.HasRight(UserRightType.ServiceRecordAllowEditAfterMindays))
{
if (serviceRecord.Start != null)
{
@@ -172,9 +176,9 @@ namespace BeWoPlanerMobil.Models
}
}
if(allowed && !MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowEditForOtherEmployees))
if(allowed && !LoggedInUser.HasRight(UserRightType.ServiceRecord_AllowEditForOtherEmployees))
{
if(MobileSessionFacade.LoggedInEmployee.EmployeeOid != serviceRecord.Employee.EmployeeOid)
if(LoggedInUser.Employee.EmployeeOid != serviceRecord.Employee.EmployeeOid)
{
allowed = false;
}
@@ -182,7 +186,7 @@ namespace BeWoPlanerMobil.Models
if(allowed && serviceRecord.GroupOid.HasValue)
{
if(!MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking))
if(!LoggedInUser.HasRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking))
{
allowed = false;
}
@@ -191,33 +195,23 @@ namespace BeWoPlanerMobil.Models
return allowed;
}
public long? SelectedServiceRecordOid { get { return MainSessionModel.SelectedServiceRecordOid; } set { MainSessionModel.SelectedServiceRecordOid = value; } }
public ServiceRecordDC SelectedServiceRecord { get; set; }
private SupportConceptDC _SelectedSupportConcept;
public SupportConceptDC SelectedSupportConcept
{
get => _SelectedSupportConcept;
set
{
var stackTrace = new StackTrace();
var callingMethodsName = stackTrace.GetFrame(1).GetMethod().Name;
Log.Info($"SC mit Oid {value?.SupportConceptOid} ausgewählt. Vorheriger SC: {_SelectedSupportConcept?.SupportConceptOid}. Aufrufende Methode: {callingMethodsName}");
_SelectedSupportConcept = value;
}
}
public long? SelectedSupportConceptOid { get { return MainSessionModel.SelectedSupportConceptOid; } set { MainSessionModel.SelectedSupportConceptOid = value; } }
public SupportConceptDC SelectedSupportConcept { get; set; }
public int Zeitraum { get; set; }
public int ErrorWert { get; set; }
public bool ShowSignature { get; set; }
public long ServiceRecordOid { get; set; }
public long LastCreatedServiceRecordOid { get { return MainSessionModel.LastCreatedServiceRecordOid; } set { MainSessionModel.LastCreatedServiceRecordOid = value; } }
public List<SupportConceptDC> SupportConcepts { get; set; }
public List<SupportConceptDC> SupportConcepts { get; set; }
public List<TextModuleDC> Textbausteine { get; set; } = new List<TextModuleDC>();
@@ -239,6 +233,8 @@ namespace BeWoPlanerMobil.Models
set => _ServiceRecords = value;
}
public List<long> SelectedGoalOids { get { return MainSessionModel.SelectedGoalOids; } set { MainSessionModel.SelectedGoalOids = value; } }
private List<ValueListEntryDC> _SelectedGoals;
public List<ValueListEntryDC> SelectedGoals
@@ -259,25 +255,21 @@ namespace BeWoPlanerMobil.Models
public long? ServiceRecordOidToDelete { get; set; }
public MainModel()
{
NewServiceRecord = new ServiceRecordDC();
ShowOnlyOwnSupportConcepts = true;
ErrorWert = 1;
}
public IEnumerable<CostBearer2SupportConceptRelListObject> SupportConceptListObjects
{
get
{
var allCostBearerRelations = new List<CostBearer2SupportConceptRelListObject> {new CostBearer2SupportConceptRelListObject("Hilfeplan auswählen", "", "-1", false, false), new CostBearer2SupportConceptRelListObject("Ohne Hilfeplan", "", "-2", false, false) };
foreach(var sc in SupportConcepts.OrderBy(sc => sc.Customer.LastName))
var allCostBearerRelations = new List<CostBearer2SupportConceptRelListObject> {new CostBearer2SupportConceptRelListObject("Hilfeplan auswählen", "", -1, false, false), new CostBearer2SupportConceptRelListObject("Ohne Hilfeplan", "", -2, false, false) };
BS.Shared.Settings.ApplicationSettings.SupportConceptExpirationLimitInMonths = MokSettings.SupportConceptExpirationLimitInMonths;
foreach (var sc in SupportConcepts.OrderBy(sc => sc.Customer.LastName))
{
allCostBearerRelations.AddRange(sc.CostBearerRelations.Where(w => ShowExpiredSupportConcepts || w.EndDate is null || w.EndDate.Value >= DateTime.Now.Date).Select(
cb => new CostBearer2SupportConceptRelListObject(
$"{sc.Customer.SimpleDescription} {(sc.Customer.DateOfBirth.HasValue ? "*" + sc.Customer.DateOfBirth.Value.ToString("dd.MM.yyyy") : string.Empty)}",
$"{cb.AuswahlBezeichnung} {cb.StartDate?.ToShortDateString().Remove(6, 2) ?? string.Empty}-{cb.EndDate?.ToShortDateString().Remove(6, 2) ?? string.Empty} {cb.CostBearer.Name}{GetIsNotApproved(cb)}",
cb.CostBearer2SupportConceptOid.ToString(),
cb.CostBearer2SupportConceptOid.Value,
cb.SupportConcept.IsAboutToExpire,
cb.SupportConcept.ExpiresIn3MonthOrLess))
);
@@ -288,6 +280,8 @@ namespace BeWoPlanerMobil.Models
public CostBearer2SupportConceptRelListObject SelectedCostBearer2SupportConceptRelListObject { get; set; }
public List<long> SelectedConceptCostBearerRelationOids { get { return MainSessionModel.SelectedConceptCostBearerRelations; } set { MainSessionModel.SelectedConceptCostBearerRelations = value; } }
public List<SupportConceptCostBearerRelDC> SelectedConceptCostBearerRelations { get; set; }
public GroupBookingSelectionObject GroupBookingSelectionObject => new GroupBookingSelectionObject(SelectedConceptCostBearerRelations, GroupBookingSelectedGroupOfPeopleOids);
@@ -304,7 +298,7 @@ namespace BeWoPlanerMobil.Models
cb => new CostBearer2SupportConceptRelListObject(
$"{sc.Customer.SimpleDescription} {(sc.Customer.DateOfBirth.HasValue ? "*" + sc.Customer.DateOfBirth.Value.ToString("dd.MM.yyyy") : string.Empty)}",
$"{cb.AuswahlBezeichnung} {cb.StartDate?.ToShortDateString().Remove(6, 2) ?? string.Empty}-{cb.EndDate?.ToShortDateString().Remove(6, 2) ?? string.Empty} {cb.CostBearer.Name}",
cb.CostBearer2SupportConceptOid.ToString(),
cb.CostBearer2SupportConceptOid.Value,
cb.SupportConcept.IsAboutToExpire,
cb.SupportConcept.ExpiresIn3MonthOrLess))
);
@@ -322,16 +316,14 @@ namespace BeWoPlanerMobil.Models
}
}
public List<CompactEmployeeDC> Employees { get; set; }
public List<CompactEmployeeDC> EmployeesForGroupAndMultiBooking { get; set; }
public List<CompactEmployeeDC> AllEmployees { get; set; }
[Display(Name = "Mitarbeiter")]
public long? SelectedEmployeeOid => SelectedEmployee?.EmployeeOid;
public long? SelectedEmployeeOid { get { return MainSessionModel.SelectedEmployeeOid; } set { MainSessionModel.SelectedEmployeeOid = value; } }
public CompactEmployeeDC SelectedEmployee { get; set; }
public CompactEmployeeDC SelectedEmployee { get; set; }
public List<GroupOfPeopleDC> GroupsOfPeople { get; set; } = new List<GroupOfPeopleDC>();
@@ -342,7 +334,7 @@ namespace BeWoPlanerMobil.Models
get
{
var result = new List<SelectListItem>();
result.AddRange(Employees.Select(item => new SelectListItem {Value = item.EmployeeOid.ToString(), Text = $"{item.LastName}, {item.FirstName}", Selected = item.Equals(MobileSessionFacade.LoggedInCompactEmployee)}).OrderBy(s => s.Text).ToList());
result.AddRange(Employees.Select(item => new SelectListItem {Value = item.EmployeeOid.ToString(), Text = $"{item.LastName}, {item.FirstName}", Selected = item.Equals(LoggedInUser.Employee)}).OrderBy(s => s.Text).ToList());
return result;
}
@@ -369,36 +361,37 @@ namespace BeWoPlanerMobil.Models
return maxDate;
}
public List<SupportConceptDC> GroupBookingSelectedSupportConcepts { get; set; } = new List<SupportConceptDC>();
public List<long> GroupBookingSelectedSupportConceptOids { get { return MainSessionModel.GroupBookingSelectedSupportConceptOids; } set { MainSessionModel.GroupBookingSelectedSupportConceptOids = value; } }
public List<SupportConceptDC> GroupBookingSelectedSupportConcepts { get; set; } = new List<SupportConceptDC>();
public List<long> GroupBookingSelectedCostbearerRelOids { get; set; } = new List<long>();
public List<long> GroupBookingSelectedCostbearerRelOids { get { return MainSessionModel.GroupBookingSelectedCostbearerRelOids; } set { MainSessionModel.GroupBookingSelectedCostbearerRelOids = value; } }
public List<CompactEmployeeDC> GroupBookingSelectedEmployees { get; set; } = new List<CompactEmployeeDC>();
public List<long> GroupBookingSelectedEmployeeOids { get { return MainSessionModel.GroupBookingSelectedEmployeeOids; } set { MainSessionModel.GroupBookingSelectedEmployeeOids = value; } }
public List<CompactEmployeeDC> GroupBookingSelectedEmployees { get; set; } = new List<CompactEmployeeDC>();
[Display(Name = "Gruppenbuchung")]
public bool IsInGroupBookingMode
{
get => _IsInGroupBookingMode;
get => MainSessionModel.IsInGroupBookingMode;
set
{
_IsInGroupBookingMode = value;
MainSessionModel.IsInGroupBookingMode = value;
if(!_IsInGroupBookingMode)
if(!MainSessionModel.IsInGroupBookingMode)
{
GroupBookingSelectedSupportConcepts?.Clear();
GroupBookingSelectedEmployees?.Clear();
}
GroupBookingSelectedSupportConceptOids?.Clear();
GroupBookingSelectedEmployeeOids?.Clear();
}
}
}
private bool _IsInGroupBookingMode;
public bool IsInEditingMode { get { return MainSessionModel.IsInEditingMode; } set { MainSessionModel.IsInEditingMode = value; } }
public bool IsInEditingMode { get; set; }
public List<ServiceDescriptionDC> GetServiceDesctiptions()
public List<ServiceDescriptionDC> GetServiceDesctiptions()
{
var result = new List<ServiceDescriptionDC>();
@@ -412,23 +405,27 @@ namespace BeWoPlanerMobil.Models
public bool IsServiceRecordNoticeMandatory { get; set; } = true;
public CompactEmployeeDC PreviouslySelectedEmployee { get; set; }
public SupportConceptDC PreviouslySelectedSupportConcept { get; set; }
private long? _PreviouslySelectedCostbearer2SupportConceptOid;
public long? PreviouslySelectedEmployeeOid { get { return MainSessionModel.PreviouslySelectedEmployeeOid; } set { MainSessionModel.PreviouslySelectedEmployeeOid = value; } }
public CompactEmployeeDC PreviouslySelectedEmployee { get; set; }
public long? PreviouslySelectedSupportConceptOid { get { return MainSessionModel.PreviouslySelectedSupportConceptOid; } set { MainSessionModel.PreviouslySelectedSupportConceptOid = value; } }
public SupportConceptDC PreviouslySelectedSupportConcept { get; set; }
public long? PreviouslySelectedCostbearer2SupportConceptOid
{
get => _PreviouslySelectedCostbearer2SupportConceptOid;
get => MainSessionModel.PreviouslySelectedCostbearer2SupportConceptOid;
set
{
var stackTrace = new StackTrace();
var callingMethodsName = stackTrace.GetFrame(1).GetMethod().Name;
var alt = _PreviouslySelectedCostbearer2SupportConceptOid;
var alt = MainSessionModel.PreviouslySelectedCostbearer2SupportConceptOid;
Log.Info($"PreviouslySelectedCostbearer2SupportConceptOid-Set von {alt} zu {value} von Methode: {callingMethodsName}");
_PreviouslySelectedCostbearer2SupportConceptOid = value;
MainSessionModel.PreviouslySelectedCostbearer2SupportConceptOid = value;
}
}
public bool IsEndDateVisible { get; set; }
@@ -479,11 +476,11 @@ namespace BeWoPlanerMobil.Models
{
var allowed = false;
if(MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecordView_Edit))
if(LoggedInUser.HasRight(UserRightType.ServiceRecordView_Edit))
{
allowed = true;
}
else if(MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowChangeWithin24Hours))
else if(LoggedInUser.HasRight(UserRightType.ServiceRecord_AllowChangeWithin24Hours))
{
if(serviceRecord.InsertedOn != null)
{
@@ -496,7 +493,7 @@ namespace BeWoPlanerMobil.Models
if(allowed && ApplicationSettings.MaxDaysEditServiceRecordsAllowed > 0)
{
if(!MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowEditAfterMaxDaysInNextMonth))
if(!LoggedInUser.HasRight(UserRightType.ServiceRecord_AllowEditAfterMaxDaysInNextMonth))
{
if(serviceRecord.Start != null)
{
@@ -512,9 +509,9 @@ namespace BeWoPlanerMobil.Models
}
}
if(allowed && !MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowEditForOtherEmployees))
if(allowed && !LoggedInUser.HasRight(UserRightType.ServiceRecord_AllowEditForOtherEmployees))
{
if(MobileSessionFacade.LoggedInEmployee.EmployeeOid != serviceRecord.Employee.EmployeeOid)
if(LoggedInUser.Employee.EmployeeOid != serviceRecord.Employee.EmployeeOid)
{
allowed = false;
}
@@ -522,7 +519,7 @@ namespace BeWoPlanerMobil.Models
if(allowed && serviceRecord.GroupOid.HasValue)
{
if(!MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking))
if(!LoggedInUser.HasRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking))
{
allowed = false;
}
@@ -530,7 +527,7 @@ namespace BeWoPlanerMobil.Models
if(allowed && ApplicationSettings.AnzTageZeiterfassErfolgt > 0)
{
if(!MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecordAllowEditAfterMindays))
if(!LoggedInUser.HasRight(UserRightType.ServiceRecordAllowEditAfterMindays))
{
if(serviceRecord.Start != null)
{
@@ -690,39 +687,29 @@ namespace BeWoPlanerMobil.Models
/// </summary>
public ServiceRecordTimeInterval ServiceRecordTimeInterval { get; set; }
public int SelectedDayCount { get; set; }
public NullableDateTimeSpan SelectedZeitraum { get; set; }
public NullableDateTimeSpan SelectedZeitraum { get { return MainSessionModel.SelectedZeitraum; } set { MainSessionModel.SelectedZeitraum = value; } }
public bool IsOnlyYearMonthVisible { get; set; }
#region Mehrfachbuchung
private bool _IsInMultiBookingMode;
[Display(Name = "Mehrfachbuchung")]
public bool IsInMultiBookingMode
{
get => _IsInMultiBookingMode;
public bool IsInMultiBookingMode { get { return MainSessionModel.IsInMultiBookingMode; } set { MainSessionModel.IsInMultiBookingMode = value; } }
set
{
_IsInMultiBookingMode = value;
if(!_IsInMultiBookingMode)
{
}
}
}
public List<long> MultiBookingSelectedSupportConceptOids { get { return MainSessionModel.MultiBookingSelectedSupportConceptOids; } set { MainSessionModel.MultiBookingSelectedSupportConceptOids = value; } }
public List<SupportConceptDC> MultiBookingSelectedSupportConcepts { get; set; } = new List<SupportConceptDC>();
public List<long> MultiBookingSelectedGroupOfPeopleOids { get; set; } = new List<long>();
public List<long> MultiBookingSelectedGroupOfPeopleOids { get { return MainSessionModel.MultiBookingSelectedGroupOfPeopleOids; } set { MainSessionModel.MultiBookingSelectedGroupOfPeopleOids = value; } }
public List<SupportConceptCostBearerRelDC> MultiBookingSelectedConceptCostBearerRelations { get; set; }
public GroupBookingSelectionObject MultiBookingSelectionObject => new GroupBookingSelectionObject(MultiBookingSelectedConceptCostBearerRelations, MultiBookingSelectedGroupOfPeopleOids);
public List<long> MultiBookingSelectedCostbearerRelOids { get; set; } = new List<long>();
public List<long> MultiBookingSelectedCostbearerRelOids { get { return MainSessionModel.MultiBookingSelectedCostbearerRelOids; } set { MainSessionModel.MultiBookingSelectedCostbearerRelOids = value; } }
public List<long> MultiBookingSelectedEmployeeOids { get { return MainSessionModel.MultiBookingSelectedEmployeeOids; } set { MainSessionModel.MultiBookingSelectedEmployeeOids = value; } }
public List<CompactEmployeeDC> MultiBookingSelectedEmployees { get; set; } = new List<CompactEmployeeDC>();
public List<CostBearer2SupportConceptRelListObject> MultiBookingSupportConceptListObjects
@@ -737,7 +724,7 @@ namespace BeWoPlanerMobil.Models
cb => new CostBearer2SupportConceptRelListObject(
$"{sc.Customer.SimpleDescription} {(sc.Customer.DateOfBirth.HasValue ? "*" + sc.Customer.DateOfBirth.Value.ToString("dd.MM.yyyy") : string.Empty)}",
$"{cb.AuswahlBezeichnung} {cb.StartDate?.ToShortDateString().Remove(6, 2) ?? string.Empty}-{cb.EndDate?.ToShortDateString().Remove(6, 2) ?? string.Empty} {cb.CostBearer.Name}",
cb.CostBearer2SupportConceptOid.ToString(),
cb.CostBearer2SupportConceptOid.Value,
cb.SupportConcept.IsAboutToExpire,
cb.SupportConcept.ExpiresIn3MonthOrLess))
);
@@ -749,8 +736,6 @@ namespace BeWoPlanerMobil.Models
#endregion
public MandatorDC Mandator { get; set; }
public bool IsPasswordSecurityEnabled { get; set; }
public bool ShowMarker { get; set; }
@@ -758,7 +743,7 @@ namespace BeWoPlanerMobil.Models
#region ServiceRecord-Pagination
public int ServiceRecordCount { get; set; }
public int CurrentPage { get; set; }
public int CurrentPage { get { return MainSessionModel.CurrentPage; } set { MainSessionModel.CurrentPage = value; } }
public int MaxResults { get; set; } = 10;
@@ -783,6 +768,7 @@ namespace BeWoPlanerMobil.Models
public ServiceCategoryDC SelectedServiceCategory { get; set; }
public ServiceDescriptionDC SelectedServiceDescription { get; set; }
public List<ValueListEntryDC> AllGoals { get; internal set; }
public ServiceDescriptionDC GetSelectedOrFirstServiceDescription()
{
@@ -830,7 +816,7 @@ namespace BeWoPlanerMobil.Models
public string SupportConceptTimeSpan { get; }
public string CostBearer2SupportConceptOid { get; }
public long CostBearer2SupportConceptOid { get; }
public string CostBearer2SupportConceptOidName { get; }
@@ -838,13 +824,13 @@ namespace BeWoPlanerMobil.Models
public bool ExpiresInThreeMonthsOrLess { get; }
public CostBearer2SupportConceptRelListObject(string pNameAndDateOfBirth, string pSupportConceptTimeSpan, string pCostBearer2SupportConceptOid, bool isAboutToExpire, bool expiresIn3MonthOrLess)
public CostBearer2SupportConceptRelListObject(string pNameAndDateOfBirth, string pSupportConceptTimeSpan, long pCostBearer2SupportConceptOid, bool isAboutToExpire, bool expiresIn3MonthOrLess)
{
NameAndDateOfBirth = pNameAndDateOfBirth;
SupportConceptTimeSpan = pSupportConceptTimeSpan;
CostBearer2SupportConceptOid = pCostBearer2SupportConceptOid;
CostBearer2SupportConceptOidName = "OidHolder_" + CostBearer2SupportConceptOid;
CostBearer2SupportConceptOidName = String.Format("OidHolder_{0}", CostBearer2SupportConceptOid);
IsAboutToExpire = isAboutToExpire;
ExpiresInThreeMonthsOrLess = expiresIn3MonthOrLess;
@@ -873,7 +859,7 @@ namespace BeWoPlanerMobil.Models
hash = (hash * hashingMultiplier) ^ (NameAndDateOfBirth?.GetHashCode() ?? 0);
hash = (hash * hashingMultiplier) ^ (SupportConceptTimeSpan?.GetHashCode() ?? 0);
hash = (hash * hashingMultiplier) ^ (CostBearer2SupportConceptOid?.GetHashCode() ?? 0);
hash = (hash * hashingMultiplier) ^ (CostBearer2SupportConceptOid.GetHashCode());
hash = (hash * hashingMultiplier) ^ IsAboutToExpire.GetHashCode();
hash = (hash * hashingMultiplier) ^ ExpiresInThreeMonthsOrLess.GetHashCode();

View File

@@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Mvc;
using BeWo.View.Navigation.Filter;
using BeWoPlanerMobil.Controllers;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using DevExpress.XtraReports.UI;
namespace BeWoPlanerMobil.Models
{
[Serializable]
public class MainSessionModel : ISessionModel
{
public bool SessionInitialized { get; internal set; }
public long? SelectedSupportConceptOid { get; internal set; }
public long? SelectedCostBearerSupportConceptOid { get; internal set; }
public bool ShowOnlyOwnSupportConcepts { get; internal set; }
public bool ShowOnlyMyTeamsSupportConcepts { get; internal set; }
public CustomerFilterEnum SelectedSupportConceptFilter { get; internal set; }
public bool ShowExpiredSupportConcepts { get; internal set; }
public long? SelectedServiceCategoryOid { get; internal set; }
public long? SelectedServiceDescriptionOid { get; internal set; }
public long? SelectedServiceRecordOid { get; internal set; }
public long? SelectedEmployeeOid { get; internal set; }
public NullableDateTimeSpan SelectedZeitraum { get; internal set; }
public List<long> SelectedConceptCostBearerRelations { get; internal set; }
public List<long> GroupBookingSelectedSupportConceptOids { get; internal set; }
public List<long> GroupBookingSelectedEmployeeOids { get; internal set; }
public List<long> GroupBookingSelectedCostbearerRelOids { get; internal set; }
public bool IsInGroupBookingMode { get; internal set; }
public bool IsInEditingMode { get; internal set; }
public long? PreviouslySelectedEmployeeOid { get; internal set; }
public long? PreviouslySelectedSupportConceptOid { get; internal set; }
public long? PreviouslySelectedCostbearer2SupportConceptOid { get; internal set; }
public bool IsInMultiBookingMode { get; internal set; }
public List<long> MultiBookingSelectedSupportConceptOids { get; internal set; }
public List<long> MultiBookingSelectedGroupOfPeopleOids { get; internal set; }
public List<long> MultiBookingSelectedCostbearerRelOids { get; internal set; }
public List<long> MultiBookingSelectedEmployeeOids { get; internal set; }
public int CurrentPage { get; internal set; }
public List<long> SelectedGoalOids { get; internal set; }
public long LastCreatedServiceRecordOid { get; internal set; }
public void ResetValues()
{
SessionInitialized = false;
SelectedSupportConceptOid = null;
SelectedCostBearerSupportConceptOid = null;
ShowOnlyOwnSupportConcepts = false;
ShowOnlyMyTeamsSupportConcepts = false;
SelectedSupportConceptFilter = CustomerFilterEnum.All;
ShowExpiredSupportConcepts = false;
SelectedServiceCategoryOid = null;
SelectedServiceDescriptionOid = null;
SelectedServiceRecordOid = null;
SelectedEmployeeOid = null;
SelectedZeitraum = null;
SelectedConceptCostBearerRelations = new List<long>();
GroupBookingSelectedSupportConceptOids = new List<long>();
GroupBookingSelectedEmployeeOids = new List<long>();
GroupBookingSelectedCostbearerRelOids = new List<long>();
MultiBookingSelectedSupportConceptOids = new List<long>();
MultiBookingSelectedGroupOfPeopleOids = new List<long>();
MultiBookingSelectedCostbearerRelOids = new List<long>();
MultiBookingSelectedEmployeeOids = new List<long>();
SelectedGoalOids = new List<long>();
PreviouslySelectedEmployeeOid = null;
PreviouslySelectedSupportConceptOid = null;
PreviouslySelectedCostbearer2SupportConceptOid = null;
IsInGroupBookingMode = false;
IsInEditingMode = false;
IsInMultiBookingMode = false;
CurrentPage = 0;
LastCreatedServiceRecordOid = 0;
}
}
}

View File

@@ -17,6 +17,19 @@ namespace BeWoPlanerMobil.Models
{
public class ReportModel : AbstractModel
{
public ReportModel()
{
SessionModel = new ReportSessionModel();
}
public ReportSessionModel ReportSessionModel
{
get
{
return SessionModel as ReportSessionModel;
}
}
public QbSignatureIntervalSelection SelectedIntervalSelection { get; set; }
public List<SelectListItem> IntervalSelections => new List<SelectListItem>
@@ -41,16 +54,16 @@ namespace BeWoPlanerMobil.Models
}
};
[Display(Name = "Klient")]
public long? SelectedCustomerOid => SelectedCustomer?.CustomerOid;
[Display(Name = "Klient")]
public long? SelectedCustomerOid { get { return ReportSessionModel.SelectedCustomerOid; } set { ReportSessionModel.SelectedCustomerOid = value; } }
public CompactCustomerDC SelectedCustomer { get; set; }
[Display(Name = "Monat")]
public int? SelectedMonth { get; set; }
public int? SelectedMonth { get { return ReportSessionModel.SelectedMonth; } set { ReportSessionModel.SelectedMonth = value; } }
[Display(Name = "Jahr")]
public int? SelectedYear { get; set; }
public int? SelectedYear { get { return ReportSessionModel.SelectedYear; } set { ReportSessionModel.SelectedYear = value; } }
public List<SelectListItem> Months
{
@@ -115,27 +128,27 @@ namespace BeWoPlanerMobil.Models
}
[Display(Name = "Vom")]
public int? SelectedStartDay { get; set; }
public int? SelectedStartDay { get { return ReportSessionModel.SelectedStartDay; } set { ReportSessionModel.SelectedStartDay = value; } }
[Display(Name = "Bis")]
public int? SelectedEndDay { get; set; }
public int? SelectedEndDay { get { return ReportSessionModel.SelectedEndDay; } set { ReportSessionModel.SelectedEndDay = value; } }
public ConfirmationReceiptObject ConfirmationReceiptObject { get; set; }
[Display(Name = "Mitarbeiter")]
public long? SelectedEmployeeOid => SelectedEmployee?.EmployeeOid;
public long? SelectedEmployeeOid { get { return ReportSessionModel.SelectedEmployeeOid; } set { ReportSessionModel.SelectedEmployeeOid = value; } }
public CompactEmployeeDC SelectedEmployee { get; set; }
[Display(Name="Kostenträger")]
public long? SelectedOrganisationOid => SelectedOrganisation?.OrganisationOid;
public long? SelectedOrganisationOid { get { return ReportSessionModel.SelectedOrganisationOid; } set { ReportSessionModel.SelectedOrganisationOid = value; } }
public CompactOrganisationDC SelectedOrganisation { get; set; }
public List<CompactOrganisationDC> Organisations { get; set; } = new List<CompactOrganisationDC>();
[Display(Name="Leistungskategorie")]
public long? SelectedServiceCategoryOid => SelectedServiceCategory?.ServiceCategoryOid;
public long? SelectedServiceCategoryOid { get { return ReportSessionModel.SelectedServiceCategoryOid; } set { ReportSessionModel.SelectedServiceCategoryOid = value; } }
public ServiceCategoryDC SelectedServiceCategory { get; set; }
@@ -166,21 +179,33 @@ namespace BeWoPlanerMobil.Models
}
[Display(Name="Filter")]
public QbFilterItem SelectedFilterItem { get; set; }
public int? SelectedFilterItemId
{
get
{
if(SelectedFilterItem is null)
public QbFilterItem SelectedFilterItem
{
get
{
if (QbFilters == null || !SelectedFilterItemId.HasValue)
{
return null;
}
return (int)SelectedFilterItem.FilterEnum;
}
return QbFilters.FirstOrDefault(f => f.FilterEnum == SelectedFilterItemId.Value);
}
}
public QBFilterEnum? SelectedFilterItemId { get { return ReportSessionModel.SelectedFilterItemId; } set { ReportSessionModel.SelectedFilterItemId = value; } }
//{
// get
// {
// if(SelectedFilterItem is null)
// {
// return null;
// }
// return (int)SelectedFilterItem.FilterEnum;
// }
//}
public List<QbFilterItem> QbFilters { get; set; } = new List<QbFilterItem>();
public List<SelectListItem> QbFilterItems
@@ -203,7 +228,7 @@ namespace BeWoPlanerMobil.Models
}
[Display(Name = "Team")]
public long? SelectedTeamOid => SelectedTeam?.TeamOid;
public long? SelectedTeamOid { get { return ReportSessionModel.SelectedTeamOid; } set { ReportSessionModel.SelectedTeamOid = value; } }
public CompactTeamDC SelectedTeam { get; set; }
@@ -244,9 +269,9 @@ namespace BeWoPlanerMobil.Models
ConfirmationReceiptSignatures.Where(crs => crs.ConfirmationReceiptSignatureOid != null && confirmationReceiptSignatureOids.Contains(crs.ConfirmationReceiptSignatureOid.Value)).ToList();
}
public bool IsForSelectedEmployeesOnly { get; set; }
public bool IsForSelectedCostbearersOnly { get; set; }
public bool IsForSelectedCategoryOnly { get; set; }
public bool IsForSelectedEmployeesOnly { get { return ReportSessionModel.IsForSelectedEmployeesOnly; } set { ReportSessionModel.IsForSelectedEmployeesOnly = value; } }
public bool IsForSelectedCostbearersOnly { get { return ReportSessionModel.IsForSelectedCostbearersOnly; } set { ReportSessionModel.IsForSelectedCostbearersOnly = value; } }
public bool IsForSelectedCategoryOnly { get { return ReportSessionModel.IsForSelectedCategoryOnly; } set { ReportSessionModel.IsForSelectedCategoryOnly = value; } }
public List<ConfirmationReceiptSignatureObject> SelectedConfirmationReceiptSignatures { get; set; }
@@ -254,7 +279,9 @@ namespace BeWoPlanerMobil.Models
public AbstractReportCreator ReportCreator { get; set; }
public XtraReport QuittierungsbelegsReportObject { get; set; }
public QuittierungsbelegsReportSettings QuittierungsbelegsReportSettings { get { return ReportSessionModel.QuittierungsbelegsReportSettings; } set { ReportSessionModel.QuittierungsbelegsReportSettings = value; } }
public XtraReport QuittierungsbelegsReport { get; set; }
public int QbEntryCount { get; set; }
public int MaxResults { get; set; } = 10;

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Mvc;
using BeWo.View.Navigation.Filter;
using BeWoPlanerMobil.Controllers;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
using BeWoPlanerMobil.Util.ReportUtils;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using DevExpress.XtraReports.UI;
namespace BeWoPlanerMobil.Models
{
[Serializable]
public class ReportSessionModel : ISessionModel
{
public long? SelectedCustomerOid { get; set; }
public long? SelectedEmployeeOid { get; set; }
public long? SelectedTeamOid { get; set; }
public long? SelectedOrganisationOid { get; set; }
public long? SelectedServiceCategoryOid { get; set; }
public int? SelectedMonth { get; internal set; }
public int? SelectedYear { get; internal set; }
public int? SelectedStartDay { get; internal set; }
public int? SelectedEndDay { get; internal set; }
public QBFilterEnum? SelectedFilterItemId { get; internal set; }
public bool IsForSelectedEmployeesOnly { get; internal set; }
public bool IsForSelectedCostbearersOnly { get; internal set; }
public bool IsForSelectedCategoryOnly { get; internal set; }
public QuittierungsbelegsReportSettings QuittierungsbelegsReportSettings { get; internal set; }
public void ResetValues()
{
SelectedCustomerOid = null;
SelectedEmployeeOid = null;
SelectedTeamOid = null;
SelectedOrganisationOid = null;
SelectedServiceCategoryOid = null;
SelectedMonth = null;
SelectedYear = null;
SelectedStartDay = null;
SelectedEndDay = null;
SelectedFilterItemId = null;
IsForSelectedEmployeesOnly = false;
IsForSelectedCostbearersOnly = false;
IsForSelectedCategoryOnly = false;
QuittierungsbelegsReportSettings = null;
}
}
}

View File

@@ -12,13 +12,26 @@ namespace BeWoPlanerMobil.Models
{
public class ReportViewerModel : AbstractModel
{
public ReportViewerModel()
{
SessionModel = new ReportViewerSessionModel();
}
public ReportViewerSessionModel ReportViewerSessionModel
{
get
{
return SessionModel as ReportViewerSessionModel;
}
}
public List<CompactEmployeeDC> AllEmployees { get; set; }
public List<CompactTeamDC> AllTeams { get; set; }
public List<QueryDC> Queries { get; set; }
public AbstractReportCreator ReportCreator { get; set; }
[Display(Name = "Monat")]
public int? SelectedMonth { get; set; }
public int? SelectedMonth { get { return ReportViewerSessionModel.SelectedMonth; } set { ReportViewerSessionModel.SelectedMonth = value; } }
public List<SelectListItem> Months
{
get
@@ -40,7 +53,7 @@ namespace BeWoPlanerMobil.Models
[Display(Name = "Jahr")]
public int? SelectedYear { get; set; }
public int? SelectedYear { get { return ReportViewerSessionModel.SelectedYear; } set { ReportViewerSessionModel.SelectedYear = value; } }
public List<SelectListItem> Years
{
get
@@ -62,7 +75,7 @@ namespace BeWoPlanerMobil.Models
[Display(Name="Bericht")]
public ReportType SelectedReportType { get; set; }
public ReportType SelectedReportType { get { return ReportViewerSessionModel.SelectedReportType; } set { ReportViewerSessionModel.SelectedReportType = value; } }
public List<SelectListItem> ReportTypes { get; set; }
@@ -94,7 +107,7 @@ namespace BeWoPlanerMobil.Models
[Display(Name = "Mitarbeiter")]
public long? SelectedEmployeeOid => SelectedEmployee?.EmployeeOid;
public long? SelectedEmployeeOid { get { return ReportViewerSessionModel.SelectedEmployeeOid; } set { ReportViewerSessionModel.SelectedEmployeeOid = value; } }
public CompactEmployeeDC SelectedEmployee { get; set; }
public List<SelectListItem> Employees
{
@@ -109,7 +122,7 @@ namespace BeWoPlanerMobil.Models
if(HasRightMitarbeiterstundenkontoViewSelf && !HasRightMitarbeiterstundenkontoViewAll)
{
result.Add(new SelectListItem{ Text = Employee.LastNameFirstName, Value = Employee.EmployeeOid.ToString()});
result.Add(new SelectListItem{ Text = LoggedInEmployee.LastNameFirstName, Value = LoggedInEmployee.EmployeeOid.ToString()});
return result;
}
@@ -126,7 +139,7 @@ namespace BeWoPlanerMobil.Models
[Display(Name = "Team")]
public long? SelectedTeamOid => SelectedTeam?.TeamOid;
public long? SelectedTeamOid { get { return ReportViewerSessionModel.SelectedTeamOid; } set { ReportViewerSessionModel.SelectedTeamOid = value; } }
public CompactTeamDC SelectedTeam { get; set; }
public List<SelectListItem> Teams
{
@@ -151,11 +164,14 @@ namespace BeWoPlanerMobil.Models
}
public List<CompactEmployeeDC> SelectedEmployees { get; set; }
public List<CompactTeamDC> SelectedTeams { get; set; }
//public List<CompactEmployeeDC> SelectedEmployees { get; set; }
//public List<CompactTeamDC> SelectedTeams { get; set; }
public long? SelectedQueryOid { get { return ReportViewerSessionModel.SelectedQueryOid; } set { ReportViewerSessionModel.SelectedQueryOid = value; } }
public QueryDC SelectedQuery { get; set; }
public List<SupportConceptDC> SupportConcepts { get; set; }
public CostBearer2SupportConceptRelListObject SelectedCostBearer2SupportConceptRelListObject { get; set; }
@@ -164,14 +180,14 @@ namespace BeWoPlanerMobil.Models
{
get
{
var allCostBearerRelations = new List<CostBearer2SupportConceptRelListObject> { new CostBearer2SupportConceptRelListObject("Hilfeplan auswählen", "", "0", false, false) };
var allCostBearerRelations = new List<CostBearer2SupportConceptRelListObject> { new CostBearer2SupportConceptRelListObject("Hilfeplan auswählen", "", 0, false, false) };
foreach(var sc in SupportConcepts.OrderBy(sc => sc.Customer.LastName))
{
allCostBearerRelations.AddRange(sc.CostBearerRelations.Select(
cb => new CostBearer2SupportConceptRelListObject(
$"{sc.Customer.SimpleDescription} {(sc.Customer.DateOfBirth.HasValue ? "*" + sc.Customer.DateOfBirth.Value.ToString("dd.MM.yyyy") : string.Empty)}",
$"{cb.AuswahlBezeichnung} {cb.StartDate?.ToShortDateString().Remove(6, 2) ?? string.Empty}-{cb.EndDate?.ToShortDateString().Remove(6, 2) ?? string.Empty} {cb.CostBearer.Name}{GetIsNotApproved(cb)}",
cb.CostBearer2SupportConceptOid.ToString(),
cb.CostBearer2SupportConceptOid.Value,
cb.SupportConcept.IsAboutToExpire,
cb.SupportConcept.ExpiresIn3MonthOrLess))
);
@@ -231,6 +247,7 @@ namespace BeWoPlanerMobil.Models
}
}
[Serializable]
public class ReportSelectListItem : SelectListItem
{
public long? QueryOid { get; set; }

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Mvc;
using BeWo.View.Navigation.Filter;
using BeWoPlanerMobil.Controllers;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using DevExpress.XtraReports.UI;
namespace BeWoPlanerMobil.Models
{
[Serializable]
public class ReportViewerSessionModel : ISessionModel
{
public long? SelectedEmployeeOid { get; set; }
public long? SelectedTeamOid { get; set; }
public int? SelectedMonth { get; internal set; }
public int? SelectedYear { get; internal set; }
public ReportType SelectedReportType { get; internal set; }
public long? SelectedQueryOid { get; internal set; }
public void ResetValues()
{
SelectedEmployeeOid = null;
SelectedTeamOid = null;
SelectedMonth = null;
SelectedYear = null;
SelectedReportType = ReportType.Berichte;
SelectedQueryOid = null;
}
}
}

View File

@@ -15,49 +15,38 @@ namespace BeWoPlanerMobil.Models
{
public class SchedulerModel : AbstractModel
{
public List<long> TeamMemberCustomerOids { get; set; }
public DateTime SelectedDate { get; set; } = DateTime.Today;
public SchedulerAppointmentDC SelectedAppointment { get; set; }
private List<SchedulerAppointmentDC> _Appointments;
public List<SchedulerAppointmentDC> Appointments
public SchedulerModel()
{
get => _Appointments ?? (_Appointments = new List<SchedulerAppointmentDC>());
SessionModel = new SchedulerSessionModel();
SessionModel.ResetValues();
}
set
public SchedulerSessionModel SchedulerSessionModel
{
get
{
var oldAppointments = AppointmentListItems.Select(li => li.SchedulerAppointment).ToList();
_Appointments = value ?? new List<SchedulerAppointmentDC>();
if(_Appointments.AreListEqual(oldAppointments))
{
return;
}
_AppointmentListItems = new List<AppointmentListItem>();
foreach(var appointment in _Appointments)
{
var listItem = new AppointmentListItem(appointment);
listItem.GenerateIdentifier(_AppointmentListItems.Select(a => a.Identifier).ToList());
_AppointmentListItems.Add(listItem);
}
return SessionModel as SchedulerSessionModel;
}
}
private List<AppointmentListItem> _AppointmentListItems;
public List<AppointmentListItem> AppointmentListItems => _AppointmentListItems ?? (_AppointmentListItems = new List<AppointmentListItem>());
public bool HasRightToEditAppointment(Guid identifier)
public List<long> TeamMemberCustomerOids { get; set; }
public DateTime SelectedDate { get { return SchedulerSessionModel.SelectedDate; } set { SchedulerSessionModel.SelectedDate = value; } }
public long? SelectedAppointmentOid { get { return SchedulerSessionModel.SelectedAppointmentOid; } set { SchedulerSessionModel.SelectedAppointmentOid = value; } }
public SchedulerAppointmentDC SelectedAppointment { get; set; }
public List<SchedulerAppointmentDC> Appointments { get; set; }
public List<AppointmentListItem> AppointmentListItems { get; set; }
public bool HasRightToEditAppointment(String identifier)
{
var appointment = AppointmentListItems.FirstOrDefault(app => app.Identifier.Equals(identifier))?.SchedulerAppointment; //Appointments.FirstOrDefault(app => app.SchedulerAppointmentOid.HasValue && app.SchedulerAppointmentOid.Value == appointmentOid);
return appointment != null && Utils.CheckSchedulerRights(appointment.CustomerList, appointment.ResourceList, appointment.EmployeeList, appointment.Originator, appointment.SchedulerAppointmentOid is null, SchedulerRightsCheckType.Edit, MobileSessionFacade.LoggedInUserDC, TeamMemberCustomerOids ?? new List<long>());
return appointment != null && BS.Shared.Core.Utils.CheckSchedulerRights(appointment.CustomerList, appointment.ResourceList, appointment.EmployeeList, appointment.Originator, appointment.SchedulerAppointmentOid is null, SchedulerRightsCheckType.Edit, LoggedInUser, TeamMemberCustomerOids ?? new List<long>());
}
public string DescriptionToEdit => SelectedAppointment?.Description ?? string.Empty;
@@ -85,7 +74,9 @@ namespace BeWoPlanerMobil.Models
}
}
public List<ResourceDC> SelectedResources { get; set; } = new List<ResourceDC>();
public List<long> SelectedResourceOids { get { return SchedulerSessionModel.SelectedResourceOids; } set { SchedulerSessionModel.SelectedResourceOids = value; } }
public List<ResourceDC> SelectedResources { get; set; }
public Dictionary<ValueListEntryDC, List<ResourceDC>> ResourceCategories2Resources { get; set; } = new Dictionary<ValueListEntryDC, List<ResourceDC>>();
@@ -112,42 +103,30 @@ namespace BeWoPlanerMobil.Models
public List<CompactEmployeeDC> AllEmployees { get; set; } = new List<CompactEmployeeDC>();
public List<CompactEmployeeDC> SelectedEmployees { get; set; } = new List<CompactEmployeeDC>();
public List<long> SelectedEmployeeOids { get { return SchedulerSessionModel.SelectedEmployeeOids; } set { SchedulerSessionModel.SelectedEmployeeOids = value; } }
public List<CompactEmployeeDC> SelectedEmployees { get; set; }
public List<CompactCustomerDC> AllCustomers { get; set; } = new List<CompactCustomerDC>();
public List<long> SelectedCustomerOids { get { return SchedulerSessionModel.SelectedCustomerOids; } set { SchedulerSessionModel.SelectedCustomerOids = value; } }
public List<CompactCustomerDC> SelectedCustomers { get; set; } = new List<CompactCustomerDC>();
public bool IsInEditMode => SelectedAppointment != null;
public bool IsInEditMode => SelectedAppointmentOid.HasValue;
// ToDo: Überarbeiten? Es kam das Ansehen hinzu
public bool HasResourcesEmployeesOrCustomers
{
get
{
var isOwnAppointment = !IsInEditMode || SelectedAppointment.Originator.EmployeeOid == Employee.EmployeeOid;
var v1 = HasRightToInsertEmployeeAppointments || IsInEditMode && HasRightToEditEmployeeAppointments;
var v2 = HasRightToInsertRessourceAppointments || IsInEditMode && HasRightToEditResourceAppointments;
if (IsInEditMode && !isOwnAppointment)
{
v2 = HasRightToEditOthersResourceAppointments;
}
var v3 = HasRightToInsertCustomerAppointments || IsInEditMode && HasRightToEditCustomerAppointments;
return v1 || v2 || v3;
}
}
public bool HasResourcesEmployeesOrCustomers { get; set; }
public bool ShowEmployeeButton => IsInEditMode ? HasRightToInsertEmployeeAppointments : HasRightToEditEmployeeAppointments;
public bool ShowCustomerButton => IsInEditMode ? HasRightToInsertCustomerAppointments : HasRightToEditCustomerAppointments;
//IntervalFinder
public List<long> SelectedEmployeeOidsForIntervalFinder { get { return SchedulerSessionModel.SelectedEmployeeOidsForIntervalFinder; } set { SchedulerSessionModel.SelectedEmployeeOidsForIntervalFinder = value; } }
public List<CompactEmployeeDC> SelectedEmployeesForIntervalFinder { get; set; } = new List<CompactEmployeeDC>();
public List<long> SelectedCustomerOidsForIntervalFinder { get { return SchedulerSessionModel.SelectedCustomerOidsForIntervalFinder; } set { SchedulerSessionModel.SelectedCustomerOidsForIntervalFinder = value; } }
public List<CompactCustomerDC> SelectedCustomersForIntervalFinder { get; set; } = new List<CompactCustomerDC>();
public List<long> SelectedResourceOidsForIntervalFinder { get { return SchedulerSessionModel.SelectedResourceOidsForIntervalFinder; } set { SchedulerSessionModel.SelectedResourceOidsForIntervalFinder = value; } }
public List<ResourceDC> SelectedResourcesForIntervalFinder { get; set; } = new List<ResourceDC>();
public Dictionary<DateTimeSpan, Dictionary<DateTime, bool>> FreeIntervals { get; set; } = new Dictionary<DateTimeSpan, Dictionary<DateTime, bool>>();
@@ -170,34 +149,38 @@ namespace BeWoPlanerMobil.Models
}
}
public bool IsInIntervalFinderMode { get; set; }
public DateTime? IntervalStartDate { get; set; }
public DateTime? IntervalEndDate { get; set; }
public bool IsInIntervalFinderMode { get { return SchedulerSessionModel.IsInIntervalFinderMode; } set { SchedulerSessionModel.IsInIntervalFinderMode = value; } }
public DateTime? IntervalStartDate { get { return SchedulerSessionModel.IntervalStartDate; } set { SchedulerSessionModel.IntervalStartDate = value; } }
public DateTime? IntervalEndDate { get { return SchedulerSessionModel.IntervalEndDate; } set { SchedulerSessionModel.IntervalEndDate = value; } }
public string IntervalStartDateStr => IntervalStartDate.HasValue ? IntervalStartDate.Value.ToString("yyyy-MM-ddTHH:mm") : string.Empty;
public string IntervalEndDateStr => IntervalEndDate.HasValue ? IntervalEndDate.Value.ToString("yyyy-MM-ddTHH:mm") : string.Empty;
public string IntervalStartTimeStr => IntervalStartDate.HasValue ? $"{IntervalStartDate:HH:mm}" : string.Empty;
public string IntervalEndTimeStr => IntervalEndDate.HasValue ? $"{IntervalEndDate:HH:mm}" : string.Empty;
public int? IntervalDuration { get; set; }
public int? IntervalDuration { get { return SchedulerSessionModel.IntervalDuration; } set { SchedulerSessionModel.IntervalDuration = value; } }
public string IntervalDurationStr => IntervalDuration.HasValue ? $"{IntervalDuration}" : string.Empty;
[Display(Name = "Ganztägig")]
public bool IsAllDay { get; set; }
public bool IsAllDay { get { return SchedulerSessionModel.IsAllDay; } set { SchedulerSessionModel.IsAllDay = value; } }
[Display(Name = "Privat")]
public bool IsPrivate { get; set; }
public bool IsPrivate { get { return SchedulerSessionModel.IsPrivate; } set { SchedulerSessionModel.IsPrivate = value; } }
public List<CompactEmployeeDC> MyTeamEmployees { get; set; }
public List<ResourceDC> SelectedResourcesForFiltering { get; set; } = new List<ResourceDC>();
public List<CompactEmployeeDC> SelectedEmployeesForFiltering { get; set; } = new List<CompactEmployeeDC>();
public List<CompactCustomerDC> SelectedCustomersForFiltering { get; set; } = new List<CompactCustomerDC>();
public List<long> SelectedResourceOidsForFiltering { get { return SchedulerSessionModel.SelectedResourceOidsForFiltering; } set { SchedulerSessionModel.SelectedResourceOidsForFiltering = value; } }
public List<ResourceDC> SelectedResourcesForFiltering { get; set; }
public List<long> SelectedEmployeeOidsForFiltering { get { return SchedulerSessionModel.SelectedEmployeeOidsForFiltering; } set { SchedulerSessionModel.SelectedEmployeeOidsForFiltering = value; } }
public List<CompactEmployeeDC> SelectedEmployeesForFiltering { get; set; }
public List<long> SelectedCustomerOidsForFiltering { get { return SchedulerSessionModel.SelectedCustomerOidsForFiltering; } set { SchedulerSessionModel.SelectedCustomerOidsForFiltering = value; } }
public List<CompactCustomerDC> SelectedCustomersForFiltering { get; set; }
public List<CompactTeamDC> MyTeams { get; set; } = new List<CompactTeamDC>();
public bool ShouldLoadTasks { get; set; }
public bool ShouldLoadTasks { get { return SchedulerSessionModel.ShouldLoadTasks; } set { SchedulerSessionModel.ShouldLoadTasks = value; } }
}
public class WeekViewObject
@@ -240,13 +223,13 @@ namespace BeWoPlanerMobil.Models
SaturdayAppointments = new KeyValuePair<DateTime, List<AppointmentListItem>>(saturday, new List<AppointmentListItem>());
SundayAppointments = new KeyValuePair<DateTime, List<AppointmentListItem>>(last, new List<AppointmentListItem>());
mondays.DoForEach(app => MondayAppointments.Value.Add(new AppointmentListItem(app)));
tuesdays.DoForEach(app => TuesdayAppointments.Value.Add(new AppointmentListItem(app)));
wednesdays.DoForEach(app => WednesdayAppointments.Value.Add(new AppointmentListItem(app)));
thursdays.DoForEach(app => ThursdayAppointments.Value.Add(new AppointmentListItem(app)));
fridays.DoForEach(app => FridayAppointments.Value.Add(new AppointmentListItem(app)));
saturdays.DoForEach(app => SaturdayAppointments.Value.Add(new AppointmentListItem(app)));
sundays.DoForEach(app => SundayAppointments.Value.Add(new AppointmentListItem(app)));
mondays.DoForEach(app => MondayAppointments.Value.Add(new AppointmentListItem("", app)));
tuesdays.DoForEach(app => TuesdayAppointments.Value.Add(new AppointmentListItem("", app)));
wednesdays.DoForEach(app => WednesdayAppointments.Value.Add(new AppointmentListItem("", app)));
thursdays.DoForEach(app => ThursdayAppointments.Value.Add(new AppointmentListItem("", app)));
fridays.DoForEach(app => FridayAppointments.Value.Add(new AppointmentListItem("", app)));
saturdays.DoForEach(app => SaturdayAppointments.Value.Add(new AppointmentListItem("", app)));
sundays.DoForEach(app => SundayAppointments.Value.Add(new AppointmentListItem("", app)));
}
}
}

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Mvc;
using BeWo.View.Navigation.Filter;
using BeWoPlanerMobil.Controllers;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using DevExpress.XtraReports.UI;
namespace BeWoPlanerMobil.Models
{
[Serializable]
public class SchedulerSessionModel : ISessionModel
{
public DateTime SelectedDate { get; set; }
public long? SelectedAppointmentOid { get; internal set; }
public List<long> SelectedResourceOids { get; internal set; }
public List<long> SelectedEmployeeOids { get; internal set; }
public List<long> SelectedCustomerOids { get; internal set; }
public List<long> SelectedEmployeeOidsForIntervalFinder { get; internal set; }
public List<long> SelectedCustomerOidsForIntervalFinder { get; internal set; }
public List<long> SelectedResourceOidsForIntervalFinder { get; internal set; }
public bool IsAllDay { get; set; }
public bool IsPrivate { get; set; }
public List<long> SelectedEmployeeOidsForFiltering { get; internal set; }
public List<long> SelectedCustomerOidsForFiltering { get; internal set; }
public List<long> SelectedResourceOidsForFiltering { get; internal set; }
public bool ShouldLoadTasks { get; internal set; }
public bool IsInIntervalFinderMode { get; internal set; }
public DateTime? IntervalStartDate { get; internal set; }
public DateTime? IntervalEndDate { get; internal set; }
public int? IntervalDuration { get; internal set; }
public void ResetValues()
{
SelectedDate = DateTime.Today;
SelectedAppointmentOid = null;
SelectedResourceOids = new List<long>();
SelectedEmployeeOids = new List<long>();
SelectedCustomerOids = new List<long>();
SelectedEmployeeOidsForIntervalFinder = new List<long>();
SelectedCustomerOidsForIntervalFinder = new List<long>();
SelectedResourceOidsForIntervalFinder = new List<long>();
SelectedEmployeeOidsForFiltering = new List<long>();
SelectedCustomerOidsForFiltering = new List<long>();
SelectedResourceOidsForFiltering = new List<long>();
IsAllDay = false;
IsPrivate = false;
ShouldLoadTasks = false;
IsInIntervalFinderMode = false;
IntervalStartDate = null;
IntervalEndDate = null;
IntervalDuration = null;
}
}
}

View File

@@ -10,6 +10,7 @@ using System.Web;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceImplementations;
using BeWoPlanerMobil.Util;
using BS.Shared;
@@ -110,10 +111,10 @@ namespace BeWoPlanerMobil.Service
var userLoaded = TryAuthenticateWithLoginForm(context);
if(!userLoaded && MobileSessionFacade.LoggedInUser != null && MobileSessionFacade.LoggedInUser.Oid.HasValue)
{
MobileSessionFacade.LoggedInUser = DAOFactory.GenericDAO.LoadByID<ApplicationUser>(MobileSessionFacade.LoggedInUser.Oid.Value);
}
//if(!userLoaded && MobileSessionFacade.LoggedInUser != null && MobileSessionFacade.LoggedInUser.UserOid.HasValue)
//{
// MobileSessionFacade.LoggedInUser = MapperFactory.UserDC_User.MapToNewDC(DAOFactory.GenericDAO.LoadByID<ApplicationUser>(MobileSessionFacade.LoggedInUser.UserOid.Value));
//}
}
};
@@ -203,7 +204,10 @@ namespace BeWoPlanerMobil.Service
}
MobileSessionFacade.PasswordStrength = new PasswordUtils().EvaluatePasswordStrength(password);
MobileSessionFacade.LoggedInUser = user;
MobileSessionFacade.LoggedInUserOid = user.Oid;
MobileSessionFacade.EmployeeFullname = user.Employee.Person.FirstNameLastName;
//MobileSessionFacade.LoggedInEmployee = MapperFactory.EmployeeDC_Employee.MapToNewDC(user.Employee);
}
return true;

View File

@@ -6,8 +6,7 @@ using BeWo.Data.Entities;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceContracts;
using BeWo.Service.ServiceImplementations;
using BeWoPlanerMobil.Util;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
@@ -43,52 +42,85 @@ namespace BeWoPlanerMobil.Service
public IReportService ReportService { get; }
public IQueryService QueryService { get; }
public static ApplicationUser LoggedInUser
public static long? LoggedInUserOid
{
get => HttpContext.Current.Session["apuser"] as ApplicationUser;
get => HttpContext.Current.Session["LoggedInUserOid"] as long?;
set => HttpContext.Current.Session["apuser"] = value;
set => HttpContext.Current.Session["LoggedInUserOid"] = value;
}
public static string EmployeeFullname => LoggedInUser != null ? LoggedInUser.Employee.Person.FirstNameLastName : string.Empty;
//public static UserDC LoggedInUser
//{
// get => HttpContext.Current.Session["apuser"] as UserDC;
public static EmployeeDC LoggedInEmployee => LoggedInUser == null ? null : MapperFactory.EmployeeDC_Employee.MapToNewDC(LoggedInUser.Employee);
// set => HttpContext.Current.Session["apuser"] = value;
//}
public static CompactEmployeeDC LoggedInCompactEmployee => LoggedInUser == null ? null : MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(LoggedInUser.Employee);
//public static EmployeeDC LoggedInEmployee
//{
// get => HttpContext.Current.Session["LoggedInEmployee"] as EmployeeDC;
public static UserDC LoggedInUserDC => LoggedInUser == null ? null : MapperFactory.UserDC_User.MapToNewDC(LoggedInUser);
// set => HttpContext.Current.Session["LoggedInEmployee"] = value;
//}
public static List<SettingsDC> UserSettings => LoggedInUserDC.Settings;
//public static string EmployeeFullname => LoggedInUser != null ? LoggedInUser.Employee.FirstNameLastName : string.Empty;
public static string Tenant
// public static CompactEmployeeDC LoggedInCompactEmployee => LoggedInUser == null ? null : LoggedInUser.Employee;
// public static List<SettingsDC> UserSettings => LoggedInUser.Settings;
public static string LocalStorageKey => LoggedInUserOid.HasValue ? $"bwp_{MobileSessionFacade.Tenant}_{LoggedInUserOid}" : null;
public static string EmployeeFullname
{
get => HttpContext.Current.Session["EmployeeFullname"] as string;
set => HttpContext.Current.Session["EmployeeFullname"] = value;
}
public static string Tenant
{
get => HttpContext.Current.Session["tenant"] as string;
set => HttpContext.Current.Session["tenant"] = value;
}
public static MandatorDC Mandator
public static string TimeOfLastAction
{
get => HttpContext.Current.Session["mandator"] as MandatorDC;
get => HttpContext.Current.Session["TimeOfLastAction"] as string;
set => HttpContext.Current.Session["mandator"] = value;
set => HttpContext.Current.Session["TimeOfLastAction"] = value;
}
public static bool IsUserLoggedIn()
//public long? MandatorOid
//{
// get => HttpContext.Current.Session["MandatorOid"] as long?;
// set => HttpContext.Current.Session["MandatorOid"] = value;
//}
public static MokMandator Mandator
{
get => HttpContext.Current.Session["mandator"] as MokMandator;
set => HttpContext.Current.Session["mandator"] = value;
}
public static bool IsUserLoggedIn()
{
return LoggedInUser != null;
return LoggedInUserOid.HasValue;
}
public static void LogUserOut()
{
HttpContext.Current.Session["apuser"] = null;
HttpContext.Current.Session["LoggedInUserOid"] = null;
HttpContext.Current.Session.Abandon();
}
public static bool CheckForUserRight(UserRightType userRightType)
{
return LoggedInUser != null && LoggedInUser.UserGroups.Any(ug => ug.Rights.Any(rr => rr.RightType.Equals(userRightType)));
}
//public static bool CheckForUserRight(UserRightType userRightType)
//{
// return LoggedInUser != null && LoggedInUser.UserGroups.Any(ug => ug.Rights.Any(rr => rr.Equals(userRightType)));
//}
public static string CookieName => "tenantKeks";

View File

@@ -7,6 +7,7 @@ using System.Xml;
using System.Xml.Serialization;
using BeWo.Data;
using BeWo.Data.Access;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceContracts;
using BeWo.Service.ServiceImplementations;
using BeWoPlanerMobil.Service;
@@ -50,7 +51,8 @@ namespace BeWoPlanerMobil
}
else
{
MobileSessionFacade.LoggedInUser = user;
MobileSessionFacade.LoggedInUserOid = user.Oid;
MobileSessionFacade.EmployeeFullname = user.Employee.Person.FirstNameLastName;
result = true;
}

View File

@@ -11,7 +11,7 @@ namespace BeWoPlanerMobil.Util
{
public class AppointmentListItem
{
public Guid Identifier { get; private set; }
public String Identifier { get; }
public long? Oid { get; }
@@ -71,20 +71,9 @@ namespace BeWoPlanerMobil.Util
public SchedulerAppointmentDC SchedulerAppointment { get; }
public void GenerateIdentifier(List<Guid> existingIdentifiers)
public AppointmentListItem(String id, SchedulerAppointmentDC schedulerAppointment)
{
var identifier = Guid.NewGuid();
while(existingIdentifiers.Contains(identifier))
{
identifier = Guid.NewGuid();
}
Identifier = identifier;
}
public AppointmentListItem(SchedulerAppointmentDC schedulerAppointment)
{
Identifier = Guid.NewGuid();
Identifier = id;
Subject = schedulerAppointment.Subject;

View File

@@ -0,0 +1,23 @@
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.DataContracts.Invoicing;
using System;
using System.Runtime.Serialization;
using System.Windows.Media;
namespace BeWoPlanerMobil.Util
{
public class DcToMokMapper
{
public static MokMandator CreateMandator(MandatorDC dc)
{
return new MokMandator
{
Settings = dc.Settings
};
}
}
}

View File

@@ -56,22 +56,22 @@
public static string ServiceRecordOidForSignature => "ServiceRecordOidForSignature";
}
public class ModelSessionConstants
{
public static string ReportModelKey => "ReportModel";
public static string CustomerModelKey => "CustomerModelModel";
public static string SchedulerModelKey => "SchedulerModel";
public static string MainModelKey => "MainModel";
public static string DevelopmentModelKey => "DevelopmentModel";
public static string DevExpressReportModelKey => "DevExpressReportModel";
public static string ReportViewerModelKey => "ReportViewerModel";
public static string DebuggingToolsModelKey => "DebuggingToolsModel";
}
//public class ModelSessionConstants
//{
// public static string ReportModelKey => "ReportModel";
// public static string CustomerModelKey => "CustomerModelModel";
// public static string SchedulerModelKey => "SchedulerModel";
// public static string MainModelKey => "MainModel";
// public static string DevelopmentModelKey => "DevelopmentModel";
// public static string DevExpressReportModelKey => "DevExpressReportModel";
// public static string ReportViewerModelKey => "ReportViewerModel";
// public static string DebuggingToolsModelKey => "DebuggingToolsModel";
//}
public class TempDataConstants
{
public static string ShowSignatureSuggestionPopup => "ShowSignatureSuggestionPopup";
public static string AppointmentListItemKey => "AppointmentListItem";
public static string AppointmentOidKey => "AppointmentOid";
public static string IsInTransferModeKey => "IsInTransferMode";
public static string AfterValidationStateKey => "AfterValidation";
public static string PwChErrKey => "passwd-change-error";

View File

@@ -0,0 +1,37 @@
using BS.Shared.DataContracts.Compact;
using BS.Shared.DataContracts.Invoicing;
using System;
using System.Runtime.Serialization;
using System.Windows.Media;
namespace BeWoPlanerMobil.Util
{
[Serializable]
public class MokMandator
{
//public long BeWoClientType { get; set; }
//public string ClientId { get; set; }
//public string Country { get; set; }
//public long? MandatorOid { get; set; }
//public long? MandatorVersion { get; set; }
//public string Name { get; set; }
//public string Website { get; set; }
//public string PostalCode { get; set; }
public string Settings { get; set; }
//public string State { get; set; }
//public string Street { get; set; }
//public string Town { get; set; }
//public string RssFeedUrl { get; set; }
//public string SupportToolUrl { get; set; }
//public bool IsSchedulerAllowed { get; set; }
//public bool IsMedicationAllowed { get; set; }
//public bool AllowSbd { get; set; }
//public string Apikey { get; set; }
//public string IKLeistungserbringer { get; set; }
//public bool CanEditIKLeistungserbringer { get; set; }
//public string ColorWaitTooLong { get; set; }
//public string ColorSendUrbelege { get; set; }
//public bool ShowGkvBzEinzel { get; set; }
//public bool ShowGkvBzUrbelege { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using BS.Shared.Core;
namespace BeWoPlanerMobil.Util
{
public class MokSettings
{
public int SupportConceptExpirationLimitInMonths { get; set; }
public int AnzTageZeiterfassErfolgt { get; set; }
public int MaxDaysEditServiceRecordsAllowed { get; set; }
public int ServiceRecordAllowChangeHours { get; set; }
public int TimeUntilUILock { get; set; }
}
}

View File

@@ -4,6 +4,7 @@ using System.Diagnostics;
namespace BeWoPlanerMobil.Util
{
[DebuggerDisplay("{StartDate} - {EndDate}")]
[Serializable]
public class NullableDateTimeSpan
{
public DateTime? StartDate { get; set; }

View File

@@ -0,0 +1,20 @@
using BS.Shared;
using System;
namespace BeWoPlanerMobil.Util.ReportUtils
{
[Serializable]
public class QuittierungsbelegsReportSettings
{
public int Year { get; set; }
public int Month { get; set; }
public int StartDay { get; set; }
public int EndDay { get; set; }
public long? CustomerOid { get; internal set; }
public long? TeamOid { get; internal set; }
public long? EmployeeOid { get; internal set; }
public long? OrganisationOid { get; internal set; }
public long? ServiceCategoryOid { get; internal set; }
public QBFilterEnum FilterEnum { get; internal set; }
}
}

View File

@@ -145,7 +145,7 @@
<div class="container mt-3 lg-max-width">
<div class="row mb-3">
@if(AbstractModel.IsAllowedToSeeCustomerFilter)
@if(Model.IsAllowedToSeeCustomerFilter)
{
<div class="col-md mb-2">
@using(Html.BeginForm("SetCustomerFilter", "Customer", FormMethod.Post))
@@ -188,7 +188,7 @@
<div class="card-body py-0">
@using(Html.BeginForm("UpdateCustomer", "Customer", FormMethod.Post, new { id = "stammdaten-form", @class = "needs-validation", novalidate = "novalidate" }))
{
var inputDisabled = !AbstractModel.HasRightToEditCustomers ? "disabled" : string.Empty;
var inputDisabled = !Model.HasRightToEditCustomers ? "disabled" : string.Empty;
<div class="row" id="stammdaten-container">
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-3 mt-2 px-1">
@@ -519,7 +519,7 @@
</div>
</div>
@if(AbstractModel.HasRightToEditCustomers)
@if(Model.HasRightToEditCustomers)
{
<div class="col-12 mb-2 px-1 mt-2">
<button type="submit" class="btn btn-primary float-right w-100 m-0" onclick="showSpinner()">Speichern</button>
@@ -808,7 +808,7 @@
}
@* ----- Dokumente ----- *@
if(AbstractModel.HasRightToViewCustomerDocuments)
if(Model.HasRightToViewCustomerDocuments)
{
<div class="col-12">
<div class="card w-100 h-100 my-1">
@@ -832,11 +832,10 @@
</div>
</div>
}
@* ----- Medikamentenliste ----- *@
if(AbstractModel.IsAllowedToSeeMedikamentenliste)
{
if (Model.IsAllowedToSeeMedikamentenliste && Model.SelectedCustomer.Medikamentenverordnungslisten.Any())
{
<div class="col-12">
<div class="card w-100 h-100 my-1">
<div class="card-header" onclick="cardHeaderClick2(this)">
@@ -859,7 +858,7 @@
}
@* ----- Diagnosen ----- *@
if(AbstractModel.HasRightToViewDiagnosen && (Model.SelectedJsonCustomer.HasDiagnosen || Model.SelectedJsonCustomer.HasDisabilities || Model.SelectedJsonCustomer.HasSchwebi))
if(Model.HasRightToViewDiagnosen && (Model.SelectedJsonCustomer.HasDiagnosen || Model.SelectedJsonCustomer.HasDisabilities || Model.SelectedJsonCustomer.HasSchwebi))
{
<div class="col-12">
<div class="card w-100 h-100 my-1">
@@ -989,9 +988,9 @@
}
var isRelatedCustomer = Model.SelectedCustomerOid.HasValue && Model.Employee.RelatedCustomers.Any(cer => cer.Customer.CustomerOid.Equals(Model.SelectedCustomerOid.Value));
var isRelatedCustomer = Model.SelectedCustomerOid.HasValue && Model.LoggedInEmployee.RelatedCustomers.Any(cer => cer.Customer.CustomerOid.Equals(Model.SelectedCustomerOid.Value));
var isAllowedToViewBargeldkassen = AbstractModel.HasRightToViewAllCustomersBargeldkassen || (isRelatedCustomer && AbstractModel.HasRightToViewOwnCustomersBargeldkassen);
var isAllowedToViewBargeldkassen = Model.HasRightToViewAllCustomersBargeldkassen || (isRelatedCustomer && Model.HasRightToViewOwnCustomersBargeldkassen);
@* ----- Bargeldverwaltung ----- *@
@@ -1021,7 +1020,7 @@
}
@* ----- Abwesenheiten ----- *@
if(AbstractModel.HasRightToViewCustomerAbsenceTimes)
if(Model.HasRightToViewCustomerAbsenceTimes)
{
<div class="col-12">
<div class="card w-100 h-100 my-1">
@@ -1054,7 +1053,7 @@
var hasRelatedEmployees = Model.SelectedCustomer?.RelatedEmployees.Any() ?? false;
var hasRelatedTeams = Model.SelectedCustomer?.RelatedTeams.Any() ?? false;
if(AbstractModel.HasRightToViewBetreuung && (hasRelatedEmployees || hasRelatedTeams))
if(Model.HasRightToViewBetreuung && (hasRelatedEmployees || hasRelatedTeams))
{
<div class="col-12">
<div class="card w-100 h-100 my-1">
@@ -1081,7 +1080,7 @@
}
</div>
@if(AbstractModel.HasRightToViewCustomerAbsenceTimes)
@if(Model.HasRightToViewCustomerAbsenceTimes)
{
<div class="modal" tabindex="-1" role="dialog" id="customer-absence-times-form-popup">
<div class="modal-dialog modal-lg" role="document">

View File

@@ -63,8 +63,8 @@
const selectedOption = $("#absence-reason-select option:selected");
if(!isInfinite && end.getTime() > start.getTime()) {
validationMessage = "Das Enddatum muss vor dem Startdatum liegen.";
if(!isInfinite && end.getTime() < start.getTime()) {
validationMessage = "Das Startdatum muss vor dem Enddatum liegen.";
}
if(selectedOption.val() === "-1") {
@@ -221,7 +221,7 @@
Kategorie
</div>
</div>
@Html.DropDownListFor(m => m.SelectedAbsenceReason, Model.AbsenceReasonItems, new { @class = "custom-select", Id = "absence-reason-select", Name = "customer-absence-time-category" })
@Html.DropDownListFor(m => m.SelectedAbsenceReasonOid, Model.AbsenceReasonItems, new { @class = "custom-select", Id = "absence-reason-select", Name = "customer-absence-time-category" })
</div>
</div>
</div>

View File

@@ -666,7 +666,7 @@
<input type="hidden" id="bk-to-delete-oid" name="bk-to-delete-oid" />
}
@if(AbstractModel.HasRightToCreateCustomerBargeldkassen || AbstractModel.HasRightToEditCustomerBargeldkassen)
@if(Model.HasRightToCreateCustomerBargeldkassen || Model.HasRightToEditCustomerBargeldkassen)
{
<div class="modal" tabindex="-1" role="dialog" id="customer-bargeldkassen-form-popup">
<div class="modal-dialog modal-lg" role="document">

View File

@@ -32,14 +32,14 @@
</div>
}
@if(AbstractModel.UserMessage != null)
@*@if(AbstractModel.UserMessage != null)
{
<div class="alert alert-danger mx-3" role="alert">
@AbstractModel.UserMessage;
</div>
AbstractModel.UserMessage = null;
}
}*@
@using(Html.BeginForm("Index", "Login", FormMethod.Post, new { @class = "px-3 col-12", id = "loginForm" }))
{

View File

@@ -40,7 +40,7 @@
}
</script>
@if(AbstractModel.HasRightToRateGoals)
@if(Model.HasRightToRateGoals)
{
<ul class="list-group">
@foreach(var ratingType in Model.GoalRatingTypes)

View File

@@ -165,7 +165,7 @@
<div class="custom-control custom-checkbox goal-card-header float-left" onclick="stopToggle(event)" >
<input type="checkbox" class="custom-control-input goal-input" value="@goalTreeItem.ValueListEntryOid" @isCheckedValue id="goal-cb-@goalTreeItem.ValueListEntryOid" onchange="updateSelectedGoals()" />
<label class="custom-control-label goal-name-label @textClass" for="goal-cb-@goalTreeItem.ValueListEntryOid">@goalTreeItem.Header</label>
@if(AbstractModel.HasRightToRateGoals)
@if(Model.HasRightToRateGoals)
{
<span style="cursor: pointer;" id="goal-rating-@goalTreeItem.ValueListEntryOid" class="badge badge-bewo-goal-rating goal-rating-badge ml-1" onclick="showGoalRatingPopup(@goalTreeItem.ValueListEntryOid)">
@(ratingType?.DisplayName ?? goalTreeItem.RatingName)
@@ -194,7 +194,7 @@
<div class="custom-control custom-checkbox goal-text @marginBottom">
<input type="checkbox" class="custom-control-input goal-input" id="goal-cb-@goalTreeItem.ValueListEntryOid" @isCheckedValue onchange="updateSelectedGoals()">
<label for="goal-cb-@goalTreeItem.ValueListEntryOid" class="custom-control-label goal-name-label @textClass">@goalTreeItem.Header</label>
@if(AbstractModel.HasRightToRateGoals)
@if(Model.HasRightToRateGoals)
{
<span id="goal-rating-@goalTreeItem.ValueListEntryOid" style="cursor: pointer;" class="badge badge-bewo-goal-rating goal-rating-badge ml-1" onclick="showGoalRatingPopup(@goalTreeItem.ValueListEntryOid)">
@(ratingType?.DisplayName ?? goalTreeItem.RatingName)

View File

@@ -53,11 +53,9 @@
$("#groupbooking-selection-container").load("@Url.Action("ReloadGroupBookingForm")", function () {
toggleForm();
$("#goals-tree").load("@Url.Action("ReloadGoals")", function () {
$("#goal-ratings-container").load("@Url.Action("ReloadGoalRatings")", function() {
$("#goals-tree").load("@Url.Action("ReloadGoals")", function() {
$("#tree").load("@Url.Action("LoadUpToDateTextModules")");
});
});
});
});
}
@@ -66,18 +64,14 @@
$(`#cb2sc-checkbox-${relOid}`).prop("checked", false);
$("#groupbooking-selection-container").load("@Url.Action("RemoveSupportConceptCostbearerRel")", {relOid: relOid}
, function () {
$("#goals-tree").load("@Url.Action("ReloadGoals")"
, function () {
$("#goal-ratings-container").load("@Url.Action("ReloadGoalRatings")", function() {
toggleForm();
, function () {
$("#goals-tree").load("@Url.Action("ReloadGoals")"
, function () {
toggleForm();
$("#tree").load("@Url.Action("LoadUpToDateTextModules")");
});
}
);
}
);
$("#tree").load("@Url.Action("LoadUpToDateTextModules")");
});
});
}
</script>
@@ -133,7 +127,7 @@
}
@* ----- Betrag ----- *@
@if(AbstractModel.ShowBetrag)
@if(Model.ShowBetrag)
{
var betrag = string.Empty;
if(Model.SelectedServiceRecord?.Betrag != null && Model.SelectedServiceRecord.Betrag.Value > 0)
@@ -268,7 +262,7 @@
</div>
@* Gefahrene Kilometer *@
@if(AbstractModel.ShowDistanceField)
@if(Model.ShowDistanceField)
{
<div class="form-row">
<div class="col-md">
@@ -285,7 +279,7 @@
}
@* Textbausteine *@
@if(AbstractModel.HasRightToSeeTextModules)
@if(Model.HasRightToSeeTextModules)
{
<div class="form-row" id="textmodule-container">
<div class="col-md">

View File

@@ -20,9 +20,9 @@
@{
var timeSpanColorClass2 = cb2Sc.IsAboutToExpire ? "text-bewo-is-about-to-expire" : cb2Sc.ExpiresInThreeMonthsOrLess ? "text-bewo-expires-in-three-months" : "text-dark";
var wasSuccessful = long.TryParse(cb2Sc.CostBearer2SupportConceptOid, out var cb2ScOid);
var checkedValue = wasSuccessful ? Model.SelectedConceptCostBearerRelations.Any(a => a.CostBearer2SupportConceptOid.Equals(cb2ScOid)) : wasSuccessful;
var checkedValue = Model.SelectedConceptCostBearerRelations.Any(a => a.CostBearer2SupportConceptOid == cb2Sc.CostBearer2SupportConceptOid);
}
<div class="custom-control custom-checkbox custom-control-inline">

View File

@@ -209,13 +209,13 @@
@{
var shouldShowSignaturePopup = TempData[TempDataConstants.ShowSignatureSuggestionPopup]?.GetType() == typeof(bool) && (bool) TempData[TempDataConstants.ShowSignatureSuggestionPopup];
if(Model.ServiceRecordOid > 0)
if(Model.LastCreatedServiceRecordOid > 0)
{
if(shouldShowSignaturePopup && Model.ShowSignature)
{
<text>
showMessagePopupWithCallback("Erfolgreich gespeichert", "Möchten Sie den Eintrag unterschreiben lassen?", function() {
initializeSignature(@Model.ServiceRecordOid);
initializeSignature(@Model.LastCreatedServiceRecordOid);
}, false);
</text>
}
@@ -356,7 +356,7 @@
<div class="container mt-3 lg-max-width" id="checkbox-container">
<div class="row">
@if(AbstractModel.IsAllowedToSeeSupportConceptFilter)
@if(Model.IsAllowedToSeeSupportConceptFilter)
{
<div class="col-md">
@using(Html.BeginForm("SetSupportConceptFilter", "Main", FormMethod.Post))
@@ -376,7 +376,7 @@
}
</div>
@if(AbstractModel.HasRightForGroupBookings)
@if(Model.HasRightForGroupBookings)
{
<div class="col-md pt-1">
@using(Html.BeginForm("SetGroupBookingMode", "Main", FormMethod.Post))
@@ -389,7 +389,7 @@
</div>
}
@if(AbstractModel.HasRightForMultiBooking)
@if(Model.HasRightForMultiBooking)
{
<div class="col-md pt-1">
@using(Html.BeginForm("SetMultiBookingMode", "Main", FormMethod.Post))
@@ -578,7 +578,7 @@
</div>
@* ----- Bewertungspopup für Ziele ----- *@
@if(AbstractModel.HasRightToRateGoals)
@if(Model.HasRightToRateGoals)
{
<div id="goal-rating-popup" class="modal" tabindex="-1" role="dialog" style="z-index: 9999 !important">
<div class="modal-dialog modal-lg" role="document">

View File

@@ -91,7 +91,7 @@
}
@* ----- Betrag ----- *@
@if(AbstractModel.ShowBetrag)
@if(Model.ShowBetrag)
{
<div class="form-row mt-2">
<div class="col-md">
@@ -221,7 +221,7 @@
</div>
@* Gefahrene Kilometer *@
@if(AbstractModel.ShowDistanceField)
@if(Model.ShowDistanceField)
{
<div class="form-row">
<div class="col-md">
@@ -240,7 +240,7 @@
}
@* Textbausteinebutton *@
@if(AbstractModel.HasRightToSeeTextModules)
@if(Model.HasRightToSeeTextModules)
{
<div class="form-row" id="textmodule-container">
<div class="col-md">

View File

@@ -317,7 +317,7 @@
<button type="button" data-toggle="modal" class="btn btn-outline-primary" onclick="getSignatureImage(@serviceRecord.ServiceRecordOid.Value, @serviceRecord.SignatureOid.Value)">
<span class="fas fa-file-contract"></span>
</button>
if(AbstractModel.HasRightToDeleteReceiptSignatures)
if(Model.HasRightToDeleteReceiptSignatures)
{
<button type="button" class="btn btn-outline-danger" onclick="deleteSigntarue(@serviceRecord.SignatureOid.Value, @serviceRecord.ServiceRecordOid.Value, '@serviceRecord.Customer', '@MainModel.GetServiceRecordTimeHeader(serviceRecord, false)')">
<i class="fas fa-file-contract"></i>
@@ -341,7 +341,7 @@
</tr>
@* Gefahrene Kilometer *@
@if(AbstractModel.ShowDistanceField && serviceRecord.DistanceInMeterDecimal != null && serviceRecord.DistanceInMeterDecimal.Value > 0)
@if(Model.ShowDistanceField && serviceRecord.DistanceInMeterDecimal != null && serviceRecord.DistanceInMeterDecimal.Value > 0)
{
<tr>
<td class="text-secondary">
@@ -412,7 +412,7 @@
</tr>
@* Angelegt von & angelegt am *@
@if(AbstractModel.ShowServiceRecordInsertedOn)
@if(Model.ShowServiceRecordInsertedOn)
{
<tr>
<td class="text-secondary">
@@ -433,7 +433,7 @@
}
@* Betrag *@
@if(AbstractModel.ShowBetrag && serviceRecord.Betrag.HasValue && serviceRecord.Betrag.Value > 0)
@if(Model.ShowBetrag && serviceRecord.Betrag.HasValue && serviceRecord.Betrag.Value > 0)
{
var betrag = serviceRecord.Betrag.Value.ToString("#.00") + " €";

View File

@@ -42,7 +42,7 @@
});
@{
if(Model.SelectedSupportConcept != null || Model.CostBearer2SupportConceptOid == -2)
if(Model.SelectedSupportConcept != null || Model.SelectedCostBearerSupportConceptOid == -2)
{
<text>
initializeIntervalSelection();
@@ -163,7 +163,7 @@
? "text-bewo-expires-in-three-months"
: "text-light";
var isFormDisabled = Model.SelectedCostBearerSupportConceptRelOid.HasValue ? string.Empty : "disabled";
var isFormDisabled = Model.SelectedCostBearerSupportConceptOid.HasValue ? string.Empty : "disabled";
<div>
<div class="container p-0">
@@ -174,7 +174,7 @@
<div class="d-flex">
<h5 class="mb-1 text-light text-left" id="selectedSupportConceptCustomerInfo">@Model.SelectedCostBearer2SupportConceptRelListObject.NameAndDateOfBirth</h5>
</div>
@if(Model.SelectedCostBearerSupportConceptRelOid > 0)
@if(Model.SelectedCostBearerSupportConceptOid > 0)
{
<div class="dropdown-divider my-0 py-0"></div>
}
@@ -184,7 +184,7 @@
</a>
</div>
</div>
@if (Model.CostBearer2SupportConceptOid != null && Model.CostBearer2SupportConceptOid > 0)
@if (Model.SelectedCostBearerSupportConceptOid != null && Model.SelectedCostBearerSupportConceptOid > 0)
{
<div class="col-md-auto mt-3">
<button type="button" class="btn btn-outline-primary w-100 h-100" id="statistics-button" data-toggle="modal" data-target="#statistics-popup" onclick="showPieChart()">
@@ -307,7 +307,7 @@
}
@* ----- Betrag ----- *@
@if(AbstractModel.ShowBetrag)
@if(Model.ShowBetrag)
{
var betrag = string.Empty;
if(Model.SelectedServiceRecord?.Betrag != null && Model.SelectedServiceRecord.Betrag.Value > 0)
@@ -429,7 +429,7 @@
</div>
@* ----- Einzelbuchung: Distanz ----- *@
@if(AbstractModel.ShowDistanceField)
@if(Model.ShowDistanceField)
{
<div class="form-row mt-2">
<div class="col-md">
@@ -448,7 +448,7 @@
}
@* ----- Einzelbuchung: Textbausteine ----- *@
@if(AbstractModel.HasRightToSeeTextModules)
@if(Model.HasRightToSeeTextModules)
{
<script type="text/javascript">
function textModuleButtonOnClick() {
@@ -539,11 +539,16 @@
<div class="col col-12 col-md-7">
@if(Model != null)
{
if(Model.SelectedSupportConcept != null || Model.CostBearer2SupportConceptOid == -2)
if(Model.SelectedSupportConcept != null || Model.SelectedCostBearerSupportConceptOid == -2)
{
var defaultStartDate = DateTime.Now.GetFirstOfMonth().ToShortDateString();
var defaultEndDate = DateTime.Today.ToShortDateString();
if (Model.SelectedZeitraum != null && Model.SelectedZeitraum.StartDate.HasValue && Model.SelectedZeitraum.EndDate.HasValue)
{
defaultStartDate = Model.SelectedZeitraum.StartDate.Value.ToShortDateString();
defaultEndDate = Model.SelectedZeitraum.EndDate.Value.ToShortDateString();
}
<div class="container-fluid w-100 mt-3 p-0">
<div class="form-row">
<div class="col">

View File

@@ -296,7 +296,7 @@
@durationStr
</td>
</tr>
@if(AbstractModel.ShowDistanceField && serviceRecord.DistanceInMeterDecimal != null && serviceRecord.DistanceInMeterDecimal.Value > 0)
@if(Model.ShowDistanceField && serviceRecord.DistanceInMeterDecimal != null && serviceRecord.DistanceInMeterDecimal.Value > 0)
{
<tr>
<td class="text-secondary">
@@ -358,7 +358,7 @@
@serviceRecord.Employee.FirstNameLastName
</td>
</tr>
@if(AbstractModel.ShowServiceRecordInsertedOn)
@if(Model.ShowServiceRecordInsertedOn)
{
<tr>
<td class="text-secondary">
@@ -377,7 +377,7 @@
</td>
</tr>
}
@if(AbstractModel.ShowBetrag && serviceRecord.Betrag.HasValue && serviceRecord.Betrag.Value > 0)
@if(Model.ShowBetrag && serviceRecord.Betrag.HasValue && serviceRecord.Betrag.Value > 0)
{
var betrag = serviceRecord.Betrag.Value.ToString("#.00") + " €";

View File

@@ -25,7 +25,7 @@
}
</script>
@if(Model.QuittierungsbelegsReportObject != null)
@if(Model.QuittierungsbelegsReport != null)
{
@Html.DevExpress().WebDocumentViewer(settings =>
{
@@ -36,5 +36,5 @@
settings.SettingsMobile.ReaderMode = true;
settings.SettingsMobile.AnimationEnabled = false;
settings.ClientSideEvents.Init = "quittierungsbelegsViewerInit";
}).Bind(Model.QuittierungsbelegsReportObject).GetHtml()
}).Bind(Model.QuittierungsbelegsReport).GetHtml()
}

View File

@@ -259,13 +259,13 @@
var canCustomerSign = customerSignatureState != SignatureState.All;
var canEmployeeSign = employeeSignatureState != SignatureState.All && employeeSignatureState != SignatureState.AllOwnServiceRecords; // || (employeeSignatureState != SignatureState.AllOwnServiceRecords);
var employeeName = Model.Employee.ToString();
var employeeName = Model.LoggedInEmployee.ToString();
var overwrite_ssp = (employeeSignatureState == SignatureState.All).ToString().ToLower();
var cardBodyId_ssp = $"#collapse-result-{result.Identifier}";
var timeSpan_ssp = Model.ConfirmationReceiptObject.TimeSpanString;
var hasNoOwnEntries = !AbstractModel.HasRightToProvideEmployeeSignatureForOthers && result.Items.All(item => !item.EmployeeOid.Equals(Model.Employee.EmployeeOid));
var hasNoOwnEntries = !Model.HasRightToProvideEmployeeSignatureForOthers && result.Items.All(item => !item.EmployeeOid.Equals(Model.LoggedInEmployee.EmployeeOid));
var disabledString = hasNoOwnEntries ? "disabled" : string.Empty;
}
@@ -292,7 +292,7 @@
<div class="btn-toolbar">
<!-- w-auto -->
<div class="btn-group pr-1" role="group" style="width: 150px !important;">
@if(AbstractModel.HasRightToDeleteReceiptSignatures && result.CustomerSignatureOids.Any())
@if(Model.HasRightToDeleteReceiptSignatures && result.CustomerSignatureOids.Any())
{
<button class="btn btn-danger mx-0" type="button" onclick="deleteCustomerSignatures('#collapse-result-@result.Identifier', '@result.Identifier', '@result.CustomerName', '@timeSpan_ssp')">
<span class="fas fa-trash"></span>
@@ -316,7 +316,7 @@
</div>
<!-- w-auto -->
<div class="btn-group" role="group" style="width: 150px !important;">
@if(AbstractModel.HasRightToDeleteReceiptSignatures && result.EmployeeSignatureOids.Any())
@if(Model.HasRightToDeleteReceiptSignatures && result.EmployeeSignatureOids.Any())
{
<button class="btn btn-danger mx-0" type="button" onclick="deleteEmployeeSignature('#collapse-result-@result.Identifier', '@result.Identifier', '@employeeName', '@result.CustomerName', '@timeSpan_ssp')">
<span class="fas fa-trash"></span>
@@ -331,7 +331,7 @@
<i class="fas fa-slash fa-stack-1x mx-0 px-0" style="color: tomato;"></i>
</span>
}
else if(employeeSignatureState == SignatureState.AllOwnServiceRecords && !AbstractModel.HasRightToProvideEmployeeSignatureForOthers)
else if(employeeSignatureState == SignatureState.AllOwnServiceRecords && !Model.HasRightToProvideEmployeeSignatureForOthers)
{
<span class="fas fa-ban" style="color: tomato;"></span>
}
@@ -351,7 +351,7 @@
<div class="container-fluid">
@foreach(var item in result.Items)
{
var isNotOwnEntry = !AbstractModel.HasRightToProvideEmployeeSignatureForOthers && !item.EmployeeOid.Equals(Model.Employee.EmployeeOid);
var isNotOwnEntry = !Model.HasRightToProvideEmployeeSignatureForOthers && !item.EmployeeOid.Equals(Model.LoggedInEmployee.EmployeeOid);
var headerTextColorClass = isNotOwnEntry ? "text-secondary" : "text-primary";

View File

@@ -62,7 +62,7 @@
$("#test-div3").addClass("d-block");
}
@if(Model.QuittierungsbelegsReportObject != null)
@if(Model.QuittierungsbelegsReportSettings != null)
{
<text>
const windowHeight = $(window).height() * .8;
@@ -262,7 +262,7 @@
const month = $("#month-select option:selected").val();
const year = $("#year-select option:selected").val();
@if(AbstractModel.ShowDifferentQBInterval)
@if(Model.ShowDifferentQBInterval)
{
<text>
const interval = $("#qb-interval-selection option:selected").val();
@@ -366,7 +366,7 @@
<div class="mt-3">
<div class="form-row">
@if(AbstractModel.ShowDifferentQBInterval)
@if(Model.ShowDifferentQBInterval)
{
<div class="input-group">
@Html.DropDownListFor(m => m.SelectedIntervalSelection, Model.IntervalSelections, new { id = "qb-interval-selection", onchange = "checkForExistingSignature()", @class = "custom-select" })
@@ -440,7 +440,7 @@
<span class="fas fa-question"></span>
</button>
<button type="button" class="btn btn-primary float-right" id="create-button" onclick="createServiceOverview()">Erstellen</button>
<button type="button" class="btn btn-primary float-right" id="create-button" onclick="createServiceOverview()">Einträge anzeigen</button>
@using(Html.BeginForm("LoadQuittierungsbeleg", "Report", FormMethod.Post, new { id = "load-report-form" }))
{
@@ -595,12 +595,12 @@
</button>
</div>
<div class="modal-body" id="qb-container">
@if(Model.QuittierungsbelegsReportObject != null)
@if (Model.QuittierungsbelegsReportSettings != null)
{
@Html.Partial("QuittierungsbelegsPreviewPartial", Model)
Html.RenderAction("CreateQuittierungsbelegsReport");
}
</div>
</div>
</div>
</div>
</div>
<!-- /Popup des Quittierungsbelegsdokuments -->

View File

@@ -145,10 +145,10 @@
</div>
}
@if(Model.SelectedReportType == ReportType.Mitarbeiterstundenkonto && AbstractModel.HasRightToViewMitarbeiterstundenkonto)
@if(Model.SelectedReportType == ReportType.Mitarbeiterstundenkonto && Model.HasRightToViewMitarbeiterstundenkonto)
{
<div id="report-form-container">
@if(AbstractModel.HasRightMitarbeiterstundenkontoViewAll || AbstractModel.HasRightMitarbeiterstundenkontoViewTeams)
@if(Model.HasRightMitarbeiterstundenkontoViewAll || Model.HasRightMitarbeiterstundenkontoViewTeams)
{
<div class="form-row">
<div class="col">
@@ -169,7 +169,7 @@
}
<div id="msk-employee-form">
@if(AbstractModel.HasRightMitarbeiterstundenkontoViewAll)
@if(Model.HasRightMitarbeiterstundenkontoViewAll)
{
<div class="form-row">
<div class="col mb-2">
@@ -186,7 +186,7 @@
</div>
</div>
</div>
@if(AbstractModel.HasRightMitarbeiterstundenkontoViewAll || AbstractModel.HasRightMitarbeiterstundenkontoViewTeams)
@if(Model.HasRightMitarbeiterstundenkontoViewAll || Model.HasRightMitarbeiterstundenkontoViewTeams)
{
<div id="msk-team-form">
<div class="form-row">

View File

@@ -223,7 +223,7 @@
@if(Model.HasResourcesEmployeesOrCustomers)
{
<div class="form-row">
@if(AbstractModel.HasRightToViewEmployeeAppointments && AbstractModel.HasRightToInsertEmployeeAppointments)
@if(Model.HasRightToViewEmployeeAppointments && Model.HasRightToInsertEmployeeAppointments)
{
<div class="col-md">
<div class="form-group my-1">
@@ -231,7 +231,7 @@
</div>
</div>
}
@if(AbstractModel.HasRightToViewCustomerSelectionInScheduler && AbstractModel.HasRightToInsertCustomerAppointments)
@if(Model.HasRightToViewCustomerSelectionInScheduler && Model.HasRightToInsertCustomerAppointments)
{
<div class="col-md">
<div class="form-group my-1">
@@ -239,7 +239,7 @@
</div>
</div>
}
@if(AbstractModel.HasRightToViewAllResourceAppointments && AbstractModel.HasRightToInsertRessourceAppointments && Model.ResourceCategories2Resources.Any())
@if(Model.HasRightToViewAllResourceAppointments && Model.HasRightToInsertRessourceAppointments && Model.ResourceCategories2Resources.Any())
{
<div class="col-md">
<div class="form-group my-1">
@@ -249,13 +249,13 @@
}
</div>
if(AbstractModel.HasRightToViewEmployeeAppointments && AbstractModel.HasRightToInsertEmployeeAppointments ||
AbstractModel.HasRightToViewCustomerSelectionInScheduler && AbstractModel.HasRightToInsertCustomerAppointments ||
AbstractModel.HasRightToViewAllResourceAppointments && AbstractModel.HasRightToInsertRessourceAppointments)
if(Model.HasRightToViewEmployeeAppointments && Model.HasRightToInsertEmployeeAppointments ||
Model.HasRightToViewCustomerSelectionInScheduler && Model.HasRightToInsertCustomerAppointments ||
Model.HasRightToViewAllResourceAppointments && Model.HasRightToInsertRessourceAppointments)
{
<div class="form-row">
<div class="col">
@if(AbstractModel.HasRightToViewEmployeeAppointments && AbstractModel.HasRightToInsertEmployeeAppointments)
@if(Model.HasRightToViewEmployeeAppointments && Model.HasRightToInsertEmployeeAppointments)
{
<div id="scheduler-selected-employees-container">
@Html.Partial("SchedulerEmployeeSelectionPartial", Model)
@@ -265,7 +265,7 @@
</div>
<div class="form-row">
<div class="col mx-0">
@if(AbstractModel.HasRightToViewCustomerSelectionInScheduler && AbstractModel.HasRightToInsertCustomerAppointments)
@if(Model.HasRightToViewCustomerSelectionInScheduler && Model.HasRightToInsertCustomerAppointments)
{
<div id="scheduler-selected-customer-container">
@Html.Partial("SchedulerCustomerSelectionPartial", Model)
@@ -276,7 +276,7 @@
<div class="form-row">
<div class="col mx-0">
@if(AbstractModel.HasRightToViewAllResourceAppointments && AbstractModel.HasRightToInsertRessourceAppointments)
@if(Model.HasRightToViewAllResourceAppointments && Model.HasRightToInsertRessourceAppointments)
{
<div id="scheduler-selected-resources-container">
@Html.Partial("SchedulerResourceSelectionPartial", Model)

View File

@@ -79,7 +79,7 @@
validationMessage = "Das Startdatum ist ungültig!";
}
if(end > start) {
if(end < start) {
if(validationMessage.length === 0) {
validationMessage += "Das Enddatum darf nicht vor dem Startdatum liegen!";
} else {
@@ -192,7 +192,7 @@
{
<!-- Hinzufügen-Buttons -->
<div class="form-row">
@if(AbstractModel.HasRightToViewEmployeeAppointments)
@if(Model.HasRightToViewEmployeeAppointments)
{
<div class="col-md">
<div class="form-group my-1">
@@ -200,7 +200,7 @@
</div>
</div>
}
@if(AbstractModel.HasRightToViewCustomerAppointments)
@if(Model.HasRightToViewCustomerAppointments)
{
<div class="col-md">
<div class="form-group my-1">
@@ -208,7 +208,7 @@
</div>
</div>
}
@if(AbstractModel.HasRightToViewAllResourceAppointments && Model.ResourceCategories2Resources.Any())
@if(Model.HasRightToViewAllResourceAppointments && Model.ResourceCategories2Resources.Any())
{
<div class="col-md">
<div class="form-group my-1">
@@ -219,7 +219,7 @@
</div>
<div class="form-row">
@if(AbstractModel.HasRightToViewEmployeeAppointments)
@if(Model.HasRightToViewEmployeeAppointments)
{
<div class="col-12">
<div class="form-group my-1">
@@ -257,7 +257,7 @@
</div>
</div>
}
@if(AbstractModel.HasRightToViewCustomerAppointments)
@if(Model.HasRightToViewCustomerAppointments)
{
<div class="col-12">
<div class="form-group my-1">
@@ -294,7 +294,7 @@
</div>
</div>
}
@if(AbstractModel.HasRightToViewAllResourceAppointments && Model.ResourceCategories2Resources.Any())
@if(Model.HasRightToViewAllResourceAppointments && Model.ResourceCategories2Resources.Any())
{
<div class="col-12">
<div class="form-group my-1">
@@ -344,7 +344,7 @@
</div>
</div>
@if(AbstractModel.HasRightToViewAllResourceAppointments && Model.ResourceCategories2Resources.Any())
@if(Model.HasRightToViewAllResourceAppointments && Model.ResourceCategories2Resources.Any())
{
<div class="modal" tabindex="-1" role="dialog" id="resources-interval-finder-popup">
<div class="modal-dialog modal-dialog-scrollable" role="document">
@@ -414,7 +414,7 @@
</div>
}
@if(AbstractModel.HasRightToViewEmployeeAppointments && Model.AllEmployees.Any())
@if(Model.HasRightToViewEmployeeAppointments && Model.AllEmployees.Any())
{
<div class="modal" tabindex="-1" role="dialog" id="employees-interval-finder-popup">
<div class="modal-dialog modal-dialog-scrollable" role="document">
@@ -449,7 +449,7 @@
</div>
</div>
@if(AbstractModel.HasRightToViewTeams)
@if(Model.HasRightToViewTeams)
{
<div class="card w-100 mb-3">
<div class="card-header" data-toggle="collapse" data-target="#collapsable-teams-selection">
@@ -500,7 +500,7 @@
</div>
}
@if(AbstractModel.HasRightToViewCustomerAppointments && Model.AllCustomers.Any())
@if(Model.HasRightToViewCustomerAppointments && Model.AllCustomers.Any())
{
<div class="modal" tabindex="-1" role="dialog" id="customers-interval-finder-popup">
<div class="modal-dialog modal-dialog-scrollable" role="document">

View File

@@ -105,7 +105,7 @@
}
</script>
@if(AbstractModel.HasRightToViewCustomerSelectionInScheduler && Model.AllCustomers.Any())
@if(Model.HasRightToViewCustomerSelectionInScheduler && Model.AllCustomers.Any())
{
<div class="modal" tabindex="-1" role="dialog" id="customers-popup2">
<div class="modal-dialog modal-dialog-scrollable" role="document">
@@ -119,7 +119,7 @@
<div class="modal-body">
<div class="container-fluid" id="customers-for-filtering-container">
@{
Html.RenderAction("FetchCustomerFilteringModalBody");
Html.RenderPartial("CustomerFilteringModalContentPartial", Model);
}
</div>
</div>

View File

@@ -39,7 +39,7 @@
</div>
<!-- /Suche -->
<!-- Meine Teams -->
@if(AbstractModel.HasRightToViewTeams && Model.MyTeams.Any())
@if(Model.HasRightToViewTeams && Model.MyTeams.Any())
{
<div class="card w-100 mb-3">
<div class="card-header" onclick="toggleTeamList()">

View File

@@ -121,6 +121,7 @@
try {
$.get('@Url.Action("SelectTeamForFiltering")', { teamOidString: teamOid }).done(function() {
updateEmployeeForFilteringPopup();
$("#one-day-scheduler-partial-container").load('@Url.Action("FetchAppointments")');
});
} catch(error) {
showErrorPopup(error);
@@ -128,7 +129,7 @@
}
</script>
@if(AbstractModel.HasRightToViewEmployeeAppointments && Model.AllEmployees.Any())
@if(Model.HasRightToViewEmployeeAppointments && Model.AllEmployees.Any())
{
<div class="modal" tabindex="-1" role="dialog" id="employees-popup2">
<div class="modal-dialog modal-dialog-scrollable" role="document">
@@ -142,7 +143,7 @@
<div class="modal-body">
<div class="container-fluid" id="employees-for-filtering-container">
@{
Html.RenderAction("FetchEmployeeFilteringModalBody");
Html.RenderPartial("EmployeeFilteringModalContentPartial", Model);
}
</div>
</div>

View File

@@ -84,7 +84,7 @@
</div>
</div>
@if(AbstractModel.HasRightToViewTeams)
@if(Model.HasRightToViewTeams)
{
<div class="card w-100 mb-3">
<div class="card-header" data-toggle="collapse" data-target="#collapsable-teams-selection">

View File

@@ -186,7 +186,7 @@
if(Model.HasResourcesEmployeesOrCustomers)
{
<div class="row justify-content-center m-0 p-0 mt-1">
@if(AbstractModel.HasRightToViewEmployeeAppointments)
@if(Model.HasRightToViewEmployeeAppointments)
{
<div class="col-auto d-flex justify-content-center mx-1 px-0">
<button type="button" class="btn btn-sm btn-bewo-employee" onclick="openEmployeeForFilteringPopup()">
@@ -194,7 +194,7 @@
</button>
</div>
}
@if(AbstractModel.HasRightToViewCustomerSelectionInScheduler)
@if(Model.HasRightToViewCustomerSelectionInScheduler)
{
<div class="col-auto d-flex justify-content-center mx-1 px-0">
<button type="button" class="btn btn-sm btn-bewo-customers" data-toggle="modal" data-target="#customers-popup2">
@@ -202,7 +202,7 @@
</button>
</div>
}
@if(AbstractModel.HasRightToViewAllResourceAppointments)
@if(Model.HasRightToViewAllResourceAppointments)
{
<div class="col-auto d-flex justify-content-center mx-1 px-0">
<button type="button" class="btn btn-sm btn-bewo-resource" data-toggle="modal" data-target="#resources-popup2">
@@ -269,7 +269,7 @@
<!-- Filterauswahl: -->
@if(AbstractModel.HasRightToViewAllResourceAppointments)
@if(Model.HasRightToViewAllResourceAppointments)
{
<div class="modal" tabindex="-1" role="dialog" id="resources-popup2">
<div class="modal-dialog modal-dialog-scrollable" role="document">
@@ -339,28 +339,28 @@
</div>
}
@if(AbstractModel.HasRightToViewEmployeeAppointments)
@if(Model.HasRightToViewEmployeeAppointments)
{
Html.RenderAction("FetchSelectedEmployeesForPopup", Model);
Html.RenderPartial("EmployeeForFilteringPartial", Model);
}
@if(AbstractModel.HasRightToViewCustomerSelectionInScheduler)
@if(Model.HasRightToViewCustomerSelectionInScheduler)
{
Html.RenderAction("FetchCustomersForFiltering", Model);
Html.RenderPartial("CustomerFilterSelectionPartial", Model);
}
<!-- /Filterauswahl -->
@if(AbstractModel.HasRightToViewEmployeeAppointments)
@if(Model.HasRightToViewEmployeeAppointments)
{
Html.RenderPartial("EmployeeSelectionPopupPartial", Model);
}
@if(AbstractModel.HasRightToViewCustomerSelectionInScheduler && AbstractModel.HasRightToInsertCustomerAppointments)
@if(Model.HasRightToViewCustomerSelectionInScheduler && Model.HasRightToInsertCustomerAppointments)
{
Html.RenderPartial("CustomerSelectionPopupPartial", Model);
}
@if(AbstractModel.HasRightToViewAllResourceAppointments && AbstractModel.HasRightToInsertRessourceAppointments)
@if(Model.HasRightToViewAllResourceAppointments && Model.HasRightToInsertRessourceAppointments)
{
Html.RenderPartial("ResourceSelectionPopupPartial", Model);
}

View File

@@ -440,7 +440,7 @@
@* Eingabenwiederherstellung *@
function getLocalStorageKey() {
return "@AbstractModel.LocalStorageKey";
return "@MobileSessionFacade.LocalStorageKey";
}
function getBeWoStorage() {
@@ -568,7 +568,7 @@
}
}
@if(AbstractModel.IsAllowedToSeeCustomers)
@if(Model.IsAllowedToSeeCustomers)
{
using(Html.BeginForm("RedirectToCustomer", "Main", FormMethod.Post))
{
@@ -591,7 +591,7 @@
</li>
}
@if(AbstractModel.IsAllowedToSeeScheduler)
@if(Model.IsAllowedToSeeScheduler)
{
using(Html.BeginForm("RedirectToScheduler", "Main", FormMethod.Post))
{
@@ -605,7 +605,7 @@
}
@if(AbstractModel.HasRightToViewQuittierungsbelege)
@if(Model.HasRightToViewQuittierungsbelege)
{
using(Html.BeginForm("RedirectToReportView", "Main", FormMethod.Post))
{
@@ -620,7 +620,7 @@
}
}
@if(AbstractModel.HasRightToViewReports && AbstractModel.HasRightToViewMitarbeiterstundenkonto)
@if(Model.HasRightToViewReports && Model.HasRightToViewMitarbeiterstundenkonto)
{
using(Html.BeginForm("RedirectToReportViewer", "Main", FormMethod.Post))
{

View File

@@ -11,7 +11,9 @@ using System.Web;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using log4net.Config;
using NHibernate;
@@ -58,10 +60,10 @@ namespace BeWo.Data
userLoaded = TryAuthenticateWithGkv(context);
}
if (!userLoaded && !(SessionFacade.LoggedInUser?.Oid is null))
{
SessionFacade.LoggedInUser = DAOFactory.GenericDAO.LoadByID<ApplicationUser>(SessionFacade.LoggedInUser.Oid.Value);
}
//if (!userLoaded && !(SessionFacade.LoggedInUserDC?.UserOid is null))
//{
// SessionFacade.LoggedInUserDC = CreateUserDC(DAOFactory.GenericDAO.LoadByID<ApplicationUser>(SessionFacade.LoggedInUser.Oid.Value));
//}
}
};
@@ -173,7 +175,7 @@ namespace BeWo.Data
if (lUser != null && lUser.CheckRC2Password(lPassword))
{
SessionFacade.LoggedInUser = lUser;
SessionFacade.LoggedInUserOid = lUser.Oid;
return true;
}
}
@@ -192,7 +194,7 @@ namespace BeWo.Data
if (user != null && DAOFactory.UserDAO.CheckPassword(user, password))
{
SessionFacade.LoggedInUser = user;
SessionFacade.LoggedInUserOid = user.Oid;
return true;
}
}
@@ -213,7 +215,7 @@ namespace BeWo.Data
if (!long.TryParse(useroidstr, out long useroid))
return false;
SessionFacade.LoggedInUser = DAOFactory.GenericDAO.LoadByID<ApplicationUser>(useroid);
SessionFacade.LoggedInUserOid = useroid;
return true;
}
@@ -333,5 +335,116 @@ namespace BeWo.Data
}
}
}
private static UserDC CreateUserDC(ApplicationUser pEntity)
{
var pDataContract = new UserDC();
pDataContract.UserOid = pEntity.Oid;
pDataContract.UserVersion = pEntity.Version;
pDataContract.LoginName = pEntity.LoginName;
pDataContract.Zeitstempel = pEntity.Zeitstempel ?? DateTime.Now;
pDataContract.LicenseType = pEntity.LicenseType;
if (pEntity.Employee != null)
{
pDataContract.Employee = CreateCompactEmployeeDC(pEntity.Employee);
}
pDataContract.UserGroups = CreateUserGroupDcList(pEntity.UserGroups);
pDataContract.Settings = CreateSettingDcList(pEntity.SettingList);
return pDataContract;
}
private static CompactEmployeeDC CreateCompactEmployeeDC(Employee pEntity)
{
var pDataContract = new CompactEmployeeDC();
pDataContract.EmployeeOid = pEntity.Oid.Value;
pDataContract.PersonOid = pEntity.Person.Oid.Value;
pDataContract.EmployeeVersion = pEntity.Version.Value;
pDataContract.FirstName = pEntity.Person.FirstName;
pDataContract.LastName = pEntity.Person.LastName;
pDataContract.PersonnelNumber = pEntity.PersonnelNumber;
pDataContract.ActivationType = pEntity.IsActive;
pDataContract.ValueListEntries = pEntity.ValueList.ToDictionary(i => i.Entry.Oid.Value, i => i.Entry.Type);
pDataContract.EmployeeColor = pEntity.EmployeeColor;
pDataContract.RelatedCustomerOIDList = pEntity.Employee2CustomerList.Where(w => w.CustomerOid.HasValue).Select(s => s.CustomerOid.Value).ToList();
return pDataContract;
}
private static UserGroupDC MergeWithDC(UserGroup pEntity, UserGroupDC pDataContract)
{
pDataContract.UserGroupOid = pEntity.Oid;
pDataContract.UserGroupVersion = pEntity.Version;
pDataContract.Name = pEntity.Name;
pDataContract.Description = pEntity.Description;
pDataContract.Rights = new List<UserRightType>();
var allrights = pEntity.Rights.Select(rr => rr.RightType).ToList();
foreach (var r in allrights)
{
var str = r.ToString();
long l = 0;
if (!Int64.TryParse(str, out l))
{
pDataContract.Rights.Add(r);
}
else
{
int test = 0;
}
//if ()
}
return pDataContract;
}
private static List<SettingsDC> CreateSettingDcList(IList<Entities.Settings> settingList)
{
var list = new List<SettingsDC>();
foreach (var item in settingList)
{
list.Add(new SettingsDC { SettingsOid = item.Oid, SettingsVersion = item.Version, Type = item.Type, Value = item.Value });
}
return list;
}
private static List<UserGroupDC> CreateUserGroupDcList(IList<UserGroup> userGroups)
{
var list = new List<UserGroupDC>();
foreach (var ug in userGroups)
{
var ugDc = new UserGroupDC();
ugDc.UserGroupOid = ug.Oid;
ugDc.UserGroupVersion = ug.Version;
ugDc.Name = ug.Name;
ugDc.Description = ug.Description;
ugDc.Rights = new List<UserRightType>();
var allrights = ug.Rights.Select(rr => rr.RightType).ToList();
foreach (var r in allrights)
{
var str = r.ToString();
long l = 0;
if (!Int64.TryParse(str, out l))
{
ugDc.Rights.Add(r);
}
}
list.Add(ugDc);
}
return list;
}
}
}

View File

@@ -1,7 +1,7 @@
using System.Data;
using MySql.Data.MySqlClient;
using System.Data;
using System.Data.SqlClient;
using MySql.Data.MySqlClient;
namespace BeWo.Data.Access
{

View File

@@ -104,8 +104,13 @@ namespace BeWo.Data.Security
public static void CheckRightVersion(UserDC user)
{
var version = GetBeWoVersion(GetLoggedInUser().LoginName);
CheckRightVersion(version, user);
var liu = GetLoggedInUser();
if (liu != null)
{
var version = GetBeWoVersion(liu.LoginName);
CheckRightVersion(version, user);
}
}

View File

@@ -1,21 +1,41 @@
using System.Web;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BS.Shared.DataContracts;
namespace BeWo.Data
{
public static class SessionFacade
{
public static long? LoggedInUserOid
{
get => HttpContext.Current.Session["LoggedInUserOid"] as long?;
set => HttpContext.Current.Session["LoggedInUserOid"] = value;
}
//public static UserDC LoggedInUserDC
//{
// get
// {
// return HttpContext.Current.Session["apuser"] as UserDC;
// }
// set
// {
// HttpContext.Current.Session["apuser"] = value;
// }
//}
public static ApplicationUser LoggedInUser
{
get
{
return HttpContext.Current.Session["apuser"] as ApplicationUser;
}
set
{
HttpContext.Current.Session["apuser"] = value;
if (LoggedInUserOid.HasValue)
{
return DAOFactory.GenericDAO.LoadByID<ApplicationUser>(LoggedInUserOid.Value);
}
return null;
}
}

View File

@@ -8,7 +8,6 @@ using BS.Shared.DataContracts;
using BS.Shared.DataContracts.GkvAbrechnung;
using BS.Shared.Exceptions;
using Newtonsoft.Json;
using NHibernate.Dialect.Function;
using System;
using System.Collections.Generic;
using System.Configuration;

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.CodeAnalysis.Analyzers.2.9.6\build\Microsoft.CodeAnalysis.Analyzers.props" Condition="Exists('..\packages\Microsoft.CodeAnalysis.Analyzers.2.9.6\build\Microsoft.CodeAnalysis.Analyzers.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
@@ -108,10 +108,6 @@
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NHibernate, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Lib\NHibernate.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
@@ -447,7 +443,6 @@
<Content Include="Scripts\jquery.mobile-1.4.5.js" />
<Content Include="Scripts\jquery.mobile-1.4.5.min.js" />
<Content Include="server.txt" />
<Content Include="ServiceRecordEditPage.aspx" />
<Content Include="StreamingService.svc" />
<Content Include="UserService.svc" />
<Content Include="ValueListService.svc" />
@@ -534,20 +529,6 @@
<Compile Include="ResetPassword.aspx.designer.cs">
<DependentUpon>ResetPassword.aspx</DependentUpon>
</Compile>
<Compile Include="ServiceRecordEditPage.aspx.cs">
<DependentUpon>ServiceRecordEditPage.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ServiceRecordEditPage.aspx.designer.cs">
<DependentUpon>ServiceRecordEditPage.aspx</DependentUpon>
</Compile>
<Compile Include="ServiceRecordPage.aspx.cs">
<DependentUpon>ServiceRecordPage.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ServiceRecordPage.aspx.designer.cs">
<DependentUpon>ServiceRecordPage.aspx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="chat.htm" />
@@ -586,7 +567,6 @@
<Content Include="BeWo.Master" />
<Content Include="DX.aspx" />
<Content Include="Login.aspx" />
<Content Include="ServiceRecordPage.aspx" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />

View File

@@ -8,8 +8,6 @@ using BeWo.Service.Security;
using BS.Shared;
using NHibernate;
using NHibernate.Cfg;
namespace Host
{

View File

@@ -1,114 +0,0 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ServiceRecordEditPage.aspx.cs" Inherits="Host.ServiceRecordEditPage" MasterPageFile="~/BeWo.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
.ui-collapsible h4 .ui-btn-inner
{
text-align: center;
}
.centeredText {
text-align: center;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<table width="100%">
<tr>
<td colspan="1">
<asp:Label ID="Label1" runat="server" Text="Hilfeplan" />
</td>
<td colspan="3">
<asp:Label ID="label_serviceRecord" runat="server" Font-Bold="True" CssClass="centeredText" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Kategorie" />
</td>
<td colspan="3">
<asp:DropDownList Width="100%" runat="server" ID="combo_serviceCategories" AutoPostBack="true"
OnSelectedIndexChanged="combo_serviceCategories_SelectedIndexChanged" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Leistung" />
</td>
<td colspan="3">
<asp:DropDownList Width="100%" runat="server" ID="combo_serviceDescriptions" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" runat="server" Text="Datum" />
</td>
<td colspan="3" class="textboxcell">
<asp:TextBox Width="100%" runat="server" ID="tb_date"></asp:TextBox>
<script type="text/javascript">
$(function () {
var date = document.getElementById('ContentPlaceHolder1_tb_date').value;
$("#ContentPlaceHolder1_tb_date").datepicker();
$("#ContentPlaceHolder1_tb_date").datepicker("option", "firstDay", 1);
$("#ContentPlaceHolder1_tb_date").datepicker("option", "dateFormat", "dd.mm.yy");
$("#ContentPlaceHolder1_tb_date").datepicker("setDate", date);
$("#ui-datepicker-div").wrap('<div class="myScope"></div>');
$("#ContentPlaceHolder1_tb_date").datepicker("option", "dayNames", ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]);
$("#ContentPlaceHolder1_tb_date").datepicker("option", "dayNamesShort", ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam"]);
$("#ContentPlaceHolder1_tb_date").datepicker("option", "dayNamesMin", ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]);
$("#ContentPlaceHolder1_tb_date").datepicker("option", "monthNames", ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]);
$("#ContentPlaceHolder1_tb_date").datepicker("option", "monthNamesShort", ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"]);
});
</script>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="Dauer" />
</td>
<td colspan="3" class="textboxcell">
<input type="text" runat="server" style="width: 100%;" ID="tb_duration" data-clear-btn="false" pattern="[0-9]*" />
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label6" runat="server" Text="von" />
</td>
<td class="textboxcell">
<input type="text" runat="server" style="width: 100%;" ID="tb_start" pattern="[0-9]{1,2}[:]{0,1}[0-9]{2}" placeholder="z.B. 09:30 oder 0930" data-clear-btn="true" onchange='TimeCalculation()'/>
</td>
<td>
<asp:Label ID="Label7" runat="server" Text="bis" />
</td>
<td class="textboxcell">
<input type="text" runat="server" style="width: 100%;" ID="tb_stop" pattern="[0-9]{1,2}[:]{0,1}[0-9]{2}" placeholder="z.B. 10:30 oder 1030" data-clear-btn="true" onchange="TimeCalculation()"/>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label8" runat="server" Text="Dokumentation" />
</td>
<td colspan="3" class="textboxcell">
<asp:TextBox Width="100%" runat="server" ID="tb_notice" />
</td>
</tr>
<tr>
<td>
<asp:Button CssClass="smallbtn_alignright" runat="server" ID="Button1" Text="Abbrechen"
OnClick="bt_cancel_Click" data-inline="true" class="ui-btn-left" data-textonly="false" data-textvisible="true" data-msgtext="Lade"/>
</td>
<td colspan="3" style="text-align: right">
<asp:Button CssClass="smallbtn_alignright" runat="server" ID="bt_saveEdit" Text="&Auml;nderung speichern"
OnClick="bt_save_Click" data-inline="true" class="ui-btn-right" />
</td>
</tr>
<tr>
<td colspan="4" style="text-align: center;">
<asp:Label ForeColor="Green" runat="server" ID="lbl_success" />
<asp:Label ForeColor="Red" runat="server" ID="lbl_error" />
</td>
</tr>
</table>
</asp:Content>

View File

@@ -1,298 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using BeWo.Data;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.ServiceImplementations;
using BS.Shared;
using NHibernate.Impl;
using ServiceDescription = BeWo.Data.Entities.ServiceDescription;
namespace Host
{
public partial class ServiceRecordEditPage : Page
{
private List<UserRightType> rights;
protected void Page_Load(object sender, EventArgs e)
{
var serviceRecord2Edit = (ServiceRecord) Session["ServiceRecord2Edit"];
if (serviceRecord2Edit == null)
return;
try
{
if (!SessionFacade.IsUserLoggedIn())
throw new SecurityException("Anmeldung erforderlich!");
if (IsPostBack)
return;
Session["SelectedSupportConcept"] = serviceRecord2Edit.CostBearer2SupportConceptOid;
var blk = DAOFactory.GenericDAO.GetByID<ServiceRecord>(serviceRecord2Edit.Oid.Value);
Session["EintragsZiele"] = (List<ValueListEntry2Object>) blk.ValueList.ToList();
var operationsService = new OperationsServiceImp();
var serviceCategories = operationsService.GetAllServiceCategories();
combo_serviceCategories.Items.AddRange(serviceCategories.Select(c => new ListItem(c.Name, c.ServiceCategoryOid.ToString())).ToArray());
combo_serviceDescriptions.Items.AddRange(operationsService.GetAllServiceDescriptions()
.Where(sd => sd.Category.ServiceCategoryOid.Equals(serviceCategories[0].ServiceCategoryOid))
.Select(sd => new ListItem(sd.Name, sd.ServiceDescriptionOid.ToString())).ToArray());
long? sdOid = serviceRecord2Edit.ServiceDescription.Oid;
if (sdOid.HasValue)
{
var sdesc = DAOFactory.GenericDAO.GetByID<ServiceDescription>(sdOid.Value);
long? cOid = sdesc.ServiceCategory.Oid;
if (cOid.HasValue)
{
var cat = DAOFactory.GenericDAO.GetByID<ServiceCategory>(cOid.Value);
ListItem catListItem = combo_serviceCategories.Items.FindByText(cat.Name);
if (catListItem != null)
combo_serviceCategories.SelectedIndex = combo_serviceCategories.Items.IndexOf(catListItem);
}
combo_serviceDescriptions.Items.Clear();
combo_serviceDescriptions.Items.AddRange(operationsService.GetAllServiceDescriptions()
.Where(sd => sd.Category.ServiceCategoryOid.ToString().Equals(combo_serviceCategories.SelectedValue))
.Select(sd => new ListItem(sd.Name, sd.ServiceDescriptionOid.ToString())).ToArray());
ListItem listItem = combo_serviceDescriptions.Items.FindByText(sdesc.Name);
if (listItem != null)
combo_serviceDescriptions.SelectedIndex = combo_serviceDescriptions.Items.IndexOf(listItem);
}
label_serviceRecord.Text = serviceRecord2Edit.Title;
tb_date.Text = serviceRecord2Edit.Start.Value.ToShortDateString();
tb_duration.Value = ((int) serviceRecord2Edit.DurationMinutes).ToString();
tb_notice.Text = serviceRecord2Edit.Notice;
tb_start.Value = string.Format("{0}{1}", serviceRecord2Edit.Start.Value.Hour.ToString("00"), serviceRecord2Edit.Start.Value.Minute.ToString("00"));
tb_stop.Value = string.Format("{0}{1}", serviceRecord2Edit.End.Value.Hour.ToString("00"), serviceRecord2Edit.End.Value.Minute.ToString("00"));
}
catch (Exception ex)
{
lbl_error.Text = "Es ist leider ein Fehler aufgetreten: " + ex.Message;
}
}
protected void combo_serviceCategories_SelectedIndexChanged(object sender, EventArgs e)
{
lbl_success.Text = string.Empty;
var operationsService = new OperationsServiceImp();
combo_serviceDescriptions.Items.Clear();
combo_serviceDescriptions.Items.AddRange(operationsService.GetAllServiceDescriptions()
.Where(sd => sd.Category.ServiceCategoryOid.ToString().Equals(combo_serviceCategories.SelectedValue))
.Select(sd => new ListItem(sd.Name, sd.ServiceDescriptionOid.ToString())).ToArray());
}
protected void bt_save_Click(object sender, EventArgs e)
{
if (rights != null && !rights.Contains(UserRightType.ServiceRecordView_Edit)) return;
decimal actualMinuteIntervall = Convert.ToDecimal(Session["actualMinuteIntervall"]);
long? oid = ((ServiceRecord) Session["ServiceRecord2Edit"]).Oid;
if (oid == null) return;
var serviceRecord = DAOFactory.GenericDAO.GetByID<ServiceRecord>(oid.Value);
long categoryId;
long descriptionId;
long.TryParse(combo_serviceCategories.SelectedItem.Value, out categoryId);
long.TryParse(combo_serviceDescriptions.SelectedItem.Value, out descriptionId);
var newServiceDescription = DAOFactory.GenericDAO.GetByID<ServiceDescription>(descriptionId);
var newServiceCategory = DAOFactory.GenericDAO.GetByID<ServiceCategory>(categoryId);
// Neue Werte
int startHours, startMinutes, endHours, endMinutes, durationMinutes;
DateTime datum;
// Änderungen
if (!DateTime.TryParse(tb_date.Text, out datum))
{
lbl_error.Text = "Bitte geben Sie ein gültiges Datum an";
return;
}
bool startParsedSuccessfully = TryParseTime(tb_start.Value, out startHours, out startMinutes);
bool endParsedSuccessfully = TryParseTime(tb_stop.Value, out endHours, out endMinutes);
bool durationParsedSuccessfully = Int32.TryParse(tb_duration.Value, out durationMinutes);
if (!durationParsedSuccessfully || durationMinutes == 0)
{
// keine Dauer angegeben... start & stop
if (startParsedSuccessfully && endParsedSuccessfully)
{
DateTime start = datum.AddHours(startHours).AddMinutes(startMinutes);
DateTime stop = datum.AddHours(endHours).AddMinutes(endMinutes);
if (start > stop)
{
lbl_error.Text = "Die Startzeit muss vor der Endzeit liegen";
return;
}
serviceRecord.Start = start;
serviceRecord.End = stop;
var duration = (int) (stop - start).TotalMinutes;
if (actualMinuteIntervall > 0)
{
decimal roudedDuration = duration%actualMinuteIntervall != 0
? duration + (actualMinuteIntervall - (duration%actualMinuteIntervall))
: duration;
serviceRecord.RoundedDuration = roudedDuration;
}
else
{
serviceRecord.RoundedDuration = duration;
}
}
else
{
lbl_error.Text = "Bitte geben Sie eine gültige Dauer (in Minuten) oder Start- und Endzeit an (HH:MM oder HHMM).";
return;
}
}
else
{
// Dauer angegeben
int istAlt = Convert.ToInt32(((ServiceRecord) Session["ServiceRecord2Edit"]).DurationMinutes);
if (startParsedSuccessfully && endParsedSuccessfully)
{
DateTime start = datum.AddHours(startHours).AddMinutes(startMinutes);
DateTime stop = datum.AddHours(endHours).AddMinutes(endMinutes);
if (start >= stop)
{
lbl_error.Text = "Die Startzeit muss vor der Stopzeit liegen";
return;
}
if (durationMinutes == istAlt)
durationMinutes = (int) (stop - start).TotalMinutes;
}
if (actualMinuteIntervall > 0)
{
decimal roundedDuration = durationMinutes%actualMinuteIntervall != 0
? durationMinutes + (actualMinuteIntervall - (durationMinutes%actualMinuteIntervall))
: durationMinutes;
serviceRecord.RoundedDuration = roundedDuration;
}
else
{
serviceRecord.RoundedDuration = durationMinutes;
}
if (startParsedSuccessfully && (startHours > 0 || startMinutes > 0))
{
// Dauer und Start angegeben
serviceRecord.Start = datum.AddHours(startHours).AddMinutes(startMinutes);
}
else
{
// nur Dauer, kein Start angegeben
serviceRecord.Start = datum.AddSeconds(1);
}
serviceRecord.End = serviceRecord.Start.Value.AddMinutes(durationMinutes);
}
serviceRecord.Notice = tb_notice.Text;
if (!newServiceDescription.Equals(serviceRecord.ServiceDescription))
serviceRecord.ServiceDescription = newServiceDescription;
if (!newServiceCategory.Equals(serviceRecord.ServiceDescription.ServiceCategory))
serviceRecord.ServiceDescription.ServiceCategory = newServiceCategory;
var ak = (SessionImpl) Context.ApplicationInstance.Context.Items["hibernateSession"];
ak.Evict(serviceRecord);
try
{
DAOFactory.GenericDAO.Update(serviceRecord);
}
catch (Exception exception)
{
lbl_error.Text = string.Format("Es ist leider ein Fehler aufgetreten: {0}", exception.Message);
}
UpdateGUI(DAOFactory.GenericDAO.GetByID<ServiceRecord>(Convert.ToInt64(((ServiceRecord) Session["ServiceRecord2Edit"]).Oid)));
lbl_success.Text = "Die &Auml;nderungen wurden erfolgreich gespeichert";
Button1.Text = "Zurück";
}
protected void bt_cancel_Click(object sender, EventArgs e)
{
Response.Redirect("~/ServiceRecordPage.aspx?tenant=" + SessionFacade.Tenant);
}
private static bool TryParseTime(string text, out int hours, out int minutes)
{
try
{
String[] hnm = null;
if (text.IndexOf(":") >= 0)
{
hnm = text.Split(':');
}
else
{
if (text.Length <= 2)
{
hnm = new[] {text, "00"};
}
else if (text.Length == 4)
{
hnm = new[] {text.Substring(0, 2), text.Substring(2)};
}
else if (text.Length == 3)
{
hnm = new[] {text.Substring(0, 1), text.Substring(1)};
}
}
hours = int.Parse(hnm[0]);
minutes = int.Parse(hnm[1]);
return (hours >= 0 && hours <= 23) && (minutes >= 0 && minutes <= 59);
}
catch
{
hours = 0;
minutes = 0;
return false;
}
}
private void UpdateGUI(ServiceRecord record)
{
tb_duration.Value = record.DurationMinutes.ToString();
tb_start.Value = record.Start.Value.ToString("t");
tb_stop.Value = record.End.Value.ToString("t");
}
}
}

View File

@@ -1,195 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Host {
public partial class ServiceRecordEditPage {
/// <summary>
/// Label1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label1;
/// <summary>
/// label_serviceRecord control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label label_serviceRecord;
/// <summary>
/// Label2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label2;
/// <summary>
/// combo_serviceCategories control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList combo_serviceCategories;
/// <summary>
/// Label3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label3;
/// <summary>
/// combo_serviceDescriptions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList combo_serviceDescriptions;
/// <summary>
/// Label4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label4;
/// <summary>
/// tb_date control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox tb_date;
/// <summary>
/// Label5 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label5;
/// <summary>
/// tb_duration control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputText tb_duration;
/// <summary>
/// Label6 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label6;
/// <summary>
/// tb_start control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputText tb_start;
/// <summary>
/// Label7 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label7;
/// <summary>
/// tb_stop control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlInputText tb_stop;
/// <summary>
/// Label8 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label8;
/// <summary>
/// tb_notice control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox tb_notice;
/// <summary>
/// Button1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button Button1;
/// <summary>
/// bt_saveEdit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button bt_saveEdit;
/// <summary>
/// lbl_success control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lbl_success;
/// <summary>
/// lbl_error control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lbl_error;
}
}

View File

@@ -1 +0,0 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/BeWo.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Host.Login" %>

View File

@@ -1,489 +0,0 @@
using System;
using System.Linq;
using System.Security;
using System.Text;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using BeWo.Service.Plugins;
using BS.Shared.DataContracts;
using BS.Shared.Services;
using BeWo.Data;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceImplementations;
using BS.Shared;
using BS.Shared.Extensions;
using System.Collections.Generic;
namespace Host
{
public partial class ServiceRecordPage : Page//, ICallbackEventHandler
{
//protected bool IsCreateAllowed
//{
// get { return rights != null && rights.Contains(UserRightType.ServiceRecordView_Create); }
//}
//protected bool CurrentSCHasGoals { get; set; }
//private List<UserRightType> rights;
//private Dictionary<ValueListEntry, List<ValueListEntry>> ziele = new Dictionary<ValueListEntry, List<ValueListEntry>>();
//private string GetCallbackReference(Control control)
//{
// return Page.ClientScript.GetCallbackEventReference(control, "arg", "callback", "context");
//}
//private string SaveTabStateCallbackRaiseEvent(string argument)
//{
// Session["CurrentlySelectedTab"] = argument;
// return argument;
//}
//protected void Page_Load(object sender, EventArgs e)
//{
// try
// {
// if (!SessionFacade.IsUserLoggedIn())
// throw new SecurityException("Anmeldung erforderlich!");
// var cm = Page.ClientScript;
// var cbReference = cm.GetCallbackEventReference(this, "arg", "ReceiveServerData", "");
// var callbackScript = "function CallServer(arg, context) {" + cbReference + "; }";
// cm.RegisterClientScriptBlock(GetType(), "CallServer", callbackScript, true);
// rights = SessionFacade.LoggedInUser.UserGroups.SelectMany(ug => ug.Rights.Select(r => r.RightType)).ToList();
// bt_create.DataBind();
// if (IsPostBack) return;
// var SelectedSupportConcept = "-1";
// if (Session["SelectedSupportConcept"] != null)
// {
// SelectedSupportConcept = Session["SelectedSupportConcept"].ToString();
// }
// var operationsService = new OperationsServiceImp();
// // Browserinformationen speichern
// var brauser = Page.Request.Browser;
// var brauserInfoDC = new BeWoMobilBrowserInfoDC
// {
// Type = brauser.Type,
// Name = brauser.Browser,
// BrowserVersion = brauser.Version,
// Platform = brauser.Platform,
// Tenant = SessionFacade.Tenant
// };
// operationsService.InsertBeWoMobilBrowserInfo(brauserInfoDC);
// // ------------------------
// var customers = SessionFacade.LoggedInUser.Employee.Employee2CustomerList.Select(ec => ec.Customer).ToList();
// var supportConcepts = DAOFactory.SearchDAO.GetAllActiveSupportConceptsByCustomers(customers.Select(s => s.Oid.Value).ToList());
// //if (!rights.Contains(UserRightType.ServiceRecord_AllowCreateServiceRecordsForAllClients))
// // supportConcepts = supportConcepts.Where(s => customers.Contains(s.Customer)).ToList();
// if(!rights.Contains(UserRightType.ServiceRecordView_View))
// supportConcepts.Clear();
// foreach (var sc in supportConcepts.OrderBy(sc => sc.Customer.Person.LastName))
// foreach (var cb in sc.CostBearer2SupportConceptList)
// {
// var li = new ListItem(sc.Customer.Person.LastName
// + ", "
// + sc.Customer.Person.FirstName[0]
// + ". "
// + (cb.StartDate.HasValue ? cb.StartDate.Value.ToShortDateString().Remove(6, 2) + "-" : string.Empty)
// + (cb.EndDate.HasValue ? cb.EndDate.Value.ToShortDateString().Remove(6, 2) : string.Empty)
// + " "
// + cb.CostBearer.Organisation.Name, cb.Oid.ToString());
// combo_supportconcepts.Items.Add(li);
// }
// combo_supportconcepts.Items.Insert(0, new ListItem(string.Empty, "-1"));
// combo_supportconcepts.SelectedValue = SelectedSupportConcept;
// var serviceCategories = operationsService.GetAllServiceCategories();
// combo_serviceCategories.Items.AddRange(serviceCategories
// .Select(c => new ListItem(c.Name, c.ServiceCategoryOid.ToString())).ToArray());
// combo_serviceDescriptions.Items.AddRange(operationsService.GetAllServiceDescriptions()
// .Where(sd => sd.Category.ServiceCategoryOid.Equals(serviceCategories[0].ServiceCategoryOid))
// .Select(sd => new ListItem(sd.Name, sd.ServiceDescriptionOid.ToString())).ToArray());
// tb_date.Text = DateTime.Now.ToShortDateString();
// if (!SelectedSupportConcept.Equals("-1"))
// {
// RefreshEntryList();
// }
// //var allCustomers = DAOFactory.GenericDAO.GetAllActive<Customer>();
// //foreach (var li in allCustomers.Select(customer => new ListItem(customer.Person.FirstNameLastName, customer.Oid.ToString())))
// //{
// // CustomerDropdownList.Items.Add(li);
// //}
// //CustomerDropdownList.Items.Insert(0, new ListItem(string.Empty, "-1"));
// //CustomerDropdownList.SelectedIndex = 0;
// }
// catch (Exception ex)
// {
// lbl_error.Text = "Es ist leider ein Fehler aufgetreten: " + ex.Message;
// }
//}
//protected void bt_create_Click(object sender, EventArgs e)
//{
// if (rights != null && !rights.Contains(UserRightType.ServiceRecordView_Create)) return;
// lbl_error.Text = string.Empty;
// lbl_success.Text = string.Empty;
// int startHours, startMinutes, endHours, endMinutes, durationMinutes;
// DateTime date;
// if (combo_supportconcepts.SelectedValue.Equals("-1"))
// {
// lbl_error.Text = "Bitte wählen Sie einen Hilfeplan aus";
// return;
// }
// if (!DateTime.TryParse(tb_date.Text, out date))
// {
// lbl_error.Text = "Bitte geben Sie ein gültiges Datum an";
// return;
// }
// var cb2sc = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(long.Parse(combo_supportconcepts.SelectedValue));
// var sd = DAOFactory.GenericDAO.LoadByID<ServiceDescription>(long.Parse(combo_serviceDescriptions.SelectedValue));
// var actualMinuteIntervall = MapperFactory.CostRatePeriodDC_CostRatePeriod
// .MapToNewDCs(cb2sc.CostBearer.CostRatePeriods)
// .GetCurrentlyValidRateValue(CostRatePeriodType.MinutesIntervall) ?? 0m;
// var ausgewaehlteZiele = (IList<ValueListEntry2Object>) Session["AusgewaehlteZiele"];
// var sr = new ServiceRecord
// {
// Notice = tb_notice.Text,
// SupportConcept = cb2sc.SupportConcept,
// Customer = cb2sc.SupportConcept.Customer,
// CostBearer2SupportConcept = cb2sc,
// CostBearer2SupportConceptOid=cb2sc.Oid,
// Employee = SessionFacade.LoggedInUser.Employee,
// ServiceDescription = sd,
// InsTs = DateTime.Now,
// InsUser = SessionFacade.LoggedInUser.LoginName,
// IP = Request.UserHostAddress,
// ValueList = ausgewaehlteZiele
// };
// bool durationParsedSuccessfully = Int32.TryParse(tb_duration.Value, out durationMinutes);
// bool startParsedSuccessfully = TryParseTime(tb_start.Value, out startHours, out startMinutes);
// bool endParsedSuccessfully = TryParseTime(tb_stop.Value, out endHours, out endMinutes);
// if (!durationParsedSuccessfully || durationMinutes == 0)
// {
// // keine Dauer angegeben... start & stop
// if (startParsedSuccessfully && endParsedSuccessfully)
// {
// var start = date.AddHours(startHours).AddMinutes(startMinutes);
// var stop = date.AddHours(endHours).AddMinutes(endMinutes);
// if (start > stop)
// {
// lbl_error.Text = "Die Startzeit muss vor der Endzeit liegen";
// return;
// }
// sr.Start = start;
// sr.End = stop;
// var duration = (int)(stop - start).TotalMinutes;
// if (sr.CostBearer2SupportConcept != null)
// {
// var calc = PluginLoader.FindClass<Calculations>(sr.CostBearer2SupportConcept.CostBearer.ID) ?? Calculations.GetInstance(sr.CostBearer2SupportConcept.CostBearer.ID);
// duration = calc.GetRoundedDuration((int) actualMinuteIntervall, duration);
// }
// sr.RoundedDuration = duration;
// }
// else
// {
// lbl_error.Text = "Bitte geben Sie eine gültige Dauer (in Minuten) oder Start und Endzeit an (HH:MM oder HHMM).";
// return;
// }
// }
// else
// {
// // Dauer angegeben
// if (sr.CostBearer2SupportConcept != null)
// {
// var calc = PluginLoader.FindClass<Calculations>(sr.CostBearer2SupportConcept.CostBearer.ID) ?? Calculations.GetInstance(sr.CostBearer2SupportConcept.CostBearer.ID);
// durationMinutes = calc.GetRoundedDuration((int)actualMinuteIntervall, durationMinutes);
// }
// sr.RoundedDuration = durationMinutes;
// if (startParsedSuccessfully && (startHours > 0 || startMinutes > 0))
// {
// // Dauer und Start angegeben
// sr.Start = date.AddHours(startHours).AddMinutes(startMinutes);
// }
// else
// {
// // nur Dauer, kein Start angegeben
// sr.Start = date.AddSeconds(1);
// }
// sr.End = sr.Start.Value.AddMinutes(durationMinutes);
// }
// var mandator = new OperationsServiceImp().GetMandatorEntity();
// //List<UserRightType> rights = SessionFacade.LoggedInUser.UserGroups.SelectMany(ug => ug.Rights.Select(r => r.RightType)).ToList();
// if (!rights.Contains(UserRightType.ServiceRecord_AllowEditAfterMaxDaysInNextMonth) && mandator.MaxDaysEditServiceRecordsAllowed.HasValue && mandator.MaxDaysEditServiceRecordsAllowed.Value > 0)
// {
// var dt = date.AddMonths(1);
// dt = dt.AddDays(mandator.MaxDaysEditServiceRecordsAllowed.Value);
// if (DateTime.Now >= dt)
// {
// lbl_error.Text = "Sie können keine neuen Leistungen für den " + date.ToShortDateString() + " dokumentieren, da bereits der " + mandator.MaxDaysEditServiceRecordsAllowed + ". des nachfolgenden Monats überschritten ist.";
// return;
// }
// }
// if (mandator.IsServiceRecordNoticeMandatory && string.IsNullOrEmpty(sr.Notice))
// {
// lbl_error.Text = "Bitte dokumentieren Sie die erbrachte Leistung (Notiz)";
// return;
// }
// DAOFactory.GenericDAO.Insert(sr);
// tb_start.Value = tb_stop.Value = tb_notice.Text = tb_duration.Value = string.Empty;
// tb_date.Text = DateTime.Now.ToShortDateString();
// lbl_success.Text = "Die Leistung wurde erfolgreich gebucht";
// RefreshEntryList();
//}
//protected void combo_serviceCategories_SelectedIndexChanged(object sender, EventArgs e)
//{
// lbl_success.Text = string.Empty;
// var operationsService = new OperationsServiceImp();
// combo_serviceDescriptions.Items.Clear();
// combo_serviceDescriptions.Items.AddRange(operationsService.GetAllServiceDescriptions()
// .Where(sd => sd.Category.ServiceCategoryOid.ToString().Equals(combo_serviceCategories.SelectedValue))
// .Select(sd => new ListItem(sd.Name, sd.ServiceDescriptionOid.ToString())).ToArray());
//}
//protected void combo_supportconcepts_SelectedIndexChanged(object sender, EventArgs e)
//{
// lbl_success.Text = string.Empty;
// Session.Remove("AusgewaehlteZiele");
// RefreshEntryList();
//}
//private void RefreshEntryList()
//{
// lb_entries.DataSource = null;
// if (!combo_supportconcepts.SelectedValue.Equals("-1"))
// {
// var oid = long.Parse(combo_supportconcepts.SelectedValue);
// var list = DAOFactory.SearchDAO.FindServiceRecords(null, oid);
// var filteredList = new List<ServiceRecord>();
// var groupOids = new Dictionary<long, bool>();
// foreach (var item in list)
// {
// if (item.CostBearer2SupportConceptOid != oid) continue;
// if (!item.GroupOid.HasValue || !groupOids.ContainsKey(item.GroupOid.Value))
// filteredList.Add(item);
// if (item.GroupOid.HasValue && !groupOids.ContainsKey(item.GroupOid.Value))
// groupOids.Add(item.GroupOid.Value, true);
// }
// filteredList.Sort((x, y) => y.Start.Value.CompareTo(x.Start.Value));
// lb_entries.DataSource = filteredList;
// var sc = DAOFactory.GenericDAO.GetByID<CostBearer2SupportConcept>(oid);
// if (sc != null)
// {
// if (sc.SupportConcept.ValueList.Count > 0)
// CurrentSCHasGoals = true;
// var children = sc.SupportConcept.ValueList.Where(vl => vl.Entry.Type == ValueListEntryType.SupportConceptGoalCategoryType || vl.Entry.Type == ValueListEntryType.SupportConceptGoalType || vl.Entry.Type == ValueListEntryType.SupportConceptIndividualGoalType).ToList();
// var parentOids = sc.SupportConcept.ValueList.Where(el => el.Entry.ParentOid.HasValue).Select(el => el.Entry.ParentOid.Value).ToList();
// var parents = DAOFactory.GenericDAO.LoadByIDs<ValueListEntry>(parentOids).Distinct().ToList();
// ziele = parents.ToDictionary(parent => parent, parent => children.Where(c => c.Entry.ParentOid.HasValue && parent.Oid.HasValue && c.Entry.ParentOid == parent.Oid.Value).Select(c => c.Entry).ToList());
// GoalListView.ItemDataBound += GoalListView_ItemDataBound;
// GoalListView.DataSource = ziele;
// GoalListView.DataBind();
// }
// }
// lb_entries.DataBind();
//}
//private static bool TryParseTime(string text, out int hours, out int minutes)
//{
// try
// {
// String[] hnm = null;
// if (text.IndexOf(":") >= 0)
// {
// hnm = text.Split(':');
// }
// else
// {
// if (text.Length <= 2)
// {
// hnm = new[] { text, "00" };
// }
// else if (text.Length == 4)
// {
// hnm = new[] { text.Substring(0, 2), text.Substring(2) };
// }
// }
// hours = int.Parse(hnm[0]);
// minutes = int.Parse(hnm[1]);
// return (hours >= 0 && hours <= 23) && (minutes >= 0 && minutes <= 59);
// }
// catch
// {
// hours = 0;
// minutes = 0;
// return false;
// }
//}
//protected void OnDeleteBtnClick(object sender, EventArgs e)
//{
// if (rights != null && !rights.Contains(UserRightType.ServiceRecordView_Create)) return;
// var b = (Button)sender;
// var serviceRecordOid = b.CommandArgument;
// long oid;
// var couldParse = long.TryParse(serviceRecordOid, out oid);
// var sr = DAOFactory.GenericDAO.GetByID<ServiceRecord>(oid);
// if (!couldParse || !sr.Version.HasValue) return;
// var operationsService = new OperationsServiceImp();
// operationsService.DeleteServiceRecord(oid, sr.Version.Value);
// RefreshEntryList();
// lbl_success.Text = "Der Eintrag '" + sr.Title + "' wurde erfolgreich gelöscht";
//}
//protected void OnEditBtnClick(object sender, EventArgs e)
//{
// if (rights != null && !rights.Contains(UserRightType.ServiceRecordView_Edit)) return;
// var b = (Button) sender;
// var serviceRecordOid = b.CommandArgument;
// long oid;
// var couldParse = long.TryParse(serviceRecordOid, out oid);
// if (!couldParse) return;
// var cb2sc = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(long.Parse(combo_supportconcepts.SelectedValue));
// Session["ServiceRecord2Edit"] = DAOFactory.GenericDAO.GetByID<ServiceRecord>(oid);
// Session["actualMinuteIntervall"] = MapperFactory.CostRatePeriodDC_CostRatePeriod
// .MapToNewDCs(cb2sc.CostBearer.CostRatePeriods)
// .GetCurrentlyValidRateValue(CostRatePeriodType.MinutesIntervall) ?? 0m;
// Response.Redirect("~/ServiceRecordEditPage.aspx?tenant=" + SessionFacade.Tenant);
//}
//protected bool IsEditBtnVisible()
//{
// return rights != null && rights.Contains(UserRightType.ServiceRecordView_Edit);
//}
//protected bool IsDelBtnVisible()
//{
// return rights != null && rights.Contains(UserRightType.ServiceRecordView_Delete);
//}
//private void GoalListView_ItemDataBound(object sender, ListViewItemEventArgs e)
//{
// try
// {
// var dataItem = (ListViewDataItem)e.Item;
// var objList = (KeyValuePair<ValueListEntry, List<ValueListEntry>>)dataItem.DataItem;
// var ddlListOfObjs = (ListView)dataItem.FindControl("GoalsThemselvesListView");
// ddlListOfObjs.DataSource = objList.Value;
// ddlListOfObjs.DataBind();
// }
// catch (Exception ex)
// {
// lbl_error.Text = "Es ist ein Fehler bei der Zieleauflistung aufgetreten: " + ex.Message;
// }
//}
//public void RaiseCallbackEvent(string valueListEntryOid)
//{
// var test = (List<ValueListEntry2Object>) Session["AusgewaehlteZiele"];
// if(test == null)
// Session["AusgewaehlteZiele"] = new List<ValueListEntry2Object>();
// var selectedGoals = (List<ValueListEntry2Object>) Session["AusgewaehlteZiele"];
// var oid = Convert.ToInt64(valueListEntryOid);
// if (selectedGoals.Any(a => a.Oid == oid)) return;
// var sg = DAOFactory.GenericDAO.GetByID<ValueListEntry>(oid);
// var blah = new ValueListEntry2Object
// {
// Entry = sg,
// InsTs = DateTime.Now,
// InsUser = SessionFacade.LoggedInUser.Employee.Person.FirstNameLastName,
// IsActive = ActivationTypeId.Active,
// ObjectTid = TableID.ServiceRecord
// };
// selectedGoals.Add(blah);
// Session["AusgewaehlteZiele"] = selectedGoals;
//}
//public string GetCallbackResult() { return string.Empty; }
//protected void combo_customers_SelectedIndexChanged(object sender, EventArgs e)
//{
//}
}
}

View File

@@ -1,15 +0,0 @@
//------------------------------------------------------------------------------
// <automatisch generiert>
// Der Code wurde von einem Tool generiert.
//
// Änderungen an der Datei führen möglicherweise zu falschem Verhalten, und sie gehen verloren, wenn
// der Code erneut generiert wird.
// </automatisch generiert>
//------------------------------------------------------------------------------
namespace Host {
public partial class ServiceRecordPage {
}
}

Binary file not shown.

View File

@@ -1561,3 +1561,29 @@ CHANGE COLUMN `Text` `Text` LONGBLOB NULL DEFAULT NULL ;
ALTER TABLE `dokumentvorlage`
CHANGE COLUMN `RTFText` `RTFText` LONGBLOB NULL DEFAULT NULL ;
ALTER TABLE `organisation`
ADD COLUMN `HausanschriftAddressOid` BIGINT NULL DEFAULT NULL AFTER `CostBearerOid`,
ADD COLUMN `PostfachanschriftAddressOid` BIGINT NULL DEFAULT NULL AFTER `HausanschriftAddressOid`,
ADD COLUMN `GroßkundenanschriftAddressOid` BIGINT NULL DEFAULT NULL AFTER `PostfachanschriftAddressOid`,
ADD INDEX `FK_ORGANISA_HAUSADD_idx` (`HausanschriftAddressOid` ASC) VISIBLE,
ADD INDEX `FK_ORGANISA_POSTADD_idx` (`PostfachanschriftAddressOid` ASC) VISIBLE,
ADD INDEX `FK_ORGANISA_GROSADD_idx` (`GroßkundenanschriftAddressOid` ASC) VISIBLE;
;
ALTER TABLE `organisation`
ADD CONSTRAINT `FK_ORGANISA_HAUSADD`
FOREIGN KEY (`HausanschriftAddressOid`)
REFERENCES `address` (`Oid`)
ON DELETE CASCADE
ON UPDATE CASCADE,
ADD CONSTRAINT `FK_ORGANISA_POSTADD`
FOREIGN KEY (`PostfachanschriftAddressOid`)
REFERENCES `address` (`Oid`)
ON DELETE CASCADE
ON UPDATE CASCADE,
ADD CONSTRAINT `FK_ORGANISA_GROSADD`
FOREIGN KEY (`GroßkundenanschriftAddressOid`)
REFERENCES `address` (`Oid`)
ON DELETE CASCADE
ON UPDATE CASCADE;

View File

@@ -49,9 +49,10 @@ namespace LebenshilfeBadKreuznachFUD.Reporting.Reports
item.Notice = ferien.Name;
}
}
if (sonderFerienDict.ContainsKey(item.StartDate))
if (sonderFerienDict.ContainsKey(item.StartDate.Date))
{
item.Notice = sonderFerienDict[item.StartDate];
item.Notice = sonderFerienDict[item.StartDate.Date];
}
if (String.IsNullOrEmpty(item.Notice))
{

View File

@@ -112,10 +112,6 @@
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.9.0.2\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Lib\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>

View File

@@ -21,7 +21,6 @@ using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using MySql.Data.MySqlClient;
using BeWo.Service.Configuration;
using BeWo.Service.OwnChat;
using BeWo.Service.Plugins;
@@ -838,8 +837,8 @@ namespace BeWo.Service.ServiceImplementations
}
catch (Exception e)
{
if (((MySqlException)e.InnerException).Number == 1062)
return -1L;
//if (((MySqlException)e.InnerException).Number == 1062)
// return -1L;
throw Utils.CreateBeWoFaultException(e);
}

View File

@@ -75,6 +75,26 @@ namespace BS.Shared.DataContracts
{
return this.GetGrantedRights().Contains(right);
}
/// <summary>
/// Prüft, ob der ApplicationUser mindestens ein Recht aus der übergebenen UserRightType-Liste hat
/// </summary>
/// <param name="rightsToCheck">Liste der Rechte, von denen der ApplicationUser mindestens eins haben muss</param>
/// <returns>Ob der ApplicationUser eins der Rechte hat.</returns>
public virtual bool CheckForAtLeastOneRight(List<UserRightType> rightsToCheck)
{
foreach (var userGroup in UserGroups)
{
foreach (var rightRelation in userGroup.Rights)
{
if (rightsToCheck.Contains(rightRelation))
{
return true;
}
}
}
return false;
}
public void SetSettingValue(SettingsType pType, string key, string val)
{