Example #1
0
        private void loggedOut()
        {
            sqlCommandAB logout = new sqlCommandAB();
            int          id     = logout.getSingleValue("SELECT loginID FROM loginLog ORDER BY loginID DESC");

            logout.updateDB("UPDATE loginLog set loginEnd = getDate() WHERE loginID = '" + id + "'");
        }
Example #2
0
        private void brandDBTN_Click(object sender, EventArgs e)
        {
            int selectedrowindex = dataGridView2.SelectedCells[0].RowIndex;

            DataGridViewRow selectedRow = dataGridView2.Rows[selectedrowindex];

            string       a           = Convert.ToString(selectedRow.Cells["brandNameDT"].Value);
            sqlCommandAB customerSql = new sqlCommandAB();
            int          id          = customerSql.getSingleValue("SELECT brandID FROM Brand WHERE( categoryName = '" + selectCat.SelectedItem.ToString() + "' AND brandName ='" + a + "')");


            DialogResult dr = MessageBox.Show("Are you sure you want to Delete " + brandNameTB.Text.ToString() + " Permanently?", "Confim Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

            if (dr == DialogResult.Yes)
            {
                DataTable DT = customerSql.QueryDT("DELETE  FROM Brand WHERE brandID = '" + id + "' AND brandName ='" + a + "' ");
                if (sqlCommandAB.message != null)
                {
                    MessageBox.Show(sqlCommandAB.message + "Couldn't delete " + a);
                }
                else
                {
                    dataGridView2.Rows.Clear();
                    CategorysAndBrand[] customer;
                    getBrandData(out customer);
                    Clear();
                }
            }
        }
Example #3
0
        //public string[] brandValues(string a, string b, string c) {
        //    string[] brandthings = new string[] {a,b,c };
        //    return brandthings;
        //}
        private void brandUBTN_Click(object sender, EventArgs e)
        {
            int selectedrowindex = dataGridView2.SelectedCells[0].RowIndex;

            DataGridViewRow selectedRow = dataGridView2.Rows[selectedrowindex];
            string          a           = Convert.ToString(selectedRow.Cells["brandNameDT"].Value);

            sqlCommandAB brandSql = new sqlCommandAB();
            int          id       = brandSql.getSingleValue("SELECT brandID FROM Brand WHERE( categoryName = '" + selectCat.SelectedItem.ToString() + "' AND brandName ='" + a + "')");

            if (brandNameTB.Text.Equals(""))
            {
                MessageBox.Show("Please Enter a Brand Name");
            }

            else
            {
                brandSql.updateDB("UPDATE Brand set brandName='" + (string)brandNameTB.Text + "',brandDescription='" + (string)brandDescriptionTB.Text + "' WHERE brandID='" + id + "'");
                if (sqlCommandAB.message != null)
                {
                    MessageBox.Show(sqlCommandAB.message + "Couldn't update " + a + "\nDue to netwrok Error, Please check your network and try again");
                }
                else
                {
                    MessageBox.Show("The brand  " + a + " update succefully");
                    dataGridView2.Rows.Clear();
                    CategorysAndBrand[] customer;
                    getBrandData(out customer);
                    Clear();
                }
            }
        }
Example #4
0
        public void updateInv(string pCode, int q)
        {
            sqlCommandAB upIn  = new sqlCommandAB();
            int          pqtyy = upIn.getSingleValue("SELECT pQty FROM Product WHERE pCode ='" + pCode + "'");

            upIn.updateDB("UPDATE Product set pQty =' " + (pqtyy - q) + "' WHERE pCode ='" + pCode + "'");
        }
Example #5
0
 private void comboBox1_SelectedIndexChanged_1(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex == -1)
     {
         buttonLoadPic.Enabled = false;
         removeImage.Enabled   = false;
     }
     else
     {
         buttonLoadPic.Enabled = true;
         removeImage.Enabled   = true;
         sqlCommandAB brandSql = new sqlCommandAB();
         brandID             = brandSql.getSingleValue("SELECT brandID FROM Brand WHERE (categoryName = '" + selectCat.SelectedItem.ToString() + "') AND ( brandName ='" + comboBox1.SelectedItem.ToString() + "')");
         tb_itemBarCode.Text = makeProductCode(selectCat.SelectedItem.ToString(), comboBox1.SelectedItem.ToString());
         addProductForm[] products;
         getProduct(out products);
     }
 }