Exemplo n.º 1
0
 protected void uiDropDownListAllCategories_SelectedIndexChanged(object sender, EventArgs e)
 {
     SubCategories obj = new SubCategories();
     obj.GetSubCatsByCategoryID(Convert.ToInt32(uiDropDownListAllCategories.SelectedValue));
     uiDropDownListSubCats.DataSource = obj.DefaultView;
     uiDropDownListSubCats.DataTextField = "Title";
     uiDropDownListSubCats.DataValueField = "SubCategoryID";
     uiDropDownListSubCats.DataBind();
     if (obj.RowCount > 0)
         uiDropDownListSubCats.SelectedIndex = 0;
     BindData();
 }
        protected void uiButtonUpdate_Click(object sender, EventArgs e)
        {
            if (CurrentSubCategory != null)
            {
                UpdateRecord();
            }
            else
            {
                AddNewRecord();
            }

            uiPanelEdit.Visible = false;
            uiPanelViewCategories.Visible = true;
            BindData();
            Clearfields();
            CurrentSubCategory = null;
        }
 protected void uiGridViewSubCategories_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditCategory")
     {
         SubCategories objData = new SubCategories();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         uiTextBoxArName.Text = objData.Title;
         uiPanelViewCategories.Visible = false;
         uiPanelEdit.Visible = true;
         CurrentSubCategory = objData;
     }
     else if (e.CommandName == "DeleteCategory")
     {
         SubCategories objData = new SubCategories();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         objData.MarkAsDeleted();
         objData.Save();
         CurrentSubCategory = null;
         BindData();
     }
 }
