Exemplo n.º 1
0
        public void MakeTicket()
        {
            TicketProcess ticketProcess = new TicketProcess();

            int count = ticketProcess.GetTickets().Count;

            Ticket ticket = new Ticket();

            ticket.SenderName    = "Sender";
            ticket.SenderAddress = "*****@*****.**";
            ticket.Subject       = "Subject";
            ticket.Body          = "Body";
            ticket.Source        = new Source()
            {
                Provider         = "System.Data.SqlClient",
                Value            = "select top 1000 userName as name, userEmail as address from Member where userEmail like '*****@*****.**'",
                ConnectionString = "Data Source=tiger02;Initial Catalog=ALToolsMember;Integrated Security=False;User Id=svcinfra;Password=dkdlvhsy10;MultipleActiveResultSets=True"
            };


            string fileName = string.Empty;

            ticketProcess.SaveTicket(ticket);

            Assert.IsTrue(Directory.GetFiles(PathInfo.Ticket).Length == ++count);

            ticketProcess = new TicketProcess();

            Assert.IsTrue(ticketProcess.GetTickets().Count > 0);
        }
Exemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Ticket ticket = new Ticket();

            ticket.SenderName    = txtSenderName.Text.Trim();
            ticket.SenderAddress = txtSenderAddress.Text.Trim();

            if (rdoRecipeints.SelectedIndex >= 0)
            {
                ticket.Source = sourceList[rdoRecipeints.SelectedValue];
            }
            else
            {
                List <string> recipients = new List <string>();
                foreach (string r in txtRecipientAddress.Text.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    recipients.Add(r.Trim());
                }

                ticket.Source = new Source
                {
                    Provider         = "System.String[]",
                    Value            = string.Join(";", recipients),
                    ConnectionString = "NODATA"
                };
            }

            ticket.Subject = txtSubject.Text.Trim();
            ticket.Body    = txtHtml.Text;

            TicketProcess ticketProcess = new TicketProcess();

            ticketProcess.SaveTicket(ticket); // TODO: check result is success?

            try
            {
                history.SetHistory(ticket);
                history.ClearHistory(100);
            }
            catch { }

            Response.Redirect("~/Logs.aspx", false);
        }