Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public IHttpContext ResponseAccountUpdate(IHttpContext context)
        {
            string payload = context.Request.Payload;

            Dictionary <string, string> args = MelBoxWeb.ReadPayload(payload);

            ReadGlobalFields(args);

            StringBuilder builder         = new StringBuilder();
            int           chosenContactId = MelBoxWeb.GetArgInt(args, "ContactId");

            if (!isAdmin && chosenContactId != logedInUserId)
            {
                builder.Append(MelBoxWeb.HtmlAlert(2, "Keine Berechtigung", "Sie haben keine Berechtigung den Benutzer zu ändern."));
            }
            else
            {
                builder.Append(MelBoxWeb.ProcessFormAccount(args, false));
            }

            if (logedInUserId != 0)
            {
                DataTable dt;
                if (isAdmin)
                {
                    dt = Program.Sql.GetViewContactInfo();
                }
                else
                {
                    dt = Program.Sql.GetViewContactInfo(chosenContactId);
                }

                DataTable dtCompany = Program.Sql.GetCompany();

                builder.Append(MelBoxWeb.HtmlFormAccount(dt, dtCompany, chosenContactId, isAdmin));
            }

#if DEBUG
            builder.Append("<p class='w3-pink w3-mobile'>" + payload + "</p>");
#endif
            context.Response.SendResponse(MelBoxWeb.HtmlCanvas(builder.ToString(), "Benutzerkonto ändern", logedInUserName));
            return(context);
        }
Exemplo n.º 3
0
        public IHttpContext ResponseCompanyDelete(IHttpContext context)
        {
            string payload = context.Request.Payload;

            Dictionary <string, string> args = MelBoxWeb.ReadPayload(payload);

            ReadGlobalFields(args);

            StringBuilder builder = new StringBuilder();

            if (!isAdmin)
            {
                builder.Append(MelBoxWeb.HtmlAlert(2, "Keine Berechtigung", "Sie haben keine Berechtigung den Firmeneintrag zu löschen."));
            }
            else
            {
                int companyId = MelBoxWeb.GetArgInt(args, "CompanyId");
                if (companyId != 0)
                {
                    string name = MelBoxWeb.GetArgStr(args, "Name");//.Replace('+', ' ');
                    if (!Program.Sql.DeleteCompany(companyId))
                    {
                        builder.Append(MelBoxWeb.HtmlAlert(2, "Fehler beim Löschen von Firma '" + name + "'", "Die Firma '" + name + "' konnte nicht aus der Datenbank gelöscht werden."));
                    }
                    else
                    {
                        builder.Append(MelBoxWeb.HtmlAlert(3, "Firma '" + name + "'gelöscht", "Die Firma '" + name + "' wurde aus der Datenbank gelöscht."));
                    }
                }
                else
                {
                    builder.Append(MelBoxWeb.HtmlAlert(1, "Ungültiger Aufruf", "Die Firmeninformationen konnten nicht zugewiesen werden."));
                }
            }
#if DEBUG
            builder.Append("<p class='w3-pink w3-mobile'>" + payload + "</p>");
#endif
            context.Response.SendResponse(MelBoxWeb.HtmlCanvas(builder.ToString(), "Firmenkonto löschen", logedInUserName));
            return(context);
        }
Exemplo n.º 4
0
        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);
        }