예제 #1
0
        public ListCategoryPage()
        {
            InitializeComponent();
            CategoryPageModel category = new CategoryPageModel();

            BindingContext = category;
        }
예제 #2
0
        public ActionResult Preview(PageData currentPage, CategoryListModel categoryModel)
        {
            var pd = (CategoryPage)currentPage;

            PreviewTextLength = 200;

            var model = new CategoryPageModel(pd)
            {
                PreviewText = GetPreviewText(pd)
            };

            return(PartialView("Preview", model));
        }
예제 #3
0
        public async Task <IActionResult> Index(Guid id)
        {
            var categoryResult = await _queries.Request <GetCategoryQuery, GetCategoryQueryResult>(new GetCategoryQuery { Id = id });

            var podcastsResult = await _queries.Request <GetPodcastsQuery, GetPodcastsQueryResult>(new GetPodcastsQuery { CategoryId = id });

            var model = new CategoryPageModel
            {
                Category = Mapper.Map <Category, CategoryViewModel>(categoryResult.Category),
                Podcasts = Mapper.Map <IEnumerable <Podcast>, IEnumerable <PodcastViewModel> >(podcastsResult.Podcasts)
            };

            return(View(model));
        }
예제 #4
0
        private void AddCategories(StreamingProvider streamingProvider)
        {
            var categoryPage = new CategoryPageModel(_webDriver, _settings.BaseUrl);

            categoryPage.NavigateTo();

            var categories = categoryPage.GetCategories();

            foreach (var category in categories)
            {
                var mediaCategory = categoryPage.GetCategory(category.Name);
                streamingProvider.AddCategory(mediaCategory);
            }
        }
        public ActionResult Preview(PageData currentPage, CategoryListModel categoryListModel)
        {
            var pd = (CategoryPage)currentPage;

            PreviewTextLength = 200;

            var model = new CategoryPageModel(pd)
            {
                PreviewText = GetPreviewText(pd),
                //ShowIntroduction = blogModel.ShowIntroduction,
                //ShowPublishDate = blogModel.ShowPublishDate
            };

            return(PartialView("Preview", model));
        }
예제 #6
0
        public ActionResult Index()
        {
            CategoryPageModel categoryPageModel = new CategoryPageModel();

            Response <List <CategoryModel> > responsecategory = JsonConvert.DeserializeObject <Response <List <CategoryModel> > >(UiRequestManager.Instance.Get("Category", "List"));

            categoryPageModel.CategoryList = responsecategory.Value;

            Response <List <TypeModel> > rest = JsonConvert.DeserializeObject <Response <List <TypeModel> > >(UiRequestManager.Instance.Get("Type", "List"));

            categoryPageModel.TypeList = rest.Value;


            return(View(categoryPageModel));
        }
예제 #7
0
        public ActionResult Full(CategoryPage currentPage)
        {
            PreviewTextLength = 200;

            var model = new CategoryPageModel(currentPage)
            {
                PreviewText = GetPreviewText(currentPage),
                //MainBody = currentPage.MainBody,
                StartPublish = currentPage.StartPublish
            };

            var editHints = ViewData.GetEditHints <CategoryPageModel, CategoryPage>();

            editHints.AddFullRefreshFor(p => p.StartPublish);

            return(PartialView("Full", model));
        }
예제 #8
0
        public ActionResult Save(Guid?id)
        {
            CategoryPageModel categoryPageModel = new CategoryPageModel();

            Response <List <CategoryModel> > responsecategory = JsonConvert.DeserializeObject <Response <List <CategoryModel> > >(UiRequestManager.Instance.Get("Category", "List"));

            categoryPageModel.CategoryList = responsecategory.Value;

            Response <List <TypeModel> > rest = JsonConvert.DeserializeObject <Response <List <TypeModel> > >(UiRequestManager.Instance.Get("Type", "List"));

            categoryPageModel.TypeList = rest.Value;

            if (Guid.Empty != id && id.HasValue)
            {
                Response <CategoryModel> responseSaving = JsonConvert.DeserializeObject <Response <CategoryModel> >(UiRequestManager.Instance.Get("Category", "GetOne", id));
                categoryPageModel.categoryModel = responseSaving.Value;
            }

            return(View(categoryPageModel));
        }
예제 #9
0
    public NavigationService(Context context)
    {
        _context = context;

        if (!menuItems.Any())
        {
            menuItems = _context.Contents.Where(page => page.IsInMenu.Equals(true) && page.IsPublished.Equals(true)).ToList();
        }

        if (!categoryItems.Any())
        {
            try
            {
                foreach (var category in _context.Categories.Include(a => a.MainCategory).Include(b => b.SubCategory).ToList())
                {
                    if (!categoryItems.Where(x => x.Id.Equals(category.MainCategoryId.ToString())).Any()) //Bewar snälla
                    {
                        List <string> subs = new List <string>();

                        subs.Add(category.SubCategory.Name);

                        CategoryPageModel categoryPage = new CategoryPageModel(category.MainCategoryId.ToString(), category.MainCategory.Name, subs);

                        categoryItems.Add(categoryPage);
                    }
                    else
                    {
                        categoryItems.Where(x => x.Id.Equals(category.MainCategoryId.ToString())).FirstOrDefault().SubCategories.Add(category.SubCategory.Name);
                    }
                }
            }
            catch
            {
            }
        }

        _context.Dispose();
    }
예제 #10
0
        public void Test()
        {
            //Case 1 Registration In the Site

            UserRegistrationPageModel pageModel = new UserRegistrationPageModel();
            CreateAccountPageModel    crtAcc    = pageModel.GoToSignIn();

            PersonalInformationPageModel userDetails = crtAcc.CreateAccount();
            CategoryPageModel            ctrModel    = userDetails.RegisterAccount();


            //Case 2 Buying Item From 2 different categoris and proceeding to checkout

            AddToCartPageModel addToCart = ctrModel.GoToCategory("NotFinal");

            addToCart.AddItemToCart("First");

            AddToCartPageModel secondItem = ctrModel.GoToCategory("Final");

            FinalPaymentCheckoutPageModel finPay = addToCart.AddItemToCart("last");

            finPay.Checkout();
        }
예제 #11
0
        public JsonResult Save(CategoryPageModel model)
        {
            Response <CategoryModel> responseSaving = JsonConvert.DeserializeObject <Response <CategoryModel> >(UiRequestManager.Instance.Post("Category", "Save", JsonConvert.SerializeObject(model.categoryModel)));

            return(Json(responseSaving));
        }
예제 #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CPM = new CategoryPageModel();

        if (Page.RouteData.Values["category"] != null)
        {
            try
            {
                string name = Page.RouteData.Values["category"].ToString();

                using (RockyingDataClassesDataContext dc = new RockyingDataClassesDataContext(Utility.ConnectionString))
                {
                    var item = (from t in dc.Categories
                                where t.UrlName == name &&
                                t.Status == (byte)GeneralStatusType.Active
                                select t).SingleOrDefault();
                    if (item != null)
                    {
                        CPM.Current = item;
                        CPM.ChildList.AddRange(item.Categories.ToList());
                        var items = from t in dc.Posts
                                    where t.Status == (byte)PostStatusType.Publish && t.Category == item.ID
                                    orderby t.DateCreated descending
                                    select t;
                        foreach (var i in items)
                        {
                            Article a = new Article();
                            a.Category      = i.Category;
                            a.CategoryName  = i.Category1.Name;
                            a.CreatedBy     = i.CreatedBy;
                            a.CreatedByName = i.Member.MemberName;
                            a.DateCreated   = i.DateCreated;
                            a.DateModified  = i.DateModified;
                            a.Description   = i.Description;
                            a.ID            = i.ID;
                            a.ModifiedBy    = i.ModifiedBy;
                            a.Status        = (PostStatusType)i.Status;
                            a.Tag           = i.Tag;
                            a.Text          = string.Empty;
                            a.Title         = i.Title;
                            a.WriterEmail   = i.WriterEmail;
                            a.WriterName    = i.WriterName;
                            a.OGDescription = i.OGDescription;
                            if (string.IsNullOrEmpty(i.OGImage))
                            {
                                a.OGImage = string.Format("//rockying.com/art/category/icons/{0}_big.jpg", a.CategoryName);
                            }
                            else
                            {
                                a.OGImage = Utility.TrimStartHTTP(i.OGImage);
                            }

                            a.Viewed = i.Viewed;
                            a.URL    = i.URL;
                            CPM.ArticleList.Add(a);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.Write("Invalid Category");
                Trace.Write(ex.Message);
                Trace.Write(ex.StackTrace);
            }
        }
    }
예제 #13
0
 public CategoryPage(int categoryId)
 {
     BindingContext = new CategoryPageModel(categoryId, Navigation);
     InitializeComponent();
 }