/// <summary>
 /// 
 /// </summary>
 /// <param name="BrandGarment"></param>
 public void Delete(BrandGarment BrandGarment)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, BrandGarment);
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="BrandGarment"></param>
 public void Save(BrandGarment BrandGarment)
 {
     using (DbManager db = new DbManager())
     {
         if (BrandGarment.RecordNo != 0)
         {
             Accessor.Query.Update(db, BrandGarment);
         }
         else
         {
             Accessor.Query.Insert(db, BrandGarment);
         }
     }
 }
 private void UpdateBrandGarments()
 {
     var brand_garments = from bg in BrandGarmentMan.BrandGarments()
                          where bg.GarmentCode == fGarment_update.GarmentCode
                          select bg;
     BrandGarmentMan.Delete(brand_garments.ToList<BrandGarment>());
     List<BrandGarment> BrandGarments = new List<BrandGarment>();
     for (int i = 0; i < chkBrandsUpdate.Items.Count; i++)
     {
         if (chkBrandsUpdate.Items[i].Selected)
         {
             BrandGarment brand_garment = new BrandGarment();
             brand_garment.BrandCode = chkBrandsUpdate.Items[i].Value;
             brand_garment.GarmentCode = fGarment_update.Garment.GarmentCode.ToUpper();
             brand_garment.DateRecorded = DateTime.Now;
             BrandGarments.Add(brand_garment);
         }
     }
     BrandGarmentMan.Save(BrandGarments);
 }
 private void SaveBrandGarments()
 {
     List<BrandGarment> BrandGarments = new List<BrandGarment>();
     for (int i = 0; i < chkBoxBrands.Items.Count; i++)
     {
         if (chkBoxBrands.Items[i].Selected)
         {
             BrandGarment brand_garment = new BrandGarment();
             brand_garment.BrandCode = chkBoxBrands.Items[i].Value;
             brand_garment.GarmentCode = fGarment.Garment.GarmentCode.ToUpper();
             brand_garment.DateRecorded = DateTime.Now;
             BrandGarments.Add(brand_garment);
         }
     }
     BrandGarmentMan.Save(BrandGarments);
 }