Exemplo n.º 1
0
        private void createBt_Click(object sender, EventArgs e)
        {
            using (ETicketServiceClient.EventServiceClient eventClient = new ETicketServiceClient.EventServiceClient())
            {
                Event newEvent = new Event();
                eventClient.ClientCredentials.UserName.UserName = "******";
                eventClient.ClientCredentials.UserName.Password = "******";


                if (checkFields())
                {
                    newEvent.Title            = titleTb.Text;
                    newEvent.Description      = descriptionTb.Text;
                    newEvent.Gate             = gateTb.Text;
                    newEvent.GateOpens        = DateTime.Parse(gateOpenTb.Text);
                    newEvent.StartTime        = DateTime.Parse(startTimeTb.Text);
                    newEvent.Date             = DateTime.Parse(dateTb.Text);
                    newEvent.AvailableTickets = Convert.ToInt32(availableTicketTb.Text);
                    newEvent.TicketPrice      = Convert.ToDecimal(ticketPriceTb.Text);

                    if (eventClient.CreateEvent(newEvent) > 0)
                    {
                        MessageBox.Show("Event Created");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("ERROR: Event not created, try again");
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void deleteBt_Click_1(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Are you sure to delete this item ??",
                                                "Confirm Delete!",
                                                MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                // If 'Yes', do something here.
                using (ETicketServiceClient.EventServiceClient eventClient = new ETicketServiceClient.EventServiceClient())
                {
                    eventClient.ClientCredentials.UserName.UserName = "******";
                    eventClient.ClientCredentials.UserName.Password = "******";

                    try
                    {
                        eventClient.DeleteEvent(eventId);
                        MessageBox.Show("Event deleted");
                        this.Close();
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Event not deleted, try again");
                        throw;
                    }
                }
            }
        }
Exemplo n.º 3
0
        public List <Event> getAllEvents()
        {
            using (ETicketServiceClient.EventServiceClient eventClient = new ETicketServiceClient.EventServiceClient())

            {
                eventClient.ClientCredentials.UserName.UserName = "******";
                eventClient.ClientCredentials.UserName.Password = "******";
                events = new List <Event>(eventClient.GetAllEvents());
                return(events);
            }
        }
Exemplo n.º 4
0
        public Event getEventData(int id)
        {
            Event myEvent = new Event();

            using (ETicketServiceClient.EventServiceClient eventClient = new ETicketServiceClient.EventServiceClient())
            {
                eventClient.ClientCredentials.UserName.UserName = "******";
                eventClient.ClientCredentials.UserName.Password = "******";
                myEvent = eventClient.GetEvent(id);
                return(myEvent);
            }
        }
Exemplo n.º 5
0
        private void createBt_Click(object sender, EventArgs e)
        {
            using (ETicketServiceClient.EventServiceClient eventClient = new ETicketServiceClient.EventServiceClient())
            {
                Event newEvent = new Event();
                eventClient.ClientCredentials.UserName.UserName = "******";
                eventClient.ClientCredentials.UserName.Password = "******";


                if (checkFields())
                {
                    newEvent.EventId          = eventId;
                    newEvent.Title            = titleTb.Text;
                    newEvent.Description      = descriptionTb.Text;
                    newEvent.Gate             = gateTb.Text;
                    newEvent.GateOpens        = DateTime.ParseExact(gateOpenTb.Text, "MM/dd/yyyy HH:mm", CultureInfo.InvariantCulture);
                    newEvent.StartTime        = DateTime.ParseExact(startTimeTb.Text, "MM/dd/yyyy HH:mm", CultureInfo.InvariantCulture);
                    newEvent.Date             = DateTime.ParseExact(dateTb.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                    newEvent.AvailableTickets = Convert.ToInt32(availableTicketTb.Text);
                    newEvent.TicketPrice      = Convert.ToDecimal(ticketPriceTb.Text);


                    try
                    {
                        eventClient.UpdateEvent(newEvent);
                        MessageBox.Show("Event updated");
                        this.Close();
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("ERROR: Event not created, try again");
                        throw;
                    }
                }
            }
        }