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(); }
//On load παίρνει τις τιμές απο το dataset και τις βάζει στα πεδία και τις τοπικές μεταβλητές . private void Profile_Load(object sender, EventArgs e) { if (x is NormalUser) { NormalUser nu = (NormalUser)x; Id = nu.GetUserID(); usrname = usernamTextBox.Text = nu.GetUserName(); onoma = onomaTextBox.Text = nu.GetProfile().GetFirstName(); lastname = lastnameTextBox.Text = nu.GetProfile().GetLastName(); email = emailTextBox.Text = nu.GetProfile().GetEmail(); dob = dobPicker.Value = nu.GetProfile().GetDob(); adress = adressTextBox.Text = nu.GetProfile().GetAddress(); } }
//Save button click that makes the updates private void button1_Click_1(object sender, EventArgs e) { if (datachange == true) { NormalUser nu = (NormalUser)x; Profile up = nu.GetProfile(); up.UpdateUserName(Id, usernamTextBox.Text); if (usernameExist.Visible == true) { usernameExist.Visible = false; } up.UpdateAddress(Id, adressTextBox.Text); up.UpdateEmail(Id, emailTextBox.Text); if (emailExist.Visible == true) { emailExist.Visible = false; } up.UpdateFirstName(Id, onomaTextBox.Text); up.UpdateLastName(Id, lastnameTextBox.Text); MessageBox.Show("Οι αλλαγές πραγματοποιήθηκαν."); string pass = nu.GetPass(); InstanceOfUser.LogOut(); InstanceOfUser.CreateCustomerUser(usrname, pass); } else { MessageBox.Show("Δεν έγινε κάποια αλλαγή για να αλλάξουν τα δεδομένα"); } }
private void button_reset_pass_Click(object sender, EventArgs e) { NormalUser nu = (NormalUser)InstanceOfUser.GetUser(); int id = nu.GetUserID(); UserProfile ru = (UserProfile)nu.GetProfile(); ru.UpdatePassword(id, txtResetPass.Text); recoverMsg.ForeColor = Color.Green; recoverMsg.Text = "Ο κωδικός άλλαξε επιτυχώς!"; }