public CategoryDetail GetCategoryDetailsForCategory(int categoryId)
        {
            var category = AllCategory.FirstOrDefault(c => c.CategoryId == categoryId);

            return(new CategoryDetail {
                CategoryId = category.CategoryId
            });
        }
        //Getting the total count of the All Categories
        public string GetAllCategoryTotal()
        {
            GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//a[@class='active item']", 6);

            Thread.Sleep(2000);
            string totalCategoryCount = null;

            //Check AllCategory is active and the total are changing
            if (AllCategory.Displayed && AllCategory.Enabled)
            {
                var span = AllCategory.FindElement(By.XPath(".//span"));
                totalCategoryCount = span.Text;
            }
            return(totalCategoryCount);
        }
Beispiel #3
0
        private void PopulateCategory(TreeNode current, string sCurPath)
        {
            ModelCategory curModel = (ModelCategory)current.Tag;


            List <ModelCategory> childModels = AllCategory.FindAll(m => m.ParentId == curModel.Id);

            foreach (ModelCategory childModel in childModels)
            {
                TreeNode childNode = new TreeNode(childModel.Code);
                childNode.Tag = childModel;
                SetNodeTooltip(childNode, childModel.DisplayName, childModel.Description);
                current.Nodes.Add(childNode);
                PopulateCategory(childNode, sCurPath);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Initializes the backend
        /// </summary>
        public void Initialize()
        {
            BusG.Init();

            // Watch the session bus for when ICEcore Daemon comes or goes.
            // When it comes, attempt to connect to it.
            sessionBus =
                Bus.Session.GetObject <org.freedesktop.DBus.IBus> (
                    "org.freedesktop.DBus",
                    new ObjectPath("/org/freedesktop/DBus"));
            sessionBus.NameOwnerChanged += OnDBusNameOwnerChanged;

            // Force the daemon to start up if it's not already running
            if (!Bus.Session.NameHasOwner(DaemonNamespace))
            {
                Bus.Session.StartServiceByName(DaemonNamespace);
            }

            // Register for ICEcore Daemon's events
            ConnectToICEcoreDaemon();

            //
            // Add in the AllCategory
            //
            AllCategory allCategory = new AllCategory();

            Gtk.TreeIter iter = categories.Append();
            categories.SetValue(iter, 0, allCategory);

            // Populate the models
            Refresh();

            initialized = true;

            if (BackendInitialized != null)
            {
                try {
                    BackendInitialized();
                } catch (Exception e) {
                    Logger.Debug("Exception in IceBackend.BackendInitialized handler: {0}", e.Message);
                }
            }
        }
Beispiel #5
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            TreeNode      nodeRoot;
            ModelCategory rootModel = null;

            if (AllCategory.Count > 0)
            {
                rootModel    = AllCategory.Find(m => m.ParentId == -1);
                nodeRoot     = new TreeNode(rootModel.DisplayName);
                nodeRoot.Tag = rootModel;

                treeCategory.Nodes.Add(nodeRoot);
                PopulateCategory(nodeRoot, string.Empty);
                nodeRoot.ExpandAll();
                treeCategory.SelectedNode = nodeRoot;
                SelectedNodeChange(nodeRoot);
            }
        }
 public CategoryDetail GetSubCategoryForCategoryByID(int CategoryId, int SubCategoryId)
 {
     return(AllCategory.FirstOrDefault(c => c.CategoryId == CategoryId)
            .CategoryDetails.FirstOrDefault(s => s.SubCategory.SubCategoryId == SubCategoryId));
 }
 public Category GetCategoryByID(int id)
 {
     return(AllCategory.FirstOrDefault(c => c.CategoryId == id));
 }