public object GetByCat(category pCat)
 {
     try
     {
         var hh = from h in pCat.products
                  select h;
         return hh;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        void btnLuu_Click(object sender, EventArgs e)
        {
            if (txtTenDanhMuc.Text == string.Empty)
            {
                XtraMessageBox.Show(lbTenDanhMuc.Text + "không được để trống", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                txtTenDanhMuc.Focus();
                return;
            }

            category cat = new category();
            cat.cat_id = txtMaDanhMuc.Text;
            cat.name = txtTenDanhMuc.Text;
            cat.describe = txtMoTa.Text;
            cat.created = DateTime.Now;

            if(lkDanhMucCha.GetSelectedDataRow() != null)
            {
                category parent_cat = (category)lkDanhMucCha.GetSelectedDataRow();
                parent_cat.categories.Add(cat);
            }
            else
            {
                busDanhMuc.Insert(cat);
            }

            // Save
            if (busDanhMuc.Save())
            {
                DialogResult = DialogResult.OK;
                Close();
            }
            else
            {
                XtraMessageBox.Show("Thêm danh mục thất bại, vui lòng thử lại", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
 partial void Deletecategory(category instance);
 partial void Insertcategory(category instance);
 partial void Updatecategory(category instance);
		private void attach_categories(category entity)
		{
			this.SendPropertyChanging();
			entity.category1 = this;
		}
		private void detach_categories(category entity)
		{
			this.SendPropertyChanging();
			entity.category1 = null;
		}
Exemple #8
0
 public void Update(category obj)
 {
     throw new NotImplementedException();
 }
Exemple #9
0
 public category Insert(category obj)
 {
     throw new NotImplementedException();
 }
Exemple #10
0
 public void Update(category entity)
 {
     _repository.Update(entity);
 }
Exemple #11
0
 public void Insert(category entity)
 {
     _repository.Insert(entity);
 }
Exemple #12
0
 public void Delete(category entity)
 {
     _repository.Delete(entity);
 }