public void OnCategoryDeleted(ICategory category)
 {
     if (CategoryDeleted != null)
     {
         CategoryDeleted(new SingleItemEventArgs<ICategory>(category));
     }        
 }
Example #2
0
		public void PopulateFrom(ICategory input) {
			this.Description = input.Description;
			this.ParentCategoryId = input.ParentCategoryId;
			this.PictureId = input.PictureId;
			this.DisplayOrder = input.DisplayOrder;
			this.Published = input.Published;
			this.Deleted = input.Deleted;
			this.CreatedOnUtc = input.CreatedOnUtc;
			this.UpdatedOnUtc = input.UpdatedOnUtc;
			this.CategoryTemplateId = input.CategoryTemplateId;
			this.MetaKeywords = input.MetaKeywords;
			this.MetaDescription = input.MetaDescription;
			this.MetaTitle = input.MetaTitle;
			this.PageSize = input.PageSize;
			this.AllowCustomersToSelectPageSize = input.AllowCustomersToSelectPageSize;
			this.PageSizeOptions = input.PageSizeOptions;
			this.PriceRanges = input.PriceRanges;
			this.ShowOnHomePage = input.ShowOnHomePage;
			this.IncludeInTopMenu = input.IncludeInTopMenu;
			this.HasDiscountsApplied = input.HasDiscountsApplied;
			this.SubjectToAcl = input.SubjectToAcl;
			this.LimitedToStores = input.LimitedToStores;
			this.Name = input.Name;
			this.ID = input.ID;
			this.ID = input.ID;
		}
Example #3
0
 public Rule(ICategory applyCategory, IAction action, ICondition condition, string name)
 {
     m_condition = condition;
     m_action = action;
     m_applyCategory = applyCategory;
     m_name = name;
 }
Example #4
0
        public IEnumerable<ITemplateBind> GetTemplateBindsForCategory(ICategory category)
        {
            //ITemplateBind bind;

            //bind = this.GetBind(TemplateBindType.CategoryTemplate, category.ID);

            //如果栏目不存在绑定,则查找模块的绑定
            //if (false || bind == null)
            //{
            //    int moduleID = cbll.Get(a => a.ID == categoryID).ModuleID;
            //    bind = GetBind(TemplateBindType.ModuleCategoryTemplate, moduleID.ToString());
            //}

               ITemplateBind bind=  this.GetBind(TemplateBindType.CategoryTemplate, category.Id);

               if (bind != null) yield return bind;
               bind= this.GetBind(TemplateBindType.CategoryArchiveTemplate, category.Id);
               if (bind != null) yield return bind;

            /*

            IDictionary<TemplateBindType, ITemplateBind> templates = new Dictionary<TemplateBindType, ITemplateBind>();
            if (bind != null)
            {
                templates.Add(TemplateBindType.CategoryTemplate, bind);
            }

            if (bindArchive != null)
            {
                templates.Add(TemplateBindType.CategoryArchiveTemplate, bindArchive);
            }
            return templates;
            */
        }
        public void SetUp()
        {
            CategoryFactory.AddCategoryType(TestCategoryFactory.CategoryName, TestCategoryFactory.CategoryTypes,
                                            TestCategoryFactory.CategoryAttributes);

            _category = CategoryFactory.GetCategory(TestCategoryFactory.CategoryName);
            _targetObject = new TargetObject(_category, _category.CategoryTypes[TestCategoryFactory.BeginnerCategory]);
        }
Example #6
0
        protected override void OnInit(EventArgs e)
        {
            int categoryType;
            base.OnInit(e);
            Int32.TryParse(Request["Category"], out categoryType);

            _category = CategoryFactory.CreateCategory(categoryType);
        }
        private string GetCellValue(ICategory phase)
        {
            if (phase == null || phase.Contributions == null) return string.Empty;

            int count = phase.Contributions.Select(x => x.Contributor).Distinct().Count();
            if (count <= 0) return string.Empty;
            return count.ToString();
        }
Example #8
0
        public void AddContribution(ICategory contributionProject)
        {
            var list = (Contributions as List<ICategory>);

            // Don't add duplicates
            if (list.Any(x => x.Name == contributionProject.Name && x.URL == contributionProject.URL)) return;
            list.Add(contributionProject);
        }
Example #9
0
 public Post(IUser userRepository, ICategory categoryRepository, ITag tagRepository, IComment commentRepository)
 {
     _postsTable = context.GetTable<PostEntity>();
     _commentRepository = commentRepository;
     _tagRepository = tagRepository;
     _categoryRepository = categoryRepository;
     _userRepository = userRepository;
 }
Example #10
0
 public CategoryData(string taxonomyId, string categoryTitle)
 {
     category = new Category
     {
         Id = taxonomyId,
         Title = categoryTitle
     };
 }
 public bool Equals(ICategory other)
 {
     if (ReferenceEquals(this, other))
         return true;
     if (other == null)
         return false;
     return this.EventType == other.EventType && this.Name == other.Name;
 }
Example #12
0
 public MockPost()
 {
     _postsTable = GetMockPosts();
     _commentRepository = new MockComment();
     _tagRepository = new MockTag();
     _categoryRepository = new MockCategory();
     _userRepository = new MockUser();
 }
Example #13
0
 public HomeController(ICategory catsvc,IProduct prodsvc,ICart cartsvc, ICheckout checkoutsvc, ICommon commonsvc)
 {
     _categoryService = catsvc;
     _productService = prodsvc;
     _cartService = cartsvc;
     _checkoutService = checkoutsvc;
     _commonService = commonsvc;
 }
Example #14
0
 public HomeController(IPost postRepository, IUser userRepository, ICategory categoryRepository, ITag tagRepository, ISettings settingsRepository, ICacheService cacheService)
     : base (settingsRepository)
 {
     _postRepository = postRepository;
     _userRepository = userRepository;
     _categoryRepository = categoryRepository;
     _tagRepository = tagRepository;
     _cacheService = cacheService;
 }
Example #15
0
 public Item(string name, decimal price, string description, string size, ICategory category, IImage img = null)
 {
     this.Name = name;
     this.Img = img;
     this.Price = price;
     this.Description = description;
     this.Size = size;
     this.Category = category;
 }
Example #16
0
        public void Init(ICategory category)
        {
            if (!category.Engine.CanBeClassify)
            {
                throw new CannotBeClassifyException("Class must be prepared to classification firstly.");
            }

            this._category = category;
        }
		public string GetCanonicalUrl(ICategory category)
		{
			var productCategoryUrl = category.UrlName;
			while (category.Parent != null)
			{
				category = category.Parent;
				productCategoryUrl = string.Format("{0}/{1}", category.UrlName, productCategoryUrl);
			}
			return productCategoryUrl;
		}
Example #18
0
        public TargetObject(ICategory category, string categoryType)
        {
            this.CategoryType = categoryType;
            this._variablesProbabilityMap = new AttributesCollection();

            foreach (string variableName in category.Attributes)
            {
                this._variablesProbabilityMap.Add(variableName);
            }
        }
Example #19
0
 public static void InitContext()
 {
     if (InitEvent != null)
     {
             CategoryService = InitEvent(typeof(ICategory)) as ICategory;         
             PostService = InitEvent(typeof(IPost)) as IPost;         
             PostTagMapService = InitEvent(typeof(IPostTagMap)) as IPostTagMap;         
             TagService = InitEvent(typeof(ITag)) as ITag;         
     }
 }
        private static void GetProbabilities(ITargetObject titanicPassenger, ICategory category, out double survivedProbability, out double notSurvivedProbability)
        {
            IClassifer classifer = new Classifer();
            classifer.Init(category);

            Dictionary<string, double> classification = classifer.GetClassification(titanicPassenger);

            survivedProbability = classification["Edible"];
            notSurvivedProbability = classification["Poisonous"];
        }
        public CategoryAdminController(ICategory categoryRepository, IPost postRepository, ISettings settingsRepository)
            : base(settingsRepository)
        {
            _categoryRepository = categoryRepository;
            _postRepository = postRepository;
            ExpectedMasterName = string.Empty;

            _itemsPerPage = settingsRepository.ManageItemsPerPage;

            IsAdminController = true;
        }
        private static void GetProbabilities(ITargetObject snowboardExpensiveFreestyleToClassify, ICategory category, out double beginnerProbability, out double mediumProbability, out double advancedProbability)
        {
            IClassifer classifer = new Classifer();
            classifer.Init(category);

            Dictionary<string, double> classification = classifer.GetClassification(snowboardExpensiveFreestyleToClassify);

            beginnerProbability = classification[category.CategoryTypes[TestCategoryFactory.BeginnerCategory]];
            mediumProbability = classification[category.CategoryTypes[TestCategoryFactory.MediumCategory]];
            advancedProbability = classification[category.CategoryTypes[TestCategoryFactory.AdvancedCategory]];
        }
        private static void TestClassifyAllMountainCheapAsBeginnerCategory(ICategory category)
        {
            ITargetObject snowboardCheapAllMountainToClassify = new TargetObject(category, String.Empty);
            snowboardCheapAllMountainToClassify.SetAttributeExist(TestCategoryFactory.CategoryAttributes[TestCategoryFactory.AllMountain]);
            snowboardCheapAllMountainToClassify.SetAttributeExist(TestCategoryFactory.CategoryAttributes[TestCategoryFactory.Cheap]);

            double beginnerProbability, mediumProbability, advancedProbability;

            GetProbabilities(snowboardCheapAllMountainToClassify, category, out beginnerProbability, out mediumProbability, out advancedProbability);

            Assert.IsTrue(beginnerProbability > mediumProbability);
            Assert.IsTrue(beginnerProbability > advancedProbability);
        }
Example #24
0
        public AdminController(IPost postRepository, IComment commentRepository, ICategory categoryRepository, ITag tagRepository, ISettings settingsRepository, IPathMapper pathMapper, IUser userRepository)
            : base(settingsRepository)
        {
            _postRepository = postRepository;
            _commentRepository = commentRepository;
            _categoryRepository = categoryRepository;
            _tagRepository = tagRepository;
            _pathMapper = pathMapper;
            _userRepository = userRepository;
            ExpectedMasterName = string.Empty;

            IsAdminController = true;
        }
Example #25
0
 public void CreateMenuButtons(ICategory button)
 {
     foreach (var p in button.Products)
     {
         var b = new Button { Text = p.Description };
         b.Click += ProductClicked;
         b.Width = 110;
         b.Height = 90;
         b.BackColor = Color.CadetBlue;
         b.ForeColor = Color.White;
         b.Tag = p;
         flpMenu.Controls.Add(b);
     }
 }
Example #26
0
        public UserAdminController(IPost postRepository, IComment commentRepository, ICategory categoryRepository, ITag tagRepository, IUser userRepository, ISettings settingsRepository)
            : base(settingsRepository)
        {
            _postRepository = postRepository;
            _commentRepository = commentRepository;
            _categoryRepository = categoryRepository;
            _tagRepository = tagRepository;
            _userRepository = userRepository;
            ExpectedMasterName = string.Empty;

            _itemsPerPage = settingsRepository.ManageItemsPerPage;

            IsAdminController = true;
        }
Example #27
0
        public CompletedTaskGroup(string groupName, DateTime rangeStart,
								   DateTime rangeEnd, Gtk.TreeModel tasks)
            : base(groupName, rangeStart, rangeEnd,
					new CompletedTasksSortModel(tasks))
        {
            // Don't hide this group when it's empty because then the range
            // slider won't appear and the user won't be able to customize the
            // range.
            this.HideWhenEmpty = false;

            selectedCategory = GetSelectedCategory ();
            Application.Preferences.SettingChanged += OnSelectedCategorySettingChanged;

            CreateRangeSlider ();
            UpdateDateRanges ();
        }
        public override void DeleteCategory(ICategory category)
        {
            if (category == null)
                throw new ArgumentNullException("category");

            ICategory c = GetCategory(category.ID);

            if (c == null)
                return;

            LinqCategory item = new LinqCategory()
            {
                ApplicationName = this.ApplicationName,
                DateCreated = category.DateCreated,
                ID = category.ID,
                LastUpdated = category.LastUpdated,
                Name = category.Name,
                ParentID = category.Parent != null ? category.Parent.ID : default(Nullable<Guid>)
            };

            using (ContentManagerDataContext db = new ContentManagerDataContext(ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString))
            {
                Table<LinqCategory> categories = db.GetTable<LinqCategory>();

                // Set to false to indicate that the object does not have a timestamp (RowVersion)
                categories.Attach(item, true);

                categories.DeleteOnSubmit(item);

                try
                {
                    db.SubmitChanges(ConflictMode.ContinueOnConflict);
                }
                catch (ChangeConflictException ex)
                {
                    Trace.TraceError(ex.Message);

                    // All database values overwrite current values.
                    foreach (ObjectChangeConflict occ in db.ChangeConflicts)
                        occ.Resolve(RefreshMode.OverwriteCurrentValues);
                }
                catch (System.Data.Common.DbException ex)
                {
                    Trace.TraceError(ex.Message);
                }
            }
        }
        public void classify(string mushroomTeachingDataFile, string mushroomTestingDataFile, string outputDataFile)
        {
            this._dataLoader = new DataLoader();
            this._category = this.PrepareCategoryFromFile();

            Console.WriteLine("Loading data");
            List<ITargetObject> targetObjects = this._dataLoader.LoadTeachingData(_category, mushroomTeachingDataFile);

            Console.WriteLine("Teaching category engine");
            _category.Engine.TeachCategory(targetObjects);

            _category.Engine.PrepareToClassification();

            var fileInfo = new FileInfo(mushroomTestingDataFile);
            TextReader reader = fileInfo.OpenText();
            TextWriter writer = new StreamWriter(outputDataFile);

            string text;
            double edible, poisonous;
            List<string> attributes;

            Console.WriteLine("Classifing");
            do
            {
                text = reader.ReadLine();
                if (String.Equals(text, NewObjectCommand))
                {
                    ITargetObject mushroom = new TargetObject(_category, String.Empty);
                    string categoryType = String.Empty;

                    attributes = getAttributes(_category, reader,out categoryType);

                    foreach (string attribute in attributes)
                    {
                        mushroom.SetAttributeExist(attribute);
                    }

                    GetProbabilities(mushroom, _category, out edible, out poisonous);

                    writer.WriteLine(edible + " " + poisonous + " " + categoryType);
                    writer.Flush();
                }
            } while (text != null);
            writer.Close();
            reader.Close();
        }
        public void DeleteRelations(ICategory category)
        {
            var queries = new List<IEnumerable<IEntityCategory>>();
            foreach (var categoryAccessor in CategoryAccessors.Accessors)
            {
                queries.Add(categoryAccessor.QueryEntityCategories(Repository, category));
            }

            foreach (var enumerable in queries)
            {
                var widgetRelations = enumerable as IList<IEntityCategory> ?? enumerable.ToList();
                foreach (var widgetRelation in widgetRelations)
                {
                    Repository.Delete(widgetRelation);
                }
            }
        }
Example #31
0
 private void cboService_SelectedIndexChanged(object sender, EventArgs e)
 {
     timer1.Stop();
     if (cboService.Text == @"Consultation")
     {
         _keyService = @"Consultation";
         _category   = new ConsultationCategory();
         var dic = _category.ShowCategoryForDoctor(Account.WorkerId);
         if (dic.Count != 0)
         {
             cboCategory.DataSource    = new BindingSource(dic, null);
             cboCategory.DisplayMember = "Value";
             cboCategory.ValueMember   = "Key";
             _have = true;
         }
         else
         {
             _have = false;
             cboCategory.DataSource = null;
             cboCategory.Items.Clear();
         }
     }
     if (cboService.Text == @"Laboratory")
     {
         _keyService = @"Laboratory";
         _category   = new LaboratoryCategory();
         var dic = _category.ShowCategoryForDoctor(Account.WorkerId);
         if (dic.Count != 0)
         {
             cboCategory.DataSource    = new BindingSource(dic, null);
             cboCategory.DisplayMember = "Value";
             cboCategory.ValueMember   = "Key";
             _have = true;
         }
         else
         {
             _have = false;
             cboCategory.DataSource = null;
             cboCategory.Items.Clear();
         }
     }
     if (cboService.Text == @"Medical Imaging")
     {
         _keyService = @"MedicalImaging";
         _category   = new MedicalImagingCategory();
         var dic = _category.ShowCategoryForDoctor(Account.WorkerId);
         if (dic.Count != 0)
         {
             cboCategory.DataSource    = new BindingSource(dic, null);
             cboCategory.DisplayMember = "Value";
             cboCategory.ValueMember   = "Key";
             _have = true;
         }
     }
     if (cboService.Text == @"Prescription")
     {
         _keyService = @"Prescription";
         _category   = new PrescriptionCategory();
         var dic = _category.ShowCategoryForDoctor(Account.WorkerId);
         if (dic.Count != 0)
         {
             cboCategory.DataSource    = new BindingSource(dic, null);
             cboCategory.DisplayMember = "Value";
             cboCategory.ValueMember   = "Key";
             _have = true;
         }
         else
         {
             _have = false;
             cboCategory.DataSource = null;
             cboCategory.Items.Clear();
         }
     }
     if (cboService.Text == @"Various Document")
     {
         _keyService = @"VariousDocument";
         _category   = new VariousDocumentCategory();
         var dic = _category.ShowCategoryForDoctor(Account.WorkerId);
         if (dic.Count != 0)
         {
             cboCategory.DataSource    = new BindingSource(dic, null);
             cboCategory.DisplayMember = "Value";
             cboCategory.ValueMember   = "Key";
             _have = true;
         }
         else
         {
             _have = false;
             cboCategory.DataSource = null;
             cboCategory.Items.Clear();
         }
     }
     Refreshing();
 }
Example #32
0
 /// <summary>
 /// Inserts the category at the specified index
 /// </summary>
 /// <param name="index">The integer index where the category should be inserted</param>
 /// <param name="category">The category to insert</param>
 public abstract void InsertCategory(int index, ICategory category);
Example #33
0
 /// <summary>
 /// Removes the specified category
 /// </summary>
 /// <param name="category">The category to insert</param>
 public abstract void RemoveCategory(ICategory category);
Example #34
0
 /// <summary>
 /// Applies the snapping rule directly to the categories, based on the most recently
 /// collected set of values, and the current VectorEditorSettings.
 /// </summary>
 /// <param name="category">Category the snapping is applied to.</param>
 public void ApplySnapping(ICategory category)
 {
     category.ApplySnapping(EditorSettings.IntervalSnapMethod, EditorSettings.IntervalRoundingDigits, Values);
 }
Example #35
0
 public StoreController(IData dataService, ICategory categoryService)
 {
     _dataService     = dataService;
     _categoryService = categoryService;
 }
 public CategoriesController(ICategory repo) => repository = repo;
Example #37
0
 public ProductController(IProduct productRepository, ICategory categoryRepository)
 {
     _productRepository  = productRepository;
     _categoryRepository = categoryRepository;
 }
Example #38
0
 public void ChangeSelectedCategory(ICategory selectedCategory)
 {
     ActiveForm.SetCurrentCategorySelected(selectedCategory);
 }
Example #39
0
        /// <summary>
        /// Attempts to increase the position of the specified category, and returns true
        /// if the index increase was successful.
        /// </summary>
        /// <param name="category">The category to increase the position of</param>
        /// <returns>Boolean, true if the item's position was increased</returns>
        public override bool IncreaseCategoryIndex(ICategory category)
        {
            IColorCategory cc = category as IColorCategory;

            return(cc != null && _categories.IncreaseIndex(cc));
        }
