예제 #1
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;
     }
 }
예제 #2
0
        public void LoadBrandComboBox()
        {
            BrandDAL BD = new BrandDAL();
            DataSet  ds = BD.LoadCMBBrand();

            CMBBrand.ValueMember   = "Brand ID";
            CMBBrand.DisplayMember = "Brand Name";
            CMBBrand.DataSource    = ds.Tables[0];
        }
예제 #3
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());
            }
        }
예제 #4
0
        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");
        }
예제 #5
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();
            }
        }
예제 #6
0
 public BrandBLL(BrandDAL brandDAL)
 {
     _branddal = brandDAL;
 }
예제 #7
0
        public void LoadDGVBrands()
        {
            BrandDAL BB = new BrandDAL();

            DGVBrand.DataSource = BB.LoadDGV();
        }