Example #1
0
 public int UpdateBrand(BrandBAL B)
 {
     try
     {
         using (C.Con)
         {
             MySqlCommand cmd = new MySqlCommand("UpdateBrand", C.Con)
             {
                 CommandType = CommandType.StoredProcedure
             };
             cmd.Parameters.Add(new MySqlParameter("BrandID", B.BrandID));
             cmd.Parameters.Add(new MySqlParameter("BName", B.BrandName));
             cmd.Parameters.Add(new MySqlParameter("CatID", B.Category));
             cmd.Connection.Open();
             int Result = cmd.ExecuteNonQuery();
             C.Con.Close();
             return(Result);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         throw;
     }
 }
Example #2
0
 private void BtnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         BrandBAL BB = new BrandBAL
         {
             BrandID   = BrandID,
             BrandName = TxtBrandName.Text.Trim(),
             Category  = Convert.ToInt32(Label.Text)
         };
         BrandDAL BD     = new BrandDAL();
         int      Result = BD.UpdateBrand(BB);
         if (Result > 0)
         {
             MessageBox.Show("Brand Successfully Updated");
             LoadDGVBrands();
         }
         else
         {
             MessageBox.Show("Something Went Wrong");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #3
0
        private void BtnAddBrand_Click(object sender, EventArgs e)
        {
            BrandBAL BB = new BrandBAL
            {
                BrandName = TxtBrandName.Text.Trim(),
                Category  = Convert.ToInt32(Label.Text.Trim())
            };
            BrandDAL BD     = new BrandDAL();
            int      Result = BD.InsertBrand(BB);

            if (Result > 0)
            {
                MessageBox.Show("Brand Added Successfully");
                LoadDGVBrands();
            }
            else
            {
                MessageBox.Show("Oops Something Went Wrong");
                LoadDGVBrands();
            }
        }