Exemple #1
0
        private void dashBtn_Click(object sender, EventArgs e)
        {
            AdminDashboard adminDashboard = new AdminDashboard(userid);

            adminDashboard.Show();
            this.Hide();
        }
        private void addScheduleBtn_Click(object sender, EventArgs e)
        {
            string trainNameValue   = trainCombo.SelectedValue.ToString();
            string dateValue        = date.Value.ToString("yyyy-MM-dd");
            string timevalue        = timeTable.Value.ToString("HH:mm:ss");
            string classValue       = classBox.SelectedItem.ToString();
            string departureValue   = departureBox.SelectedItem.ToString();
            string destinationvalue = destinationBox.SelectedItem.ToString();
            string farevalue        = fareBox.Text;

            AdminAddScheduleRepo adminAddScheduleRepo = new AdminAddScheduleRepo();

            adminAddScheduleRepo.addTrain(classValue, "100", farevalue, "100", trainNameValue, dateValue, timevalue, departureValue, destinationvalue);
            MessageBox.Show("Schedule Added");
            AdminDashboard adminDashboard = new AdminDashboard(userid);

            adminDashboard.Show();
            this.Hide();
        }
Exemple #3
0
        private void loginBtn_Click(object sender, EventArgs e)
        {
            string    userId    = userIdBox.Text;
            string    password  = passTextBox.Text;
            UserLogin userLogin = new UserLogin();
            int       flag      = userLogin.getLoginInfo(userId, password);

            if (flag == 1)
            {
                UserDashboard dashboard = new UserDashboard(userId);
                dashboard.Show();
                this.Hide();
            }
            else if (flag == 2)
            {
                AdminDashboard adminDashboard = new AdminDashboard(userid);
                adminDashboard.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Invalid ID or Password");
            }
        }