Exemplo n.º 1
0
    protected void SupportTicketButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (Member.IsLogged)
            {
                var ticket = new SupportTicket(Convert.ToInt32(Request.QueryString["ticketId"]));
                var InText = InputChecker.HtmlEncode(SupportTicketTextBox.Text, SupportTicketTextBox.MaxLength, U5004.MESSAGE);

                ticket.ReplyFromMember(InText);
                ticket.IsSolved = false;
                ticket.Date     = DateTime.Now;
                ticket.Save();
                SuccMessage.Text = U3501.SUPPSENT;

                TicketLiteral.Text = SupportTicketReply.GetAllTicketRepliesHtml(ticket.Id, Member.Current, true);

                //Clear the fields
                ErrorMessagePanel.Visible = false;
                SupportTicketTextBox.Text = "";
            }
        }
        catch (MsgException ex)
        {
            ErrorMessagePanel.Visible = true;
            ErrorMessage.Text         = ex.Message;
        }
        catch (Exception ex)
        {
            ErrorLogger.Log(ex);
        }
    }
Exemplo n.º 2
0
    protected void SendMessageButton_Click(object sender, EventArgs e)
    {
        ErrorMessagePanel.Visible = false;
        SuccMessagePanel.Visible  = false;

        if (Page.IsValid)
        {
            AppSettings.Email.Reload();

            try
            {
                var InText = InputChecker.HtmlEncode(MessageText.Text, MessageText.MaxLength, U5004.MESSAGE);
                if (Member.IsLogged)
                {
                    string Title = (InText.Length > 41) ? InText.Substring(0, 40) : InText;
                    string BrowserPlatformInfo = Request.Browser.Browser + Request.Browser.Version + " " + Request.Browser.Platform;
                    string name        = AppSettings.SupportTickets.InsertNameWhenCreatingTicketsEnabled ? FullNameTextBox.Text : String.Empty;
                    string phoneNumber = AppSettings.SupportTickets.InsertPhoneWhenCreatingTicketsEnabled ? CountryCodeTextBox.Text + PhoneNumberTextBox.Text : String.Empty;
                    BrowserPlatformInfo = (BrowserPlatformInfo.Length > 49) ? BrowserPlatformInfo.Substring(0, 49) : BrowserPlatformInfo;

                    name        = InputChecker.HtmlEncode(name, name.Length, L1.NAME);
                    phoneNumber = InputChecker.HtmlEncode(phoneNumber, 100, U4200.PHONE);

                    int departmentId = 1;

                    if (AppSettings.SupportTickets.TicketDepartmentsEnabled)
                    {
                        departmentId = Convert.ToInt32(TicketDepartmentsButtonList.SelectedValue);
                    }

                    var newTicket = new SupportTicket(Member.Current, Title, Mailer.ReplaceNewLines(InText), departmentId, BrowserPlatformInfo, name, phoneNumber);
                    newTicket.IsRead = true;
                    newTicket.Save();

                    Response.Redirect("/sites/tickets.aspx");
                    SuccMessage.Text = U3501.SUPPSENT;
                }
                else
                {
                    Mailer.SendContactMessage(Email.Text, MessageText.Text);
                    SuccMessage.Text = U3501.MESSAGESENT;
                }

                SuccMessagePanel.Visible = true;
                //SuccMessage.Text = L1.OP_SUCCESS;

                //Clear the fields
                ErrorMessagePanel.Visible = false;
                MessageText.Text          = "";
                Email.Text = "";
            }
            catch (MsgException ex)
            {
                ErrorMessagePanel.Visible = true;
                ErrorMessage.Text         = ex.Message;
            }
            catch (Exception ex)
            {
                ErrorLogger.Log(ex);
            }
        }
    }