Example #1
0
        private void BillingForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            // daily sale report generated by dafault if staff by mistake closes the application.
            DailySalesReportButton_Click(sender, e);
            DialogResult Message = MessageBox.Show("do yo want to Update the stock ?", "Confiramtion Message", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (Message == DialogResult.Yes)
            {
                //Code to save the daily transactions everyday.
                File.Delete("StockFile.txt");
                StreamWriter FileWrite;
                FileWrite = File.AppendText("StockFile.txt");
                for (int i = 0; i < 14; i++)
                {
                    for (int j = 0; j < 5; j++)
                    {
                        FileWrite.WriteLine(StockArray[i, j].ToString());
                    }
                }
                FileWrite.Close();
            }
            else
            {
                e.Cancel = true;
                ExitButton.Focus();
            }
        }
 private void ClearButton_Click(object sender, EventArgs e)
 {
     //Code to chnage the visisbility of the code.
     ExitButton.Focus();
     Searchpanel.Visible = true;
     TransactionDateTextBox.Clear();
     TransactionIDTextBox.Clear();
     SearchDetailsListBox.Items.Clear();
     SearchListBoxPanel.Visible = false;
 }
        //Move focus where needed, a crude way of doing it thou
        //int indicates direction
        private void MoveFocus(int e)
        {
            //0 = down
            if (e == 0)
            {
                if (PlayButton.IsFocused)
                {
                    OptionsButton.Focus();
                }
                else if (OptionsButton.IsFocused)
                {
                    ExitButton.Focus();
                }
                else if (ExitButton.IsFocused)
                {
                    PlayButton.Focus();
                }
                else
                {
                    PlayButton.Focus();
                }
            }

            //1 = up
            if (e == 1)
            {
                if (PlayButton.IsFocused)
                {
                    ExitButton.Focus();
                }
                else if (OptionsButton.IsFocused)
                {
                    PlayButton.Focus();
                }
                else if (ExitButton.IsFocused)
                {
                    OptionsButton.Focus();
                }
                else
                {
                    PlayButton.Focus();
                }
            }
        }
Example #4
0
 private void MainMenu_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Alt && e.KeyCode.ToString() == "A")
     {
         AddQuoteButton.Focus();
     }
     if (e.Alt && e.KeyCode.ToString() == "V")
     {
         ViewQuotesButton.Focus();
     }
     if (e.Alt && e.KeyCode.ToString() == "S")
     {
         SearchQuotesButton.Focus();
     }
     if (e.Alt && e.KeyCode.ToString() == "X")
     {
         ExitButton.Focus();
     }
 }
Example #5
0
        private void ClearButton_Click(object sender, EventArgs e)
        {
            // code which clears the selected value and changes visisbility of form.
            QuantityValuesTextBox.Focus();
            QuantityValuesTextBox.SelectAll();
            ButtonPanelOne.Visible    = true;
            CancelButton.Visible      = true;
            DataGridViewPanel.Visible = false;
            DataGridCart.ClearSelection();
            DataGridCart.Rows.Clear();
            TotalCostValueTextBox.Text = "0";
            FinalValue = 0;
            QuantityValuesTextBox.Clear();
            ExitButton.Focus();
            BeerNamesListBox.SelectedItems.Clear();
            BeerSubTypeListBox.SelectedItems.Clear();
            PriceForBeerListBox.SelectedItems.Clear();
            DataGridCart.Visible          = false;
            TotalCostValueTextBox.Visible = false;
            TotalcostLabel.Visible        = false;

            DataGridCart.ClearSelection();
            DataGridCart.Rows.Clear();
        }