示例#1
0
        public BookingStep2(int id, string date, string pay_type, int normal, int reduced)
        {
            InitializeComponent();
            //pairno titlo tou event
            Event ev = new Event(id);

            //pairno ta tickets
            enventDataSetTableAdapters.ticketsTableAdapter tick = new enventDataSetTableAdapters.ticketsTableAdapter();
            float normal_ticket_price  = (float)tick.GetNormalPriceEventId(id);
            float reduced_ticket_price = (float)tick.GetReducedPriceEventId(id);


            User x = InstanceOfUser.GetUser();

            Debug.WriteLine(x);
            if (x is Project_4.App_Code.NormalUser)
            {
                NormalUser nr = (NormalUser)x;
                name_label.Text = nr.GetProfile().GetLastName() + " " + nr.GetProfile().GetFirstName();
            }

            PlayTitle_label.Text      = ev.GetTitle();
            date_label.Text           = date;
            normalTickets_Label.Text  = normal.ToString();
            reducedTickets_Label.Text = reduced.ToString();
            label5.Text += "(" + normal_ticket_price + "€) :";
            label7.Text += "(" + reduced_ticket_price + "€) :";

            float total_price = normal_ticket_price * normal + reduced_ticket_price * reduced;

            total_Price.Text = total_price.ToString();
        }
        private void PrepareElements(int id)
        {
            //pairno to venue
            enventDataSetTableAdapters.venuesTableAdapter ven = new enventDataSetTableAdapters.venuesTableAdapter();
            int   venue_id = (int)ven.GetVenueIdFromEventID(id);
            Venue theVenue = new Venue(venue_id);

            //pairno ta tickets
            enventDataSetTableAdapters.ticketsTableAdapter tick = new enventDataSetTableAdapters.ticketsTableAdapter();
            float normal_ticket  = (float)tick.GetNormalPriceEventId(id);
            float reduced_ticket = (float)tick.GetReducedPriceEventId(id);


            User_Classes.Event event_kati = new User_Classes.Event(id);
            App_Code.Play      plays      = new App_Code.Play(id);


            Dictionary <int, string> category = new Dictionary <int, string>();

            category[1] = "Music"; category[2] = "Theater"; category[3] = "Conference"; category[4] = "Festivals"; category[5] = "Sports"; category[6] = "Educational"; category[7] = "Informing"; category[8] = "Soccer"; category[9] = "Basketball"; category[10] = "Cinema";
            int    cat_id   = event_kati.GetCategory();
            string cat_name = category[cat_id];
            int    duration = event_kati.GetDuration();

            this.eventTitle.Text     = event_kati.GetTitle();
            this.imerominia.Text     = event_kati.GetCreatedAt().ToString("d/M/yyyy");
            this.perigrafilabel.Text = event_kati.GetDescription().ToString();
            this.durationlabel.Text  = (duration / 3600).ToString() + " ώρες";
            this.categorylabel.Text  = cat_name;
            this.topothesia.Text     = theVenue.GetName();
            this.NameofPlace.Text    = theVenue.GetName();
            this.addressofPlace.Text = theVenue.GetLocation();
            this.kanonikoTimi.Text   = normal_ticket.ToString();
            this.meiomenoTimi.Text   = reduced_ticket.ToString();
            //Debug.WriteLine(event_kati.GetTitle().ToString());
            Image rszimg = Images.resizeImage(Images.pic.ElementAt(id), new Size(880, 222));

            IconEvent.Image = rszimg;

            int z = 0;

            List <DateTime> dates = plays.GetDates();

            foreach (DateTime date in dates)
            {
                Label newLabel = new Label();

                newLabel.Width    = 125;
                newLabel.Height   = 20;
                newLabel.Location = new Point(10, 50 + 2 * z * newLabel.Height);
                newLabel.Name     = "label" + z;

                newLabel.Text = date.ToString("dd/MM/yyyy HH:mm");
                date_panel.Controls.Add(newLabel);


                z++;
            }
        }
示例#3
0
 public Ticket(int id)
 {
     this.id = id;
     enventDataSetTableAdapters.ticketsTableAdapter ev = new enventDataSetTableAdapters.ticketsTableAdapter();
     if (Convert.ToInt32(ev.tryTicket(this.id)) > 0)
     {
         List <enventDataSet.ticketsRow> ticketDetails = ev.GetTicket(this.id).ToList();
         this.type  = ticketDetails.ElementAt(0).type;
         this.price = ticketDetails.ElementAt(0).price;
     }
     else
     {
         throw new TicketException("Το Ticket δεν υπάρχει");
     }
 }