コード例 #1
0
        //=======================================================================================================
        //This method is called when the user hits the "Update" button. Which then calls the method to narrow the
        //  current list to one department. If there is nothing entered ub the text box, it will assume the user
        //  wants to view the entire list of the weight table. If the count of the PartWeights list is 0, it will
        //  then prompt the user an invalid department was entered and clears out the text box; if it is greater
        //  than 0 it refreshes the dgv to show the current parts entered in the specified department
        //=======================================================================================================
        private async void btnUpdate_Click(object sender, EventArgs e)
        {
            SplashScreen _splash = new SplashScreen
            {
                StartPosition   = FormStartPosition.CenterScreen,
                FormBorderStyle = FormBorderStyle.None,
                WindowState     = FormWindowState.Normal,
                MaximumSize     = new Size(Program.SplashScreenWidth, Program.SplashScreenHeight),
                MinimumSize     = new Size(Program.SplashScreenWidth, Program.SplashScreenHeight)
            };
            await Task.Delay(200);

            _splash.Show();
            _splash.BringToFront();
            _splash.Focus();
            await Task.Delay(200);

            Program.PartWeights.Clear();

            if (txtDept.Text != "")
            {
                DatabaseFunctions.NarrowToDept(txtDept.Text);
                if (Program.PartWeights.Count > 0)
                {
                    RefreshDGV();
                }
                else
                {
                    txtDept.Text = "";
                    DatabaseFunctions.ViewCurrent();
                    RefreshDGV();
                    MessageBox.Show("Invalid Department Entered");
                }
            }
            else
            {
                DatabaseFunctions.ViewCurrent();
                RefreshDGV();
            }
            _splash.Close();
        }
コード例 #2
0
        //========================================================================================================
        //This method is called when the user clicks on the "View Archived Entries" button. It calls the
        //  DatabaseFunctions view current archive entries method
        //========================================================================================================
        private async void btnViewArchive_Click(object sender, EventArgs e)
        {
            SplashScreen _splash = new SplashScreen
            {
                StartPosition   = FormStartPosition.CenterScreen,
                FormBorderStyle = FormBorderStyle.None,
                WindowState     = FormWindowState.Normal,
                MaximumSize     = new Size(Program.SplashScreenWidth, Program.SplashScreenHeight),
                MinimumSize     = new Size(Program.SplashScreenWidth, Program.SplashScreenHeight)
            };
            await Task.Delay(200);

            _splash.Show();
            _splash.BringToFront();
            _splash.Focus();
            await Task.Delay(200);

            DatabaseFunctions.ViewArchive();
            bolArchiveView = true;
            _splash.Close();
        }
コード例 #3
0
        //========================================================================================================
        //This method is called when the user clicks on the "Delete Entry" button when currently viewing archived
        //  entires. This allows the user to permanently delete the entry. It first checks if there are more than
        //  0 entries currently in the part weight list, if there isnt any, it will tell the user there are no
        //  entries to delete. If there is, it shows a yes/no message box, if the user clicks "Yes" the entry is
        //  wiped from the database, if not, it just shows them the current archived entries
        //========================================================================================================
        private async void btnDelete_Click(object sender, EventArgs e)
        {
            if (Program.PartWeights.Count > 0)
            {
                DialogResult result = MessageBox.Show("Are You Sure You Want To Delete This Entry?", "Delete Entry", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    SplashScreen _splash = new SplashScreen
                    {
                        StartPosition   = FormStartPosition.CenterScreen,
                        FormBorderStyle = FormBorderStyle.None,
                        WindowState     = FormWindowState.Normal,
                        MaximumSize     = new Size(Program.SplashScreenWidth, Program.SplashScreenHeight),
                        MinimumSize     = new Size(Program.SplashScreenWidth, Program.SplashScreenHeight)
                    };
                    await Task.Delay(200);

                    _splash.Show();
                    _splash.BringToFront();
                    _splash.Focus();
                    await Task.Delay(200);

                    bolArchiveView         = false;
                    pnlDefault.Visible     = true;
                    pnlUpdate.Visible      = false;
                    pnlArchiveView.Visible = false;
                    btnViewArchive.Visible = true;
                    DatabaseFunctions.DeleteEntry(intTUID);
                    _splash.Close();
                }
            }
            else
            {
                MessageBox.Show("No Entries To Delete");
            }
        }