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