Exemplo n.º 1
0
        private async void SubmitButton_Click(object sender, RoutedEventArgs e)
        {
            var ticket   = new Ticket();
            var customer = new Customer();

            using (var Db = new HelpDeskDataContext())
            {
                try
                {
                    customer.Name       = CustomerList.Text;
                    ticket.DeviceType   = DeviceType.Text;
                    ticket.Customer     = customer;
                    ticket.SerialNumber = SerialNumberField.Text;
                    ticket.PartNumber   = PartNumberField.Text;
                    Db.Add(ticket);
                    Db.SaveChanges();
                    OutputTextBlock.Text = ticket.Id + " " + "Created.";
                }
                catch (Exception)
                {
                    var message = new MessageDialog("Error Ticket Not Created");
                    await message.ShowAsync();
                }
            }
            SubmitButton.IsEnabled = false;
            var send = new Send();
            await send.Send_Email(ticket);

            SubmitButton.IsEnabled = true;
            ClearField();
        }
Exemplo n.º 2
0
 private async void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (var Db = new HelpDeskDataContext())
         {
             var customer = new Customer();
             customer.Name         = NameField.Text;
             customer.EmailAddress = EmailField.Text;
             Db.Add(customer);
             Db.SaveChanges();
             OutputTextBlock.Text = customer.Name + " " + "Created.";
             ClearField();
         }
     }
     catch (Exception)
     {
         var message = new MessageDialog("Unable to Create Ticket");
         await message.ShowAsync();
     }
 }