public void Delete(Category category)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, category);
     }
 }
 protected void btnSaveUpdate_Click(object sender, EventArgs e)
 {
     category = CM.GetCategoryByKey(long.Parse(gvProductCategoryList.SelectedRow.Cells[2].Text));
     category.CategoryCode  = txtCategoryUpdate.Text.ToUpper();
     category.CategoryDescription = txtCategoryDescriptionUpdate.Text.ToUpper();
     CM.Save(category);
     LoadAllCategories();
 }
 public void Save(Category category)
 {
     using (DbManager db = new DbManager())
     {
         if (category.RecordNo != 0)
         {
             Accessor.Query.Update(db, category);
         }
         else
         {
             Accessor.Query.Insert(db, category);
         }
     }
 }
 protected void btnSaveProductCategory_Click(object sender, EventArgs e)
 {
     var category = new Category
     {
       CategoryCode = txtCategoryCode.Text.ToUpper(),
       CategoryDescription = txtCategoryDescription.Text.ToUpper(),
       DateCreated = DateTimeOffset.Now ,
       IsActive = "Yes"
     };
     CM.Save(category);
     txtCategoryCode.Text = null;
     txtCategoryDescription.Text = null;
     LoadAllCategories();
 }
 protected void gvProductCategoryList_SelectedIndexChanged(object sender, EventArgs e)
 {
     category = CM.GetCategoryByKey(long.Parse(gvProductCategoryList.SelectedRow.Cells[2].Text));
     txtCategoryUpdate.Text = category.CategoryCode;
     txtCategoryDescriptionUpdate.Text = category.CategoryDescription;
 }