Exemple #1
0
 //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("Δεν έγινε κάποια αλλαγή για να αλλάξουν τα δεδομένα");
     }
 }
Exemple #2
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 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      = "Ο κωδικός άλλαξε επιτυχώς!";
        }
 //Μέθοδος για το LogIn
 public User LogInAsEventManager(string userName, string passWord)
 {
     enventDataSetTableAdapters.adminTableAdapter tr = new enventDataSetTableAdapters.adminTableAdapter();
     if (Convert.ToInt32(tr.tryLogInManager(userName)) > 0)
     {
         InstanceOfUser.CreateEventManager(userName, passWord);    //Δημιουργία global χρήστη τύπου Event Manager στην στατική κλάση.
         return(InstanceOfUser.GetUser());
     }
     else
     {
         throw new FailLoginAsEventManager("O manager δεν υπάρχει");
     }
 }
 //Μέθοδος για το LogIn
 public User LogInAsNormalUser(string userName, string passWord)
 {
     enventDataSetTableAdapters.userTableAdapter tr = new enventDataSetTableAdapters.userTableAdapter();
     if (Convert.ToInt32(tr.tryLogInAsUser(userName)) > 0)
     {
         InstanceOfUser.CreateCustomerUser(userName, passWord); //Δημιουργία global χρήστη τύπου normla στην στατική κλάση.
         return(InstanceOfUser.GetUser());                      // Επιστροφή
     }
     else
     {
         throw new Exceptions.FailLogInAsNormalUser("O Χρήστης δεν υπάρχει");
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            //Dimiourgia antikeimenou gia na pame to email se alli klasi
            theEmail = EmailForgot.Text;


            User x = InstanceOfUser.GetUser();

            if ((x is Visitor) && (emailExists()))
            {
                Visitor vis = (Visitor)x;
                enventDataSetTableAdapters.userTableAdapter env = new enventDataSetTableAdapters.userTableAdapter();

                string username = env.returnUsernamePassword(theEmail).ToList().ElementAt(0).username;
                string password = env.returnUsernamePassword(theEmail).ToList().ElementAt(0).password;

                NormalUser nu = (NormalUser)vis.LogInAsNormalUser(username, password);
            }



            if (emailExists())
            {
                //Dimiourgia Random Verification Code
                Random rand = new Random();
                randomCode = (rand.Next(999999)).ToString();

                //Apostoli Email
                MailMessage mm = new MailMessage("*****@*****.**", EmailForgot.Text.Trim());
                mm.Subject    = "Κωδικός Επαναφοράς";
                mm.Body       = string.Format("Ο κωδικός επαναφοράς είναι: " + randomCode);
                mm.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host      = "smtp.gmail.com";
                smtp.EnableSsl = true;
                NetworkCredential NetworkCred = new NetworkCredential();
                NetworkCred.UserName       = "******";
                NetworkCred.Password       = "******";
                smtp.UseDefaultCredentials = true;
                smtp.Credentials           = NetworkCred;
                smtp.Port = 587;
                smtp.Send(mm);
                labelSend.ForeColor = Color.Green;
                labelSend.Text      = "Ο κωδικός επαναφοράς εστάλη επιτυχώς!";
            }
            else
            {
                labelSend.ForeColor = Color.Red;
                labelSend.Text      = "Το e-mail δεν βρέθηκε";
            }
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(true);
            Splash_Animation sa = new Splash_Animation();

            sa.SetDesktopLocation(500, 500);
            sa.Show();
            Events.FillEventsData();
            Images.LoadImages();
            InstanceOfUser.CreateVisitor();
            Categories.FillCategoryData();
            sa.Close();
            Application.Run(new Form1());
        }
        private void HomeMainPrepare()
        {
            int indexImg;
            int indexEv;

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

            category["musicPanel"] = 1; category["theaterPanel"] = 2; category["conferencePanel"] = 3; category["festivalsPanel"] = 4; category["sportsPanel"] = 8;
            User              user      = InstanceOfUser.GetUser();
            List <Event>      events    = App_Code.StaticMethods.Events.events;
            List <Event>      eventsCat = new List <Event>();
            List <Categories> cat       = Categories.categories;

            foreach (Control i in flowLayoutPanel1.Controls)
            {
                indexImg  = 0;
                indexEv   = 0;
                eventsCat = events.FindAll(x => x.GetCategory() == category[i.Name]);
                foreach (Control k in i.Controls)
                {
                    foreach (Control p in k.Controls)
                    {
                        if (indexImg < eventsCat.Count)
                        {
                            if (p is PictureBox)
                            {
                                PictureBox pic    = (PictureBox)p;
                                Image      rszimg = Images.resizeImage(Images.pic.ElementAt(indexImg), new Size(241, 110));
                                pic.Image = rszimg;
                                indexImg++;
                            }
                            if (p is Label)
                            {
                                Label lb = (Label)p;
                                lb.Text = eventsCat.ElementAt(indexEv).GetTitle();
                                indexEv++;
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
        }
        public EventFullDescription(int id)
        {
            InitializeComponent();
            PrepareElements(id);
            User x = InstanceOfUser.GetUser();

            if (x is NormalUser)
            {
                button8.Enabled = true;
            }
            else
            {
                button8.Enabled   = false;
                button8.BackColor = Color.LightSlateGray;
            }
            event_id = id;
        }
Exemple #10
0
 private void button8_Click(object sender, EventArgs e)
 {
     if (button8.Text == "LOGIN")
     {
         MainPanel.Controls.Clear();
         LogIn su = new LogIn();
         MainPanel.Controls.Add(su);
     }
     else if (button8.Text == "LOGOUT")
     {
         InstanceOfUser.LogOut();
         button8.Text    = "LOGIN";
         button7.Visible = true;
         MainPanel.Controls.Clear();
         MainPanel.Controls.Add(hm);
     }
 }
Exemple #11
0
        private void cCircularButton1_Click(object sender, EventArgs e)
        {
            User x = InstanceOfUser.GetUser();

            if (x is NormalUser)
            {
                MainPanel.Controls.Clear();
                ProfileControl su = new ProfileControl();
                MainPanel.Controls.Add(su);
            }
            else if (x is EventManager)
            {
                MainPanel.Controls.Clear();
                ProfileEventManager pem = new ProfileEventManager();
                MainPanel.Controls.Add(pem);
            }
        }
Exemple #12
0
 public void LogOut()
 {
     InstanceOfUser.LogOut();
 }
        private void Syndesi_Click(object sender, EventArgs e)
        {
            loginfail.Visible = false;
            if (AllCheck() == true)
            {
                //kane eisodo
                User_Classes.Visitor vis = new User_Classes.Visitor();
                String username          = UsernameLog.Text;
                String password          = PasswordLog.Text;

                try
                {
                    //try gia na dei ean einai normaluser
                    Cursor.Current = Cursors.WaitCursor;
                    vis.LogInAsNormalUser(username, password);
                    NormalUser nu = (NormalUser)InstanceOfUser.GetUser();
                    MessageBox.Show(nu.GetUserID().ToString());
                    Cursor.Current = Cursors.Default;
                    if (MessageBox.Show("Είσοδος στον λογαριασμό σας!", "OK", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                    {
                        Control parent = this.Parent;
                        while (parent.Name != "Form1")
                        {
                            Debug.WriteLine(parent.Name);
                            parent = parent.Parent;
                        }

                        foreach (Control c in parent.Controls)
                        {
                            if (c.Name == "homepagePanel")
                            {
                                parent = c;
                            }
                        }

                        switch (parent.Controls["button8"].Text)
                        {
                        case "LOGIN":
                            parent.Controls["button8"].Text             = "LOGOUT";
                            parent.Controls["button7"].Visible          = false;
                            parent.Controls["cCircularbutton1"].Visible = true;
                            break;
                        }

                        Controls.Clear();
                        Controls.Add(new HomeMain());
                    }
                }
                catch (User_Classes.Exceptions.FailLogInAsNormalUser msg)
                {//ean den einainormaluser ,try ean einai eventmanager
                    try
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        vis.LogInAsEventManager(username, password);
                        Cursor.Current = Cursors.Default;
                        if (MessageBox.Show("Είσοδος στον λογαριασμό σας!", "OK", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                        {
                            Control parent = this.Parent;
                            while (parent.Name != "Form1")
                            {
                                Debug.WriteLine(parent.Name);
                                parent = parent.Parent;
                            }

                            foreach (Control c in parent.Controls)
                            {
                                if (c.Name == "homepagePanel")
                                {
                                    parent = c;
                                }
                            }
                            switch (parent.Controls["button8"].Text)
                            {
                            case "LOGIN":
                                parent.Controls["button8"].Text             = "LOGOUT";
                                parent.Controls["button7"].Visible          = false;
                                parent.Controls["cCircularbutton1"].Visible = true;
                                break;
                            }

                            Controls.Clear();
                            Controls.Add(new HomeMain());
                        }
                    }
                    catch (User_Classes.Exceptions.FailLoginAsEventManager msg1)
                    {//ean den einai emfanizei minma lathous
                        Cursor.Current    = Cursors.Default;
                        messagelabel.Text = msg1.ToString();
                        loginfail.Visible = true;

                        UsernameLog.ForeColor = System.Drawing.Color.Gray;
                        UsernameLog.Text      = "Username";
                        PasswordLog.ForeColor = System.Drawing.Color.Gray;
                        PasswordLog.Text      = "Κωδικός";
                    }
                }
            }
        }