private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0 | e.ColumnIndex == 1)
            {
                productEL.Productid = Convert.ToInt32(dgv.SelectedRows[0].Cells["PRODUCT ID"].Value);
            }

            if (e.ColumnIndex == 0)
            {
                s             = "EDIT";
                lblTitle.Text = "UPDATE CATEGORY";
                ShowForm(true);

                productEL             = productBL.Select(productEL);
                categoryEL.Categoryid = productEL.Categoryid;
                categoryEL            = categoryBL.Select(categoryEL);

                txtProductName.Text      = productEL.Productname;
                cbCategory.SelectedIndex = cbCategory.FindString(categoryEL.Category);
                txtDescription.Text      = productEL.Description;
                txtPrice.Text            = productEL.Price.ToString();
                txtStocks.Text           = productEL.Stocks.ToString();
            }
            else if (e.ColumnIndex == 1)
            {
                DialogResult dialogResult = MessageBox.Show("ARE YOU SURE TO DELETE THIS SELECTED ITEM?", "DELETING", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    ShowResult(productBL.Delete(productEL));
                }
            }
        }
示例#2
0
        private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0 | e.ColumnIndex == 1)
            {
                categoryEL.Categoryid = Convert.ToInt32(dgv.SelectedRows[0].Cells["CATEGORY ID"].Value);
            }

            if (e.ColumnIndex == 0)
            {
                s             = "EDIT";
                lblTitle.Text = "UPDATE CATEGORY";
                ShowForm(true);

                categoryEL       = categoryBL.Select(categoryEL);
                txtCategory.Text = categoryEL.Category;
            }
            else if (e.ColumnIndex == 1)
            {
                DialogResult dialogResult = MessageBox.Show("ARE YOU SURE TO DELETE THIS SELECTED ITEM?", "DELETING", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    ShowResult(categoryBL.Delete(categoryEL));
                }
            }
        }
示例#3
0
        public EL.Registrations.categories Select(EL.Registrations.categories categoryEL)
        {
            var dt = Helper.executeQuery("select * from categories where categoryid = '" + categoryEL.Categoryid + "'");

            if (dt.Rows.Count > 0)
            {
                categoryEL.Categoryid = Convert.ToInt32(dt.Rows[0]["categoryid"].ToString());
                categoryEL.Category   = dt.Rows[0]["category"].ToString();
                return(categoryEL);
            }
            else
            {
                return(null);
            }
        }
 public bool Delete(EL.Registrations.categories categoryEL)
 {
     return(categoryDL.Delete(categoryEL));
 }
 public bool Update(EL.Registrations.categories categoryEL)
 {
     return(categoryDL.Update(categoryEL));
 }
 public long Insert(EL.Registrations.categories categoryEL)
 {
     return(categoryDL.Insert(categoryEL));
 }
 public EL.Registrations.categories Select(EL.Registrations.categories categoryEL)
 {
     return(categoryDL.Select(categoryEL));
 }
示例#8
0
 public bool Delete(EL.Registrations.categories categoryEL)
 {
     return(Helper.executeNonQueryBool("delete from categories where categoryid = '" + categoryEL.Categoryid + "'"));
 }
示例#9
0
 public bool Update(EL.Registrations.categories categoryEL)
 {
     categoryEL.Category = MySql.Data.MySqlClient.MySqlHelper.EscapeString(categoryEL.Category);
     return(Helper.executeNonQueryBool("update categories set category = '" + categoryEL.Category + "' where categoryid = '" + categoryEL.Categoryid + "'"));
 }
示例#10
0
 public long Insert(EL.Registrations.categories categoryEL)
 {
     categoryEL.Category = MySql.Data.MySqlClient.MySqlHelper.EscapeString(categoryEL.Category);
     return(Helper.executeNonQueryLong("insert into categories (category) values ('" + categoryEL.Category + "')"));
 }