Exemplo n.º 4
0
        private void BindData()
        {
            if (Request.QueryString["catid"] != null && !string.IsNullOrEmpty(Request.QueryString["catid"]))
            {
                SubCategories scat = new SubCategories();
                scat.GetSubCatsByCategoryID(Convert.ToInt32(Request.QueryString["catid"].ToString()));
                PagedDataSource pds = new PagedDataSource();
                pds.DataSource = scat.DefaultView;
                pds.AllowPaging = true;
                pds.PageSize = 6;
                pds.CurrentPageIndex = currentPageSub;
                uiDataListSub.DataSource = pds;
                uiDataListSub.DataBind();
                uiLinkButtonSubPrev.Enabled = true;
                uiLinkButtonSubNext.Enabled = true;
                if (currentPageSub == 0)
                {
                    uiLinkButtonSubPrev.Enabled = false;
                }

                if (currentPageSub == (pds.PageCount - 1))
                {
                    uiLinkButtonSubNext.Enabled = false;
                }
                uiPanelSubCats.Visible = true;
                uiPanelCats.Visible = false;
                uiPanelVideos.Visible = false;
            }
            else if (Request.QueryString["scatid"] != null && !string.IsNullOrEmpty(Request.QueryString["scatid"]))
            {
                GeneralVideos objData = new GeneralVideos();
                objData.GetGeneralVideosBySubCategoryID(Convert.ToInt32(Request.QueryString["scatid"].ToString()));
                PagedDataSource pds = new PagedDataSource();
                pds.DataSource = objData.DefaultView;
                pds.AllowPaging = true;
                pds.PageSize = 6;
                pds.CurrentPageIndex = currentPage;
                uiDataListVideos.DataSource = pds;
                uiDataListVideos.DataBind();
                uiLinkButtonPrev.Enabled = true;
                uiLinkButtonNext.Enabled = true;
                if (currentPage == 0)
                {
                    uiLinkButtonPrev.Enabled = false;
                }

                if (currentPage == (pds.PageCount - 1))
                {
                    uiLinkButtonNext.Enabled = false;
                }
                uiPanelSubCats.Visible = false;
                uiPanelCats.Visible = false;
                uiPanelVideos.Visible = true;

            }
            else
            {
                Categories scat = new Categories();
                scat.GetCategoriesByTypeID(1);
                PagedDataSource pds = new PagedDataSource();
                pds.DataSource = scat.DefaultView;
                pds.AllowPaging = true;
                pds.PageSize = 6;
                pds.CurrentPageIndex = currentPageCat;
                uiDataListCats.DataSource = pds;
                uiDataListCats.DataBind();
                uiLinkButtonCatPrev.Enabled = true;
                uiLinkButtonCatNext.Enabled = true;
                if (currentPageCat == 0)
                {
                    uiLinkButtonCatPrev.Enabled = false;
                }

                if (currentPageCat == (pds.PageCount - 1))
                {
                    uiLinkButtonCatNext.Enabled = false;
                }
                uiPanelSubCats.Visible = false;
                uiPanelCats.Visible = true;
                uiPanelVideos.Visible = false;
            }
        }
 private void BindData()
 {
     SubCategories objData = new SubCategories();
     if (uiDropDownListAllCategories.SelectedIndex != -1)
     {
         objData.GetSubCatsByCategoryID(Convert.ToInt32(uiDropDownListAllCategories.SelectedValue));
     }
     uiGridViewSubCategories.DataSource = objData.DefaultView;
     uiGridViewSubCategories.DataBind();
 }
 private void AddNewRecord()
 {
     SubCategories objData = new SubCategories();
     objData.AddNew();
     objData.Title = uiTextBoxArName.Text;
     objData.CategoryID = Convert.ToInt32(uiDropDownListAllCategories.SelectedValue);
     if (uiFileUploadPicturePath.HasFile)
     {
         uiFileUploadPicturePath.SaveAs(Server.MapPath("~/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName));
         objData.IconPath = "/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName;
     }
     objData.Save();
 }
Exemplo n.º 7
0
        private void LoadFilesCats()
        {
            Categories cats = new Categories();
            cats.GetCategoriesByTypeIDAndPageID(3, CurrentPage.PageID);
            uiDropDownListAllCategories.DataSource = cats.DefaultView;
            uiDropDownListAllCategories.DataTextField = "Title";
            uiDropDownListAllCategories.DataValueField = "CategoryID";
            uiDropDownListAllCategories.DataBind();
            if (cats.RowCount > 0)
                uiDropDownListAllCategories.SelectedIndex = 0;

            SubCategories Scats = new SubCategories();
            if (uiDropDownListAllCategories.SelectedIndex != -1)
            {
                Scats.GetSubCatsByCategoryID(Convert.ToInt32(uiDropDownListAllCategories.SelectedValue));
            }
            uiDropDownListsubCats.DataSource = Scats.DefaultView;
            uiDropDownListsubCats.DataTextField = "Title";
            uiDropDownListsubCats.DataValueField = "SubCategoryID";
            uiDropDownListsubCats.DataBind();

            if (Scats.RowCount > 0)
                LoadFiles();
        }
Exemplo n.º 8
0
        protected void uiDropDownListAllCMSCats_SelectedIndexChanged(object sender, EventArgs e)
        {
            SubCategories Scats = new SubCategories();
            if (uiDropDownListAllCMSCats.SelectedIndex != -1)
            {
                Scats.GetSubCatsByCategoryID(Convert.ToInt32(uiDropDownListAllCMSCats.SelectedValue));
            }
            uiDropDownListCMSSubCats.DataSource = Scats.DefaultView;
            uiDropDownListCMSSubCats.DataTextField = "Title";
            uiDropDownListCMSSubCats.DataValueField = "SubCategoryID";
            uiDropDownListCMSSubCats.DataBind();

            if (Scats.RowCount > 0)
                LoadArticles();
        }
Exemplo n.º 9
0
        private void LoadDDLs()
        {
            Categories objData = new Categories();
            objData.GetCategoriesByTypeID(1);
            uiDropDownListAllCategories.DataSource = objData.DefaultView;
            uiDropDownListAllCategories.DataTextField = "Title";
            uiDropDownListAllCategories.DataValueField = "CategoryID";
            uiDropDownListAllCategories.DataBind();
            uiDropDownListAllCategories.SelectedIndex = 0;

            SubCategories obj = new SubCategories();
            obj.GetSubCatsByCategoryID(Convert.ToInt32(uiDropDownListAllCategories.SelectedValue));
            uiDropDownListSubCats.DataSource = obj.DefaultView;
            uiDropDownListSubCats.DataTextField = "Title";
            uiDropDownListSubCats.DataValueField = "SubCategoryID";
            uiDropDownListSubCats.DataBind();
            uiDropDownListSubCats.SelectedIndex = 0;
        }
Exemplo n.º 10
0
 protected void uiGridViewSubCategories_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         DataRowView row = (DataRowView)e.Row.DataItem;
         SubCategories objData = new SubCategories();
         objData.LoadByPrimaryKey(Convert.ToInt32(row["SubCategoryID"].ToString()));
         Label l = (Label)e.Row.FindControl("uiLabelCategoryName");
         l.Text = objData.Title;
     }
 }
Exemplo n.º 11
0
        private void LoadFilesSubcats(string id)
        {
            SubCategories scat = new SubCategories();
            scat.GetSubCatsByCategoryID(Convert.ToInt32(id));
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = scat.DefaultView;
            pds.AllowPaging = true;
            pds.PageSize = 6;
            pds.CurrentPageIndex = currentFileSub;
            uiDataListSub.DataSource = pds;
            uiDataListSub.DataBind();
            uiLinkButtonSubPrev.Enabled = true;
            uiLinkButtonSubNext.Enabled = true;
            if (currentFileSub == 0)
            {
                uiLinkButtonSubPrev.Enabled = false;
            }

            if (currentFileSub == (pds.PageCount - 1))
            {
                uiLinkButtonSubNext.Enabled = false;
            }
            uiPanelSubCats.Visible = true;
            uiPanelCats.Visible = false;
            uiPanelFiles.Visible = false;
        }