Ejemplo n.º 1
0
        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);
        }