Beispiel #1
0
        private void buttonAddUsers_Click(object sender, EventArgs e)
        {
            if (textBoxEditUserName.Text == "")
            {
                MessageBox.Show("Please fill the required information", "Error");
            }
            else
            {
                try
                {
                    DBL.User user = new DBL.User();
                    user.Name1     = textBoxEditUserName.Text;
                    user.Username1 = textBoxEditUserUsername.Text;
                    user.Password1 = textBoxEditUserPassword.Text;
                    user.Mobile1   = textBoxEditUserMobile.Text;
                    user.Branch1   = textBoxEditUserBranch.Text;
                    user.addUser(user);
                    MessageBox.Show("Inserted Well", "Success");
                    allUserTable();

                    textBoxEditUserName.Text     = "";
                    textBoxEditUserUsername.Text = "";
                    textBoxEditUserPassword.Text = "";
                    textBoxEditUserMobile.Text   = "";
                    textBoxEditUserBranch.Text   = "";
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
            }
        }
Beispiel #2
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;
        }
Beispiel #3
0
        public bool foundUser(String username)
        {
            DBL.User user = new DBL.User();
            user.Username1 = username;
            SqlDataReader rdr = user.getUser(user);

            if (rdr.Read())
            {
                /*
                 * string col = rdr["id"].ToString();
                 * MessageBox.Show(col, "Success");
                 */
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
 private void buttonDeleteUser_Click(object sender, EventArgs e)
 {
     if (textBoxEditUserSearch.Text == "")
     {
         MessageBox.Show("Please fill the required information", "Error");
     }
     else
     {
         try
         {
             DBL.User user = new DBL.User();
             user.Username1 = textBoxEditUserSearch.Text;
             user.deleteUser(user);
             MessageBox.Show("Deleted Well", "Success");
             allUserTable();
             textBoxEditUserSearch.Text = "";
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error");
         }
     }
 }
Beispiel #5
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();
            }
        }