Example #40
0
 public Play(ICategory category, int points)
 {
     Category = category;
     Points   = points;
 }
Example #41
0
 public Products(IProduct productRepository, ICategory categoryRepository, UserManager <Customer> userManager)
 {
     _productRepository  = productRepository;
     _categoryRepository = categoryRepository;
     _userManager        = userManager;
 }
Example #42
0
 public abstract bool Remove(ICategory item);
Example #43
0
 public abstract bool Contains(ICategory item);
Example #44
0
        /// <summary>
        /// Reduces the index value of the specified category by 1 by
        /// exchaning it with the category before it.  If there is no
        /// category before it, then this does nothing.
        /// </summary>
        /// <param name="category">The category to decrease the index of</param>
        public override bool DecreaseCategoryIndex(ICategory category)
        {
            ILineCategory pc = category as ILineCategory;

            return(pc != null && Categories.DecreaseIndex(pc));
        }
Example #45
0
 public Form1(IProvider pService, ICategory cService)
 {
     InitializeComponent();
     this.pService = pService;
     this.cService = cService;
 }
Example #46
0
 /// <summary>
 /// Re-orders the specified member by attempting to exchange it with the next higher
 /// index category. If there is no higher index, this does nothing.
 /// </summary>
 /// <param name="category">The category to increase the index of</param>
 /// <returns>True, if run successfully.</returns>
 public abstract bool IncreaseCategoryIndex(ICategory category);
 public MenuItemController(ApplicationDbContext db, IWebHostEnvironment hostingEnvironment, ICategory category)
 {
     _db = db;
     _hostingEnvironment = hostingEnvironment;
     _category           = category;
 }
Example #48
0
        public void TestGetCategoryById()
        {
            ICategory ic = this.repo.GetCategory(siteId, 2);

            Console.WriteLine(this.Stringfy(ic.Get()));
        }
Example #49
0
 public static void AssertEqual(ICategory expected, ICategory actual)
 {
     Assert.Equal(expected.Name, actual.Name);
     Assert.Equal(expected.Total, actual.Total);
 }
Example #50
0
 public CategoryController(ICategory _iCategory)
 {
     iCategory = _iCategory;
 }
Example #51
0
 public static int GetStoryCount(this ICategory category)
 {
     return(IoC.Resolve <IStoryRepository>().CountByCategory(category.Id));
 }
Example #52
0
 public EditCategoryViewModel(ICategoryStorage categoryStorage, ICategory category, ICategory parent)
 {
     _categoryStorage = categoryStorage;
     Categories       = _categoryStorage.MakeFlatCategoryTree();
     if (category != null)
     {
         _category   = category;
         Name        = category.Name;
         Description = category.Description;
         if (category.Parent != null)
         {
             ParentCategory = Categories.FirstOrDefault(x => x.Id == category.Parent.Id);
         }
     }
     else
     {
         if (parent != null)
         {
             ParentCategory = Categories.FirstOrDefault(x => x.Id == parent.Id);
         }
     }
 }
Example #53
0
 /// <summary>
 /// Adds a new scheme, assuming that the new scheme is the correct type.
 /// </summary>
 /// <param name="category">The category to add</param>
 public abstract void AddCategory(ICategory category);
        //private static Property Deserialize(IContext context, XmlReader reader, IDictionary<Guid, Signal> signals, IDictionary<Guid, Bus> buses);

        public bool EqualsById(ICategory other)
        {
            return(_id.Equals(other.TypeId));
        }
Example #55
0
 public int GetCategoryExtendRefrenceNum(ICategory category, int extendId)
 {
     return(this.extendDAL.GetCategoryExtendRefrenceNum(category.Site.Id, category.Id, extendId));
 }
Example #56
0
 public CategoryController(ICategory icategory)
 {
     allcategory = icategory;
 }
Example #57
0
 abstract public bool CanApplyToCategory(ICategory category);
