Exemplo n.º 1
0
        private void registerButton_Click(object sender, RoutedEventArgs e)
        {
            string name     = registerName.Text;
            string email    = registerEmail.Text;
            string password = registerPassword.Password;
            User   user     = new User(0, email, name, password, "X:\\C#PROJECT\\Ensemble\\Ensemble\\Images\\profile.jpg");
            string info     = dbms.register(user);

            if (info == "success")
            {
                userID = dbms.getUID(email);
                FirstPage c = new FirstPage(userID);
                c.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                c.Show();
                this.Close();
                System.Console.WriteLine("success");
            }
            else if (info == "exist")
            {
                info2.Content = "Email exists";
            }
            else
            {
                info2.Content = "Connection wrong";
            }
        }
Exemplo n.º 2
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            //string info = DBManager.login(email, password);
            string email    = loginEmail.Text;
            string password = loginPassword.Password;

            userID = dbms.getUID(email);
            string info = dbms.login(email, password);

            if (info == "loged_in")
            {
                FirstPage c = new FirstPage(userID);
                c.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                c.Show();
                this.Close();
            }
            else if (info == "wrong_password")
            {
                info1.Content = "Password is wrong";
            }
            else if (info == "not_exist")
            {
                info1.Content = "Email not exists";
            }
            else
            {
                info1.Content = "Database connection wrong";
            }
        }
        private void submit(object sender, RoutedEventArgs e)
        {
            string newName  = name.Text;
            string oldP     = oldPassword.Password;
            string newP     = newPassword.Password;
            string newImage = path.Content.ToString();

            if (oldP != newP)
            {
                if (dbms.editMyInfo(userID, newName, newP, newImage) != 0)
                {
                    System.Console.WriteLine("success");
                }
                else
                {
                    System.Console.WriteLine("Edit failed!");
                }
            }
            else
            {
                System.Console.WriteLine("The new password should not be the same like the old one!");
            }

            FirstPage firstPage = new FirstPage(userID);

            firstPage.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            firstPage.Show();
            this.Close();
        }
        private void Hyperlink_Click(object sender, RoutedEventArgs e)
        {
            FirstPage mainPage = new FirstPage(userID);

            mainPage.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            mainPage.Show();
            this.Close();
        }
Exemplo n.º 5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string   act_name       = name.Text;
            DateTime act_date       = (DateTime)date.SelectedDate;
            string   act_start      = start.Text;
            string   act_end        = end.Text;
            string   act_budget_str = budget.Text;
            int      act_budget     = 0;

            Int32.TryParse(act_budget_str, out act_budget);

            string act_city = (string)cityValue.SelectedItem;

            string act_location = location.Text;

            string imgURL;

            if (path.Content.ToString() == "image")
            {
                imgURL = null;
            }
            else
            {
                imgURL = path.Content.ToString();
            }

            string act_tag = (string)tagValue.SelectedItem;

            string act_intro = intro.Text;

            Activity act = new Activity(act_name, act_date, act_start, act_end, act_budget, act_intro, userID, act_city, act_location
                                        , imgURL, act_tag);

            database.createActivity(act);

            FirstPage firstPage = new FirstPage(userID);

            firstPage.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            firstPage.Show();
            this.Close();
        }