Vergessen einzuchecken

This commit is contained in:
Lyndon
2019-07-10 11:42:18 +02:00
parent 3d8244c489
commit 238c660ce6
5 changed files with 123 additions and 31 deletions

View File

@@ -0,0 +1,29 @@
using System.Text.RegularExpressions;
namespace BeWo.Scheduler.Utils
{
public static class Utils
{
private static readonly Regex indexRegex = new Regex("(?:Index=\"){1}([0-9]+)\"{1}");
private static readonly Regex idRegex = new Regex("(?:Id=\")(([a-z0-9]{8})-{1}([a-z0-9]{4})-{1}([a-z0-9]{4})-{1}([a-z0-9]{4})-{1}([a-z0-9]{12}))(?=\"{1})");
public static string ExtractIdFromRecurrenceInfo(string pRecurrenceInfo)
{
return pRecurrenceInfo != null ? idRegex.Match(pRecurrenceInfo).Groups[1].Value : null;
}
public static int ExtractIndexFromRecurrenceInfo(string pRecurrenceInfo)
{
if(pRecurrenceInfo != null)
{
var indexString = indexRegex.Match(pRecurrenceInfo).Groups[1].Value;
var index = !string.IsNullOrEmpty(indexString) ? int.Parse(indexString) : 0;
return index;
}
return -1;
}
}
}

View File

