Skip to content

Commit a1ba7da

Browse files
Edit user registration for admins done #72
1 parent 3ec9d42 commit a1ba7da

2 files changed

Lines changed: 92 additions & 1 deletion

File tree

Controllers/EventRegistrationResultController.cs

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using BExIS.Emm.Entities.Event;
1+
using BExIS.Dcm.CreateDatasetWizard;
2+
using BExIS.Dcm.Wizard;
3+
using BExIS.Emm.Entities.Event;
24
using BExIS.Emm.Services.Event;
35
using BExIS.IO.Transform.Output;
46
using BExIS.Modules.EMM.UI.Helper;
@@ -29,6 +31,8 @@ namespace BExIS.Modules.EMM.UI.Controllers
2931
public class EventRegistrationResultController : Controller
3032
{
3133

34+
private CreateTaskmanager TaskManager;
35+
3236
#region Show Event Registration Results
3337

3438
public ActionResult Show()
@@ -216,6 +220,85 @@ private void SendNotification(XmlDocument data, Event e)
216220

217221
}
218222

223+
#endregion
224+
225+
#region edit event registration
226+
227+
public ActionResult LoadForm(long id, long eventid)
228+
{
229+
using (EventManager eManager = new EventManager())
230+
{
231+
Event e = eManager.EventRepo.Get(eventid);
232+
233+
//add default value to session
234+
DefaultEventInformation defaultEventInformation = new DefaultEventInformation();
235+
defaultEventInformation.EventName = e.Name;
236+
defaultEventInformation.Id = e.Id.ToString();
237+
if (!String.IsNullOrEmpty(e.EventDate))
238+
defaultEventInformation.Date = e.EventDate;
239+
if (!String.IsNullOrEmpty(e.EventLanguage))
240+
defaultEventInformation.Language = e.EventLanguage;
241+
242+
if (!String.IsNullOrEmpty(e.ImportantInformation))
243+
defaultEventInformation.ImportantInformation = e.ImportantInformation;
244+
245+
Session["DefaultEventInformation"] = defaultEventInformation;
246+
247+
//CreateTaskmanager taskManager = new CreateTaskmanager();
248+
if (TaskManager == null)
249+
TaskManager = new CreateTaskmanager();
250+
251+
TaskManager.AddToBus(CreateTaskmanager.METADATASTRUCTURE_ID, e.MetadataStructure.Id);
252+
TaskManager.AddToBus(CreateTaskmanager.ENTITY_ID, e.Id);
253+
254+
using (EventRegistrationManager erManager = new EventRegistrationManager())
255+
{
256+
257+
EventRegistration reg = erManager.EventRegistrationRepo.Get(a => a.Id == id).FirstOrDefault();
258+
XmlNodeReader xmlNodeReader = new XmlNodeReader(reg.Data);
259+
TaskManager.AddToBus(CreateTaskmanager.METADATA_XML, reg.Data);
260+
xmlNodeReader.Dispose();
261+
}
262+
263+
}
264+
265+
TaskManager.AddToBus(CreateTaskmanager.SAVE_WITH_ERRORS, false);
266+
267+
TaskManager.AddToBus(CreateTaskmanager.NO_IMPORT_ACTION, true);
268+
TaskManager.AddToBus(CreateTaskmanager.INFO_ON_TOP_TITLE, "Event registration");
269+
TaskManager.AddToBus(CreateTaskmanager.INFO_ON_TOP_DESCRIPTION, "<p><b>help</b></p>");
270+
271+
272+
Session["EventRegistrationTaskmanager"] = TaskManager;
273+
274+
setAdditionalFunctions();
275+
276+
return new EmptyResult();
277+
278+
}
279+
private void setAdditionalFunctions()
280+
{
281+
CreateTaskmanager taskManager = (CreateTaskmanager)Session["EventRegistrationTaskmanager"];
282+
283+
284+
ActionInfo submitAction = new ActionInfo();
285+
submitAction.ActionName = "Save";
286+
submitAction.ControllerName = "EventRegistration";
287+
submitAction.AreaName = "EMM";
288+
289+
ActionInfo cancelAction = new ActionInfo();
290+
cancelAction.ActionName = "Cancel";
291+
cancelAction.ControllerName = "EventRegistration";
292+
cancelAction.AreaName = "EMM";
293+
294+
taskManager.Actions.Add(CreateTaskmanager.SUBMIT_ACTION, submitAction);
295+
taskManager.Actions.Add(CreateTaskmanager.CANCEL_ACTION, cancelAction);
296+
297+
Session["EventRegistrationTaskmanager"] = taskManager;
298+
299+
}
300+
301+
219302
#endregion
220303

221304
#region Xml to DataTable

Views/EventRegistrationResult/EventRegistrationResults.cshtml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
@Model.Results.Columns[c].ColumnName
2929
</th>
3030
}
31+
<th>Actions</th>
3132
</tr>
3233
</thead>
3334
<tbody>
@@ -41,6 +42,7 @@
4142
</td>
4243

4344
}
45+
<td><div onclick="onClickEdit(@Model.Results.Rows[0][i].ToString(), @Model.EventId)" class="bx bx-grid-function bx-edit" style="cursor: pointer;" title="Edit registration"></div></td>
4446
</tr>
4547
}
4648

@@ -138,4 +140,10 @@
138140
}
139141
}
140142
143+
function onClickEdit(id, eventid) {
144+
$.get('@Url.Action("LoadForm", "EventRegistrationResult", new RouteValueDictionary { { "area", "EMM" } })', { id: id, eventid: eventid }, function (data) {
145+
window.location.href = "/EMM/EventRegistration/LoadMetadataForm?edit=true";
146+
});
147+
}
148+
141149
</script>

0 commit comments

Comments
 (0)