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; } }
public void LoadBrandComboBox() { BrandDAL BD = new BrandDAL(); DataSet ds = BD.LoadCMBBrand(); CMBBrand.ValueMember = "Brand ID"; CMBBrand.DisplayMember = "Brand Name"; CMBBrand.DataSource = ds.Tables[0]; }
private void CMBBrand_SelectedIndexChanged(object sender, EventArgs e) { string CmbBrandText = CMBBrand.Text.ToString(); BrandDAL BD = new BrandDAL(); DataTable ds = BD.LoadValueMemberOfBrandComboBox(CmbBrandText); foreach (DataRow dr in ds.Rows) { CMBBrandValueMember = Convert.ToInt32(dr[0].ToString()); } }
public void GetAllBrandsTest() { IBrandDAL brandDAL = new BrandDAL(connString); List <Brand> brands = brandDAL.GetAllBrands(); Assert.IsNotNull(brands); List <string> names = new List <string>(); foreach (Brand brand in brands) { names.Add(brand.Name); } CollectionAssert.Contains(names, "Nico Shoes"); }
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(); } }
public BrandBLL(BrandDAL brandDAL) { _branddal = brandDAL; }
public void LoadDGVBrands() { BrandDAL BB = new BrandDAL(); DGVBrand.DataSource = BB.LoadDGV(); }