diff --git a/Controllers/EventController.cs b/Controllers/EventController.cs
index a46a175..82c3c92 100644
--- a/Controllers/EventController.cs
+++ b/Controllers/EventController.cs
@@ -118,6 +118,13 @@ public ActionResult Save(EventModel model, HttpPostedFileBase file)
if (model.ImportantInformation == null)
ModelState.AddModelError("ImportantInformation", "Important information is required.");
+
+ if(model.ParticipantsLimitation == 0 && model.WaitingList == true)
+ ModelState.AddModelError("WaitingList", "You don't need a waiting list if there is no participants limitation.");
+
+ if (model.WaitingListLimitation > 0 && model.WaitingList == false)
+ ModelState.AddModelError("WaitingListLimitation", "You don't need a waiting list limitation if you dont use the waiting list.");
+
//check if schema file is uploaded
//if (attachments ==null &&model.Id == 0)
@@ -134,7 +141,7 @@ public ActionResult Save(EventModel model, HttpPostedFileBase file)
if (model.Id == 0)
{
- Event newEvent = eManager.CreateEvent(model.Name, model.EventDate, model.ImportantInformation, model.MailInformation, model.SelectedEventLanguage, model.StartDate, model.Deadline, model.ParticipantsLimitation, model.EditAllowed, model.LogInPassword, model.EmailBCC, model.EmailCC, model.EmailReply, ms, null);
+ Event newEvent = eManager.CreateEvent(model.Name, model.EventDate, model.ImportantInformation, model.MailInformation, model.SelectedEventLanguage, model.StartDate, model.Deadline, model.ParticipantsLimitation, model.WaitingList,model.WaitingListLimitation, model.EditAllowed, model.Closed, model.LogInPassword, model.EmailBCC, model.EmailCC, model.EmailReply, ms, null);
newEvent = SaveFile(file, newEvent, eManager);
eManager.UpdateEvent(newEvent);
@@ -172,7 +179,10 @@ public ActionResult Save(EventModel model, HttpPostedFileBase file)
e.StartDate = model.StartDate;
e.Deadline = model.Deadline;
e.ParticipantsLimitation = model.ParticipantsLimitation;
+ e.WaitingList = model.WaitingList;
+ e.WaitingListLimitation = model.WaitingListLimitation;
e.EditAllowed = model.EditAllowed;
+ e.Closed = model.Closed;
e.LogInPassword = model.LogInPassword;
e.LogInPassword = model.LogInPassword;
e.EmailCC = model.EmailCC;
@@ -184,7 +194,7 @@ public ActionResult Save(EventModel model, HttpPostedFileBase file)
eManager.UpdateEvent(e);
}
- return View("EventManager");
+ return RedirectToAction("EventManager");
}
}
else
diff --git a/Controllers/EventRegistrationController.cs b/Controllers/EventRegistrationController.cs
index ed0de8a..8a5de72 100644
--- a/Controllers/EventRegistrationController.cs
+++ b/Controllers/EventRegistrationController.cs
@@ -86,6 +86,11 @@ private List GetAvailableEvents(string ref_id = null)
if (today >= e.StartDate)
{
EventRegistrationModel model = new EventRegistrationModel(e);
+ model.NumberOfRegistration = erManager.GetAllRegistrationsNotDeletedByEvent(e.Id).Count;
+ model.NrOfRegistrationWaitingList = erManager.GetAllWaitingListRegsByEvent(e.Id).Count;
+
+ model.Closed = e.Closed;
+
//check if user already registered (if logged in)
if (user != null)
{
@@ -482,6 +487,7 @@ public ActionResult DeleteRegistration(string id, string ref_id = null)
using (SubjectManager subManager = new SubjectManager())
{
using (EventRegistrationManager erManager = new EventRegistrationManager())
+ using (var eventManager = new EventManager())
{
User user = subManager.Subjects.Where(a => a.Name == HttpContext.User.Identity.Name).FirstOrDefault() as User;
if (user != null)
@@ -493,6 +499,9 @@ public ActionResult DeleteRegistration(string id, string ref_id = null)
{
reg.Deleted = true;
erManager.UpdateEventRegistration(reg);
+ MoveFromWaitingList(reg.Event.Id);
+
+ SendEmailNotification("deleted", user.Email, ref_id, reg.Data, reg.Event, user);
}
}
else if (ref_id != null)
@@ -502,13 +511,83 @@ public ActionResult DeleteRegistration(string id, string ref_id = null)
{
reg.Deleted = true;
erManager.UpdateEventRegistration(reg);
+ MoveFromWaitingList(reg.Event.Id);
+
+ SendEmailNotification("deleted", user.Email, ref_id, reg.Data, reg.Event, user);
}
}
}
+
+
+
+
}
return Json(new { result = "redirect", url = Url.Action("EventRegistration", "EventRegistration", new { area = "EMM" }) }, JsonRequestBehavior.AllowGet);
}
+ private void MoveFromWaitingList(long eventId)
+ {
+ using (var erManager = new EventRegistrationManager())
+ using (var eventManager = new EventManager())
+ {
+ int countWaitingList = erManager.GetAllWaitingListRegsByEvent(eventId).Count;
+ if (countWaitingList > 0)
+ {
+ var reg = erManager.GetLatestWaitingListEntry(eventId);
+ reg.WaitingList = false;
+ erManager.UpdateEventRegistration(reg);
+ var e = eventManager.GetEventById(eventId);
+ SendWaitingListNotification(reg.Data, e);
+ }
+ }
+ }
+
+ private void SendWaitingListNotification(XmlDocument data, Event e)
+ {
+ // todo: add not allowed / log in info to mail
+
+ EmailStructure emailStructure = new EmailStructure();
+ emailStructure = EmailHelper.ReadFile(e.EventLanguage);
+
+ string first_name = data.GetElementsByTagName(emailStructure.lableFirstName)[0].InnerText;
+ string last_name = data.GetElementsByTagName(emailStructure.lableLastname)[0].InnerText;
+ string email = data.GetElementsByTagName(emailStructure.lableEmail)[0].InnerText;
+
+ string url = Request.Url.GetLeftPart(UriPartial.Authority);
+
+ string mail_message = "";
+ string subject = emailStructure.removeFromWaitingListSubject + e.Name;
+
+ string body = emailStructure.bodyTitle + first_name + " " + last_name + ", " + "
" +
+ emailStructure.removeFromWaitingList1 + "
" +
+ emailStructure.bodyClosing + "
" +
+ emailStructure.bodyClosingName;
+
+
+ var es = new EmailService();
+
+ // If no explicit Reply to mail is set use the SystemEmail
+ string replyTo = "";
+ if (String.IsNullOrEmpty(e.EmailReply))
+ {
+ replyTo = ConfigurationManager.AppSettings["SystemEmail"];
+ }
+ else
+ {
+ replyTo = e.EmailReply;
+ }
+
+ es.Send(
+ subject,
+ body,
+ new List { email }, // to
+ new List { e.EmailCC }, // CC
+ new List { ConfigurationManager.AppSettings["SystemEmail"], e.EmailBCC }, // Allways send BCC to SystemEmail + additional set
+ new List { replyTo }
+ );
+
+ }
+
public ActionResult Save()
{
using (EventManager eManager = new EventManager())
@@ -559,14 +638,14 @@ public ActionResult Save()
{
if (e.EditAllowed != true)
{
- SendEmailNotification("resend", email, ref_id, data, e, user);
+ SendEmailNotification("resend", email, ref_id, XmlMetadataWriter.ToXmlDocument(data), e, user);
return RedirectToAction("EventRegistrationPatial", new { message = "Update of your previous registration is not allowed. You registration details are send to your Email adress again.", message_type = "error" });
}
reg.Data = XmlMetadataWriter.ToXmlDocument(data);
erManager.UpdateEventRegistration(reg);
- SendEmailNotification("updated", email, ref_id, data, e, user);
+ SendEmailNotification("updated", email, ref_id, XmlMetadataWriter.ToXmlDocument(data), e, user);
}
else
CreateNewEventRegistration(e, data, user, email, notificationType, ref_id);
@@ -575,7 +654,6 @@ public ActionResult Save()
else
CreateNewEventRegistration(e, data, user, email, notificationType, ref_id);
-
return Json(new { result = "redirect", url = Url.Action("EventRegistration", "EventRegistration", new { area = "EMM", ref_id = ref_id }) }, JsonRequestBehavior.AllowGet);
}
}
@@ -587,15 +665,36 @@ public ActionResult Save()
///
private void CreateNewEventRegistration(Event e, XDocument data, User user, string email, string notificationType, string ref_id)
{
+ bool waitingList = false;
using (var erManager = new EventRegistrationManager())
+ using(var eventManager = new EventManager())
{
//check Participants Limitation
if (e.ParticipantsLimitation != 0)
{
- int countRegs = erManager.GetNumerOfRegistrationsByEvent(e.Id);
+ int countRegs = erManager.GetNumerOfRegistrationsByEvent(e.Id) + 1;
+ int countWaitingList = erManager.GetAllWaitingListRegsByEvent(e.Id).Count + 1;
+
if (countRegs >= e.ParticipantsLimitation)
{
- notificationType = "succesfully_registered_waiting_list";
+ if(e.WaitingList && !e.Closed)
+ {
+ if(countWaitingList == e.WaitingListLimitation)
+ {
+ e.Closed = true;
+ eventManager.UpdateEvent(e);
+ }
+
+ notificationType = "succesfully_registered_waiting_list";
+ waitingList = true;
+
+ }
+ else
+ {
+ e.Closed = true;
+ eventManager.UpdateEvent(e);
+ notificationType = "succesfully_registered";
+ }
}
else
{
@@ -607,10 +706,10 @@ private void CreateNewEventRegistration(Event e, XDocument data, User user, stri
notificationType = "succesfully_registered";
}
- // Save registration and send notification
- erManager.CreateEventRegistration(XmlMetadataWriter.ToXmlDocument(data), e, user, false, ref_id);
+ // Save registration and send notification
+ erManager.CreateEventRegistration(XmlMetadataWriter.ToXmlDocument(data), e, user, false, ref_id, waitingList, DateTime.Now);
- SendEmailNotification(notificationType, email, ref_id, data, e, user);
+ SendEmailNotification(notificationType, email, ref_id, XmlMetadataWriter.ToXmlDocument(data), e, user);
}
}
@@ -1077,19 +1176,15 @@ private EventRegistration CheckEventRegistration(User user, string ref_id, long
}
}
- private void SendEmailNotification(string notificationType, string email, string ref_id, XDocument data, Event e, User user)
+ private void SendEmailNotification(string notificationType, string email, string ref_id, XmlDocument data, Event e, User user)
{
// todo: add not allowed / log in info to mail
- //temp for alb symosium
EmailStructure emailStructure = new EmailStructure();
- if(e.Id == 12)
- emailStructure = EmailHelper.ReadFile("English");
- else
- emailStructure = EmailHelper.ReadFile(e.EventLanguage);
+ emailStructure = EmailHelper.ReadFile(e.EventLanguage);
- string first_name = XmlMetadataWriter.ToXmlDocument(data).GetElementsByTagName(emailStructure.lableFirstName)[0].InnerText;
- string last_name = XmlMetadataWriter.ToXmlDocument(data).GetElementsByTagName(emailStructure.lableLastname)[0].InnerText;
+ string first_name = data.GetElementsByTagName(emailStructure.lableFirstName)[0].InnerText;
+ string last_name = data.GetElementsByTagName(emailStructure.lableLastname)[0].InnerText;
string url = Request.Url.GetLeftPart(UriPartial.Authority);
@@ -1110,6 +1205,10 @@ private void SendEmailNotification(string notificationType, string email, string
subject = emailStructure.updateSubject + e.Name;
mail_message = emailStructure.updateMessage + e.Name + ".
";
break;
+ case "deleted":
+ subject = emailStructure.deletedSubject + e.Name;
+ mail_message = emailStructure.deletedMessage + e.Name + ".
";
+ break;
//case "resend":
// subject = "Resend of registration confirmation for " + e.Name;
// mail_message = "your registration for " + e.Name + "
";
@@ -1118,7 +1217,8 @@ private void SendEmailNotification(string notificationType, string email, string
string details = "";
//read xml file and format email output
- foreach (XElement xe in XElement.Parse(data.ToString()).Elements())
+ XDocument xDocument = XDocument.Parse(data.OuterXml);
+ foreach (XElement xe in XElement.Parse(xDocument.ToString()).Elements())
{
string displayNameRoot = "";
if (xe.HasElements)
@@ -1142,14 +1242,15 @@ private void SendEmailNotification(string notificationType, string email, string
}
}
- string body = emailStructure.bodyTitle + first_name + " " + last_name + ", " + "
" +
+ string body = emailStructure.bodyTitle + first_name + " " + last_name + ", " + "
" +
- mail_message + "
" +
- e.MailInformation + "
" +
- "
" + emailStructure.bodyOpening +"
" +
- details + "
" +
- emailStructure.bodyHintToLink + url + "/emm/EventRegistration/EventRegistration/?ref_id=" + ref_id + "
" +
- emailStructure.bodyClosing + "
" +
+ mail_message + "
" +
+ e.MailInformation + "
" +
+ "
" + emailStructure.bodyOpening + "
" +
+ details + "
";
+ if (notificationType != "deleted")
+ body += emailStructure.bodyHintToLink + url + "/emm/EventRegistration/EventRegistration/?ref_id=" + ref_id + "
";
+ body += emailStructure.bodyClosing + "
" +
emailStructure.bodyClosingName;
var es = new EmailService();
diff --git a/Controllers/EventRegistrationResultController.cs b/Controllers/EventRegistrationResultController.cs
index 185f0f6..c540dac 100644
--- a/Controllers/EventRegistrationResultController.cs
+++ b/Controllers/EventRegistrationResultController.cs
@@ -1,15 +1,18 @@
using BExIS.Emm.Entities.Event;
using BExIS.Emm.Services.Event;
using BExIS.IO.Transform.Output;
+using BExIS.Modules.EMM.UI.Helper;
using BExIS.Modules.EMM.UI.Models;
using BExIS.Security.Entities.Authorization;
using BExIS.Security.Entities.Objects;
using BExIS.Security.Services.Authorization;
using BExIS.Security.Services.Objects;
using BExIS.Security.Services.Subjects;
+using BExIS.Security.Services.Utilities;
using BExIS.Xml.Helpers;
using System;
using System.Collections.Generic;
+using System.Configuration;
using System.Data;
using System.IO;
using System.Linq;
@@ -131,6 +134,8 @@ public ActionResult OnSelectTreeViewItem(long id)
{
EventRegistrationResultModel model = new EventRegistrationResultModel();
model.Results = GetEventResults(id);
+ model.WaitingListResults = GetWaitingListResults(id);
+
model.EventId = id;
//check rights on event
@@ -146,6 +151,71 @@ public ActionResult OnSelectTreeViewItem(long id)
return View("EventRegistrationResults", model);
}
+ public ActionResult MoveFromWaitingList(long id, long eventId)
+ {
+ using (EventRegistrationManager erManager = new EventRegistrationManager())
+ using (EventManager eventManager = new EventManager())
+ {
+ var registration = erManager.EventRegistrationRepo.Get(a => a.Id == id).FirstOrDefault();
+ if (registration.WaitingList == true)
+ registration.WaitingList = false;
+
+ erManager.UpdateEventRegistration(registration);
+
+ var e = eventManager.GetEventById(eventId);
+ SendNotification(registration.Data, e);
+
+ }
+
+ return RedirectToAction("OnSelectTreeViewItem", new { id = eventId });
+ }
+
+ private void SendNotification(XmlDocument data, Event e)
+ {
+ // todo: add not allowed / log in info to mail
+
+ EmailStructure emailStructure = new EmailStructure();
+ emailStructure = EmailHelper.ReadFile(e.EventLanguage);
+
+ string first_name = data.GetElementsByTagName(emailStructure.lableFirstName)[0].InnerText;
+ string last_name = data.GetElementsByTagName(emailStructure.lableLastname)[0].InnerText;
+ string email = data.GetElementsByTagName(emailStructure.lableEmail)[0].InnerText;
+
+ string url = Request.Url.GetLeftPart(UriPartial.Authority);
+
+ string mail_message = "";
+ string subject = emailStructure.removeFromWaitingListSubject + e.Name;
+
+ string body = emailStructure.bodyTitle + first_name + " " + last_name + ", " + "
" +
+ emailStructure.removeFromWaitingList1 + "
" +
+ emailStructure.bodyClosing + "
" +
+ emailStructure.bodyClosingName;
+
+
+ var es = new EmailService();
+
+ // If no explicit Reply to mail is set use the SystemEmail
+ string replyTo = "";
+ if (String.IsNullOrEmpty(e.EmailReply))
+ {
+ replyTo = ConfigurationManager.AppSettings["SystemEmail"];
+ }
+ else
+ {
+ replyTo = e.EmailReply;
+ }
+
+ es.Send(
+ subject,
+ body,
+ new List { email }, // to
+ new List { e.EmailCC }, // CC
+ new List { ConfigurationManager.AppSettings["SystemEmail"], e.EmailBCC }, // Allways send BCC to SystemEmail + additional set
+ new List { replyTo }
+ );
+
+ }
+
#endregion
#region Xml to DataTable
@@ -153,6 +223,7 @@ public ActionResult OnSelectTreeViewItem(long id)
private DataTable GetEventResults(long eventId)
{
DataTable results = new DataTable();
+ results.Columns.Add("Id");
results.Columns.Add("Deleted");
using (EventRegistrationManager erManager = new EventRegistrationManager())
@@ -169,7 +240,7 @@ private DataTable GetEventResults(long eventId)
foreach (EventRegistration er in eventRegistrations)
{
XmlNodeReader xmlNodeReader = new XmlNodeReader(er.Data);
- results.Rows.Add(AddDataRow(XElement.Load(xmlNodeReader), results, er.Deleted.ToString()));
+ results.Rows.Add(AddDataRow(XElement.Load(xmlNodeReader), results, er.Deleted.ToString(), er.Id));
xmlNodeReader.Dispose();
}
}
@@ -177,6 +248,34 @@ private DataTable GetEventResults(long eventId)
return results;
}
+ private DataTable GetWaitingListResults(long eventId)
+ {
+ DataTable results = new DataTable();
+ results.Columns.Add("Id");
+ results.Columns.Add("Deleted");
+ results.Columns.Add("Action");
+
+ using (EventRegistrationManager erManager = new EventRegistrationManager())
+ {
+ List eventRegistrations = erManager.GetAllWaitingListRegsByEvent(eventId);
+
+ if (eventRegistrations.Count != 0)
+ {
+ XmlNodeReader xmlNodeReader = new XmlNodeReader(eventRegistrations[0].Data);
+ results = CreateDataTableColums(results, XElement.Load(xmlNodeReader));
+ xmlNodeReader.Dispose();
+ }
+
+ foreach (EventRegistration er in eventRegistrations)
+ {
+ XmlNodeReader xmlNodeReader = new XmlNodeReader(er.Data);
+ results.Rows.Add(AddDataRow(XElement.Load(xmlNodeReader), results, er.Deleted.ToString(), er.Id));
+ xmlNodeReader.Dispose();
+ }
+ }
+
+ return results;
+ }
//private DataTable GetEventRegistration(long eventId, XDocument data)
//{
// DataTable results = new DataTable();
@@ -210,9 +309,10 @@ private DataTable CreateDataTableColums(DataTable dataTable, XElement x)
return dt;
}
- private DataRow AddDataRow(XElement x, DataTable dt, string deleted)
+ private DataRow AddDataRow(XElement x, DataTable dt, string deleted, long id)
{
DataRow dr = dt.NewRow();
+ dr["Id"] = id;
dr["Deleted"] = deleted;
foreach (XElement xe in x.Descendants())
{
diff --git a/Entities/BExIS.Emm.Entities/Events/Event.cs b/Entities/BExIS.Emm.Entities/Events/Event.cs
index 1c6e6e1..c510a06 100644
--- a/Entities/BExIS.Emm.Entities/Events/Event.cs
+++ b/Entities/BExIS.Emm.Entities/Events/Event.cs
@@ -29,8 +29,14 @@ public class Event : BusinessEntity
public virtual int ParticipantsLimitation { get; set; }
+ public virtual bool WaitingList { get; set; }
+
+ public virtual int WaitingListLimitation { get; set; }
+
public virtual bool EditAllowed { get; set; }
+ public virtual bool Closed { get; set; }
+
public virtual string LogInPassword { get; set; }
public virtual string EmailBCC { get; set; }
diff --git a/Entities/BExIS.Emm.Entities/Events/EventRegistration.cs b/Entities/BExIS.Emm.Entities/Events/EventRegistration.cs
index 3b6e37c..ff00440 100644
--- a/Entities/BExIS.Emm.Entities/Events/EventRegistration.cs
+++ b/Entities/BExIS.Emm.Entities/Events/EventRegistration.cs
@@ -19,6 +19,11 @@ public class EventRegistration : BusinessEntity
public virtual string Token { get; set; }
+ public virtual bool WaitingList { get; set; }
+
+ public virtual DateTime InsertDate { get; set; }
+
+
#endregion
#region Associations
diff --git a/Helper/EmailHelper.cs b/Helper/EmailHelper.cs
index 426fff0..ebca672 100644
--- a/Helper/EmailHelper.cs
+++ b/Helper/EmailHelper.cs
@@ -24,6 +24,7 @@ public class EmailStructure
{
public string lableFirstName { get; set; }
public string lableLastname { get; set; }
+ public string lableEmail { get; set; }
public string succesfullyRegisteredSubject { get; set; }
public string succesfullyRegisteredMessage { get; set; }
public string waitingListSubject { get; set; }
@@ -35,6 +36,11 @@ public class EmailStructure
public string bodyHintToLink { get; set; }
public string bodyClosing { get; set; }
public string bodyClosingName { get; set; }
+ public string removeFromWaitingListSubject { get; set; }
+ public string removeFromWaitingList1 { get; set; }
+ public string deletedSubject { get; set; }
+ public string deletedMessage { get; set; }
+
public EmailStructure()
{
diff --git a/Models/EventModel.cs b/Models/EventModel.cs
index ad92b2d..fa0869b 100644
--- a/Models/EventModel.cs
+++ b/Models/EventModel.cs
@@ -41,9 +41,16 @@ public class EventModel
[DisplayName("Participants limitation")]
public int ParticipantsLimitation { get; set; }
+ [DisplayName("Allow waiting list")]
+ public bool WaitingList { get; set; }
+
+ [DisplayName("Waiting list limitation")]
+ public int WaitingListLimitation { get; set; }
+
[DisplayName("Allow edit")]
public bool EditAllowed { get; set; }
+ public bool Closed { get; set; }
public bool EditMode { get; set; }
[DisplayName("Event password")]
@@ -97,6 +104,9 @@ public EventModel(Event eEvent)
StartDate = eEvent.StartDate;
Deadline = eEvent.Deadline;
ParticipantsLimitation = eEvent.ParticipantsLimitation;
+ WaitingList = eEvent.WaitingList;
+ WaitingListLimitation = eEvent.WaitingListLimitation;
+ Closed = eEvent.Closed;
//if (eEvent.ParticipantsLimitation == 0)
// ParticipantsLimitation = "no limitation";
diff --git a/Models/EventRegistrationModel.cs b/Models/EventRegistrationModel.cs
index 58e0790..148390b 100644
--- a/Models/EventRegistrationModel.cs
+++ b/Models/EventRegistrationModel.cs
@@ -12,26 +12,57 @@ namespace BExIS.Modules.EMM.UI.Models
{
///
- /// The EventRegistrationModel represent all informatio ehich are needed to handel a event registration.
+ /// The EventRegistrationModel represent all information which are needed to handel a event registration.
///
///
public class EventRegistrationModel
{
public EventModel Event { get; set; }
- public string Participants { get; set; } //number of participants limitation
-
- public int NumberOfRegistration { get; set; } //number of already registered participants
-
- public bool EditAllowed { get; set; } // edit allowed by user
-
- public bool AlreadyRegistered { get; set; } //user already registered, this will find out via user email
-
- public bool Deleted { get; set; } //is registration deleted by user
-
- public string AlreadyRegisteredRefId { get; set; } //Already registered RefId
-
- public string Message { get; set; } //
+ ///
+ /// Number of participants limitation
+ ///
+ public string Participants { get; set; }
+
+ ///
+ /// Number of already registered participants
+ ///
+ public int NumberOfRegistration { get; set; }
+
+ ///
+ /// Number of already registered participants on waiting list
+ ///
+ public int NrOfRegistrationWaitingList { get; set; }
+
+ ///
+ /// edit allowed by user
+ ///
+ public bool EditAllowed { get; set; }
+
+ ///
+ /// user already registered, this will find out via user email
+ ///
+ public bool AlreadyRegistered { get; set; }
+
+ ///
+ /// is registration deleted by user
+ ///
+ public bool Deleted { get; set; }
+
+ ///
+ ///true if ParticipantsLimitation and WaitingListLimitation is reached
+ ///
+ public bool Closed { get; set; }
+
+ ///
+ ///Already registered RefId
+ ///
+ public string AlreadyRegisteredRefId { get; set; }
+
+ ///
+ ///
+ ///
+ //public string Message { get; set; }
public EventRegistrationModel()
{
@@ -43,10 +74,6 @@ public EventRegistrationModel(Event e)
Event = new EventModel(e);
EditAllowed = e.EditAllowed;
- using (EventRegistrationManager erManger = new EventRegistrationManager())
- {
- NumberOfRegistration = erManger.GetAllRegistrationsNotDeletedByEvent(e.Id).Count;
- }
}
}
@@ -100,6 +127,7 @@ public class EventRegistrationResultModel
public long EventId { get; set; }
public XmlDocument Form { get; set; }
public DataTable Results { get; set; }
+ public DataTable WaitingListResults { get; set; }
public bool UserHasRights { get; set; }
public EventRegistrationResultModel()
diff --git a/Orm/BExIS.Emm.Orm.NH/Mappings/Default/Event/Event.hbm.xml b/Orm/BExIS.Emm.Orm.NH/Mappings/Default/Event/Event.hbm.xml
index 22c2dcf..5d50712 100644
--- a/Orm/BExIS.Emm.Orm.NH/Mappings/Default/Event/Event.hbm.xml
+++ b/Orm/BExIS.Emm.Orm.NH/Mappings/Default/Event/Event.hbm.xml
@@ -83,10 +83,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Orm/BExIS.Emm.Orm.NH/Mappings/Default/Event/EventRegistration.hbm.xml b/Orm/BExIS.Emm.Orm.NH/Mappings/Default/Event/EventRegistration.hbm.xml
index c90a3ab..ced7524 100644
--- a/Orm/BExIS.Emm.Orm.NH/Mappings/Default/Event/EventRegistration.hbm.xml
+++ b/Orm/BExIS.Emm.Orm.NH/Mappings/Default/Event/EventRegistration.hbm.xml
@@ -31,6 +31,14 @@
+
+
+
+
+
+
+
+
diff --git a/Services/BExIS.Emm.Services/Event/EventManager.cs b/Services/BExIS.Emm.Services/Event/EventManager.cs
index fcac2f2..68cd3ee 100644
--- a/Services/BExIS.Emm.Services/Event/EventManager.cs
+++ b/Services/BExIS.Emm.Services/Event/EventManager.cs
@@ -72,7 +72,7 @@ public E.Event GetEventById(long id)
///
/// Creates an EventRegistration and persists the entity in the database.
///
- public E.Event CreateEvent(string name, string eventDate, string importantInformation, string mailInformation, string eventLanguage, DateTime startDate, DateTime deadline, int participantsLimitation, bool editAllowed, string logInPassword, string emailBCC, string emailCC, string emailReply, MetadataStructure metadataStructure, string javaScriptPath)
+ public E.Event CreateEvent(string name, string eventDate, string importantInformation, string mailInformation, string eventLanguage, DateTime startDate, DateTime deadline, int participantsLimitation, bool waitingList, int waitingListLimitation, bool editAllowed, bool closed, string logInPassword, string emailBCC, string emailCC, string emailReply, MetadataStructure metadataStructure, string javaScriptPath)
{
E.Event newEvent = new E.Event();
newEvent.Name = name;
@@ -84,7 +84,10 @@ public E.Event CreateEvent(string name, string eventDate, string importantInform
newEvent.StartDate = startDate;
newEvent.Deadline = deadline;
newEvent.ParticipantsLimitation = participantsLimitation;
+ newEvent.WaitingList = waitingList;
+ newEvent.WaitingListLimitation = waitingListLimitation;
newEvent.EditAllowed = editAllowed;
+ newEvent.Closed = closed;
newEvent.LogInPassword = logInPassword;
newEvent.EmailBCC = emailBCC;
newEvent.EmailCC = emailCC;
diff --git a/Services/BExIS.Emm.Services/Event/EventRegistrationManager.cs b/Services/BExIS.Emm.Services/Event/EventRegistrationManager.cs
index 52d319c..617087f 100644
--- a/Services/BExIS.Emm.Services/Event/EventRegistrationManager.cs
+++ b/Services/BExIS.Emm.Services/Event/EventRegistrationManager.cs
@@ -58,7 +58,7 @@ protected virtual void Dispose(bool disposing)
///
/// Creates an EventRegistration and persists the entity in the database.
///
- public E.EventRegistration CreateEventRegistration(XmlDocument data, E.Event e, User user, bool deleted, string token)
+ public E.EventRegistration CreateEventRegistration(XmlDocument data, E.Event e, User user, bool deleted, string token, bool waitingList, DateTime insertDate)
{
E.EventRegistration eventRegistration = new E.EventRegistration();
eventRegistration.Data = data;
@@ -66,6 +66,8 @@ public E.EventRegistration CreateEventRegistration(XmlDocument data, E.Event e,
eventRegistration.Event = e;
eventRegistration.Person = user;
eventRegistration.Token= token;
+ eventRegistration.WaitingList = waitingList;
+ eventRegistration.InsertDate = insertDate;
using (IUnitOfWork uow = this.GetUnitOfWork())
{
@@ -113,9 +115,22 @@ public E.EventRegistration UpdateEventRegistration(E.EventRegistration eventRegi
public List GetAllRegistrationsByEvent(long id)
{
- return EventRegistrationRepo.Query(a=>a.Event.Id == id).ToList();
+ return EventRegistrationRepo.Query(a=>a.Event.Id == id && a.WaitingList == false).ToList();
}
+ public List GetAllWaitingListRegsByEvent(long id)
+ {
+ return EventRegistrationRepo.Query(a => a.Event.Id == id && a.WaitingList == true && a.Deleted == false).ToList();
+ }
+
+ public E.EventRegistration GetLatestWaitingListEntry(long id)
+ {
+ var lastestDates = EventRegistrationRepo.Query(d=>d.Event.Id == id && d.WaitingList == true).ToList();
+ var date = lastestDates.Max(a => a.InsertDate);
+ return EventRegistrationRepo.Query(a => a.Event.Id == id && a.WaitingList == true && a.InsertDate == date).FirstOrDefault();
+ }
+
+
public List GetAllRegistrationsNotDeletedByEvent(long id)
{
return EventRegistrationRepo.Query(a => a.Event.Id == id && a.Deleted == false).ToList();
diff --git a/Views/Event/EditEvent.cshtml b/Views/Event/EditEvent.cshtml
index f72b7da..5fe1335 100644
--- a/Views/Event/EditEvent.cshtml
+++ b/Views/Event/EditEvent.cshtml
@@ -111,10 +111,22 @@
@(Html.Telerik().IntegerTextBoxFor(m => m.ParticipantsLimitation)
- .MinValue(0)
- .MaxValue(Int32.MaxValue)
- .Value(Model.ParticipantsLimitation)
- .HtmlAttributes(new { tabindex = "2", style = "border-width: 2px; height: 30px;" })
+ .HtmlAttributes(new { tabindex = "2", style = "border-width: 2px; height: 30px;" })
+ )
+ |
+
+
+ | @Html.LabelFor(m => m.WaitingList) |
+ @Html.CheckBoxFor(m => m.WaitingList, new { @class = "js-switch" }) |
+
+
+ |
+ *
+ @Html.LabelFor(m => m.WaitingListLimitation)
+ |
+
+ @(Html.Telerik().IntegerTextBoxFor(m => m.WaitingListLimitation)
+ .HtmlAttributes(new { tabindex = "2", style = "border-width: 2px; height: 30px;" })
)
|
@@ -182,6 +194,10 @@
@Html.ValidationMessage("EmailReply")
+
+ | @Html.LabelFor(m => m.Closed) |
+ @Html.CheckBoxFor(m => m.Closed, new { @class = "js-switch" }) |
+
diff --git a/Views/Event/EventManager.cshtml b/Views/Event/EventManager.cshtml
index 91f6601..24dc8a5 100644
--- a/Views/Event/EventManager.cshtml
+++ b/Views/Event/EventManager.cshtml
@@ -1,5 +1,4 @@
-@using Telerik.Web.Mvc.UI
-@using BExIS.Modules.EMM.UI.Models;
+@using BExIS.Modules.EMM.UI.Models;
@model List
@@ -11,106 +10,57 @@
}
-@{
- GridPagerStyles pagerStyles = GridPagerStyles.PageSizeDropDown;
- pagerStyles |= GridPagerStyles.NextPreviousAndNumeric;
- pagerStyles |= GridPagerStyles.Numeric;
-}
-
@Html.ActionLink("Create new Event", "Create", "Event", new { @class = "bx-button function" })
-@(Html.Telerik().Grid(Model)
- .Name("Grid_Event")
- .DataKeys(keys =>
- {
- keys.Add(r => r.Id);
- })
- .Columns(columns =>
- {
-
- columns.Bound(r => r.Id).Width(90);
- columns.Bound(r => r.Name);
- columns.Bound(r => r.ParticipantsLimitation) ;
- columns.Bound(r => r.StartDate).Format("{0: dd-MM-yyyy}");
- columns.Bound(r => r.Deadline).Format("{0: dd-MM-yyyy}"); ;
- columns.Bound(r => r.EditAllowed);
- columns.Template(
- @
- @if (!item.InUse)
- {
-
-
- }
- else
- {
-
- }
+
+
+
+
+ | Id |
+ Event name |
+ Participants limitation |
+ Start date |
+ Deadline |
+ Allow edit |
+ Actions |
+
+
+
+ @for (int i = 0; i < Model.Count; i++)
+ {
+
+ | @Model[i].Id |
+ @Model[i].Name |
+ @Model[i].ParticipantsLimitation |
+ @Model[i].StartDate.ToString("dd-MM-yyyy") |
+ @Model[i].Deadline.ToString("dd-MM-yyyy") |
+
+ @if (Model[i].EditAllowed)
+ {
+
+ }
+ else
+ {
+
+ }
-
- ).Title(" ")
- .ClientTemplate(
- "" +
- " \">" +
- " " +
- " " +
- " " +
- " " +
- " " +
- " "
+ |
+
+
+
+ |
+
+ }
+
- ).Width(90);
- })
- .ClientEvents(clientevents => clientevents
- .OnDataBound("onDataBound")
- )
- .DataBinding(databinding => databinding
- .Ajax()
- .Select("AllEvents", "Event")
- )
- .Pageable(paging =>
- paging
- .Style(pagerStyles)
- .PageSize(50)
- .Position(GridPagerPosition.Both)
- )
- .Filterable()
- .Sortable(sortable => sortable
- .OrderBy(orderby => orderby
- .Add(r => r.Deadline).Descending()))
-)
+
\ No newline at end of file
+
diff --git a/Views/EventRegistration/AvailableEventsList.cshtml b/Views/EventRegistration/AvailableEventsList.cshtml
index a9e5fb1..8f3818b 100644
--- a/Views/EventRegistration/AvailableEventsList.cshtml
+++ b/Views/EventRegistration/AvailableEventsList.cshtml
@@ -11,70 +11,68 @@
-->
}
-@{
- GridPagerStyles pagerStyles = GridPagerStyles.PageSizeDropDown;
- pagerStyles |= GridPagerStyles.NextPreviousAndNumeric;
- pagerStyles |= GridPagerStyles.Numeric;
-}
-
@ViewBag.Message
-@(Html.Telerik().Grid(Model)
- .Name("Events")
- .Columns(columns =>
- {
- columns.Template(
- @
- @if (item.AlreadyRegistered == false || item.Deleted == true)
- {
- Register
- }
-
-
- @if (item.EditAllowed && item.AlreadyRegistered == true && item.Deleted == false && item.Event.Deadline >= DateTime.Now)
+
+
+
+ | Actions |
+ Event name |
+ Deadline |
+ Participant number |
+
+
+
+ @for(int i = 0; i < Model.Count; i++)
+ {
+
+ |
+ @if (Model[i].Closed)
+ {
+ Booked out
+ }
+ else if (Model[i].AlreadyRegistered == false || Model[i].Deleted == true)
+ {
+ Register
+ }
+
+
+ @if (Model[i].EditAllowed && Model[i].AlreadyRegistered == true && Model[i].Deleted == false && Model[i].Event.Deadline >= DateTime.Now)
{
-
-
+
+
- }
- else if (item.AlreadyRegistered == true && item.Deleted == false)
+ }
+ else if (Model[i].AlreadyRegistered == true && Model[i].Deleted == false)
{
-
-
+
+
}
-
- ).Width(150);
- columns.Bound(r => r.Event.Name);
- columns.Bound(r => r.Event.Deadline).Format("{0: dd-MM-yyyy}").Width(200);
- columns.Template(
- @
- @item.NumberOfRegistration/
- @if (item.Event.ParticipantsLimitation == 0)
- {
- no limitation
- }
- else {
- @item.Event.ParticipantsLimitation
- }
-
- ).Width(150);
- //columns.Bound(r => r.Event.ParticipantsLimitation);
- })
- .Pageable(paging =>
- paging
- .Style(pagerStyles)
- .PageSize(50)
- .Position(GridPagerPosition.Both)
- )
- .Filterable()
- //.Sortable(sortable => sortable
- // .OrderBy(orderby => orderby
- // .Add(r => r.Id).Descending()))
-)
+ |
+
+ @Model[i].Event.Name
+ |
+
+ @Model[i].Event.Deadline.ToString("dd-MM-yyyy")
+ |
+
+ @Model[i].NumberOfRegistration/
+ @if(Model[i].Event.ParticipantsLimitation == 0)
+ {
+ no limitation
+ }
+ else
+ {
+ @Model[i].Event.ParticipantsLimitation
+ }
+ |
+
+ }
+
+
+
+
@(Html.Telerik().Window()
.Name("Window_LogInToEvent")
.Title("Event registration")
@@ -94,10 +92,10 @@
diff --git a/Views/EventRegistrationResult/EventRegistrationResults.cshtml b/Views/EventRegistrationResult/EventRegistrationResults.cshtml
index 615f6b5..eebf3ea 100644
--- a/Views/EventRegistrationResult/EventRegistrationResults.cshtml
+++ b/Views/EventRegistrationResult/EventRegistrationResults.cshtml
@@ -19,38 +19,79 @@
{
if (Model.UserHasRights)
{
-
-
-
- @for (int c = 0; c < Model.Results.Columns.Count; c++)
- {
- |
- @Model.Results.Columns[c].ColumnName
- |
- }
-
-
-
- @for (int i = 0; i < Model.Results.Rows.Count; i++)
- {
-
- @for (int c = 0; c < Model.Results.Columns.Count; c++)
- {
- |
- @Model.Results.Rows[i][c].ToString()
- |
-
- }
-
- }
-
-
-
-
-
+
+
+
+ @for (int c = 0; c < Model.Results.Columns.Count; c++)
+ {
+ |
+ @Model.Results.Columns[c].ColumnName
+ |
+ }
+
+
+
+ @for (int i = 0; i < Model.Results.Rows.Count; i++)
+ {
+
+ @for (int c = 0; c < Model.Results.Columns.Count; c++)
+ {
+ |
+ @Model.Results.Rows[i][c].ToString()
+ |
+
+ }
+
+ }
+
+
+
@Html.ActionLink("Export (csv)", "Export", "EventRegistrationResult", new { id = Model.EventId }, new { @class = "bx-button function" })
Delete
+
+ if (Model.WaitingListResults.Rows.Count > 0)
+ {
+ Waiting list
+
+
+
+ @for (int c = 0; c < Model.WaitingListResults.Columns.Count; c++)
+ {
+ |
+ @Model.WaitingListResults.Columns[c].ColumnName
+ |
+ }
+
+
+
+ @for (int i = 0; i < Model.WaitingListResults.Rows.Count; i++)
+ {
+
+ @for (int c = 0; c < Model.WaitingListResults.Columns.Count; c++)
+ {
+ if (Model.WaitingListResults.Columns[c].ColumnName == "Action")
+ {
+ |
+ @Html.ActionLink("Move", "MoveFromWaitingList", "EventRegistrationResult", new { id = Model.WaitingListResults.Rows[i][0], eventId = Model.EventId }, new { @class = "bx bx-grid-function"})
+ |
+ }
+ else
+ {
+
+ @Model.WaitingListResults.Rows[i][c].ToString()
+ |
+ }
+
+ }
+
+ }
+
+
+
+
+ }
+
}
else
{
@@ -72,6 +113,7 @@
$(document).ready(function () {
$('#regResults').DataTable();
+ $('#regWaitingListResults').DataTable();
});