Beispiel #1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     panel2.Width += 24;
     if (panel2.Width >= 769)
     {
         timer1.Stop();
         FrmMain2 inv = new FrmMain2();
         inv.lblUsername.Text = Login.InvPassName;
         inv.lblName.Text     = Login.InvPassName;
         inv.lblAccount.Text  = Login.InvPassAccount;
         inv.lblPosition.Text = Login.InvPassAccount;
         inv.Show();
         this.Hide();
     }
 }
        private void timer1_Tick(object sender, EventArgs e)
        {
            panel2.Width += 50;
            if (panel2.Width >= 329)
            {
                timer1.Stop();
                FrmMain2 load = new FrmMain2();
                load.lblUsername.Text         = FrmMain1.PassToPOSName;
                load.lblName.Text             = FrmMain1.PassToPOSName;
                load.lblAccount.Text          = FrmMain1.PassToPOSAccount;
                load.lblPosition.Text         = FrmMain1.PassToPOSAccount;
                load.BtnBackAdminMode.Visible = true;
                load.Show();

                this.Hide();
            }
        }
Beispiel #3
0
        private void BtnConfirm_Click(object sender, EventArgs e)
        {
            FrmMain2 main = new FrmMain2();

            try
            {
                string _oldpass = dbcon.GetPassword(txtUsername.Text);
                if (_oldpass != txtOldPass.Text)
                {
                    MessageBox.Show("Old Password did not matched!", "Changing Password", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (txtNewPass.Text != txtConfirmPass.Text)
                {
                    MessageBox.Show("New Password didi not matched!", "Changing Password", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    if (MessageBox.Show("Are you sure you want to Change Password?", "Changing Password", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        cn.Open();
                        cm = new SqlCommand("UPDATE tblUsers SET password = @password WHERE username = @username", cn);
                        cm.Parameters.AddWithValue("@password", txtNewPass.Text);
                        cm.Parameters.AddWithValue("@username", txtUsername.Text);
                        cm.ExecuteNonQuery();
                        cn.Close();
                        MessageBox.Show("Password has been Successfully Changed! You may now continue your work.", "Password Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Dispose();
                        ClearPassword();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #4
0
        public void BackToAdminButton()
        {
            FrmMain2 back = new FrmMain2();

            back.BtnBackAdminMode.Visible = true;
        }
        public void PassTheUsername()
        {
            FrmMain2 main2 = new FrmMain2();

            lblPasslblName.Text = main2.lblUsername.Text;
        }
Beispiel #6
0
        private void txtQty_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                if (e.KeyChar == 46)
                {
                    //accept .(for cents or decimal places)
                }
                else if (e.KeyChar == 8)
                {
                    //accept backspace
                }
                else if ((e.KeyChar < 48) || (e.KeyChar > 57)) //ascii code 48 - 57 between 0-9
                {
                    e.Handled = true;
                }

                //Enter = 13
                if ((e.KeyChar == 13) && (txtQty.Text != String.Empty))
                {
                    bool   found = false;
                    String id    = "";

                    cn.Open();
                    cm = new SqlCommand("SELECT * FROM tblInvoiceOrder WHERE invoiceno = @invoiceno and prodcode = @prodcode", cn);
                    cm.Parameters.AddWithValue("@invoiceno", edit.lblInvoiceNo.Text);
                    cm.Parameters.AddWithValue("@prodcode", prodcode);
                    dr = cm.ExecuteReader();
                    dr.Read();
                    if (dr.HasRows)
                    {
                        found = true;
                        id    = dr["id"].ToString();
                    }
                    else
                    {
                        // if found = false, it will crate new row for new product
                        found = false;
                    }
                    dr.Close();
                    cn.Close();

                    if (found == true)
                    {
                        Frm2EditInvoices up = new Frm2EditInvoices();

                        for (int i = 0; i < up.dataGridView1.Rows.Count; i++)
                        {
                            up.dataGridView1.Rows[i].Cells[2].Value = txtQty.Text;
                        }

                        cn.Open();
                        cm = new SqlCommand("UPDATE tblInvoiceOrder SET qty = (qty + " + int.Parse(txtQty.Text) + ") WHERE id = '" + id + "'", cn);
                        cm.ExecuteNonQuery();
                        cn.Close();

                        edit.LoadInvoiceOrder();
                        this.Dispose();
                    }
                    else
                    {
                        FrmMain2 Main2 = new FrmMain2();

                        cn.Open();
                        cm = new SqlCommand("INSERT INTO tblInvoiceOrder (invoiceno, customer, address, prodcode, proddescrip, prodprice, qty, stockdate, name, payment, days, billaddress) VALUES (@invoiceno, @customer, @address, @code, @desc, @price, @qty, @date, @name, @payment, @days, @bill)", cn);
                        cm.Parameters.AddWithValue("@invoiceno", transno);
                        cm.Parameters.AddWithValue("@customer", edit.txtCustomer.Text);
                        cm.Parameters.AddWithValue("@address", edit.txtAddress.Text);
                        cm.Parameters.AddWithValue("@code", prodcode);
                        cm.Parameters.AddWithValue("@desc", proddescrip);
                        cm.Parameters.AddWithValue("@price", prodprice);
                        cm.Parameters.AddWithValue("@qty", int.Parse(txtQty.Text));
                        cm.Parameters.AddWithValue("@name", Main2.lblUsername.Text);
                        cm.Parameters.AddWithValue("@date", edit.bunifuDatepicker1.Value.ToString("ddMMMyyyy"));
                        cm.Parameters.AddWithValue("@payment", edit.cbxPayment.Text);;
                        cm.Parameters.AddWithValue("@days", edit.Dmdays.Text);
                        cm.Parameters.AddWithValue("@bill", edit.txtBilling.Text);
                        cm.ExecuteNonQuery();
                        cn.Close();

                        edit.LoadInvoiceOrder();
                        this.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                cn.Close();
                MessageBox.Show(ex.Message, "Invoice Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }