Beispiel #1
0
        public FrmCategory()
        {
            InitializeComponent();

            //
            categoryManager = new CategoryManager();
        }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
      // Initialise data table to hold test results
      _results.Columns.Add("test");
      _results.Columns.Add("result");
      _results.Columns.Add("time");
      _results.Columns.Add("message");
      _results.Columns.Add("class");

      // Initialise controls
      lblResult.Text = "";
      ltlStats.Text = "";

      // Initialise NUnit
      CoreExtensions.Host.InitializeService();

      // Find tests in current assembly
      _testPackage = new TestPackage(Assembly.GetExecutingAssembly().Location);

      if (!IsPostBack)
      {
        var testSuite = new TestSuiteBuilder().Build(_testPackage);
        var categoryManager = new CategoryManager();
        categoryManager.AddAllCategories(testSuite);

        cblCategories.DataSource = (from string cat in categoryManager.Categories select cat).OrderBy(x => x);
        cblCategories.DataBind();
      }
    }
Beispiel #3
0
        public FrmSearchProduct(FrmDanhMucSanPham frmParent)
        {
            InitializeComponent();

            productManager = new ProductManager();
            productNameManager = new ProductNameManager();
            categoryManager = new CategoryManager();
            unitManager = new UnitManager();
            countryManager = new CountryManager();
            manufacturerManager = new ManufacturerManager();
            productStatusManager = new ProductStatusManager();

            this.frmParent = frmParent;
        }
Beispiel #4
0
        public FrmDanhMucSanPham()
        {
            InitializeComponent();

            //Create Manager which will use in form
            productManager = new ProductManager();
            productNameManager = new ProductNameManager();
            productStatusManager = new ProductStatusManager();
            unitManager = new UnitManager();

            categoryManager = new CategoryManager();
            manufacturerManager = new ManufacturerManager();
            countryManager = new CountryManager();
            providerManager = new ProviderManager();

            //
            MODE = Constants.MODE.ADD;
        }
Beispiel #5
0
 public CategoryController()
 {
     _Manager = new CategoryManager();
 }
 /// <summary>
 /// Handles the Validate event of the ComponentValidation control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Web.UI.WebControls.ServerValidateEventArgs"/> instance containing the event data.</param>
 protected void CategoryValidation_Validate(object sender, ServerValidateEventArgs e)
 {
     //validate that at least one version exists.
     e.IsValid = CategoryManager.GetByProjectId(ProjectId).Count > 0;
 }
 public CharacteristicPrintConsoleService(CharacteristicManager characteristicManager, CategoryManager categoryManager)
 {
     _characteristicManager = characteristicManager;
     _categoryManager       = categoryManager;
 }
 public NewsController()
 {
     _postM   = new PostManager();
     _catRepo = new CategoryManager();
 }
Beispiel #9
0
		public IList GetCategories() 
		{
			CategoryManager categoryManager = new CategoryManager();
			categoryManager.AddAllCategories( this.loadedTest );
			ArrayList list = new ArrayList( categoryManager.Categories );
			list.Sort();
			return list;
		}
Beispiel #10
0
        private void BindData()
        {
            if (product != null)
            {
                string productURL = SEOHelper.GetProductUrl(product.ProductId);

                // product name
                hpProductName.Text        = product.Name;
                hpProductName.NavigateUrl = productURL;

                // view more
                hlViewMore.NavigateUrl = productURL;

                #region product price
                var productVariantCollection = ProductManager.GetProductVariantsByProductId(product.ProductId);
                if (productVariantCollection.Count > 0)
                {
                    if (!(productVariantCollection.Count > 1))
                    {
                        var productVariant = productVariantCollection[0];

                        if (!SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                            (NopContext.Current.User != null &&
                             !NopContext.Current.User.IsGuest))
                        {
                            if (productVariant.CustomerEntersPrice)
                            {
                                lblPrice.Visible = false;
                            }
                            else
                            {
                                decimal oldPriceBase = TaxManager.GetPrice(productVariant, productVariant.OldPrice);
                                decimal finalPriceWithoutDiscountBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));

                                decimal oldPrice = CurrencyManager.ConvertCurrency(oldPriceBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                decimal finalPriceWithoutDiscount = CurrencyManager.ConvertCurrency(finalPriceWithoutDiscountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                                if (finalPriceWithoutDiscountBase != oldPriceBase && oldPriceBase != decimal.Zero)
                                {
                                    lblPrice.Text = PriceHelper.FormatPrice(finalPriceWithoutDiscount, false, false);
                                }
                                else
                                {
                                    lblPrice.Text = PriceHelper.FormatPrice(finalPriceWithoutDiscount, false, false);
                                }
                            }
                        }
                        else
                        {
                            lblPrice.Visible = false;
                        }
                    }
                    else
                    {
                        var productVariant = GetVariant(productVariantCollection);
                        if (productVariant != null)
                        {
                            if (!SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                                (NopContext.Current.User != null &&
                                 !NopContext.Current.User.IsGuest))
                            {
                                if (productVariant.CustomerEntersPrice)
                                {
                                    lblPrice.Visible = false;
                                }
                                else
                                {
                                    decimal fromPriceBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));
                                    decimal fromPrice     = CurrencyManager.ConvertCurrency(fromPriceBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                                    lblPrice.Text = String.Format(GetLocaleResourceString("Products.PriceRangeFromText"), PriceHelper.FormatPrice(fromPrice, false, false));
                                }
                            }
                            else
                            {
                                lblPrice.Visible = false;
                            }
                        }
                    }
                }
                else
                {
                    lblPrice.Visible = false;
                }
                #endregion

                // category
                var productCategories = CategoryManager.GetProductCategoriesByProductId(product.ProductId);
                if (productCategories.Count > 0)
                {
                    var breadCrumb = CategoryManager.GetBreadCrumb(productCategories[0].CategoryId);
                    if (breadCrumb.Count > 0)
                    {
                        rptrCategoryBreadcrumb.DataSource = breadCrumb;
                        rptrCategoryBreadcrumb.DataBind();
                    }
                }

                lblCategory.Text = "";// ProductManager.GetProductReviewByProductId(Product.ProductId);
                // catalog number
                LWG.Business.CatalogBiz catalogBiz = new LWG.Business.CatalogBiz();
                lwg_Catalog             catalog    = catalogBiz.GetByID(product.ProductId);
                hlCatalogNo.Text        = Server.HtmlEncode("# - " + catalog.CatalogNumber);
                hlCatalogNo.NavigateUrl = productURL;
            }
        }
Beispiel #11
0
 public void CreateCategoryManager()
 {
     categoryManager = new CategoryManager();
 }
 public void SetUp()
 {
     _categoryManager = new CategoryManager();
     _category1       = _categoryManager.GetOrCreate(18, "Small Car");
     _category2       = _categoryManager.GetOrCreate(70, "Building");
 }
 public CategoryAppService(CategoryManager categoryManager)
 {
     _categoryManager = categoryManager;
 }
Beispiel #14
0
 public Boolean insertCategory(CategoryDto dto)
 {
     Category obj = Category.createCategory(dto.CategoryId, dto.CategoryName, dto.CategoryDescription);
     CategoryManager mgr = new CategoryManager();
     return mgr.insertCategory(obj);
 }
 public void BindTree()
 {
     CategoryManager categoryManager = new CategoryManager(this);
     treCategory.DataSource = categoryManager.GetCategoriesByCompany(Convert.ToInt16(Company.CompanyId));
     treCategory.DataBind();
 }
Beispiel #16
0
 public BankAccountController()
 {
     _db = new ApplicationDbContext();
     _categoryManager = new CategoryManager(_db);
     _manager         = new BankAccountManager(_db);
 }
Beispiel #17
0
 public Form1()
 {
     InitializeComponent();
     _productService  = new ProductManager(new EfProductDal());
     _categoryService = new CategoryManager(new EfCategoryDal());
 }
Beispiel #18
0
        private void LoadBlogPost()
        {
            //Context item - gets Blog Post infomration
            BlogPost blogPost = Sitecore.Context.Item.CreateAs <BlogPost>();

            scTitle.Item = Sitecore.Context.Item;
            scBody.Item  = Sitecore.Context.Item;
            dateBlogPostPublishDate.Item = Sitecore.Context.Item;

            UrlOptions option = new UrlOptions();

            option.AlwaysIncludeServerUrl = true;
            //currentUrl = HttpUtility.UrlEncode(LinkManager.GetItemUrl(blogPost.InnerItem, option));
            currentUrl = LinkManager.GetItemUrl(blogPost.InnerItem, option);
            title      = HttpUtility.UrlEncode(blogPost.Title);

            if (settingsItem.IncludeEmailOnBlogPost)
            {
                pnlEmail.Visible = true;
            }
            if (settingsItem.IncludeFacebookOnBlogPost)
            {
                pnlFacebook.Visible = true;
            }
            if (settingsItem.IncludeGooglePlusOnBlogPost)
            {
                pnlGooglePlus.Visible = true;
            }
            if (settingsItem.IncludeLinkedinOnBlogPost)
            {
                pnlLinkedin.Visible = true;
            }
            if (settingsItem.IncludeTwitterOnBlogPost)
            {
                pnlTwitter.Visible = true;
            }

            if (dateBlogPostPublishDate != null)
            {
                dateBlogPostPublishDate.Field  = BlogPost.BlogPostPublishDateFieldId;
                dateBlogPostPublishDate.Format = settingsItem.BlogPostDateFormat;
            }


            if (blogPost.Authors.Any())
            {
                List <Sitecore.Data.ID> authorIds = new List <Sitecore.Data.ID>();
                foreach (Author a in blogPost.Authors)
                {
                    authorIds.Add(a.ItemId);
                }

                List <Author> authors = AuthorManager.GetAuthorsForBlogPost(authorIds);


                litAuthor.Text = authors[0].FullName;
            }

            litCategories.Text = CategoryManager.GetCommaSeperatedCategoryList(blogPost);

            litTags.Text = TagManager.GetCommaSeperatedTagList(blogPost);
        }
Beispiel #19
0
        protected void LoadCategories(ITest test)
        {
            var categoryManager = new CategoryManager();
            categoryManager.AddAllCategories(test);

            cblCategories.DataSource = (from string cat in categoryManager.Categories select cat).OrderBy(x => x);
            cblCategories.DataBind();
        }
Beispiel #20
0
 public CategoryEditForm(CategoryManager categoryManager)
 {
     _categoryManager = categoryManager;
 }
Beispiel #21
0
 public CategoryDto selectCategoryById(String CategoryId)
 {
     CategoryManager mgr = new CategoryManager();
     Category obj = new Category();
     obj.CategoryId = CategoryId;
     obj = mgr.selectCategoryById(obj);
     if (obj != null)
     {
         return CategoryDto.createCategoryDTO(obj);
     }
     else
     {
         return null;
     }
 }
 public CategoryUpdateUI()
 {
     categoryManager = new CategoryManager();
 }
Beispiel #23
0
    private void InitData()
    {
        CategoryManager cm = new CategoryManager();

        BindDataHelper.BindDropDownList<Category>(this.ddlCateogry, cm.GetAllCategories(), "categoryid", "categoryname");
    }
Beispiel #24
0
        protected void BindData()
        {
            var category = CategoryManager.GetCategoryById(this.CategoryId);

            //breadcrumb
            rptrCategoryBreadcrumb.DataSource = CategoryManager.GetBreadCrumb(this.CategoryId);
            rptrCategoryBreadcrumb.DataBind();

            lDescription.Text = category.Description;

            //subcategories
            var subCategoryCollection = CategoryManager.GetAllCategories(category.CategoryId);

            if (subCategoryCollection.Count > 0)
            {
                dlSubCategories.DataSource = subCategoryCollection;
                dlSubCategories.DataBind();
            }
            else
            {
                dlSubCategories.Visible = false;
            }

            //featured products
            var featuredProducts = category.FeaturedProducts;

            if (featuredProducts.Count > 0)
            {
                dlFeaturedProducts.DataSource = featuredProducts;
                dlFeaturedProducts.DataBind();
            }
            else
            {
                pnlFeaturedProducts.Visible = false;
            }

            //price ranges
            this.ctrlPriceRangeFilter.PriceRanges = category.PriceRanges;

            //page size
            int totalRecords = 0;
            int pageSize     = 12;
            //\Tungnho comment here
            //if (category.PageSize > 0)
            //{
            //    pageSize = category.PageSize;
            //}

            //price ranges
            decimal?minPrice          = null;
            decimal?maxPrice          = null;
            decimal?minPriceConverted = null;
            decimal?maxPriceConverted = null;

            if (ctrlPriceRangeFilter.SelectedPriceRange != null)
            {
                minPrice = ctrlPriceRangeFilter.SelectedPriceRange.From;
                if (minPrice.HasValue)
                {
                    minPriceConverted = CurrencyManager.ConvertCurrency(minPrice.Value, NopContext.Current.WorkingCurrency, CurrencyManager.PrimaryStoreCurrency);
                }

                maxPrice = ctrlPriceRangeFilter.SelectedPriceRange.To;
                if (maxPrice.HasValue)
                {
                    maxPriceConverted = CurrencyManager.ConvertCurrency(maxPrice.Value, NopContext.Current.WorkingCurrency, CurrencyManager.PrimaryStoreCurrency);
                }
            }

            //specification filter
            var psoFilterOption = ctrlProductSpecificationFilter.GetAlreadyFilteredSpecOptionIds();

            //sorting
            ProductSortingEnum orderBy = ProductSortingEnum.Position;

            if (SettingManager.GetSettingValueBoolean("Common.AllowProductSorting"))
            {
                CommonHelper.SelectListItem(this.ddlSorting, CommonHelper.QueryStringInt("orderby"));
                orderBy = (ProductSortingEnum)Enum.ToObject(typeof(ProductSortingEnum), int.Parse(ddlSorting.SelectedItem.Value));
            }

            var productCollection = ProductManager.GetAllProducts(this.CategoryId,
                                                                  0, 0, false, minPriceConverted, maxPriceConverted,
                                                                  string.Empty, false, pageSize, this.CurrentPageIndex,
                                                                  psoFilterOption, orderBy, out totalRecords);

            if (productCollection.Count > 0)
            {
                this.productsPager.PageSize     = pageSize;
                this.productsPager.TotalRecords = totalRecords;
                this.productsPager.PageIndex    = this.CurrentPageIndex;

                this.dlProducts.DataSource = productCollection;
                this.dlProducts.DataBind();
            }
            else
            {
                this.dlProducts.Visible = false;
                this.pnlSorting.Visible = false;
            }
        }
Beispiel #25
0
        public void CategoriesManagerFullTest()
        {
            LocalUser       user                   = Login(username: "******", password: "******");
            var             statusManager          = CategoryManager.ManagerStatus.UnknownError;
            var             statusGetterCategories = CategoriesGetter.GetStatus.UnknownError;
            bool            done                   = false;
            Category        category;
            List <Category> categories        = null;
            var             categoriesManager = new CategoryManager(user);

            categoriesManager.AddCategoryResult = (_status, _category) =>
            {
                statusManager = _status;
                category      = _category;
                done          = true;
            };

            categoriesManager.RemoveCategoryResult = (_status, _category) =>
            {
                statusManager = _status;
                category      = _category;
                done          = true;
            };

            categoriesManager.UpdateCategoryResult = (_status, _category) =>
            {
                statusManager = _status;
                category      = _category;
                done          = true;
            };

            var getterCategories = new CategoriesGetter(user, (_status, _categories) => {
                statusGetterCategories = _status;
                categories             = _categories;
                done = true;
            });

            ///Siunčiam category
            done = false;
            var random = new Random();

            category = new Category {
                Title = random.Next().ToString(), Description = random.Next().ToString()
            };
            categoriesManager.addCategory(category);

            while (!done)
            {
            }
            Assert.AreEqual(statusManager, CategoryManager.ManagerStatus.Success);
            Assert.AreNotEqual(category, null);
            ///

            ///Gaunam categories
            done = false;
            getterCategories.get();

            while (!done)
            {
            }
            Assert.AreEqual(statusGetterCategories, CategoriesGetter.GetStatus.Success);
            Assert.AreNotEqual(categories, null);
            ///Tikrinam ar yra mūsų
            var myCategory = categories.Find((_category) =>
            {
                return(_category.Title == category.Title &&
                       _category.Description == category.Description &&
                       _category.CreatorUsername == user.Username);
            });

            Assert.AreNotEqual(myCategory, null);
            ///

            ///Naujinam category
            category.Description += random.Next().ToString();
            done = false;
            categoriesManager.updateCategory(category);

            while (!done)
            {
            }
            Assert.AreEqual(statusManager, CategoryManager.ManagerStatus.Success);
            Assert.AreNotEqual(category, null);
            ///

            ///Gaunam categories
            done = false;
            getterCategories.get();

            while (!done)
            {
            }
            Assert.AreEqual(statusGetterCategories, CategoriesGetter.GetStatus.Success);
            Assert.AreNotEqual(categories, null);
            ///Tikrinam ar atsinaujino
            myCategory = categories.Find((_category) =>
            {
                return(_category.Title == category.Title &&
                       _category.Description == category.Description &&
                       _category.CreatorUsername == user.Username);
            });
            Assert.AreNotEqual(myCategory, null);
            ///

            ///Trinam category
            done = false;
            categoriesManager.removeCategory(category);

            while (!done)
            {
            }
            Assert.AreEqual(statusManager, CategoryManager.ManagerStatus.Success);
            Assert.AreNotEqual(category, null);
            ///

            ///Gaunam categories
            done = false;
            getterCategories.get();

            while (!done)
            {
            }
            Assert.AreEqual(statusGetterCategories, CategoriesGetter.GetStatus.Success);
            Assert.AreNotEqual(categories, null);
            ///Tikrinam ar išsitrynė
            myCategory = categories.Find((_category) =>
            {
                return(_category.Title == category.Title &&
                       _category.Description == category.Description &&
                       _category.CreatorUsername == user.Username);
            });
            Assert.AreEqual(myCategory, null);
            ///
        }
Beispiel #26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CategoryManager CM = new CategoryManager();

        listCategory = CM.GetList();
    }
Beispiel #27
0
        //[Authorize(Roles = "Marketing")]
        public ActionResult EditSubmission(SubmissionVM model)
        {
            if (ModelState.IsValid)
            {
                var postMgr = new PostManager();
                var catMgr  = new CategoryManager();
                var tagMgr  = new TagManager();

                var editTarget = postMgr.GetById(int.Parse(model.SubmissionId));
                //sub.Id = int.Parse(model.SubmissionId);
                editTarget.Payload.PostTitle         = model.SubmissionTitle;
                editTarget.Payload.PostBody          = model.SubmissionBody;
                editTarget.Payload.PostImageFileName = model.SubmissionImageFileName;

                var catResponse = catMgr.GetCategoryById(int.Parse(model.SubmissionCategoryId));

                if (catResponse.Success)
                {
                    editTarget.Payload.PostCategory = catResponse.Payload;
                }
                else
                {
                    throw new Exception(catResponse.Message);
                }

                var tagResponse = tagMgr.ConvertTagStringToList(model.SubmissionTags);

                if (tagResponse.Success)
                {
                    var tagList = new List <Tag>();

                    foreach (var t in tagResponse.Payload)
                    {
                        t.Posts.Add(editTarget.Payload);
                        tagMgr.AddTag(t);
                        tagList.Add(t);
                    }

                    editTarget.Payload.PostTags = tagList;
                }
                else
                {
                    throw new Exception();
                }

                editTarget.Payload.PostState = PostState.Pending;
                editTarget.Payload.Username  = User.Identity.Name;

                var subResponse = postMgr.EditPost(editTarget.Payload);

                if (subResponse.Success)
                {
                    return(RedirectToAction("ViewSubmissions"));
                }
                else
                {
                    throw new Exception(subResponse.Message);
                }
            }
            else
            {
                return(View(model));
            }
        }
Beispiel #28
0
 public ItemController(CategoryManager categoryManager, ItemManager itemManager)
 {
     _categories = categoryManager;
     _items      = itemManager;
 }
        /// <summary>
        /// Handles the Click event of the OkButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void OkButton_Click(object sender, EventArgs e)
        {
            var oldCategoryId = 0;

            if (!string.IsNullOrEmpty(HiddenField1.Value))
            {
                oldCategoryId = Convert.ToInt32(HiddenField1.Value);
            }

            if (oldCategoryId != 0)
            {
                var queryClauses = new List <QueryClause>
                {
                    new QueryClause("AND", "iv.[IssueCategoryId]", "=", HiddenField1.Value, SqlDbType.Int)
                };

                var issues = IssueManager.PerformQuery(queryClauses, null, ProjectId);

                if (RadioButton1.Checked) //delete category
                {
                    //if (RecursiveDelete.Checked == true)
                    //Category.DeleteChildCategoriesByCategoryId(OldCategoryId);
                    //delete the category.
                    CategoryManager.Delete(oldCategoryId);
                }

                if (RadioButton2.Checked) //reassign issues to existing category.
                {
                    if (DropCategory.SelectedValue == 0)
                    {
                        Message1.ShowErrorMessage(GetLocalResourceObject("NoCategorySelected").ToString());
                        return;
                    }
                    if (oldCategoryId == DropCategory.SelectedValue)
                    {
                        Message1.ShowErrorMessage(GetLocalResourceObject("SameCategorySelected").ToString());
                        return;
                    }

                    foreach (var issue in issues)
                    {
                        issue.CategoryName = DropCategory.SelectedText;
                        issue.CategoryId   = DropCategory.SelectedValue;
                        IssueManager.SaveOrUpdate(issue);
                    }

                    //delete the category.
                    CategoryManager.Delete(oldCategoryId);
                }

                //assign new category
                if (RadioButton3.Checked)
                {
                    if (string.IsNullOrEmpty(NewCategoryTextBox.Text))
                    {
                        Message1.ShowErrorMessage(GetLocalResourceObject("NewCategoryNotEntered").ToString());
                        return;
                    }
                    var c = new Category {
                        ProjectId = ProjectId, ParentCategoryId = 0, Name = NewCategoryTextBox.Text, ChildCount = 0
                    };
                    CategoryManager.SaveOrUpdate(c);
                    foreach (var issue in issues)
                    {
                        issue.CategoryName = NewCategoryTextBox.Text;
                        issue.CategoryId   = c.Id;
                        IssueManager.SaveOrUpdate(issue);
                    }
                    //delete the category.
                    CategoryManager.Delete(oldCategoryId);
                }
            }
            else
            {
                Message1.ShowErrorMessage(GetLocalResourceObject("CannotDeleteRootCategory").ToString());
            }
        }
        /// <summary>
        /// Setup the CategoryView
        /// </summary>
        /// <param name="p_lvwList">The source list view.</param>
        /// <param name="p_cmgCategoryManager">The mod Category Manager.</param>
        public void Setup(ReadOnlyObservableList <IMod> p_rolManagedMods, ReadOnlyObservableList <IMod> p_rolActiveMods, IModRepository p_mmrModRepository, CategoryManager p_cmgCategoryManager, ISettings p_Settings)
        {
            this.Tag = false;

            this.CellEditActivation = CellEditActivateMode.None;
            this.MultiSelect        = true;
            this.AllowDrop          = true;
            this.UseFiltering       = true;

            CategoryManager    = p_cmgCategoryManager;
            m_mmrModRepository = p_mmrModRepository;
            m_rolManagedMods   = p_rolManagedMods;
            m_rolActiveMods    = p_rolActiveMods;
            Settings           = p_Settings;

            // Setup menuStrip commands
            SetupContextMenu();

            // Setup category validator
            SetupCategoryValidator();

            // Setup category sorter
            SetupCategorySorter();

            this.CheckBoxes              = false;
            this.UseSubItemCheckBoxes    = false;
            this.BooleanCheckStateGetter = delegate(object x)
            {
                if (x.GetType() != typeof(ModCategory))
                {
                    if (m_rolActiveMods.Contains((IMod)x))
                    {
                        return(true);
                    }
                }

                return(false);
            };

            // Setup AspectGetter (IconListView cell parser)
            SetupColumnParser();

            // Setup the Drag&Drop functionality
            SetupDragAndDrop();

            // Setup hyperlink manager
            SetupHyperlinkManager();

            // Setup ImageGetters
            SetupImageGetters();

            // Set control initialized
            this.Tag = true;
        }
Beispiel #31
0
 public EditCategoriesViewModel(CategoryManager categoryManager, HttpClient httpClient)
 {
     _categoryManager = categoryManager;
     _httpClient      = httpClient;
 }
        /// <summary>
        /// Setup the IconListView cell parser
        /// </summary>
        public void SetupColumnParser()
        {
            tlcModName.AspectGetter = delegate(object rowObject)
            {
                string Val = String.Empty;

                if (rowObject.GetType() == typeof(ModCategory))
                {
                    Val = ((IModCategory)rowObject).CategoryName;
                }
                else
                {
                    Val = ((IMod)rowObject).ModName;
                }

                return(Val);
            };

            tlcModName.AspectToStringConverter = delegate(object x)
            {
                return(x.ToString());
            };

            tlcInstallDate.AspectGetter = delegate(object rowObject)
            {
                string Val = String.Empty;

                if (rowObject.GetType() != typeof(ModCategory))
                {
                    if (!String.IsNullOrEmpty(((IMod)rowObject).InstallDate))
                    {
                        Val = ((IMod)rowObject).InstallDate;
                    }
                    if (CheckDate(Val))
                    {
                        return(Convert.ToDateTime(Val));
                    }
                }
                else
                {
                    return(((ModCategory)rowObject).NewMods.ToString());
                }

                return(null);
            };

            tlcInstallDate.AspectToStringConverter = delegate(object x)
            {
                int intCheck;
                if ((x != null) && (!Int32.TryParse(x.ToString(), out intCheck)))
                {
                    return(x.ToString());
                }
                else
                {
                    return(String.Empty);
                }
            };

            tlcDownloadDate.AspectGetter = delegate(object rowObject)
            {
                string Val = String.Empty;

                if (rowObject.GetType() != typeof(ModCategory))
                {
                    string strFilePath = ((IMod)rowObject).Filename;
                    if (!String.IsNullOrWhiteSpace(strFilePath))
                    {
                        if (File.Exists(strFilePath))
                        {
                            Val = File.GetLastWriteTime(((IMod)rowObject).Filename).ToString();
                        }
                    }
                    if (CheckDate(Val))
                    {
                        return(Convert.ToDateTime(Val));
                    }
                }
                else
                {
                    return(((ModCategory)rowObject).NewMods.ToString());
                }

                return(null);
            };

            tlcDownloadDate.AspectToStringConverter = delegate(object x)
            {
                int intCheck;
                if ((x != null) && (!Int32.TryParse(x.ToString(), out intCheck)))
                {
                    return(x.ToString());
                }
                else
                {
                    return(String.Empty);
                }
            };

            tlcEndorsement.AspectGetter = delegate(object rowObject)
            {
                string Value = String.Empty;

                if (rowObject.GetType() != typeof(ModCategory))
                {
                    IMod modMod = (IMod)rowObject;
                    if (modMod != null)
                    {
                        Value = modMod.IsEndorsed.ToString();
                    }
                }

                return(Value);
            };

            tlcEndorsement.AspectToStringConverter = delegate(object x)
            {
                return(String.Empty);
            };

            tlcVersion.AspectGetter = delegate(object rowObject)
            {
                string Val = string.Empty;

                if (rowObject.GetType() != typeof(ModCategory))
                {
                    if (!String.IsNullOrEmpty(((IMod)rowObject).HumanReadableVersion))
                    {
                        Val = ((IMod)rowObject).HumanReadableVersion;
                    }
                    return(Val);
                }
                else
                {
                    return(String.Empty);
                }
            };

            tlcWebVersion.AspectGetter = delegate(object rowObject)
            {
                string Val = String.Empty;

                if (rowObject.GetType() != typeof(ModCategory))
                {
                    if (!String.IsNullOrEmpty(((IMod)rowObject).LastKnownVersion))
                    {
                        Val = ((IMod)rowObject).LastKnownVersion;
                    }
                    return(Val);
                }
                else
                {
                    return(String.Empty);
                }
            };

            tlcAuthor.AspectGetter = delegate(object rowObject)
            {
                string Val = String.Empty;

                if (rowObject.GetType() != typeof(ModCategory))
                {
                    if (!String.IsNullOrEmpty(((IMod)rowObject).Author))
                    {
                        Val = ((IMod)rowObject).Author;
                    }
                    return(Val);
                }
                else
                {
                    return(String.Empty);
                }
            };

            tlcCategory.AspectGetter = delegate(object rowObject)
            {
                string Val = String.Empty;

                if (rowObject.GetType() != typeof(ModCategory))
                {
                    IMod modMod = (IMod)rowObject;
                    Val = CategoryManager.FindCategory(modMod.CustomCategoryId >= 0 ? modMod.CustomCategoryId : modMod.CategoryId).CategoryName;
                }

                return(Val);
            };
        }
 public PostDetailsController(CategoryManager category, PostManager post)
 {
     this.categoryManager = category;
     this.postManager     = post;
 }
 /// <summary>
 /// Adds a new category.
 /// </summary>
 public void AddNewCategory()
 {
     this.AddData(CategoryManager.AddCategory(), true);
     this.SetupContextMenu();
 }
    public void Initialize()
    {
        categoryManager = FindObjectOfType <CategoryManager>();

        Signals.SelectCategoryFromLibrary.AddListener(SelectCategory);
    }
        public CategoriesController()
        {
            _db = new ToDoListDbContext();

            _cm = new CategoryManager <Category>(new CategoryStore <Category>(_db));
        }
 public BrowseController(ArticleManager articleManager, CategoryManager categoryManager, SearchesManager searchesManager)
 {
     this._articleManager = articleManager;
     this._categoryManager = categoryManager;
     this._searchesManager = searchesManager;
 }
        public IActionResult Delete(int id)
        {
            CategoryManager.Delete(id);

            return(RedirectToAction(nameof(List)));
        }
Beispiel #39
0
        /// <summary>
        /// 加载文章列表
        /// </summary>
        protected void LoadPostList()
        {
            int    categoryId = -1;
            int    tagId      = -1;
            int    userId     = -1;
            string keyword    = string.Empty;
            string data       = string.Empty;
            string begindate  = string.Empty;
            string enddate    = string.Empty;

            int pageindex = RequestHelper.QueryInt("page", 1);

            string messageinfo = string.Empty;

            string url = MakeUrl(string.Empty, string.Empty, string.Empty);

            if (pageType == "category")
            {
                string       slug = RequestHelper.QueryString("slug");
                CategoryInfo cate = CategoryManager.GetCategory(slug);
                if (cate != null)
                {
                    categoryId = cate.CategoryId;
                    th.Put(TagFields.META_KEYWORDS, cate.Name);
                    th.Put(TagFields.META_DESCRIPTION, cate.Description);
                    th.Put(TagFields.PAGE_TITLE, cate.Name);
                    messageinfo = string.Format("<h2 class=\"post-message\">分类:{0}</h2>", cate.Name);

                    url = MakeUrl("category", "slug", Server.UrlEncode(slug));
                }
            }
            else if (pageType == "tag")
            {
                string  slug = RequestHelper.QueryString("slug");
                TagInfo tag  = TagManager.GetTagBySlug(slug);
                if (tag != null)
                {
                    tagId = tag.TagId;
                    th.Put(TagFields.META_KEYWORDS, tag.Name);
                    th.Put(TagFields.META_DESCRIPTION, tag.Description);
                    th.Put(TagFields.PAGE_TITLE, tag.Name);
                    messageinfo = string.Format("<h2 class=\"post-message\">标签:{0}</h2>", tag.Name);

                    url = MakeUrl("tag", "slug", Server.UrlEncode(slug));
                }
            }
            else if (pageType == "author")
            {
                string   userName = RequestHelper.QueryString("username");
                UserInfo user     = UserManager.GetUser(userName);
                if (user != null)
                {
                    userId = user.UserId;
                    th.Put(TagFields.META_KEYWORDS, user.Name);
                    th.Put(TagFields.META_DESCRIPTION, user.Description);
                    th.Put(TagFields.PAGE_TITLE, user.Name);
                    messageinfo = string.Format("<h2 class=\"post-message\">作者:{0}</h2>", user.Name);

                    url = MakeUrl("author", "username", Server.UrlEncode(userName));
                }
            }
            else if (pageType == "search")
            {
                keyword = StringHelper.CutString(StringHelper.SqlEncode(RequestHelper.QueryString("keyword")), 15);
                th.Put(TagFields.META_KEYWORDS, keyword);
                th.Put(TagFields.META_DESCRIPTION, keyword);
                th.Put(TagFields.PAGE_TITLE, keyword);
                th.Put(TagFields.SEARCH_KEYWORD, keyword);
                messageinfo = string.Format("<h2 class=\"post-message\">搜索:{0}</h2>", keyword);

                url = MakeUrl("search", "keyword", Server.UrlEncode(keyword));
            }
            else if (pageType == "archive")     //先按月归档
            {
                string datestr = RequestHelper.QueryString("date");

                string   year  = datestr.Substring(0, 4);
                string   month = datestr.Substring(4, 2);
                DateTime date  = Convert.ToDateTime(year + "-" + month);
                begindate = date.ToString("yyy-MM-dd");
                enddate   = date.AddMonths(1).ToString("yyy-MM-dd");
                th.Put(TagFields.META_KEYWORDS, "归档");
                th.Put(TagFields.META_DESCRIPTION, SettingManager.GetSetting().SiteName + date.ToString("yyyy-MM") + "的归档");
                th.Put(TagFields.PAGE_TITLE, "归档:" + date.ToString("yyyy-MM"));
                messageinfo = string.Format("<h2 class=\"post-message\">归档:{0}</h2>", date.ToString("yyyy-MM"));

                url = MakeUrl("archive", "date", datestr);
            }

            else    //首页
            {
                if (pageindex == 1)
                {
                    th.Put(TagFields.IS_DEFAULT, "1");
                }
            }

            th.Put(TagFields.POST_MESSAGE, messageinfo);
            //     th.Put(TagFields.PAGER_INDEX, pageindex);

            int recordCount = 0;

            th.Put(TagFields.POSTS, PostManager.GetPostList(SettingManager.GetSetting().PageSizePostCount, pageindex, out recordCount, categoryId, tagId, userId, -1, 1, -1, 0, begindate, enddate, keyword));
            th.Put(TagFields.PAGER, Pager.CreateHtml(SettingManager.GetSetting().PageSizePostCount, recordCount, url));

            Display("default.html");
        }
Beispiel #40
0
        /// <summary>
        /// 加载通用标签
        /// </summary>
        protected void LoadDefault()
        {
            #region 全局

            th.Put(TagFields.SITE_NAME, SettingManager.GetSetting().SiteName);
            th.Put(TagFields.SITE_DESCRIPTION, SettingManager.GetSetting().SiteDescription);
            th.Put(TagFields.META_KEYWORDS, SettingManager.GetSetting().MetaKeywords);
            th.Put(TagFields.META_DESCRIPTION, SettingManager.GetSetting().MetaDescription);

            th.Put(TagFields.FOOTER_HTML, SettingManager.GetSetting().FooterHtml);

            th.Put(TagFields.VERSION, SettingManager.GetSetting().Version);

            th.Put(TagFields.PAGE_TITLE, "首页");

            th.Put(TagFields.SITE_PATH, ConfigHelper.SitePath);
            th.Put(TagFields.SITE_URL, ConfigHelper.SiteUrl);

            th.Put(TagFields.THEME_PATH, ConfigHelper.SitePath + "themes/" + themeName + "/");
            th.Put(TagFields.THEME_URL, ConfigHelper.SiteUrl + "themes/" + themeName + "/");

            th.Put(TagFields.IS_DEFAULT, "0");
            th.Put(TagFields.IS_POST, "0");

            //th.Put(TagFields.FEED_URL, ConfigHelper.SiteUrl + "feed/post" + SettingManager.GetSetting().RewriteExtension);
            //th.Put(TagFields.FEED_COMMENT_URL, ConfigHelper.SiteUrl + "feed/comment" + SettingManager.GetSetting().RewriteExtension);

            th.Put(TagFields.FEED_URL, ConfigHelper.SiteUrl + "feed/post.aspx");
            th.Put(TagFields.FEED_COMMENT_URL, ConfigHelper.SiteUrl + "feed/comment.aspx");

            th.Put(TagFields.PAGER, string.Empty);
            th.Put(TagFields.PAGER_INDEX, RequestHelper.QueryInt("page", 1));

            th.Put(TagFields.URL, RequestHelper.CurrentUrl);
            th.Put(TagFields.DATE, DateTime.Now);

            th.Put(TagFields.ARCHIVES, ArchiveManager.GetArchive());

            th.Put(TagFields.SEARCH_KEYWORD, string.Empty);

            th.Put(TagFields.QUERY_COUNT, 0);
            th.Put(TagFields.PROCESS_TIME, 0);

            th.Put(TagFields.ENABLE_VERIFYCODE, SettingManager.GetSetting().EnableVerifyCode);

            string headhtml = string.Empty;

            headhtml += string.Format("<meta name=\"generator\" content=\"Loachs {0}\" />\n", SettingManager.GetSetting().Version);
            headhtml += "<meta name=\"author\" content=\"Loachs Team\" />\n";
            headhtml += string.Format("<meta name=\"copyright\" content=\"2008-{0} Loachs Team.\" />\n", DateTime.Now.Year);
            headhtml += string.Format("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"{0}\"  href=\"{1}\"  />\n", SettingManager.GetSetting().SiteName, ConfigHelper.SiteUrl + "feed/post" + SettingManager.GetSetting().RewriteExtension);
            headhtml += string.Format("<link rel=\"EditURI\" type=\"application/rsd+xml\" title=\"RSD\" href=\"{0}xmlrpc/rsd.aspx\" />\n", ConfigHelper.SiteUrl);
            headhtml += string.Format("<link rel=\"wlwmanifest\" type=\"application/wlwmanifest+xml\" href=\"{0}xmlrpc/wlwmanifest.aspx\" />", ConfigHelper.SiteUrl);

            th.Put(TagFields.HEAD, headhtml);

            //if (Utils.IsSupportUrlRewriter == false)
            //{
            //    th.Put(TagFields.SEARCH_URL, ConfigHelper.SiteUrl + "default.aspx?type=search&keyword=");
            //}
            //else
            //{
            //      th.Put(TagFields.SEARCH_URL, ConfigHelper.SiteUrl + "search");
            //   }

            #endregion

            #region 文章

            //th.Put(TagFields.POST, null);
            //th.Put(TagFields.POST_MESSAGE, null);
            //th.Put(TagFields.POSTS, null);

            th.Put(TagFields.RECENT_POSTS, PostManager.GetPostList(SettingManager.GetSetting().SidebarPostCount, -1, -1, -1, 1, -1, 0));
            th.Put(TagFields.RECOMMEND_POSTS, PostManager.GetPostList(SettingManager.GetSetting().SidebarPostCount, -1, -1, 1, 1, -1, 0));
            th.Put(TagFields.TOP_POSTS, PostManager.GetPostList(Int32.MaxValue, -1, -1, -1, 1, 1, 0));

            //th.Put(TagFields.FEED_POSTS, null);

            #endregion

            #region 评论

            //th.Put(TagFields.COMMENTS, null);

            th.Put(TagFields.RECENT_COMMENTS, CommentManager.GetCommentListByRecent(SettingManager.GetSetting().SidebarCommentCount));

            if (PageUtils.IsLogin)
            {
                UserInfo user = UserManager.GetUser(PageUtils.CurrentUserId);
                if (user != null)
                {
                    th.Put(TagFields.COMMENT_AUTHOR, user.Name);
                    th.Put(TagFields.COMMENT_EMAIL, user.Email);
                    th.Put(TagFields.COMMENT_SITEURL, user.SiteUrl);
                }
            }
            else
            {
                th.Put(TagFields.COMMENT_AUTHOR, Server.UrlDecode(PageUtils.GetCookie(TagFields.COMMENT_AUTHOR)));
                th.Put(TagFields.COMMENT_EMAIL, Server.UrlDecode(PageUtils.GetCookie(TagFields.COMMENT_EMAIL)));
                th.Put(TagFields.COMMENT_SITEURL, Server.UrlDecode(PageUtils.GetCookie(TagFields.COMMENT_SITEURL)));
            }
            th.Put(TagFields.COMMENT_CONTENT, string.Empty);
            th.Put(TagFields.COMMENT_MESSAGE, string.Empty);

            #endregion

            #region 作者,分类,标签

            th.Put(TagFields.AUTHORS, UserManager.GetUserList().FindAll(delegate(UserInfo user) { return(user.Status == 1); }));
            th.Put(TagFields.CATEGORIES, CategoryManager.GetCategoryList());
            th.Put(TagFields.RECENT_TAGS, TagManager.GetTagList(SettingManager.GetSetting().SidebarTagCount));

            #endregion

            #region 连接

            th.Put(TagFields.LINKS, LinkManager.GetLinkList(-1, 1));
            th.Put(TagFields.NAV_LINKS, LinkManager.GetLinkList((int)LinkPosition.Navigation, 1));
            th.Put(TagFields.GENERAL_LINKS, LinkManager.GetLinkList((int)LinkPosition.General, 1));

            #endregion

            #region 统计

            th.Put(TagFields.POST_COUNT, StatisticsManager.GetStatistics().PostCount);
            th.Put(TagFields.COMMENT_COUNT, StatisticsManager.GetStatistics().CommentCount);
            th.Put(TagFields.VIEW_COUNT, StatisticsManager.GetStatistics().VisitCount);
            th.Put(TagFields.AUTHOR_COUNT, UserManager.GetUserList().FindAll(delegate(UserInfo user) { return(user.Status == 1); }).Count);

            #endregion
        }
Beispiel #41
0
    public List<CategoryDto> selectAllCategory()
    {
        CategoryManager mgr = new CategoryManager();
        List<Category> catList = mgr.selectAllCategory();
        List<CategoryDto> dtoList = new List<CategoryDto>();

        foreach (Category cat in catList)
        {
            dtoList.Add(CategoryDto.createCategoryDTO(cat));
        }

        return dtoList;
    }
Beispiel #42
0
        static void Main(string[] args)
        {
            ProductManager  _productManager  = new ProductManager();
            CategoryManager _categoryManager = new CategoryManager();

            //For Add
            //Product product = new Product()
            //{
            //    Code = "p006",
            //    Name = "Symphony68",
            //    ReorderLevel = 20,
            //    Description = "Nice product..",
            //    CategoryId = 6
            //};

            //bool addProduct = _productManager.Add(product);

            //if (addProduct)
            //{
            //    Console.WriteLine("Saved");
            //}
            //else
            //{
            //    Console.WriteLine("Not Saved");
            //}


            //For Update
            //Product product = new Product()
            //{
            //    Id = 11,
            //    Code = "p007",
            //    Name = "Motors",
            //    ReorderLevel = 15,
            //    Description = "Nice product..",
            //    CategoryId = 6
            //};
            //bool updateProduct = _productManager.Update(product);
            //if (updateProduct)
            //{
            //    Console.WriteLine("Updated");
            //}
            //else
            //{
            //    Console.WriteLine("Not Updated");
            //}


            //For Delete
            //bool deleteProduct = _productManager.Delete(10);
            //if (deleteProduct)
            //{
            //    Console.WriteLine("Deleted");
            //}
            //else
            //{
            //    Console.WriteLine("Not Deleted");
            //}


            //For Display

            var result = _productManager.GetAll().Join(_categoryManager.GetAll(),
                                                       p => p.CategoryId,
                                                       c => c.Id,
                                                       (prodct, category) => new
            {
                ProductName  = prodct.Name,
                CategoryName = category.Name
            });

            foreach (var product in result)
            {
                Console.WriteLine("ProductName: " + product.ProductName + "\t\t\tCategoryName: " + product.CategoryName);
            }



            //Console.WriteLine("For Multiple Products");
            //foreach (var prdct in _productManager.GetAll())
            //{
            //    Console.WriteLine("Code:\t\t" + prdct.Code + "\nName:\t\t" + prdct.Name + "\nReorderLevel:\t" +
            //        prdct.ReorderLevel + "\nDescription:\t" + prdct.Description + "\nCategoryId:\t" + prdct.CategoryId);
            //    Console.WriteLine();
            //}

            //Console.WriteLine();
            //Console.WriteLine();
            //Console.WriteLine("For Single Products");
            //Product prduct = _productManager.GetById(2);
            //Console.WriteLine("Code: " + prduct.Code + "\tName: " + prduct.Name + "\tReorderLevel: " +
            //        prduct.ReorderLevel + "\tDescription: " + prduct.Description + "\tCategoryId: " + prduct.CategoryId);

            Console.ReadKey();
        }
Beispiel #43
0
 public Boolean insertCategory(String CategoryId, String CategoryName, String CategoryDescription)
 {
     Category obj = Category.createCategory(CategoryId, CategoryName, CategoryDescription);
     CategoryManager mgr = new CategoryManager();
     return mgr.insertCategory(obj);
 }
 // public MemoryLogItemCollection( MemoryViewControl viewControl )
 public MemoryLogItemCollection()
 {
     mMemoryLogItems = new ArrayList();
     mCategories = new CategoryManager(); // new CategoryManager( viewControl );
     Clear();
 }