- Aufgaben werden nicht mehr doppelt angezeigt
- Erledigte Aufgaben werden nicht mehr angezeigt
- Die Meldung bei bereits belegten Ressourcen ist wieder sichtbar
911 lines
47 KiB
C#
911 lines
47 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using BeWoPlanerMobil.Models;
|
|
using BeWoPlanerMobil.Service;
|
|
using BeWoPlanerMobil.Util;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Extensions;
|
|
using Newtonsoft.Json;
|
|
using static BS.Shared.UserRightType;
|
|
|
|
namespace BeWoPlanerMobil.Controllers
|
|
{
|
|
// TODO: Rechte einstellen ungeachtet der Rechte das zu dürfen
|
|
// TODO: Termine erstellen (alle möglichen Kombinationen)
|
|
// TODO: Zeiterfassungseinträge erstellen
|
|
// TODO: Dokumentationsfelder anlegen
|
|
// TODO:
|
|
// TODO:
|
|
// TODO:
|
|
// TODO:
|
|
|
|
public class DevelopmentController : AbstractBaseController
|
|
{
|
|
private DevelopmentModel _Model;
|
|
|
|
public DevelopmentModel Model
|
|
{
|
|
get
|
|
{
|
|
if(!MobileSessionFacade.IsUserLoggedIn())
|
|
{
|
|
RedirectToActionPermanent("Index", "Login");
|
|
return null;
|
|
}
|
|
|
|
if(((DevelopmentModel) Session[ModelSessionConstants.DevelopmentModelKey])?.Employee == null)
|
|
{
|
|
_Model = new DevelopmentModel {Employee = MobileSessionFacade.LoggedInEmployee};
|
|
Session[ModelSessionConstants.DevelopmentModelKey] = _Model;
|
|
}
|
|
else
|
|
{
|
|
_Model = (DevelopmentModel) Session[ModelSessionConstants.DevelopmentModelKey];
|
|
}
|
|
|
|
return _Model;
|
|
}
|
|
}
|
|
|
|
[Authorize]
|
|
public ActionResult Development()
|
|
{
|
|
#if !DEBUG
|
|
return RedirectToActionPermanent("Main", "Main");
|
|
#endif
|
|
|
|
if(!MobileSessionFacade.IsUserLoggedIn() || Model == null)
|
|
{
|
|
return RedirectToActionPermanent("Index", "Login");
|
|
}
|
|
|
|
#region Rechte
|
|
// 1. Universalrechte
|
|
var universalRechteGroup = new UserRightGroup("Universalrechte", new Dictionary<UserRightType, string>
|
|
{
|
|
{ViewAll, EnumTranslations.AllTranslations[ViewAll]},
|
|
{CreateAll, EnumTranslations.AllTranslations[CreateAll]},
|
|
{EditAll, EnumTranslations.AllTranslations[EditAll]},
|
|
{DeleteAll, EnumTranslations.AllTranslations[DeleteAll]}
|
|
});
|
|
|
|
// 2. Zeiterfassung
|
|
var serviceRecordRightGroup = new UserRightGroup("Zeiterfassung", new Dictionary<UserRightType, string>
|
|
{
|
|
{ServiceRecordView_View, EnumTranslations.AllTranslations[ServiceRecordView_View]},
|
|
{ServiceRecordView_Edit, EnumTranslations.AllTranslations[ServiceRecordView_Edit]},
|
|
{ServiceRecordView_Create, EnumTranslations.AllTranslations[ServiceRecordView_Create]},
|
|
{ServiceRecordView_Delete, EnumTranslations.AllTranslations[ServiceRecordView_Delete]},
|
|
{ServiceRecord_AllowChangeWithin24Hours, EnumTranslations.AllTranslations[ServiceRecord_AllowChangeWithin24Hours]},
|
|
{ServiceRecord_AllowCreateServiceRecordsForAllClients, EnumTranslations.AllTranslations[ServiceRecord_AllowCreateServiceRecordsForAllClients]},
|
|
{ServiceRecord_AllowCreationForOtherEmployees, EnumTranslations.AllTranslations[ServiceRecord_AllowCreationForOtherEmployees]},
|
|
{ServiceRecord_AllowEditAfterMaxDaysInNextMonth, EnumTranslations.AllTranslations[ServiceRecord_AllowEditAfterMaxDaysInNextMonth]},
|
|
{ServiceRecord_AllowCreateMoreFLSThanApproved, EnumTranslations.AllTranslations[ServiceRecord_AllowCreateMoreFLSThanApproved]},
|
|
{ServiceRecord_AllowCreateOverlappingFLS, EnumTranslations.AllTranslations[ServiceRecord_AllowCreateOverlappingFLS]},
|
|
{ServiceRecord_AllowCreationForOtherTeamMember, EnumTranslations.AllTranslations[ServiceRecord_AllowCreationForOtherTeamMember]},
|
|
{BookServiceRecordOutOfSupportConcept, EnumTranslations.AllTranslations[BookServiceRecordOutOfSupportConcept]},
|
|
{BookServiceRecordAfterSettlementInvoice, EnumTranslations.AllTranslations[BookServiceRecordAfterSettlementInvoice]},
|
|
{ServiceRecord_ShowHistory, EnumTranslations.AllTranslations[ServiceRecord_ShowHistory]},
|
|
{ServiceRecord_AllowCreateOverlappingFLSForEmployee, EnumTranslations.AllTranslations[ServiceRecord_AllowCreateOverlappingFLSForEmployee]},
|
|
{ServiceRecord_AllowCreatingGroupBooking, EnumTranslations.AllTranslations[ServiceRecord_AllowCreatingGroupBooking]},
|
|
{ServiceRecord_AllowCreatingMultiBooking, EnumTranslations.AllTranslations[ServiceRecord_AllowCreatingMultiBooking]},
|
|
{ServiceRecord_AllowEditForOtherEmployees, EnumTranslations.AllTranslations[ServiceRecord_AllowEditForOtherEmployees]},
|
|
{ServiceRecordAllowRebooking, EnumTranslations.AllTranslations[ServiceRecordAllowRebooking]},
|
|
{ServiceRecordAllowEditAfterMindays, EnumTranslations.AllTranslations[ServiceRecordAllowEditAfterMindays]},
|
|
{ServiceRecord_AllowCreateAfterEmployeeSignature, EnumTranslations.AllTranslations[ServiceRecord_AllowCreateAfterEmployeeSignature]},
|
|
{ServiceRecord_AllowEditAfterEmployeeSignature, EnumTranslations.AllTranslations[ServiceRecord_AllowEditAfterEmployeeSignature]},
|
|
{ServiceRecord_AllowDeleteAfterEmployeeSignature, EnumTranslations.AllTranslations[ServiceRecord_AllowDeleteAfterEmployeeSignature]},
|
|
{BewertenInZeiterfassung, EnumTranslations.AllTranslations[BewertenInZeiterfassung]}
|
|
});
|
|
|
|
// 3. Finanzen
|
|
var financeRightGroup = new UserRightGroup("Finanzen", new Dictionary<UserRightType, string>
|
|
{
|
|
{AccountingTransactionView_View, EnumTranslations.AllTranslations[AccountingTransactionView_View] },
|
|
{AccountingTransactionView_Edit, EnumTranslations.AllTranslations[AccountingTransactionView_Edit] },
|
|
{AccountingTransactionView_Create, EnumTranslations.AllTranslations[AccountingTransactionView_Create] },
|
|
{AccountingTransactionView_Delete, EnumTranslations.AllTranslations[AccountingTransactionView_Delete] }
|
|
});
|
|
|
|
// 4. Ressourcen
|
|
var resourceRightGroup = new UserRightGroup("Ressourcen", new Dictionary<UserRightType, string>
|
|
{
|
|
{ResourceBookingView_View, EnumTranslations.AllTranslations[ResourceBookingView_View] },
|
|
{ResourceBookingView_Edit, EnumTranslations.AllTranslations[ResourceBookingView_Edit] },
|
|
{ResourceBookingView_Create, EnumTranslations.AllTranslations[ResourceBookingView_Create] },
|
|
{ResourceBookingView_Delete, EnumTranslations.AllTranslations[ResourceBookingView_Delete] }
|
|
});
|
|
|
|
// 5. Berichte
|
|
var reportRightView = new UserRightGroup("Berichte", new Dictionary<UserRightType, string>
|
|
{
|
|
{QueryView_View, EnumTranslations.AllTranslations[QueryView_View] },
|
|
{QueryView_Edit, EnumTranslations.AllTranslations[QueryView_Edit] },
|
|
{QueryView_Create, EnumTranslations.AllTranslations[QueryView_Create] },
|
|
{QueryView_Delete, EnumTranslations.AllTranslations[QueryView_Delete] }
|
|
});
|
|
|
|
// 6. Hilfepläne
|
|
var supportConceptRightGroup = new UserRightGroup("Hilfepläne", new Dictionary<UserRightType, string>
|
|
{
|
|
{SupportConceptView_View, EnumTranslations.AllTranslations[SupportConceptView_View] },
|
|
{SupportConceptView_Edit, EnumTranslations.AllTranslations[SupportConceptView_Edit] },
|
|
{SupportConceptView_Create, EnumTranslations.AllTranslations[SupportConceptView_Create] },
|
|
{SupportConceptView_Delete, EnumTranslations.AllTranslations[SupportConceptView_Delete] },
|
|
{SupportConcept_ViewAllSupportConcepts, EnumTranslations.AllTranslations[SupportConcept_ViewAllSupportConcepts] },
|
|
{SupportConcept_AllowGoalOrientedSupportConcepts, EnumTranslations.AllTranslations[SupportConcept_AllowGoalOrientedSupportConcepts] },
|
|
{SupportConceptView_AllowArchiving, EnumTranslations.AllTranslations[SupportConceptView_AllowArchiving] },
|
|
{SupportConcept_ViewMyTeams, EnumTranslations.AllTranslations[SupportConcept_ViewMyTeams] },
|
|
{SupportConcept_AllowEditGoals, EnumTranslations.AllTranslations[SupportConcept_AllowEditGoals] },
|
|
{SupportConcept_AllowEditTasks, EnumTranslations.AllTranslations[SupportConcept_AllowEditTasks] },
|
|
{SupportConceptAllowReactivation, EnumTranslations.AllTranslations[SupportConceptAllowReactivation] },
|
|
{CostbearerAllowChange, EnumTranslations.AllTranslations[CostbearerAllowChange] }
|
|
});
|
|
|
|
// 7. Klienten
|
|
var customerRightGroup = new UserRightGroup("Klienten", new Dictionary<UserRightType, string>
|
|
{
|
|
{CustomerView_View,EnumTranslations.AllTranslations[CustomerView_View]},
|
|
{CustomerView_Edit,EnumTranslations.AllTranslations[CustomerView_Edit]},
|
|
{CustomerView_Create,EnumTranslations.AllTranslations[CustomerView_Create]},
|
|
{CustomerView_Delete,EnumTranslations.AllTranslations[CustomerView_Delete]},
|
|
{Customer_ViewMyCustomers,EnumTranslations.AllTranslations[Customer_ViewMyCustomers]},
|
|
{Customer_AllowArchiving,EnumTranslations.AllTranslations[Customer_AllowArchiving]},
|
|
{Customer_ViewMyTeams,EnumTranslations.AllTranslations[Customer_ViewMyTeams]},
|
|
{CustomerAllowReactivation,EnumTranslations.AllTranslations[CustomerAllowReactivation]},
|
|
{Customer_ViewMedication,EnumTranslations.AllTranslations[Customer_ViewMedication]},
|
|
{Customer_ViewDiagnosis,EnumTranslations.AllTranslations[Customer_ViewDiagnosis]},
|
|
{CustomerTeam_View,EnumTranslations.AllTranslations[CustomerTeam_View]},
|
|
{CustomerTeam_Edit,EnumTranslations.AllTranslations[CustomerTeam_Edit]},
|
|
{CustomerTeam_Delete,EnumTranslations.AllTranslations[CustomerTeam_Delete]},
|
|
{CustomerTeam_Create,EnumTranslations.AllTranslations[CustomerTeam_Create]},
|
|
{Customer_Anonymization,EnumTranslations.AllTranslations[Customer_Anonymization]},
|
|
{Customer_Full_Delete,EnumTranslations.AllTranslations[Customer_Full_Delete]}
|
|
});
|
|
|
|
// 8. Organisationen
|
|
var organisationRightGroup = new UserRightGroup("Organisationen", new Dictionary<UserRightType, string>
|
|
{
|
|
{OrganisationView_View,EnumTranslations.AllTranslations[OrganisationView_View]},
|
|
{OrganisationView_Edit,EnumTranslations.AllTranslations[OrganisationView_Edit]},
|
|
{OrganisationView_Create,EnumTranslations.AllTranslations[OrganisationView_Create]},
|
|
{OrganisationView_Delete,EnumTranslations.AllTranslations[OrganisationView_Delete]},
|
|
{OrganisationView_AllowEditCostBearer,EnumTranslations.AllTranslations[OrganisationView_AllowEditCostBearer]},
|
|
{Organisation_AllowArchiving,EnumTranslations.AllTranslations[Organisation_AllowArchiving]},
|
|
{OrganisationAllowReactivation,EnumTranslations.AllTranslations[OrganisationAllowReactivation]}
|
|
});
|
|
|
|
// 9. Personen
|
|
var personRightGroup = new UserRightGroup("Personen", new Dictionary<UserRightType, string>
|
|
{
|
|
{PersonView_View,EnumTranslations.AllTranslations[PersonView_View]},
|
|
{PersonView_Edit,EnumTranslations.AllTranslations[PersonView_Edit]},
|
|
{PersonView_Create,EnumTranslations.AllTranslations[PersonView_Create]},
|
|
{PersonView_Delete,EnumTranslations.AllTranslations[PersonView_Delete]},
|
|
{Person_AllowArchiving,EnumTranslations.AllTranslations[Person_AllowArchiving]},
|
|
{PersonAllowReactivation,EnumTranslations.AllTranslations[PersonAllowReactivation]},
|
|
{Person_Full_Delete,EnumTranslations.AllTranslations[Person_Full_Delete]}
|
|
});
|
|
|
|
// 10. Mitarbeiter
|
|
var employeeRightGroup = new UserRightGroup("Mitarbeiter", new Dictionary<UserRightType, string>
|
|
{
|
|
{EmployeeView_View,EnumTranslations.AllTranslations[EmployeeView_View]},
|
|
{EmployeeView_Edit,EnumTranslations.AllTranslations[EmployeeView_Edit]},
|
|
{EmployeeView_Create,EnumTranslations.AllTranslations[EmployeeView_Create]},
|
|
{EmployeeView_Delete,EnumTranslations.AllTranslations[EmployeeView_Delete]},
|
|
{Employee_AllowEditExtendedProperties,EnumTranslations.AllTranslations[Employee_AllowEditExtendedProperties]},
|
|
{Employee_AllowEditContracts,EnumTranslations.AllTranslations[Employee_AllowEditContracts]},
|
|
{Employee_AllowEditOwnEmployees,EnumTranslations.AllTranslations[Employee_AllowEditOwnEmployees]},
|
|
{Employee_AllowArchiving,EnumTranslations.AllTranslations[Employee_AllowArchiving]},
|
|
{Employee_AllowViewOwnEmployees,EnumTranslations.AllTranslations[Employee_AllowViewOwnEmployees]},
|
|
{Employee_AllowViewOwnTeam,EnumTranslations.AllTranslations[Employee_AllowViewOwnTeam]},
|
|
{Employee_ShowFinance,EnumTranslations.AllTranslations[Employee_ShowFinance]},
|
|
{EmployeeAllowReactivation,EnumTranslations.AllTranslations[EmployeeAllowReactivation]},
|
|
{Employee_Full_Delete,EnumTranslations.AllTranslations[Employee_Full_Delete]},
|
|
{Employee_Anonymization,EnumTranslations.AllTranslations[Employee_Anonymization]}
|
|
});
|
|
|
|
// 11. Teams
|
|
var teamRightGroup = new UserRightGroup("Teams", new Dictionary<UserRightType, string>
|
|
{
|
|
{TeamView_ViewAll,EnumTranslations.AllTranslations[TeamView_ViewAll]},
|
|
{TeamView_Edit,EnumTranslations.AllTranslations[TeamView_Edit]},
|
|
{TeamView_Create,EnumTranslations.AllTranslations[TeamView_Create]},
|
|
{TeamView_Delete,EnumTranslations.AllTranslations[TeamView_Delete]},
|
|
{TeamView_ViewMyTeams,EnumTranslations.AllTranslations[TeamView_ViewMyTeams]}
|
|
});
|
|
|
|
// 12. Benutzer
|
|
var userRightGroup = new UserRightGroup("Benutzer", new Dictionary<UserRightType, string>
|
|
{
|
|
{UserView_View,EnumTranslations.AllTranslations[UserView_View]},
|
|
{UserView_Edit,EnumTranslations.AllTranslations[UserView_Edit]},
|
|
{UserView_Create,EnumTranslations.AllTranslations[UserView_Create]},
|
|
{UserView_Delete,EnumTranslations.AllTranslations[UserView_Delete]},
|
|
{User_AllowOrderLicense,EnumTranslations.AllTranslations[User_AllowOrderLicense]},
|
|
{UserView_AllowChangePassword,EnumTranslations.AllTranslations[UserView_AllowChangePassword]},
|
|
{AllowChangeOwnPassword,EnumTranslations.AllTranslations[AllowChangeOwnPassword]}
|
|
});
|
|
|
|
// 13. Benutzergruppen
|
|
var userGroupRightGroup = new UserRightGroup("Benutzergruppen", new Dictionary<UserRightType, string>
|
|
{
|
|
{UserGroupView_View, EnumTranslations.AllTranslations[UserGroupView_View]},
|
|
{UserGroupView_Edit, EnumTranslations.AllTranslations[UserGroupView_Edit]},
|
|
{UserGroupView_Create, EnumTranslations.AllTranslations[UserGroupView_Create]},
|
|
{UserGroupView_Delete, EnumTranslations.AllTranslations[UserGroupView_Delete]}
|
|
});
|
|
|
|
// 14. Verwaltung
|
|
var administrationRightGroup = new UserRightGroup("Verwaltung", new Dictionary<UserRightType, string>
|
|
{
|
|
{AdministrationView_View, EnumTranslations.AllTranslations[AdministrationView_View]},
|
|
{AdministrationView_Edit, EnumTranslations.AllTranslations[AdministrationView_Edit]},
|
|
{AdministrationView_Create, EnumTranslations.AllTranslations[AdministrationView_Create]},
|
|
{AdministrationView_Delete, EnumTranslations.AllTranslations[AdministrationView_Delete]}
|
|
});
|
|
|
|
// 15. Auswertungen
|
|
var analysisRightGroup = new UserRightGroup("Auswertungen", new Dictionary<UserRightType, string>
|
|
{
|
|
{Analysis_Settlement_View, EnumTranslations.AllTranslations[Analysis_Settlement_View]},
|
|
{Analysis_EmployeeOverviewAll_View, EnumTranslations.AllTranslations[Analysis_EmployeeOverviewAll_View]},
|
|
{Analysis_ServiceOverview_View, EnumTranslations.AllTranslations[Analysis_ServiceOverview_View]},
|
|
{Analysis_SupportConceptOverviewAll_View, EnumTranslations.AllTranslations[Analysis_SupportConceptOverviewAll_View]},
|
|
{Analysis_AllowFLSOverviewForCostbearer, EnumTranslations.AllTranslations[Analysis_AllowFLSOverviewForCostbearer]},
|
|
{Analysis_AuslastungAllEmployee_View, EnumTranslations.AllTranslations[Analysis_AuslastungAllEmployee_View]},
|
|
{Analysis_AuslastungTeam_View, EnumTranslations.AllTranslations[Analysis_AuslastungTeam_View]},
|
|
{Analysis_Auslastung_View, EnumTranslations.AllTranslations[Analysis_Auslastung_View]},
|
|
{Analysis_AllowFLSOverviewForTeam, EnumTranslations.AllTranslations[Analysis_AllowFLSOverviewForTeam]},
|
|
{Analysis_AllowFLSOverviewForAllTeams, EnumTranslations.AllTranslations[Analysis_AllowFLSOverviewForAllTeams]},
|
|
{Kilometerauswertung_View, EnumTranslations.AllTranslations[Kilometerauswertung_View]},
|
|
{BewertungAuswertung_View, EnumTranslations.AllTranslations[BewertungAuswertung_View]},
|
|
{PivotTabelleAnsehen, EnumTranslations.AllTranslations[PivotTabelleAnsehen]},
|
|
{ResourceBookingView_AllowEditResourcesFromOtherEmployees, EnumTranslations.AllTranslations[ResourceBookingView_AllowEditResourcesFromOtherEmployees]},
|
|
{Jahresbericht, EnumTranslations.AllTranslations[Jahresbericht]}
|
|
});
|
|
|
|
// 16. AssessmentSheet
|
|
var assessmentSheetRightGroup = new UserRightGroup("AssessmentSheet", new Dictionary<UserRightType, string>
|
|
{
|
|
{AssessmentSheet_View, EnumTranslations.AllTranslations[AssessmentSheet_View]},
|
|
{AssessmentSheet_Edit, EnumTranslations.AllTranslations[AssessmentSheet_Edit]},
|
|
{AssessmentSheet_Create, EnumTranslations.AllTranslations[AssessmentSheet_Create]},
|
|
{AssessmentSheet_Delete, EnumTranslations.AllTranslations[AssessmentSheet_Delete]}
|
|
});
|
|
|
|
// 17. Gruppen
|
|
var groupOfPeopleRightGroup = new UserRightGroup("Gruppen", new Dictionary<UserRightType, string>
|
|
{
|
|
{GroupOfPeopleView_Edit, EnumTranslations.AllTranslations[GroupOfPeopleView_Edit]},
|
|
{GroupOfPeopleView_Create, EnumTranslations.AllTranslations[GroupOfPeopleView_Create]},
|
|
{GroupOfPeopleView_Delete, EnumTranslations.AllTranslations[GroupOfPeopleView_Delete]}
|
|
});
|
|
|
|
// 18. Mitarbeiterstundenkonto
|
|
var mitarbeiterstundenkontoRightGroup = new UserRightGroup("Mitarbeiterstundenkonto", new Dictionary<UserRightType, string>
|
|
{
|
|
{Mitarbeiterstundenkonto_ViewSelf, EnumTranslations.AllTranslations[Mitarbeiterstundenkonto_ViewSelf]},
|
|
{Mitarbeiterstundenkonto_ViewAll, EnumTranslations.AllTranslations[Mitarbeiterstundenkonto_ViewAll]},
|
|
{Mitarbeiterstundenkonto_ViewTeams, EnumTranslations.AllTranslations[Mitarbeiterstundenkonto_ViewTeams]}
|
|
});
|
|
|
|
// 19.
|
|
var schedulerRightGroup = new UserRightGroup("Kalender", new Dictionary<UserRightType, string>
|
|
{
|
|
{KalenderAnsehen,EnumTranslations.AllTranslations[KalenderAnsehen]},
|
|
{KalenderMitarbeitertermineAnsehen,EnumTranslations.AllTranslations[KalenderMitarbeitertermineAnsehen]},
|
|
{KalenderMitarbeitertermineAnlegen,EnumTranslations.AllTranslations[KalenderMitarbeitertermineAnlegen]},
|
|
{KalenderMitarbeitertermineAendern,EnumTranslations.AllTranslations[KalenderMitarbeitertermineAendern]},
|
|
{KalenderKliententermineAlleAnsehen,EnumTranslations.AllTranslations[KalenderKliententermineAlleAnsehen]},
|
|
{KalenderKliententermineAnlegen,EnumTranslations.AllTranslations[KalenderKliententermineAnlegen]},
|
|
{KalenderKliententermineAendern,EnumTranslations.AllTranslations[KalenderKliententermineAendern]},
|
|
{KalenderRessourcentermineAnsehen,EnumTranslations.AllTranslations[KalenderRessourcentermineAnsehen]},
|
|
{KalenderRessourcentermineAnlegen,EnumTranslations.AllTranslations[KalenderRessourcentermineAnlegen]},
|
|
{KalenderRessourcentermineAendern,EnumTranslations.AllTranslations[KalenderRessourcentermineAendern]},
|
|
{KalenderRessourcentermineAndererAendern,EnumTranslations.AllTranslations[KalenderRessourcentermineAndererAendern]},
|
|
{KalenderInZeiterfassungUebernehmen,EnumTranslations.AllTranslations[KalenderInZeiterfassungUebernehmen]},
|
|
{Termine_IntervalDelete,EnumTranslations.AllTranslations[Termine_IntervalDelete]}
|
|
});
|
|
|
|
// 20.
|
|
var textModuleRightGroup = new UserRightGroup("Textbausteine", new Dictionary<UserRightType, string>
|
|
{
|
|
{TextbausteineAlleAnsehen,EnumTranslations.AllTranslations[TextbausteineAlleAnsehen]},
|
|
{TextbausteineNurEigeneAnsehen,EnumTranslations.AllTranslations[TextbausteineNurEigeneAnsehen]},
|
|
{TextbausteineAlleBearbeiten,EnumTranslations.AllTranslations[TextbausteineAlleBearbeiten]},
|
|
{TextbausteineNurEigeneBearbeiten,EnumTranslations.AllTranslations[TextbausteineNurEigeneBearbeiten]}
|
|
});
|
|
|
|
// 21.
|
|
var cashManagingRightGroup = new UserRightGroup("Bargeldverwaltung", new Dictionary<UserRightType, string>
|
|
{
|
|
{BargeldverwaltungAnsehen,EnumTranslations.AllTranslations[BargeldverwaltungAnsehen]},
|
|
{BargeldverwaltungNurEigeneAnsehen,EnumTranslations.AllTranslations[BargeldverwaltungNurEigeneAnsehen]},
|
|
{BargeldverwaltungBearbeiten,EnumTranslations.AllTranslations[BargeldverwaltungBearbeiten]},
|
|
{BargeldverwaltungAnlegen,EnumTranslations.AllTranslations[BargeldverwaltungAnlegen]},
|
|
{BargeldverwaltungLoeschen,EnumTranslations.AllTranslations[BargeldverwaltungLoeschen]},
|
|
{BargeldverwaltungFinanzenAnsehen,EnumTranslations.AllTranslations[BargeldverwaltungFinanzenAnsehen]},
|
|
{BargeldverwaltungFinanzenAnlegen,EnumTranslations.AllTranslations[BargeldverwaltungFinanzenAnlegen]},
|
|
{BargeldverwaltungFinanzenBearbeiten,EnumTranslations.AllTranslations[BargeldverwaltungFinanzenBearbeiten]},
|
|
{BargeldverwaltungFinanzenLoeschen,EnumTranslations.AllTranslations[BargeldverwaltungFinanzenLoeschen]}
|
|
});
|
|
|
|
// 22.
|
|
var wohnheimRightGroup = new UserRightGroup("Wohnheime", new Dictionary<UserRightType, string>
|
|
{
|
|
{WohnheimView_View,EnumTranslations.AllTranslations[WohnheimView_View]},
|
|
{WohnheimView_Edit,EnumTranslations.AllTranslations[WohnheimView_Edit]},
|
|
{WohnheimView_Create,EnumTranslations.AllTranslations[WohnheimView_Create]},
|
|
{WohnheimView_Delete,EnumTranslations.AllTranslations[WohnheimView_Delete]},
|
|
{Wohnheim_AllowArchiving,EnumTranslations.AllTranslations[Wohnheim_AllowArchiving]}
|
|
});
|
|
|
|
// 23.
|
|
var assistanceKeyRightGroup = new UserRightGroup("Betreuungsschlüssel", new Dictionary<UserRightType, string>
|
|
{
|
|
{Betreuungsschluessel_View,EnumTranslations.AllTranslations[Betreuungsschluessel_View]},
|
|
{Betreuungsschluessel_Edit,EnumTranslations.AllTranslations[Betreuungsschluessel_Edit]},
|
|
{Betreuungsschluessel_Delete,EnumTranslations.AllTranslations[Betreuungsschluessel_Delete]},
|
|
{Betreuungsschluessel_Create,EnumTranslations.AllTranslations[Betreuungsschluessel_Create]}
|
|
});
|
|
|
|
// 24.
|
|
var documentRightGroup = new UserRightGroup("Dokumente", new Dictionary<UserRightType, string>
|
|
{
|
|
{DocumentsAllowViewAll,EnumTranslations.AllTranslations[DocumentsAllowViewAll]},
|
|
{DocumentsDownloadAll,EnumTranslations.AllTranslations[DocumentsDownloadAll]},
|
|
{DokumenteFinanzen,EnumTranslations.AllTranslations[DokumenteFinanzen]},
|
|
{DokumenteKlienten,EnumTranslations.AllTranslations[DokumenteKlienten]},
|
|
{DokumenteMitarbeiter,EnumTranslations.AllTranslations[DokumenteMitarbeiter]},
|
|
{DokumenteOrganisationen,EnumTranslations.AllTranslations[DokumenteOrganisationen]},
|
|
{DokumentePersonen,EnumTranslations.AllTranslations[DokumentePersonen]},
|
|
{DokumenteHilfeplaene,EnumTranslations.AllTranslations[DokumenteHilfeplaene]},
|
|
{DokumenteTeams,EnumTranslations.AllTranslations[DokumenteTeams]}
|
|
});
|
|
|
|
// 25. Sonstige
|
|
var sonstigeRightGroup = new UserRightGroup("Sonstige", new Dictionary<UserRightType, string>
|
|
{
|
|
{Support_View,EnumTranslations.AllTranslations[Support_View]},
|
|
{AdditionalService_View,EnumTranslations.AllTranslations[AdditionalService_View]},
|
|
{OvertimeView,EnumTranslations.AllTranslations[OvertimeView]},
|
|
{ChatSettings,EnumTranslations.AllTranslations[ChatSettings]},
|
|
{ChatAdminSettings,EnumTranslations.AllTranslations[ChatAdminSettings]},
|
|
{VertretungenView_View,EnumTranslations.AllTranslations[VertretungenView_View]}
|
|
});
|
|
|
|
Model.UserRightGroups.Clear();
|
|
|
|
Model.UserRightGroups.Add(universalRechteGroup);
|
|
Model.UserRightGroups.Add(serviceRecordRightGroup);
|
|
Model.UserRightGroups.Add(financeRightGroup);
|
|
Model.UserRightGroups.Add(resourceRightGroup);
|
|
Model.UserRightGroups.Add(reportRightView);
|
|
|
|
Model.UserRightGroups.Add(supportConceptRightGroup);
|
|
Model.UserRightGroups.Add(customerRightGroup);
|
|
Model.UserRightGroups.Add(organisationRightGroup);
|
|
Model.UserRightGroups.Add(personRightGroup);
|
|
Model.UserRightGroups.Add(employeeRightGroup);
|
|
|
|
Model.UserRightGroups.Add(teamRightGroup);
|
|
Model.UserRightGroups.Add(userRightGroup);
|
|
Model.UserRightGroups.Add(userGroupRightGroup);
|
|
Model.UserRightGroups.Add(administrationRightGroup);
|
|
Model.UserRightGroups.Add(analysisRightGroup);
|
|
|
|
Model.UserRightGroups.Add(assessmentSheetRightGroup);
|
|
Model.UserRightGroups.Add(groupOfPeopleRightGroup);
|
|
Model.UserRightGroups.Add(mitarbeiterstundenkontoRightGroup);
|
|
Model.UserRightGroups.Add(schedulerRightGroup);
|
|
Model.UserRightGroups.Add(textModuleRightGroup);
|
|
|
|
Model.UserRightGroups.Add(cashManagingRightGroup);
|
|
Model.UserRightGroups.Add(wohnheimRightGroup);
|
|
Model.UserRightGroups.Add(assistanceKeyRightGroup);
|
|
Model.UserRightGroups.Add(documentRightGroup);
|
|
Model.UserRightGroups.Add(sonstigeRightGroup);
|
|
|
|
Model.UserRightGroups = Model.UserRightGroups.OrderBy(urg => urg.UserRightTypes.Keys.Count).ToList();
|
|
#endregion
|
|
|
|
// Verfügbare Ressourcen für die Termine
|
|
var allResources = KalenderService.GetAllResources().ToList();
|
|
|
|
var categories2Resources = new Dictionary<ValueListEntryDC, List<ResourceDC>>();
|
|
|
|
foreach(var category in allResources.Select(resource => resource.ResourceCategory))
|
|
{
|
|
categories2Resources.AddOrUpdateValueInDictionary(category, allResources.Where(resource => resource.ResourceCategory.Equals(category)).ToList());
|
|
}
|
|
|
|
Model.ResourceCategories2Resources = categories2Resources;
|
|
|
|
Model.AllEmployees = EmployeeService.GetAllActiveEmployeesCompact();
|
|
|
|
Model.AllCustomers = CustomerService.GetAllActiveCompactCustomers();
|
|
|
|
return View(Model);
|
|
}
|
|
|
|
[Authorize]
|
|
public string UpdateSelectedRights(string indicesString)
|
|
{
|
|
// Format: UserRightGroups-Index;Dictionary-Index
|
|
// Bei alle? UserRightGroup-Index;0
|
|
|
|
// Alle ignorieren! Es werden per JavaScript schon alle ausgesucht
|
|
|
|
var selectedUserRightTypes = new List<UserRightType>();
|
|
|
|
if(!string.IsNullOrWhiteSpace(indicesString))
|
|
{
|
|
var ids = indicesString.Split(';');
|
|
|
|
if(ids.Length > 0)
|
|
{
|
|
foreach(var id in ids)
|
|
{
|
|
if(!string.IsNullOrWhiteSpace(id))
|
|
{
|
|
var splitId = id.Split('-');
|
|
if(splitId.Length > 1)
|
|
{
|
|
if(Enum.TryParse(splitId[1], out UserRightType userRightType))
|
|
{
|
|
selectedUserRightTypes.AddIfNotIn(userRightType);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else // nichts ausgewählt. Soll das gehen oder nicht? Ja, soll gehen. Man braucht ja nicht das Recht, Rechte sich selbst vergeben zu können
|
|
{
|
|
|
|
}
|
|
|
|
var userGroups = MobileSessionFacade.LoggedInUser.UserGroups;
|
|
|
|
userGroups?.DoForEach(userGroup =>
|
|
{
|
|
|
|
});
|
|
|
|
return _LeerzeichenFuerGetMethoden;
|
|
}
|
|
|
|
[Authorize]
|
|
public string UpdateAppointmentResources(string selectedResourceOids)
|
|
{
|
|
#if !DEBUG
|
|
Logout();
|
|
return _LeerzeichenFuerGetMethoden;
|
|
#endif
|
|
|
|
if(Model == null)
|
|
{
|
|
Logout();
|
|
}
|
|
|
|
var oids = selectedResourceOids.Split(';');
|
|
|
|
Model.SelectedResources.Clear();
|
|
|
|
oids.Where(w => w.Length > 0).DoForEach(oidString =>
|
|
{
|
|
if(long.TryParse(oidString, out var oid))
|
|
{
|
|
var resource = Model.AvailableResources.FirstOrDefault(r => r.ResourceOid.HasValue && r.ResourceOid.Value.Equals(oid));
|
|
|
|
Model.SelectedResources.AddIfNotIn(resource);
|
|
}
|
|
});
|
|
|
|
return JsonConvert.SerializeObject(Model.SelectedResources.Count);
|
|
}
|
|
|
|
[Authorize]
|
|
[HttpPost]
|
|
public ActionResult InsertTestAppointments(FormCollection formCollection)
|
|
{
|
|
if(Model == null)
|
|
{
|
|
return Logout();
|
|
}
|
|
|
|
var selectedOriginatorOidString = formCollection["SelectedEmployeeOid"];
|
|
|
|
var originatorOidParsingResult = long.TryParse(selectedOriginatorOidString, out var originatorOid);
|
|
|
|
var intervalStart = formCollection["interval-start-date"];
|
|
var intervalend = formCollection["interval-end-date"];
|
|
|
|
var dateParsingResult = DateTime.TryParse(intervalStart, out var start);
|
|
var endDateParsingResult = DateTime.TryParse(intervalend, out var end);
|
|
|
|
if(originatorOidParsingResult == false || dateParsingResult == false || endDateParsingResult == false)
|
|
{
|
|
return View("Development", Model);
|
|
}
|
|
|
|
var originator = Model.AllEmployees.FirstOrDefault(f => f.EmployeeOid.Equals(originatorOid));
|
|
|
|
_IntervalStart = start;
|
|
|
|
_AppointmentStart = _IntervalStart.MergeDatesByDate(new DateTime(2000, 1, 1, 6, 0, 0));
|
|
|
|
// Keine Mitarbeiter, Ressourcen und Klienten ausgewählt -> nur Einzeltermine erstellen
|
|
/*
|
|
* Nur Originator (4):
|
|
* Normal
|
|
* Privat
|
|
* Ganztägig
|
|
* Mehrtägig
|
|
*
|
|
* Originator und Mitarbeiter (4)
|
|
* Originator und Ressourcen (4)
|
|
* Originator und Klienten (4)
|
|
*
|
|
* Originator und Mitarbeiter und Ressourcen (4)
|
|
* Originator und Mitarbeiter und Klienten (4)
|
|
* Originator und Ressourcen und Klienten (4)
|
|
* Originator und Mitarbeiter und Ressourcen und Klienten (4)
|
|
*
|
|
* TODO: Datumsangaben für die Termine bestimmen. Mindestintervall bestimmen
|
|
*/
|
|
|
|
var app1 = CreateTestAppointment("Normaler Termin", originator);
|
|
var app2 = CreateTestAppointment("Normaler, privater Termin", originator, true);
|
|
var app3 = CreateTestAppointment("Ganztägiger Termin", originator, false, true);
|
|
var app4 = CreateTestAppointment("Ganztägiger, privater Termin", originator, true, true);
|
|
|
|
var appointments = new List<SchedulerAppointmentDC>{app1, app2, app3, app4};
|
|
|
|
if(Model.SelectedResources.Count > 0)
|
|
{
|
|
var a1 = CreateTestAppointment("Normaler Ressourcentermin", originator);
|
|
var a2 = CreateTestAppointment("Normaler, privater Ressourcentermin", originator, true);
|
|
var a3 = CreateTestAppointment("Normaler, ganztägiger Ressourcentermin", originator, false, true);
|
|
var a4 = CreateTestAppointment("Normaler, ganztägiger, privater Ressourcentermin", originator, true, true);
|
|
|
|
var apps = new List<SchedulerAppointmentDC> { a1, a2, a3, a4 };
|
|
|
|
AddResourcesToAppointments(apps);
|
|
|
|
appointments.AddRange(apps);
|
|
}
|
|
|
|
if(Model.SelectedEmployees.Count > 0)
|
|
{
|
|
|
|
var a1 = CreateTestAppointment("Normaler Mitarbeitertermin", originator);
|
|
var a2 = CreateTestAppointment("Normaler, privater Mitarbeitertermin", originator, true);
|
|
var a3 = CreateTestAppointment("Normaler, ganztägiger Mitarbeitertermin", originator, false, true);
|
|
var a4 = CreateTestAppointment("Normaler, ganztägiger und privater Mitarbeitertermin", originator, true, true);
|
|
|
|
var apps = new List<SchedulerAppointmentDC> {a1, a2, a3, a4};
|
|
|
|
AddEmployeesToAppointments(apps);
|
|
|
|
appointments.AddRange(apps);
|
|
}
|
|
|
|
if(Model.SelectedCustomers.Count > 0)
|
|
{
|
|
var a1 = CreateTestAppointment("Normaler Kliententermin", originator);
|
|
var a2 = CreateTestAppointment("Normaler, privater Kliententermin", originator, true);
|
|
var a3 = CreateTestAppointment("Normaler, ganztägiger Kliententermin", originator, false ,true);
|
|
var a4 = CreateTestAppointment("Normaler, ganztägiger privater Kliententermin", originator, true, true);
|
|
|
|
var onlyCustomerAppointments = new List<SchedulerAppointmentDC> {a1, a2, a3, a4};
|
|
|
|
AddCustomersToAppointments(onlyCustomerAppointments);
|
|
|
|
appointments.AddRange(onlyCustomerAppointments);
|
|
}
|
|
|
|
// Terrmin mit angemeldetem Mitarbeiter, anderen Mitarbeitern und Ressourcen
|
|
if(Model.SelectedEmployees.Count > 0 && Model.SelectedResources.Count > 0)
|
|
{
|
|
appointments.AddRange(CreateEmployeeAndResourceAppointments(originator));
|
|
}
|
|
|
|
// Termine mit angemeldetem Mitarbeiter, Klienten und Mitarbeitern
|
|
if(Model.SelectedEmployees.Count > 0 && Model.SelectedCustomers.Count > 0)
|
|
{
|
|
appointments.AddRange(CreateEmployeeAndCustomerAppointments(originator));
|
|
}
|
|
|
|
// Termine mit angemeldetem Mitarbeiter, Ressourcen und Klienten
|
|
if(Model.SelectedResources.Count > 0 && Model.SelectedCustomers.Count > 0)
|
|
{
|
|
appointments.AddRange(CreateResourceAndCustomerAppointments(originator));
|
|
}
|
|
|
|
// Termine mit angemeldetem Mitarbeiter mit anderen Mitarbeitern, Klienten und Ressourcen
|
|
if(Model.SelectedEmployees.Count > 0 && Model.SelectedResources.Count > 0 && Model.SelectedCustomers.Count > 0)
|
|
{
|
|
appointments.AddRange(CreateResourceAndCustomerAndEmployeeAppointments(originator));
|
|
}
|
|
|
|
KalenderService.InsertSchedulerAppointments(appointments);
|
|
|
|
return View("Development", Model);
|
|
}
|
|
|
|
private IEnumerable<SchedulerAppointmentDC> CreateResourceAndCustomerAndEmployeeAppointments(CompactEmployeeDC originator)
|
|
{
|
|
if(Model == null || Model?.SelectedResources?.Count == 0 || Model?.SelectedCustomers?.Count == 0 || Model?.SelectedEmployees?.Count == 0)
|
|
{
|
|
return new List<SchedulerAppointmentDC>();
|
|
}
|
|
|
|
var a1 = CreateTestAppointment("Termin mit Mitarbeitern, Ressourcen und Klienten", originator);
|
|
var a2 = CreateTestAppointment("Privater Termin mit Mitarbeitern, Ressourcen und Klienten", originator, true);
|
|
var a3 = CreateTestAppointment("Ganztägiger Termin mit Mitarbeitern, Ressourcen und Klienten", originator, false, true);
|
|
var a4 = CreateTestAppointment("Ganztätiger, privater Termin mit Mitarbeitern, Ressourcen und Klienten", originator, true, true);
|
|
|
|
var result = new List<SchedulerAppointmentDC> { a1, a2, a3, a4 };
|
|
|
|
AddResourcesToAppointments(result);
|
|
|
|
AddCustomersToAppointments(result);
|
|
|
|
AddEmployeesToAppointments(result);
|
|
|
|
return result;
|
|
}
|
|
|
|
private IEnumerable<SchedulerAppointmentDC> CreateResourceAndCustomerAppointments(CompactEmployeeDC originator)
|
|
{
|
|
if(Model == null || Model?.SelectedResources?.Count == 0 || Model?.SelectedCustomers?.Count == 0)
|
|
{
|
|
return new List<SchedulerAppointmentDC>();
|
|
}
|
|
|
|
var a1 = CreateTestAppointment("Termin mit Ressourcen und Klienten", originator);
|
|
var a2 = CreateTestAppointment("Privater Termin mit Ressourcen und Klienten", originator, true);
|
|
var a3 = CreateTestAppointment("Ganztägiger Termin mit Ressourcen und Klienten", originator, false, true);
|
|
var a4 = CreateTestAppointment("Ganztätiger, privater Termin mit Ressourcen und Klienten", originator, true, true);
|
|
|
|
var result = new List<SchedulerAppointmentDC> { a1, a2, a3, a4 };
|
|
|
|
AddResourcesToAppointments(result);
|
|
|
|
AddCustomersToAppointments(result);
|
|
|
|
return result;
|
|
}
|
|
|
|
private IEnumerable<SchedulerAppointmentDC> CreateEmployeeAndResourceAppointments(CompactEmployeeDC originator)
|
|
{
|
|
if(Model == null || Model?.SelectedResources?.Count == 0 || Model?.SelectedEmployees?.Count == 0)
|
|
{
|
|
return new List<SchedulerAppointmentDC>();
|
|
}
|
|
|
|
var a1 = CreateTestAppointment("Termin mit Mitarbeitern und Ressourcen", originator);
|
|
var a2 = CreateTestAppointment("Privater Termin mit Mitarbeitern und Ressourcen", originator, true);
|
|
var a3 = CreateTestAppointment("Ganztägiger Termin mit Mitarbeitern und Ressourcen", originator, false, true);
|
|
var a4 = CreateTestAppointment("Ganztätiger, privater Termin mit Mitarbeitern und Ressourcen", originator, true, true);
|
|
|
|
var result = new List<SchedulerAppointmentDC> { a1, a2, a3, a4 };
|
|
|
|
AddCustomersToAppointments(result);
|
|
|
|
AddEmployeesToAppointments(result);
|
|
|
|
return result;
|
|
}
|
|
|
|
private IEnumerable<SchedulerAppointmentDC> CreateEmployeeAndCustomerAppointments(CompactEmployeeDC originator)
|
|
{
|
|
if(Model == null || Model?.SelectedCustomers?.Count == 0 || Model?.SelectedEmployees?.Count == 0)
|
|
{
|
|
return new List<SchedulerAppointmentDC>();
|
|
}
|
|
|
|
var a1 = CreateTestAppointment("Termin mit Mitarbeitern und Klienten", originator);
|
|
var a2 = CreateTestAppointment("Privater Termin mit Mitarbeitern und Klienten", originator, true);
|
|
var a3 = CreateTestAppointment("Ganztägiger Termin mit Mitarbeitern und Klienten", originator, false, true);
|
|
var a4 = CreateTestAppointment("Ganztägiger, privater Termin mit Mitarbeitern und Klienten", originator);
|
|
|
|
var result = new List<SchedulerAppointmentDC> {a1, a2, a3, a4};
|
|
|
|
AddEmployeesToAppointments(result);
|
|
|
|
return result;
|
|
}
|
|
|
|
private void AddEmployeesToAppointments(List<SchedulerAppointmentDC> appointments)
|
|
{
|
|
if(Model.SelectedEmployees?.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var employee2SchedulerAppointmentList = new List<Employee2SchedulerAppointmentDC>();
|
|
|
|
Model.SelectedEmployees.DoForEach(employee => { employee2SchedulerAppointmentList.AddIfNotIn(new Employee2SchedulerAppointmentDC { Employee = employee }); });
|
|
|
|
appointments.DoForEach(era => era.EmployeeList = employee2SchedulerAppointmentList);
|
|
}
|
|
|
|
private void AddCustomersToAppointments(IEnumerable<SchedulerAppointmentDC> appointments)
|
|
{
|
|
if(Model.SelectedCustomers?.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
appointments.DoForEach(appointment => appointment.CustomerList = Model.SelectedCustomers);
|
|
}
|
|
|
|
private void AddResourcesToAppointments(IEnumerable<SchedulerAppointmentDC> appointments)
|
|
{
|
|
if(Model.SelectedResources?.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
appointments.DoForEach(appointment => appointment.ResourceList = Model.SelectedResources);
|
|
}
|
|
|
|
private static DateTime _IntervalStart;
|
|
|
|
private static DateTime _AppointmentStart;
|
|
|
|
private static AppointmentDates CalcAppointmentDates(int minHour = 5, int maxHour = 23)
|
|
{
|
|
var s = _AppointmentStart;
|
|
var e = s.AddHours(1);
|
|
|
|
var min = s.MergeDateWithHoursMinutesSeconds(minHour, 0);
|
|
var max = s.MergeDateWithHoursMinutesSeconds(maxHour, 0);
|
|
|
|
var result = new AppointmentDates(s, e);
|
|
|
|
if(!s.InBetween(min, max, false) || !e.InBetween(min, max, false))
|
|
{
|
|
s = _AppointmentStart.AddDays(1).MergeDateWithHoursMinutesSeconds(minHour, 0);
|
|
e = s.AddHours(1);
|
|
|
|
result = new AppointmentDates(s, e);
|
|
}
|
|
|
|
_AppointmentStart = e.AddMinutes(15);
|
|
|
|
return result;
|
|
}
|
|
|
|
private static SchedulerAppointmentDC CreateTestAppointment(string subject, CompactEmployeeDC originator, bool isPrivate = false, bool isAllDay = false)
|
|
{
|
|
var appointmentDate = CalcAppointmentDates();
|
|
|
|
return new SchedulerAppointmentDC
|
|
{
|
|
StartDate = appointmentDate.Start,
|
|
EndDate = appointmentDate.End,
|
|
Subject = subject,
|
|
Description = "mob-dev-app",
|
|
Location = "Kölle",
|
|
Originator = originator,
|
|
IsPrivate = isPrivate,
|
|
AllDay = isAllDay,
|
|
ActivationType = ActivationTypeId.Active
|
|
};
|
|
}
|
|
|
|
[Authorize]
|
|
public string AddEmployeeToAppointment(string employeeOids)
|
|
{
|
|
if(string.IsNullOrEmpty(employeeOids))
|
|
{
|
|
Model.SelectedEmployees.Clear();
|
|
return JsonConvert.SerializeObject(Model.SelectedEmployees.Count);
|
|
}
|
|
|
|
var rawEmployeeOids = employeeOids.Split(',');
|
|
var oids = new List<long>();
|
|
|
|
rawEmployeeOids.DoForEach(s => oids.AddIfNotIn(long.Parse(s)));
|
|
|
|
var employees = Model.AllEmployees.Where(w => oids.Contains(w.EmployeeOid));
|
|
|
|
Model.SelectedEmployees.Clear();
|
|
Model.SelectedEmployees.AddRangeIfElementsNotIn(employees);
|
|
|
|
return JsonConvert.SerializeObject(Model.SelectedEmployees.Count);
|
|
}
|
|
|
|
[Authorize]
|
|
public string AddCustomerToAppointment(string customerOids)
|
|
{
|
|
if(string.IsNullOrWhiteSpace(customerOids))
|
|
{
|
|
Model.SelectedCustomers.Clear();
|
|
return JsonConvert.SerializeObject(Model.SelectedCustomers.Count);
|
|
}
|
|
|
|
var rawCustomerOids = customerOids.Split(',');
|
|
var oids = new List<long>();
|
|
|
|
rawCustomerOids.DoForEach(s => oids.AddIfNotIn(long.Parse(s)));
|
|
|
|
var customers = Model.AllCustomers.Where(w => oids.Contains(w.CustomerOid));
|
|
|
|
Model.SelectedCustomers.Clear();
|
|
Model.SelectedCustomers.AddRangeIfElementsNotIn(customers);
|
|
|
|
return JsonConvert.SerializeObject(Model.SelectedCustomers.Count);
|
|
}
|
|
|
|
[Authorize]
|
|
[HttpPost]
|
|
public ActionResult DeleteTestAppointments()
|
|
{
|
|
KalenderService.DeleteMobileTestAppointments();
|
|
|
|
return RedirectToActionPermanent("Development");
|
|
}
|
|
}
|
|
|
|
public class UserRightGroup
|
|
{
|
|
public string Title { get; set; }
|
|
public Dictionary<UserRightType, UserRightTypeTranslation2IsAssigned> UserRightTypes { get; set; }
|
|
|
|
public bool AreAllChecked { get; set; }
|
|
|
|
public UserRightGroup(string title, Dictionary<UserRightType, string> userRightTypes)
|
|
{
|
|
Title = title ?? "Unbenannt";
|
|
UserRightTypes = new Dictionary<UserRightType, UserRightTypeTranslation2IsAssigned>();
|
|
|
|
userRightTypes?.DoForEach(rel =>
|
|
{
|
|
var isAssigned = MobileSessionFacade.LoggedInUser.CheckForRight(rel.Key);
|
|
var translation = rel.Value;
|
|
|
|
UserRightTypes.AddIfNotIn(new KeyValuePair<UserRightType, UserRightTypeTranslation2IsAssigned>(rel.Key, new UserRightTypeTranslation2IsAssigned(translation, isAssigned)));
|
|
});
|
|
|
|
if(userRightTypes != null)
|
|
{
|
|
AreAllChecked = MobileSessionFacade.LoggedInUser.CheckForRights(userRightTypes.Keys);
|
|
}
|
|
}
|
|
}
|
|
|
|
public struct UserRightTypeTranslation2IsAssigned
|
|
{
|
|
public bool IsAssigned { get; set; }
|
|
public string Translation { get; set; }
|
|
|
|
public UserRightTypeTranslation2IsAssigned(string translation, bool isAssigned)
|
|
{
|
|
IsAssigned = isAssigned;
|
|
Translation = translation;
|
|
}
|
|
}
|
|
|
|
public struct AppointmentDates
|
|
{
|
|
public DateTime Start { get; set; }
|
|
public DateTime End { get; set; }
|
|
|
|
public AppointmentDates(DateTime start, DateTime end)
|
|
{
|
|
Start = start;
|
|
End = end;
|
|
}
|
|
}
|
|
} |