コード例 #1
0
 protected void uiDropDownListPages_SelectedIndexChanged(object sender, EventArgs e)
 {
     Categories cats = new Categories();
     cats.GetCategoriesByTypeIDAndPageID(4, Convert.ToInt32(uiDropDownListPages.SelectedValue));
     uiDropDownListAllCategories.DataSource = cats.DefaultView;
     uiDropDownListAllCategories.DataTextField = "Title";
     uiDropDownListAllCategories.DataValueField = "CategoryID";
     uiDropDownListAllCategories.DataBind();
     if (cats.RowCount > 0)
         uiDropDownListAllCategories.SelectedIndex = 0;
 }
コード例 #2
0
        protected void uiButtonUpdate_Click(object sender, EventArgs e)
        {
            if (CurrentCategory != null)
            {
                UpdateRecord();
            }
            else
            {
                AddNewRecord();
            }

            uiPanelEdit.Visible = false;
            uiPanelViewCategories.Visible = true;
            BindData();
            Clearfields();
            CurrentCategory = null;
        }
コード例 #3
0
 protected void uiGridViewCategories_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditCategory")
     {
         Categories objData = new Categories();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         uiTextBoxArName.Text = objData.Title;
         uiPanelViewCategories.Visible = false;
         uiPanelEdit.Visible = true;
         CurrentCategory = objData;
     }
     else if (e.CommandName == "DeleteCategory")
     {
         Categories objData = new Categories();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         objData.MarkAsDeleted();
         objData.Save();
         CurrentCategory = null;
         BindData();
     }
 }
コード例 #4
0
 private void BindData()
 {
     Categories objData = new Categories();
     objData.GetCategoriesByTypeID(2);
     uiGridViewCategories.DataSource = objData.DefaultView;
     uiGridViewCategories.DataBind();
 }
コード例 #5
0
 private void AddNewRecord()
 {
     Categories objData = new Categories();
     objData.AddNew();
     objData.Title = uiTextBoxArName.Text;
     if (uiFileUploadPicturePath.HasFile)
     {
         uiFileUploadPicturePath.SaveAs(Server.MapPath("~/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName));
         objData.IconPath = "/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName;
     }
     objData.TypeID = 2;
     objData.Save();
 }
コード例 #6
0
 private void LoadDDls()
 {
     Categories cats = new Categories();
     cats.GetCategoriesByTypeID(1);
     uiDropDownListAllCategories.DataSource = cats.DefaultView;
     uiDropDownListAllCategories.DataTextField = "Title";
     uiDropDownListAllCategories.DataValueField = "CategoryID";
     uiDropDownListAllCategories.DataBind();
     uiDropDownListAllCategories.SelectedIndex = 0;
 }
コード例 #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();
        }
コード例 #8
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;
        }
コード例 #9
0
        private void LoadDDls()
        {
            Pages pages = new Pages();
            pages.LoadAll();
            uiDropDownListPages.DataSource = pages.DefaultView;
            uiDropDownListPages.DataTextField = "ArTitle";
            uiDropDownListPages.DataValueField = "PageID";
            uiDropDownListPages.DataBind();
            uiDropDownListPages.SelectedIndex = 0;

            Categories cats = new Categories();
            cats.GetCategoriesByTypeIDAndPageID(4, Convert.ToInt32(uiDropDownListPages.SelectedValue));
            uiDropDownListAllCategories.DataSource = cats.DefaultView;
            uiDropDownListAllCategories.DataTextField = "Title";
            uiDropDownListAllCategories.DataValueField = "CategoryID";
            uiDropDownListAllCategories.DataBind();
            if (cats.RowCount > 0)
                uiDropDownListAllCategories.SelectedIndex = 0;
        }
コード例 #10
0
 private void BindData()
 {
     Categories objData = new Categories();
     objData.GetCategoriesByTypeIDAndPageID(4, Convert.ToInt32(uiDropDownListPages.SelectedValue));
     uiGridViewCategories.DataSource = objData.DefaultView;
     uiGridViewCategories.DataBind();
 }
コード例 #11
0
 private void AddNewRecord()
 {
     Categories objData = new Categories();
     objData.AddNew();
     objData.Title = uiTextBoxArName.Text;
     if (uiFileUploadPicturePath.HasFile)
     {
         uiFileUploadPicturePath.SaveAs(Server.MapPath("~/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName));
         objData.IconPath = "/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName;
     }
     objData.TypeID = 4;
     objData.PageID = Convert.ToInt32(uiDropDownListPages.SelectedValue);
     objData.Save();
 }