public int Del(CategoryLevel1_CategoryLevel2 aItem)
 {
     this.aDatabaseDA.CategoryLevel1_CategoryLevel2.Remove(aItem);
     return aDatabaseDA.SaveChanges();
 }
 public int InsCategoryLevel1_CategoryLevel2(CategoryLevel1_CategoryLevel2 aCategoryLevel1_CategoryLevel2)
 {
     try
     {
         aDatabaseDA.CategoryLevel1_CategoryLevel2.Add(aCategoryLevel1_CategoryLevel2);
         return aDatabaseDA.SaveChanges();
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("CategoryLevel1BO.InsCategoryLevel1_CategoryLevel2: {0}", ex.Message));
     }
 }
        //tqtrung
        public void Ins_CategoryLevel1_CategoryLevel2(HttpContext context, int NUM_LANG)
        {
            int ret = -1;
            String jSonString = "";
            try
            {
                CategoryLevel1_CategoryLevel2 aCategoryLevel1_CategoryLevel2 = new CategoryLevel1_CategoryLevel2();

                for (int i = 1; i <= NUM_LANG; i++)
                {
                    aCategoryLevel1_CategoryLevel2.IDLang = !String.IsNullOrEmpty(context.Request.Form["IDLang_" + i]) ? Convert.ToInt32(context.Request.Form["IDLang_" + i]) : 0;

                    aCategoryLevel1_CategoryLevel2.Status = !String.IsNullOrEmpty(context.Request.Form["cbbStatus"]) ? Convert.ToInt32(context.Request.Form["cbbStatus"]) : 0;

                    aCategoryLevel1_CategoryLevel2.Disable = !String.IsNullOrEmpty(context.Request.Form["cbbDisable"]) ? Convert.ToBoolean(context.Request.Form["cbbDisable"]) : false;

                    // aCategoryLevel1.CodeCategoryLevel2 = !String.IsNullOrEmpty(context.Request.Form["txt_CodeCategoryLevel2"]) ? Convert.ToString(context.Request.Form["txt_CodeCategoryLevel2"]) : "";

                    aCategoryLevel1_CategoryLevel2.Type = !String.IsNullOrEmpty(context.Request.Form["cbbType"]) ? Convert.ToInt32(context.Request.Form["cbbType"]) : 0;

                    aCategoryLevel1_CategoryLevel2.CodeCategoryLevel1 = !String.IsNullOrEmpty(context.Request.Form["txtCodeCategoryLevel1"]) ? Convert.ToString(context.Request.Form["txtCodeCategoryLevel1"]) : "";
                    aCategoryLevel1_CategoryLevel2.CodeCategoryLevel2 = !String.IsNullOrEmpty(context.Request.Form["txtCodeCategoryLevel2"]) ? Convert.ToString(context.Request.Form["txtCodeCategoryLevel2"]) : "";

                    CategoryLevel1BO aCategoryLevel1BO = new CategoryLevel1BO();
                    ret = aCategoryLevel1BO.InsCategoryLevel1_CategoryLevel2(aCategoryLevel1_CategoryLevel2);
                    if (ret == 0)
                    {
                        jSonString = "{\"status\":\"error|" + ret.ToString() + "\"}";
                        break;
                    }

                }

                if (ret != 0)
                { jSonString = "{\"status\": \"success\"}"; }
            }
            catch (Exception ex)
            {
                jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message.ToString() + "\"}";
            }
            finally
            {
                context.Response.Write(jSonString);
            }
        }