Ejemplo n.º 1
0
        private void bgwReloadCategories_DoWork(object sender, DoWorkEventArgs e)
        {
            if (bgwReloadCategories.IsBusy)
                bgwReloadCategories.ReportProgress(0);

            var list = service.GetCategories();

            // Veritabanına kaydet.
            var dataService = new StorMan.Business.N11DataService();
            dataService.ClearCtategories(N11_STORE_ID);

            foreach (var categoryModel in list)
            {
                //catService.InsertCategory(categoryModel, N11_STORE_ID);
                insertCategory(dataService, categoryModel);
            }
        }
Ejemplo n.º 2
0
        private void tree_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            if (e.Node.Nodes.Count == 1 && e.Node.Nodes[0].Text == "dummy" && e.Node.Tag is CategoryModel)
            {
                e.Node.Nodes.Clear();

                var cat = e.Node.Tag as CategoryModel;

                var dataService = new N11DataService();
                var list = dataService.GetSubCategories(N11_STORE_ID, (int?) cat.ID);
                foreach (var categoryModel in list)
                {
                    e.Node.Nodes.Add(categoryToTreeNode(categoryModel, false));
                }
            }
        }
Ejemplo n.º 3
0
        private List<CategoryModel> getCategoryListFromService()
        {
            var list = service.GetCategories();

            // Veritabanına kaydet.
            var dataService = new StorMan.Business.N11DataService();
            dataService.ClearCtategories(N11_STORE_ID);

            foreach (var categoryModel in list)
            {
                //catService.InsertCategory(categoryModel, N11_STORE_ID);
                insertCategory(dataService, categoryModel);
            }

            lblStatus.Text = String.Format("Kategoriler güncellendi, {0} kategori bulundu.", categoryList.Count);

            return list;
        }
Ejemplo n.º 4
0
 private int insertCategory(N11DataService dataService, CategoryModel category)
 {
     Debug.WriteLine("Inserting " + category.ToString());
     dataService.InsertCategory(category, N11_STORE_ID);
     var count = 1;
     foreach (var subCategory in category.Children)
     {
         count += insertCategory(dataService, subCategory);
         if (bgwReloadCategories.IsBusy)
             bgwReloadCategories.ReportProgress(count);
     }
     return count;
 }
Ejemplo n.º 5
0
 private List<CategoryModel> getCategoryListFromDb()
 {
     var dataService = new StorMan.Business.N11DataService();
     var list = dataService.GetSubCategories(N11_STORE_ID, null);
     return list;
 }