Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.RequiresAuthentication    = true;
            Master.SelectedUrl               = "/account/offering";
            Master.Body.Attributes["class"] += " account ";

            try { Category = Core.Entities.Category.Find(Id: int.Parse(Request.QueryString["cid"])); }
            catch { Category = Core.Entities.Category.Find(Id: Core.Entities.Category.LorriesId); }

            switch (Category.Id)
            {
            case Core.Entities.Category.LorriesId:
                ListTitle.Text = "Lorries"; break;

            case Core.Entities.Category.TractorsId:
                ListTitle.Text = "Tractors"; break;

            case Core.Entities.Category.ProcessingId:
                ListTitle.Text = "Processing"; break;
            }

            List.RecordCount = Core.Entities.Listing.Count(UserId: Master.CurrentUser.Id, CategoryId: Category?.Id ?? 0);
            List.DataSource  = Core.Entities.Listing.List(PageIndex: List.CurrentPageIndex, PageSize: List.PageSize, UserId: Master.CurrentUser.Id, CategoryId: Category?.Id ?? 0);
            List.DataBind();

            AddButton.Text        = $"Add {Type}";
            AddButton.NavigateUrl = $"/account/listing/{Type}";
        }
Ejemplo n.º 2
0
            public Core.Entities.Category ToCategoryEntity()
            {
                var _category = new Core.Entities.Category
                {
                    ParentId     = this.ParentId,
                    CategoryName = this.CategoryName
                };

                return(_category);
            }
Ejemplo n.º 3
0
 public static Category Convert(Core.Entities.Category c)
 {
     return(c is null ? null : new Category {
         Id = c.Id, Name = c.Name
     });
 }
        void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                CMS.Core.Entities.Category category = new Core.Entities.Category();
                category.CreationDate = DateTime.Now;
                category.Description = txtDescription.Text;
                category.ID = 0;
                category.IsDeleted = false;
                category.LanguageID = CMSContext.LanguageID;
                category.ModuleID = Convert.ToInt32(ViewState[CMSViewStateManager.ModuleID]);
                category.Name = txtName.Text;
                category.Order = Convert.ToInt32(txtOrderNumber.Text);
                category.PortalID = CMSContext.PortalID;
                category.ParentID = Convert.ToInt32(cddParentCategory.SelectedValue);
                category.CreatedBy = CMSContext.CurrentUserID;
                CategoryManager.Add(category);

                BeginAddMode();
                FillCategoryTree();
                upnlCategory.Update();
            }
            catch (Exception ex)
            {
                dvProblems.Visible = true;
                dvProblems.InnerText = ex.ToString();
                upnlCategory.Update();
            }
        }