Esempio n. 1
0
        //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

        public void txtBoxDescription_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {

                string keyVal;
                string keyCd;
                string searchKey;



                keyVal = e.KeyValue.ToString(); //keycode value
                keyCd = e.KeyCode.ToString().ToLower(); //character
                RowIndex = 0;

                KeyPressEvent kpe = new KeyPressEvent();

                searchKey = kpe.manualSearchkey(keyVal, keyCd, "ManualBillingform", "des", this);



                if (searchKey == "exit")
                {
                    this.Close();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Error Occured, Please Try Again, " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }


        }
Esempio n. 2
0
        private void Admin_Load(object sender, EventArgs e)
        {

            //-------------------Dilanka Rathnayaka------------------------------2/9/2014----------------------------
            Reports rep = new Reports();
            //set dates
            rep.FormLoadDateTimePicker(dateTimePicker1, dateTimePicker2);
            //Set Cashier names to combo box
            rep.FormLoadComboBox(comboBox1, comboBox2);
            //-------------------------------------------------------------------------------------------------------

            KeyPressEvent kpe = new KeyPressEvent();
            kpe.manualBilling("admin", "", this);

            this.KeyPreview = true;
            this.textBox6.KeyDown += new KeyEventHandler(textBox6_KeyDown);

        }
Esempio n. 3
0
        //--------------------------------------------------------------------------------------------------------------------------------------------------------------------

        public void txtBoxDescription_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                string keyVal;
                string keyCd;
                string searchKey;

                ManualBilling mb = new ManualBilling();

                keyVal = e.KeyValue.ToString(); //convert and assign pressed keyValue 
                keyCd = e.KeyCode.ToString();   //convert and assign pressed keystring




                KeyPressEvent kpe = new KeyPressEvent();
                searchKey = kpe.manualSearchkey(keyVal, keyCd, "Billingform", "des", this); //call manualSearchkey function



                if (searchKey == "exit")
                {
                    this.Close();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Error Occured, Please Try Again, " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }

        }
Esempio n. 4
0
        //------------------------------------------------------------------------------------------------------------------------------------------------------------------
        public void dataGridView1_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {

                string keyVal;


                keyVal = e.KeyValue.ToString();


                if (int.Parse(keyVal) == 40)
                {
                    if (dataGridView1.RowCount != 0 || dataGridView1.RowCount != 1)
                    {
                        KeyPressEvent kpe = new KeyPressEvent();
                        kpe.downArrow("bf", "dgv", this); //mb=ManualBilling, dgv=DataGridView

                    }

                }
                else if (int.Parse(keyVal) == 38)
                {
                    KeyPressEvent kpe = new KeyPressEvent();

                    kpe.upArrow("bf", "dgv", this);
                }
                else if (int.Parse(keyVal) == 13)
                {
                    KeyPressEvent kpe = new KeyPressEvent();
                    kpe.enterButton("bf", "dgv", this);

                }
                else if (int.Parse(keyVal) == 27)
                {
                    dataGridView1.Rows[0].Selected = true;
                    dataGridView1.CurrentCell = dataGridView1[0, 0];
                    ActiveControl = txtBoxDescription; // focus on Description textbox
                    dataGridView1.BorderStyle = BorderStyle.Fixed3D; //change borderStyle to identify active control
                    txtBoxDescription.BorderStyle = BorderStyle.FixedSingle; //change borderStyle to identify active control
                    txtBoxDescription.Select(txtBoxDescription.Text.Length, 0);   //move cursor into the end of text in the textbox

                }
                else if (int.Parse(keyVal) == 46)
                {
                    dataGridView1.Rows.RemoveAt(dataGridView1.CurrentCell.RowIndex);

                    if (dataGridView1.RowCount == 0)
                    {
                        ActiveControl = txtBoxDescription; // focus on Description textbox
                        dataGridView1.BorderStyle = BorderStyle.Fixed3D; //change borderStyle to identify active control
                        txtBoxDescription.BorderStyle = BorderStyle.FixedSingle; //change borderStyle to identify active control
                        txtBoxDescription.Select(txtBoxDescription.Text.Length, 0);   //move cursor into the end of text in the textbox
                    }
                    else
                    {

                        dataGridView1.Rows[0].Selected = true;
                        dataGridView1.CurrentCell = dataGridView1[0, 0];
                        ActiveControl = txtBoxDescription; // focus on Description textbox
                        dataGridView1.BorderStyle = BorderStyle.Fixed3D; //change borderStyle to identify active control
                        txtBoxDescription.BorderStyle = BorderStyle.FixedSingle; //change borderStyle to identify active control
                        txtBoxDescription.Select(txtBoxDescription.Text.Length, 0);   //move cursor into the end of text in the textbox
                    }
                    BillGeneration bg = new BillGeneration();
                    bg.total(this);
                }
                else
                {
                    if (int.Parse(keyVal) < 65 && int.Parse(keyVal) > 105 && int.Parse(keyVal) != 32)
                    {

                        SystemSounds.Hand.Play();
                    }

                }
            }

            catch (Exception exc)
            {
                MessageBox.Show("Error Occured, Please Try Again, " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }

        }
Esempio n. 5
0
        //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



        public void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                string keyVal = e.KeyValue.ToString();


                if (int.Parse(keyVal) > 95 && int.Parse(keyVal) < 106)
                {

                    string key = e.KeyCode.ToString();
                    key = key.Substring(6, key.Length - 6);

                    textBox2.ReadOnly = false;
                    if (textBox2.Text.Length < 4)
                    {
                        textBox2.Text = textBox2.Text + key;
                    }
                    textBox2.Select(textBox2.Text.Length, 0);
                    textBox2.ReadOnly = true;


                }

                else if (int.Parse(keyVal) == 8) //validate BackSpace---------------------------------------------------------------
                {
                    if (textBox2.Text.Length != 0)
                    {
                        textBox2.Text = textBox2.Text.Substring(0, textBox2.Text.Length - 1); //remove last character from the text of the textbox

                        textBox2.Select(textBox2.Text.Length, 0); //move cursor into the end of text in the textbox
                    }
                    else
                    {
                        SystemSounds.Hand.Play();
                    }
                }
                else if (int.Parse(keyVal) == 37 || int.Parse(keyVal) == 39)
                {
                }
                else if (int.Parse(keyVal) == 13)
                {
                    KeyPressEvent kpe = new KeyPressEvent();
                    kpe.enterButton("bf", "qty", this);
                }
                else
                {
                    SystemSounds.Hand.Play();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Error Occured, Please Try Again, " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }
        }
Esempio n. 6
0
        private void button9_Click(object sender, EventArgs e)
        {
            KeyPressEvent kpe = new KeyPressEvent();
            kpe.manualBilling("admin", textBox6.Text, this);
          

        }