@@ -90,7 +90,7 @@ namespace BeWo.View
#if DEBUG
//txtChangePassword.Visibility = Visibility.Visible;
//TestTermineAnlegenButton.Visibility = Visibility.Visible;
#else
if (BeWoApp.Tenant == "demo" || !BeWoApp.LoggedOnUser.HasRight(UserRightType.AllowChangeOwnPassword))
{
@@ -756,7 +756,8 @@ namespace BeWo.View
if (_HasRightsToSeeAppointments && _IsAllowedToSeeMitarbeitertermine)
{
#if DEBUG
//TestTermineLoeschenButton.Visibility = Visibility.Visible;
TestTermineAnlegenButton.Visibility = Visibility.Visible;
TestTermineLoeschenButton.Visibility = Visibility.Visible;
#endif
employeeFilterBox.Visibility = Visibility.Visible;

View File

@@ -0,0 +1,18 @@
using BS.Shared;
namespace BeWo.Data.Entities
{
public class DeletionHistory : BeWoEntityBase
{
public DeletionHistory()
{
_Tid = TableID.DeletionHistory;
}
public virtual string DeletingEmployeeName { get; set; }
public virtual string DeletedEntityName { get; set; }
public virtual TableID DeletedEntityTableId { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="BeWo.Data.Entities.DeletionHistory, BeWo.Data" table="DeletionHistory">
<id name="Oid" column="Oid" type="Int64" unsaved-value="null">
<generator class="identity" />
</id>
<version type="Int64" column="Version" name="Version" />
<property column="Tid" type="BS.Shared.TableID, BS.Shared" name="_Tid" access="field" />
<property column="InsTs" type="DateTime" name="InsTs" />
<property column="InsUser" type="String" name="InsUser" length="256" />
<property column="IsActive" type="BS.Shared.ActivationTypeId, BS.Shared" name="IsActive" />
<property column="SystemEntryID" type="BS.Shared.SystemEntryID, BS.Shared" name="SystemEntryID" />
<property column="UdpUser" type="String" name="UdpUser" length="256" />
<property column="Notice" type="String" name="Notice" length="1024" />
<property column="DeletedEntityName" type="String" name="DeletedEntityName" length="256" />
<property column="DeletingEmployeeName" type="String" name="DeletingEmployeeName" length="256" />
<property column="DeletedEntityTableId" type="BS.Shared.TableID, BS.Shared" name="DeletedEntityTableId" length="256" />
</class>
</hibernate-mapping>

View File

@@ -1589,7 +1589,6 @@ namespace BeWo.Service.ServiceImplementations
{
try
{
// Appointments speichern, dann die Mitarbeiterlisten...
CreateTestAppointmentsForEmployee(pEmployeeOid);
}
catch(Exception e)
@@ -1614,10 +1613,29 @@ namespace BeWo.Service.ServiceImplementations
var fiveCustomers = customers.TakeWhile((t, i) => i != 5).ToList();
var fiveResources = resources.TakeWhile((t, i) => i != 3).ToList();
var employeeList = employeesWithoutEmployee.TakeWhile((t, i) => i != 5).Select(t => new Employee2SchedulerAppointment(t)).ToList();
var employeeListIncludingLoggedInEmployee1 = employeesWithoutEmployee.TakeWhile((t, i) => i != 4).Select(t => new Employee2SchedulerAppointment(t)).ToList();
employeeListIncludingLoggedInEmployee1.Add(new Employee2SchedulerAppointment(employee));
var employeeListIncludingLoggedInEmployee = employeesWithoutEmployee.TakeWhile((t, i) => i != 4).Select(t => new Employee2SchedulerAppointment(t)).ToList();//new List<Employee2SchedulerAppointment>();
employeeListIncludingLoggedInEmployee.Add(new Employee2SchedulerAppointment(employee));
var employeeListIncludingLoggedInEmployee2 = employeesWithoutEmployee.TakeWhile((t, i) => i != 4).Select(t => new Employee2SchedulerAppointment(t)).ToList();
employeeListIncludingLoggedInEmployee2.Add(new Employee2SchedulerAppointment(employee));
var employeeListIncludingLoggedInEmployee3 = employeesWithoutEmployee.TakeWhile((t, i) => i != 4).Select(t => new Employee2SchedulerAppointment(t)).ToList();
employeeListIncludingLoggedInEmployee3.Add(new Employee2SchedulerAppointment(employee));
var employeeListIncludingLoggedInEmployee4 = employeesWithoutEmployee.TakeWhile((t, i) => i != 4).Select(t => new Employee2SchedulerAppointment(t)).ToList();
employeeListIncludingLoggedInEmployee4.Add(new Employee2SchedulerAppointment(employee));
var employeeListIncludingLoggedInEmployee5 = employeesWithoutEmployee.TakeWhile((t, i) => i != 4).Select(t => new Employee2SchedulerAppointment(t)).ToList();
employeeListIncludingLoggedInEmployee5.Add(new Employee2SchedulerAppointment(employee));
var employeeListIncludingLoggedInEmployee6 = employeesWithoutEmployee.TakeWhile((t, i) => i != 4).Select(t => new Employee2SchedulerAppointment(t)).ToList();
employeeListIncludingLoggedInEmployee6.Add(new Employee2SchedulerAppointment(employee));
var employeeListIncludingLoggedInEmployee7 = employeesWithoutEmployee.TakeWhile((t, i) => i != 4).Select(t => new Employee2SchedulerAppointment(t)).ToList();
employeeListIncludingLoggedInEmployee7.Add(new Employee2SchedulerAppointment(employee));
var employeeListIncludingLoggedInEmployee8 = employeesWithoutEmployee.TakeWhile((t, i) => i != 4).Select(t => new Employee2SchedulerAppointment(t)).ToList();
employeeListIncludingLoggedInEmployee8.Add(new Employee2SchedulerAppointment(employee));
var monday = DateTime.Today.FirstDateOfWeek(DateTime.Today.GetIso8601WeekOfYear());
var tuesday = monday.AddDays(1);
@@ -1629,23 +1647,23 @@ namespace BeWo.Service.ServiceImplementations
//Originator ist angemeldeten Mitarbeiter
GenerateAppointments(monday, false, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeList, null);
GenerateAppointments(monday, false, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeesWithoutEmployee.TakeWhile((t, i) => i != 5).Select(t => new Employee2SchedulerAppointment(t)).ToList(), null);
//Termin von anderem Mitarbeiter
GenerateAppointments(tuesday, false, secondEmployee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeListIncludingLoggedInEmployee, null);
GenerateAppointments(tuesday, false, secondEmployee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeListIncludingLoggedInEmployee1, null);
//Originator ist angemeldeter Mitarbeiter und in Liste
GenerateAppointments(wednesday, false, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeListIncludingLoggedInEmployee, null);
GenerateAppointments(wednesday, false, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeListIncludingLoggedInEmployee2, null);
//Originator ist nicht angemeldeter Mitarbeiter und der ist auch nicht in der Liste
GenerateAppointments(thursday, false, secondEmployee, fiveCustomers, fiveOfSecondEmployeesCustomers, fiveResources, employeeList, null);
GenerateAppointments(thursday, false, secondEmployee, fiveCustomers, fiveOfSecondEmployeesCustomers, fiveResources, employeesWithoutEmployee.TakeWhile((t, i) => i != 5).Select(t => new Employee2SchedulerAppointment(t)).ToList(), null);
//Private Termine
GenerateAppointments(friday, true, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeList, null);
GenerateAppointments(saturday, true, secondEmployee, fiveCustomers, fiveOfSecondEmployeesCustomers, fiveResources, employeeList, null);
GenerateAppointments(sunday, true, secondEmployee, fiveCustomers, fiveOfSecondEmployeesCustomers, fiveResources, employeeListIncludingLoggedInEmployee, null);
GenerateAppointments(friday.AddHours(12), true, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeListIncludingLoggedInEmployee, null);
GenerateAppointments(friday, true, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeesWithoutEmployee.TakeWhile((t, i) => i != 5).Select(t => new Employee2SchedulerAppointment(t)).ToList(), null);
GenerateAppointments(saturday, true, secondEmployee, fiveCustomers, fiveOfSecondEmployeesCustomers, fiveResources, employeesWithoutEmployee.TakeWhile((t, i) => i != 5).Select(t => new Employee2SchedulerAppointment(t)).ToList(), null);
GenerateAppointments(sunday, true, secondEmployee, fiveCustomers, fiveOfSecondEmployeesCustomers, fiveResources, employeeListIncludingLoggedInEmployee3, null);
GenerateAppointments(friday.AddHours(12), true, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeListIncludingLoggedInEmployee4, null);
//AllDay-Termine ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -1658,23 +1676,23 @@ namespace BeWo.Service.ServiceImplementations
var sun = sunday.AddDays(7);
//Originator ist angemeldeten Mitarbeiter
GenerateAppointments(mon, false, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeList, null, true);
GenerateAppointments(mon, false, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeesWithoutEmployee.TakeWhile((t, i) => i != 5).Select(t => new Employee2SchedulerAppointment(t)).ToList(), null, true);
//Termin von anderem Mitarbeiter
GenerateAppointments(tue, false, secondEmployee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeListIncludingLoggedInEmployee, null, true);
GenerateAppointments(tue, false, secondEmployee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeListIncludingLoggedInEmployee5, null, true);
//Originator ist angemeldeter Mitarbeiter und in Liste
GenerateAppointments(wed, false, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeListIncludingLoggedInEmployee, null, true);
GenerateAppointments(wed, false, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeListIncludingLoggedInEmployee6, null, true);
//Originator ist nicht angemeldeter Mitarbeiter und der ist auch nicht in der Liste
GenerateAppointments(thu, false, secondEmployee, fiveCustomers, fiveOfSecondEmployeesCustomers, fiveResources, employeeList, null, true);
GenerateAppointments(thu, false, secondEmployee, fiveCustomers, fiveOfSecondEmployeesCustomers, fiveResources, employeesWithoutEmployee.TakeWhile((t, i) => i != 5).Select(t => new Employee2SchedulerAppointment(t)).ToList(), null, true);
//Private Termine
GenerateAppointments(fri, true, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeList, null, true);
GenerateAppointments(sat, true, secondEmployee, fiveCustomers, fiveOfSecondEmployeesCustomers, fiveResources, employeeList, null, true);
GenerateAppointments(sun, true, secondEmployee, fiveCustomers, fiveOfSecondEmployeesCustomers, fiveResources, employeeListIncludingLoggedInEmployee, null, true);
GenerateAppointments(fri.AddHours(12), true, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeListIncludingLoggedInEmployee, null, true);
GenerateAppointments(fri, true, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeesWithoutEmployee.TakeWhile((t, i) => i != 5).Select(t => new Employee2SchedulerAppointment(t)).ToList(), null, true);
GenerateAppointments(sat, true, secondEmployee, fiveCustomers, fiveOfSecondEmployeesCustomers, fiveResources, employeesWithoutEmployee.TakeWhile((t, i) => i != 5).Select(t => new Employee2SchedulerAppointment(t)).ToList(), null, true);
GenerateAppointments(sun, true, secondEmployee, fiveCustomers, fiveOfSecondEmployeesCustomers, fiveResources, employeeListIncludingLoggedInEmployee7, null, true);
GenerateAppointments(fri.AddHours(12), true, employee, fiveCustomers, fiveOfMyOwnCustomers, fiveResources, employeeListIncludingLoggedInEmployee8, null, true);
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
var mo = mon.AddDays(7);
@@ -1819,7 +1837,6 @@ namespace BeWo.Service.ServiceImplementations
appointment.Subject += " mit Klienten";
break;
case 2:
appointment.EmployeeList = pEmployees;
appointment.Subject += " mit Mitarbeitern";
break;
case 3:
@@ -1828,7 +1845,6 @@ namespace BeWo.Service.ServiceImplementations
break;
case 4:
appointment.CustomerList = pCustomerList;
appointment.EmployeeList = pEmployees;
appointment.Subject += " mit Klienten und Mitarbeitern";
break;
case 5:
@@ -1838,12 +1854,10 @@ namespace BeWo.Service.ServiceImplementations
break;
case 6:
appointment.CustomerList = pCustomerList;
appointment.EmployeeList = pEmployees;
appointment.ResourceList = pResourceList;
appointment.Subject += " mit Klienten, Mitarbeitern und Ressourcen";
break;
case 7:
appointment.EmployeeList = pEmployees;
appointment.ResourceList = pResourceList;
appointment.Subject += " mit Mitarbeitern und Ressourcen";
break;
@@ -1853,7 +1867,6 @@ namespace BeWo.Service.ServiceImplementations
break;
case 9:
appointment.CustomerList = pOwnCustomers;
appointment.EmployeeList = pEmployees;
appointment.Subject += " mit eigenen Klienten und Mitarbeitern";
break;
case 10:
@@ -1863,20 +1876,31 @@ namespace BeWo.Service.ServiceImplementations
break;
case 11:
appointment.CustomerList = pOwnCustomers;
appointment.EmployeeList = pEmployees;
appointment.ResourceList = pResourceList;
appointment.Subject += " mit eigenen Klienten, Mitarbeitern und Ressourcen";
break;
}
appointment.Subject = (pIsPrivate ? "Privat: " : "") + appointment.Subject;
if (pEmployees != null)
{
DAOFactory.GenericDAO.Insert(pEmployees);
pEmployees = DAOFactory.GenericDAO.LoadByIDs<Employee2SchedulerAppointment>(pEmployees.Where(w => w.Oid.HasValue).Select(s => s.Oid.Value));
appointment.EmployeeList = pEmployees;
}
appointment.Subject = (pIsPrivate ? "Privat: " : "") + appointment.Subject;
DAOFactory.GenericDAO.Insert(appointment);
if(pEmployees != null)
{
foreach(var abc in appointment.EmployeeList)
{
abc.SchedulerAppointmentOid = appointment.Oid;
}
DAOFactory.GenericDAO.Update(appointment.EmployeeList);
}
}
}
@@ -2158,7 +2182,6 @@ namespace BeWo.Service.ServiceImplementations
Notice = SUtils.TestAppointmentNotice
};
return appointment;
}