Example #58
0
        private void cboCategory_TextUpdate(object sender, EventArgs e)
        {
            var text = cboCategory.Text;

            if (cboService.Text == @"Consultation")
            {
                _category = new ConsultationCategory();
                var dic = _category.SearchCategory(Account.WorkerId, cboCategory.Text.ToLower());
                if (dic.Count != 0)
                {
                    cboCategory.DataSource    = new BindingSource(dic, null);
                    cboCategory.DisplayMember = "Value";
                    cboCategory.ValueMember   = "Key";
                    _have = true;
                }
                else
                {
                    _have = false;
                    cboCategory.DataSource = null;
                    cboCategory.Items.Clear();
                    cboCategory.Text = text;
                    cboCategory.Select(text.Length, 0);
                }
            }
            if (cboService.Text == @"Laboratory")
            {
                _category = new LaboratoryCategory();
                var dic = _category.SearchCategory(Account.WorkerId, cboCategory.Text.ToLower());
                if (dic.Count != 0)
                {
                    cboCategory.DataSource    = new BindingSource(dic, null);
                    cboCategory.DisplayMember = "Value";
                    cboCategory.ValueMember   = "Key";
                    _have = true;
                }
                else
                {
                    _have = false;
                    cboCategory.DataSource = null;
                    cboCategory.Items.Clear();
                    cboCategory.Text = text;
                    cboCategory.Select(text.Length, 0);
                }
            }
            if (cboService.Text == @"Medical Imaging")
            {
                _category = new MedicalImagingCategory();
                var dic = _category.SearchCategory(Account.WorkerId, cboCategory.Text.ToLower());
                if (dic.Count != 0)
                {
                    cboCategory.DataSource    = new BindingSource(dic, null);
                    cboCategory.DisplayMember = "Value";
                    cboCategory.ValueMember   = "Key";
                    _have = true;
                }
                else
                {
                    _have = false;
                    cboCategory.DataSource = null;
                    cboCategory.Items.Clear();
                    cboCategory.Text = text;
                    cboCategory.Select(text.Length, 0);
                }
            }
            if (cboService.Text == @"Prescription")
            {
                _category = new PrescriptionCategory();
                var dic = _category.SearchCategory(Account.WorkerId, cboCategory.Text.ToLower());
                if (dic.Count != 0)
                {
                    cboCategory.DataSource    = new BindingSource(dic, null);
                    cboCategory.DisplayMember = "Value";
                    cboCategory.ValueMember   = "Key";
                    _have = true;
                }
                else
                {
                    _have = false;
                    cboCategory.DataSource = null;
                    cboCategory.Items.Clear();
                    cboCategory.Text = text;
                    cboCategory.Select(text.Length, 0);
                }
            }
            if (cboService.Text == @"Various Document" || cboService.Text == @"VariousDocument")
            {
                _category = new VariousDocumentCategory();
                var dic = _category.SearchCategory(Account.WorkerId, cboCategory.Text.ToLower());
                if (dic.Count != 0)
                {
                    cboCategory.DataSource    = new BindingSource(dic, null);
                    cboCategory.DisplayMember = "Value";
                    cboCategory.ValueMember   = "Key";
                    _have = true;
                }
                else
                {
                    _have = false;
                    cboCategory.DataSource = null;
                    cboCategory.Items.Clear();
                    cboCategory.Text = text;
                    cboCategory.Select(text.Length, 0);
                }
            }
            try
            {
                cboCategory.DroppedDown = false;
            }
            catch
            {
                //
            }
            if (cboCategory.DataSource == null)
            {
                return;
            }
            if (cboCategory.Focused)
            {
                cboCategory.DroppedDown = true;
            }
            Cursor.Current            = Cursors.Default;
            cboCategory.SelectedIndex = -1;
            cboCategory.Text          = text;
            cboCategory.Select(text.Length, 0);
        }
Example #59
0
 public abstract void Add(ICategory item);
Example #60
0
 public CategoryController(ICategory catRepository)
 {
     catRepo = catRepository;
 }