예제 #1
0
        private void fillCategory()
        {
            DataTable dt = CategoryBL.GetAll();

            ddlCategory.DataSource     = dt;
            ddlCategory.DataTextField  = "Name";
            ddlCategory.DataValueField = "Name";
            ddlCategory.DataBind();
        }
예제 #2
0
        private void FillGridView()
        {
            DataTable dt = new DataTable();

            dt = CategoryBL.GetAll() as DataTable;
            GridView1.DataSource = dt;
            GridView1.DataBind();
            ViewState.Add("Mydt", dt);
        }
예제 #3
0
        private void LoadCategory()
        {
            //Gọi đối tượng CategoryBL từ tầng BusinessLogic
            CategoryBL categoryBL = new CategoryBL();

            // Lấy dữ liệu gán cho biến toàn cục listCategory
            listCategory = categoryBL.GetAll();
            // Chuyển vào Combobox với dữ liệu là ID, hiển thị là Name
            cbbCategory.DataSource    = listCategory;
            cbbCategory.ValueMember   = "ID";
            cbbCategory.DisplayMember = "Name";
        }
예제 #4
0
 public Task <List <CategoryModel> > Handle(GetAllCategoryQuery request, CancellationToken cancellationToken)
 {
     try
     {
         var bl = new CategoryBL();
         return(Task.FromResult(bl.GetAll()));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #5
0
        private void CategoryInfo(SubCategoryVO subcategory)
        {
            if (subcategory != null && subcategory.CategoryID > 0)
            {
                CategoryVO category   = _categoryBl.GetAll().FirstOrDefault(x => x.CategoryID == subcategory.CategoryID);
                var        parameters = new NavigationParameters();
                parameters.Add("To", category);
                _regionManager.RequestNavigate("ContentRegion", new Uri("CategoryInfoView", UriKind.Relative),
                                               NavigationCompleted, parameters);

                //IRegion region = ...
                //region.RequestNavigate(newUri("MyView", UriKind.Relative));
            }
        }
        public ActionResult Delete(string id)
        {
            var categories = objBS.GetAll();

            try
            {
                objBS.Delete(id);
                PrepareData(null, null, null, "A törlés sikeres");

                return(Json(new { ok = true, newurl = Url.Action("Index") }));
            }
            catch
            {
                PrepareData(null, null, null, "A törlés sikertelen");
                return(Json(new { ok = true, newurl = Url.Action("Index") }));
            }
        }
        public ActionResult Index(int?page)
        {
            ModelSearch ModelSearch = new ModelSearch();

            ModelSearch.code = Request.Form["code"];
            ModelSearch.name = Request.Form["name"];
            int  Out;
            bool checkparent = int.TryParse(Request.Form["parent"], out Out);

            if (checkparent == true)
            {
                ModelSearch.parent_id = int.Parse(Request.Form["parent"]);
            }
            bool checkchild = int.TryParse(Request.Form["child"], out Out);

            if (checkchild == true)
            {
                ModelSearch.Child_id = int.Parse(Request.Form["child"]);
            }
            ModelSearch.parent_id = 0;
            var pageNumber = page ?? 1;
            List <CategoryViewModel> model = new List <CategoryViewModel>();

            if (ModelSearch.name == null && ModelSearch.code == null && ModelSearch.parent_id == 0)
            {
                model = _categoryBL.GetAll();
            }
            else
            {
                int result = _categoryBL.Search(ModelSearch, out model);
            }
            var List = model.ToPagedList(pageNumber, 13);

            ViewBag.ListSearch = model.OrderByDescending(x => x.id);
            return(View(new Tuple <ModelSearch, IPagedList <CategoryViewModel> >(ModelSearch, List)));
        }
예제 #8
0
 // GET: api/Categorias
 public IEnumerable <Category> Get()
 {
     return(categoryBL.GetAll());
 }
예제 #9
0
 public void GetAll()
 {
     var category = categoryBL.GetAll();
 }
 public ManageCategoriesController()
 {
     objBS      = new CategoryBL();
     categories = objBS.GetAll().ToList();;
 }
 /// <summary>
 /// I store the categories in the viewbag to farther process.
 /// </summary>
 /// <returns></returns>
 // GET: User/BookAnAppointment
 public ActionResult Index()
 {
     ViewBag.Categories = categBL.GetAll().OrderBy(x => x.CategoryName).ToList();
     return(View());
 }
예제 #12
0
 public List <CategoryDTO> Get()
 {
     return(CategoryBL.GetAll());
 }