Esempio n. 1
0
        private void TryLogin(string Username, string Password)
        {
            cnn = new SqlConnection(connectionString);
            var sql = @"Select * FROM Users WHERE Username = '******'";

            OpenConnection();
            cmd = new SqlCommand(sql, cnn);
            cmd.ExecuteNonQuery();

            dataReader = cmd.ExecuteReader();

            //if (!dataReader.Read()) { MessageBox.Show("No user by that name found."); }

            while (dataReader.Read())
            {
                if ((Username == dataReader.GetValue(4).ToString()) && (Password == dataReader.GetValue(5).ToString()))
                {
                    MessageBox.Show("Welcome " + dataReader.GetValue(1).ToString() + "!");

                    frmParent parent = (frmParent)this.Owner;
                    this.userID       = Int32.Parse(dataReader.GetValue(0).ToString());
                    this.adminP       = Convert.ToBoolean(dataReader.GetValue(3));
                    this.username     = dataReader.GetValue(1).ToString();
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Incorrect login credentials. Please try again.");
                    txtPassword.Clear();
                }
            }

            cnn.Close();
        }
Esempio n. 2
0
        private void ViewMaintainToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmMaintainClient maintainClient = new frmMaintainClient();
            frmParent         parent         = this;

            maintainClient.MdiParent = parent;
            maintainClient.Show();
        }
Esempio n. 3
0
        private void MaintainVehicleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSearchVehicles searchVehicle = new frmSearchVehicles();
            frmParent         parent        = this;

            searchVehicle.MdiParent = parent;
            searchVehicle.Show();
        }
Esempio n. 4
0
        private void RegionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmRegionDetails regionDetails = new frmRegionDetails();
            frmParent        parent        = this;

            regionDetails.MdiParent = parent;
            regionDetails.Show();
        }
Esempio n. 5
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            maintain = new frmMaintainParcels();
            frmParent parent = this;

            maintain.MdiParent = parent;
            maintain.Show();
        }
Esempio n. 6
0
        private void DeliveriesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmMaintainDeliveries maintain = new frmMaintainDeliveries(getUserID());
            frmParent             parent   = this;

            maintain.MdiParent = parent;
            maintain.Show();
        }
Esempio n. 7
0
        private void AllocateParcelsToVehiclesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmAssignParcels maintain = new frmAssignParcels(getUserID());
            frmParent        parent   = this;

            maintain.MdiParent = parent;
            maintain.Show();
        }
Esempio n. 8
0
        private void MaintainUserToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSearchUser searchUsers = new frmSearchUser();
            frmParent     parent      = this;

            searchUsers.MdiParent = parent;
            searchUsers.Show();
        }
Esempio n. 9
0
        private void DeliverParcelsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmDeliverParcels deliver = new frmDeliverParcels();
            frmParent         parent  = this;

            deliver.MdiParent = parent;
            deliver.Show();
        }
Esempio n. 10
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmMaintainParcels parcel = new frmMaintainParcels(getUserID());
            frmParent          parent = this;

            parcel.MdiParent = parent;
            parcel.Show();
        }
Esempio n. 11
0
        private void HistoricalParcelsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmReport report = new frmReport();
            frmParent parent = this;

            report.MdiParent = parent;
            report.Show();
        }
Esempio n. 12
0
        private void ReportingToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            frmDeliveryReport deliveryReport = new frmDeliveryReport();
            frmParent         parent         = this;

            deliveryReport.MdiParent = parent;
            deliveryReport.Show();
        }
Esempio n. 13
0
        private void addToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            frmMaintainClient client  = new frmMaintainClient();
            frmClientDetails  details = new frmClientDetails(client);
            frmParent         parent  = this;

            details.MdiParent = parent;
            details.Show();
        }
Esempio n. 14
0
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmMaintainParcels parcels = new frmMaintainParcels(getUserID());
            frmParcelDetails   details = new frmParcelDetails(parcels, true, getUserID());
            frmParent          parent  = this;

            details.MdiParent = parent;
            details.Show();
        }
Esempio n. 15
0
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            maintain = new frmMaintainParcels();
            frmParent        parent  = this;
            frmParcelDetails details = new frmParcelDetails(maintain);

            details.disableButton(true);
            details.MdiParent = parent;
            details.Show();
        }
Esempio n. 16
0
        private void AddNewVehicleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmMaintainVehicles vehicle = new frmMaintainVehicles();
            frmParent           parent  = this;

            vehicle.setMode("add");
            vehicle.clearForm();
            vehicle.MdiParent = parent;
            vehicle.Show();
        }
Esempio n. 17
0
        private void AddNewUserToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSearchUser    user   = new frmSearchUser();
            frmMaintainUsers users  = new frmMaintainUsers(user);
            frmParent        parent = this;

            users.setMode("add");
            users.clearForm();
            users.MdiParent = parent;
            users.Show();
        }
Esempio n. 18
0
        private void AddToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            frmMaintainClient maintain = new frmMaintainClient();
            frmParent         parent   = this;

            maintain.MdiParent = parent;
            frmClientDetails details = new frmClientDetails(maintain, true);

            details.MdiParent = parent;
            details.Show();
        }
Esempio n. 19
0
 private void MaintainToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     //maintain user
     if (getUserAdmin() == false)
     {
         MessageBox.Show("Access denied: Only admin users have access to this feature");
     }
     else
     {
         frmSearchUser searchUsers = new frmSearchUser();
         frmParent     parent      = this;
         searchUsers.MdiParent = parent;
         searchUsers.Show();
     }
 }
Esempio n. 20
0
 private void AddToolStripMenuItem2_Click(object sender, EventArgs e)
 {
     //add new user
     if (getUserAdmin() == false)
     {
         MessageBox.Show("Access denied: Only admin users have access to this feature");
     }
     else
     {
         frmSearchUser    user   = new frmSearchUser();
         frmMaintainUsers users  = new frmMaintainUsers(user);
         frmParent        parent = this;
         users.setMode("add");
         users.clearForm();
         users.MdiParent = parent;
         users.Show();
     }
 }