예제 #1
0
        public manage(String CU)
        {
            this.CurrentUser = CU;

            InitializeComponent();
            _instance = this;

            labelCU.Text           = "Logged In : " + this.CurrentUser;
            labelDate.Text         = "Date " + DateTime.Now.ToString("yyyy-M-dd");
            comboBoxResTo.Enabled  = false;
            comboBoxResCab.Enabled = false;
            labelResAmount.Text    = "";
            labelResKm.Text        = "";


            DBL.User ust = new DBL.User();
            ust.Username1 = this.CurrentUser;
            if (ust.IsHeadOfficeUser(ust))
            {
                groupBoxUsers.Enabled   = true;
                groupBoxTours.Enabled   = true;
                groupBoxDrivers.Enabled = true;

                labelUser.Text   = "User Management";
                labelDriver.Text = "Driver Management";
                labelTour.Text   = "Tour Management";
            }
            else
            {
                groupBoxUsers.Enabled   = false;
                groupBoxTours.Enabled   = false;
                groupBoxDrivers.Enabled = false;

                labelUser.Text   = "User Management (Only for Head Ofiice)";
                labelDriver.Text = "Driver Management (Only for Head Ofiice)";
                labelTour.Text   = "Tour Management (Only for Head Ofiice)";

                dataGridViewUsers.Enabled = false;
                dataGridViewTour.Enabled  = false;
                dataGridViewCab.Enabled   = false;
            }

            allTourTable();
            allUserTable();
            allCabTable();
            allClientTable();
            curResTable();
            comboboxes();

            this.FormClosing += new FormClosingEventHandler(manage_FormClosing);
            this.WindowState  = FormWindowState.Maximized;
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DBL.User user = new DBL.User();
            user.Username1 = textBoxUsername.Text;
            user.Password1 = textBoxPassword.Text;
            if (user.IsValidUser(user))
            {
                notificationUser(textBoxUsername.Text);

                manage c = new manage(textBoxUsername.Text);
                c.Show();
                this.Hide();
            }
            else
            {
                //MessageBox.Show("Your username and password are not matched !");
                textBoxPassword.Text = "";
                textBoxUsername.Select();
                textBoxUsername.SelectAll();
                labelAlert.Text = "Your username and password are not matched !";
                notificationUserFailed();
            }
        }