public IHttpContext ResponseShift(IHttpContext context) { string payload = context.Request.Payload; Dictionary <string, string> args = MelBoxWeb.ReadPayload(payload); ReadGlobalFields(args); #region Tabelle anzeigen Dictionary <string, string> action = new Dictionary <string, string> { { "/shift/edit", "Bereitschaft bearbeiten" } }; if (isAdmin) { action.Add("/shift/delete", "Bereitschaft löschen"); } DataTable dt = Program.Sql.GetViewShift(); StringBuilder builder = new StringBuilder(); builder.Append(MelBoxWeb.HtmlTableShift(dt, 0, logedInUserId, isAdmin)); builder.Append(MelBoxWeb.HtmlEditor(action)); #endregion #if DEBUG builder.Append("<p class='w3-pink'>" + payload + "</p>"); #endif context.Response.SendResponse(MelBoxWeb.HtmlCanvas(builder.ToString(), dt.TableName, logedInUserName)); return(context); }
public IHttpContext ResponseIn(IHttpContext context) { string payload = context.Request.Payload; Dictionary <string, string> args = MelBoxWeb.ReadPayload(payload); ReadGlobalFields(args); Dictionary <string, string> action = new Dictionary <string, string>(); if (isAdmin) { action.Add("/blocked/create", "Ausgewählte Nachricht sperren"); } DataTable dt = Program.Sql.GetViewMsgRec(); StringBuilder builder = new StringBuilder(); builder.Append(MelBoxWeb.HtmlTablePlain(dt, isAdmin)); builder.Append(MelBoxWeb.HtmlEditor(action)); #if DEBUG builder.Append("<p class='w3-pink'>" + payload + "</p>"); #endif context.Response.SendResponse(MelBoxWeb.HtmlCanvas(builder.ToString(), dt.TableName, logedInUserName)); return(context); }
public IHttpContext ResponseBlockedDelete(IHttpContext context) { string payload = context.Request.Payload; Dictionary <string, string> args = MelBoxWeb.ReadPayload(payload); ReadGlobalFields(args); #region Inhalt ermitteln int contentId = 0; if (args.ContainsKey("selectedRow")) { int.TryParse(args["selectedRow"].ToString(), out contentId); } #endregion StringBuilder builder = new StringBuilder(); if (contentId == 0) { builder.Append(MelBoxWeb.HtmlAlert(1, "Fehler", "Die übergebene Nachricht konnte nicht zugeordnet werden.")); } else { if (!Program.Sql.DeleteMessageBlocked(contentId)) { builder.Append(MelBoxWeb.HtmlAlert(1, "Fehler Nachricht entsperren", "Die Nachricht mit der Nr. " + contentId + " konnte nicht aus der Sperrliste freigegeben werden.")); } else { builder.Append(MelBoxWeb.HtmlAlert(3, "Nachricht aus der Sperrliste genommen", "Die gesperrte Nachricht mit der Nr. " + contentId + " wurde durch '" + logedInUserName + "' wieder freigegeben.")); } } Dictionary <string, string> action = new Dictionary <string, string>(); if (isAdmin) { action.Add("/blocked/update", "Gesperrte Nachricht bearbeiten"); action.Add("/blocked/delete", "Aus Sperrliste entfernen"); } DataTable dt = Program.Sql.GetViewMsgBlocked(); builder.Append(MelBoxWeb.HtmlTableBlocked(dt, 0, isAdmin)); builder.Append(MelBoxWeb.HtmlEditor(action)); #if DEBUG builder.Append("<p class='w3-pink'>" + payload + "</p>"); #endif context.Response.SendResponse(MelBoxWeb.HtmlCanvas(builder.ToString(), dt.TableName, logedInUserName)); return(context); }
public IHttpContext ResponseBlockedCreate(IHttpContext context) { string payload = context.Request.Payload; Dictionary <string, string> args = MelBoxWeb.ReadPayload(payload); ReadGlobalFields(args); #region Inhalt ermitteln int recMsgId = MelBoxWeb.GetArgInt(args, "selectedRow"); int contentId = Program.Sql.GetContentId(recMsgId); #endregion StringBuilder builder = new StringBuilder(); if (contentId == 0) { builder.Append(MelBoxWeb.HtmlAlert(1, "Fehler", "Die übergebene Nachricht konnte nicht zugeordnet werden.")); } else { Program.Sql.InsertMessageBlocked(contentId); string msg = "Die Weiterleitung der Nachricht Nr. " + contentId + " wurde durch den Benutzer '" + logedInUserName + "' zu bestimmten Zeiten gesperrt."; builder.Append(MelBoxWeb.HtmlAlert(3, "Nachricht in die Sperrliste aufgenommen", msg)); Program.Sql.Log(MelBoxSql.LogTopic.Shift, MelBoxSql.LogPrio.Warning, msg); } Dictionary <string, string> action = new Dictionary <string, string>(); if (isAdmin) { action.Add("/blocked/update", "Gesperrte Nachricht bearbeiten"); action.Add("/blocked/delete", "Aus Sperrliste entfernen"); } DataTable dt = Program.Sql.GetViewMsgBlocked(); builder.Append(MelBoxWeb.HtmlTableBlocked(dt, 0, isAdmin)); builder.Append(MelBoxWeb.HtmlEditor(action)); #if DEBUG builder.Append("<p class='w3-pink'>" + payload + "</p>"); #endif context.Response.SendResponse(MelBoxWeb.HtmlCanvas(builder.ToString(), dt.TableName, logedInUserName)); return(context); }
public IHttpContext ResponseShiftCreateOrUpdate(IHttpContext context) { string payload = context.Request.Payload; Dictionary <string, string> args = MelBoxWeb.ReadPayload(payload); ReadGlobalFields(args); StringBuilder builder = new StringBuilder(); if (logedInUserId == 0) { builder.Append(MelBoxWeb.HtmlAlert(1, "Fehler", "Der eingeloggte Benutzer konnte nicht zugeordnet werden.")); } else { builder.Append(MelBoxWeb.ProcessFormShift(args, logedInUserId, isAdmin)); } #region Tabelle anzeigen Dictionary <string, string> action = new Dictionary <string, string> { { "/shift/edit", "Bereitschaft bearbeiten" } }; if (isAdmin) { action.Add("/shift/delete", "Bereitschaft löschen"); } DataTable dt = Program.Sql.GetViewShift(); builder.Append(MelBoxWeb.HtmlTableShift(dt, 0, logedInUserId, isAdmin)); builder.Append(MelBoxWeb.HtmlEditor(action)); #endregion #if DEBUG builder.Append("<p class='w3-pink'>" + payload + "</p>"); #endif context.Response.SendResponse(MelBoxWeb.HtmlCanvas(builder.ToString(), "Bereitschaft erstellen", logedInUserName)); return(context); }
public IHttpContext ResponseShiftDelete(IHttpContext context) { string payload = context.Request.Payload; Dictionary <string, string> args = MelBoxWeb.ReadPayload(payload); ReadGlobalFields(args); StringBuilder builder = new StringBuilder(); int shiftId = 0; if (args.ContainsKey("selectedRow")) { int.TryParse(args["selectedRow"].ToString(), out shiftId); } if (logedInUserId == 0) { builder.Append(MelBoxWeb.HtmlAlert(1, "Fehler", "Der eingeloggte Benutzer konnte nicht zugeordnet werden.")); } else if (!isAdmin) { builder.Append(MelBoxWeb.HtmlAlert(2, "Keine Berechtigung", "Sie besitzen nicht die notwendigen Rechte für diese Aktion.")); } else if (shiftId == 0) { builder.Append(MelBoxWeb.HtmlAlert(1, "Fehler Bereitschaft löschen", "Fehlerhafter Aufruf. Die zu löschende Bereitschaft konnte nicht zugeordnet werden.")); } else { if (!Program.Sql.DeleteShift(shiftId)) { builder.Append(MelBoxWeb.HtmlAlert(1, "Fehler Bereitschaft Nr. " + shiftId + " löschen", string.Format("Die Bereitschaft konnte nicht aus der Datenbank gelöscht werden."))); } else { string msg = string.Format("Die Bereitschaft Nr. {0} wurde durch den Benutzer '{1}' gelöscht.", shiftId, logedInUserName); builder.Append(MelBoxWeb.HtmlAlert(3, "Bereitschaft Nr. " + shiftId + " gelöscht", msg)); Program.Sql.Log(MelBoxSql.LogTopic.Shift, MelBoxSql.LogPrio.Warning, msg); } } #region Tabelle anzeigen Dictionary <string, string> action = new Dictionary <string, string> { { "/shift/edit", "Bereitschaft bearbeiten" } }; if (isAdmin) { action.Add("/shift/delete", "Bereitschaft löschen"); } DataTable dt = Program.Sql.GetViewShift(); builder.Append(MelBoxWeb.HtmlTableShift(dt, 0, logedInUserId, isAdmin)); builder.Append(MelBoxWeb.HtmlEditor(action)); #endregion #if DEBUG builder.Append("<p class='w3-pink'>" + payload + "</p>"); #endif context.Response.SendResponse(MelBoxWeb.HtmlCanvas(builder.ToString(), "Bereitschaft löschen", logedInUserName)); return(context); }
public IHttpContext ResponseBlockedUpdate(IHttpContext context) { string payload = context.Request.Payload; Dictionary <string, string> args = MelBoxWeb.ReadPayload(payload); ReadGlobalFields(args); #region Inhalt ermitteln int recMsgId = MelBoxWeb.GetArgInt(args, "selectedRow"); int beginHour = MelBoxWeb.GetArgInt(args, "Beginn"); int endHour = MelBoxWeb.GetArgInt(args, "Ende"); int contentId = recMsgId; #endregion StringBuilder builder = new StringBuilder(); if (args.ContainsKey("Beginn") && args.ContainsKey("Ende")) { //int beginHour = int.Parse(args["Beginn"].ToString()); //int endHour = int.Parse(args["Ende"].ToString()); MelBoxSql.BlockedDays days = MelBoxSql.BlockedDays.None; if (args.ContainsKey("Mo")) { days |= MelBoxSql.BlockedDays.Monday; } if (args.ContainsKey("Di")) { days |= MelBoxSql.BlockedDays.Tuesday; } if (args.ContainsKey("Mi")) { days |= MelBoxSql.BlockedDays.Wendsday; } if (args.ContainsKey("Do")) { days |= MelBoxSql.BlockedDays.Thursday; } if (args.ContainsKey("Fr")) { days |= MelBoxSql.BlockedDays.Friday; } if (args.ContainsKey("Sa")) { days |= MelBoxSql.BlockedDays.Saturday; } if (args.ContainsKey("So")) { days |= MelBoxSql.BlockedDays.Sunday; } if (Program.Sql.UpdateMessageBlocked(contentId, beginHour, endHour, days)) { builder.Append(MelBoxWeb.HtmlAlert(3, "Sperrzeiten geändert", "Die Sperrzeiten für Nachricht Nr. " + contentId + " wurden geändert.")); } else { builder.Append(MelBoxWeb.HtmlAlert(2, "Sperrzeiten nicht geändert", "Die Sperrzeiten für Nachricht Nr. " + contentId + " konnten nicht geändert werden.")); } } Dictionary <string, string> action = new Dictionary <string, string>(); if (isAdmin) { action.Add("/blocked/update", "Änderungen speichern"); action.Add("/blocked/delete", "Aus Sperrliste entfernen"); } DataTable dt = Program.Sql.GetViewMsgBlocked(); builder.Append(MelBoxWeb.HtmlTableBlocked(dt, contentId, isAdmin)); builder.Append(MelBoxWeb.HtmlEditor(action)); #if DEBUG builder.Append("<p class='w3-pink'>" + payload + "</p>"); #endif context.Response.SendResponse(MelBoxWeb.HtmlCanvas(builder.ToString(), dt.TableName, logedInUserName)); return(context); }