Exemplo n.º 1
0
 protected void uiButtonCancel_Click(object sender, EventArgs e)
 {
     Clearfields();
     CurrentPhoto = null;
     uiPanelEdit.Visible = false;
     uiPanelViewSubCategories.Visible = true;
 }
Exemplo n.º 2
0
        protected void uiButtonUpdate_Click(object sender, EventArgs e)
        {
            if (CurrentPhoto != null)
            {
                UpdateRecord();
            }
            else
            {
                AddNewRecord();
            }

            uiPanelEdit.Visible = false;
            uiPanelViewSubCategories.Visible = true;
            BindData();
            Clearfields();
            RequiredFieldValidator3.Enabled = true;
            CurrentPhoto = null;
        }
Exemplo n.º 3
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;
                uiPanelPics.Visible = false;
            }
            else if (Request.QueryString["scatid"] != null && !string.IsNullOrEmpty(Request.QueryString["scatid"]))
            {
                GeneralPhotos objData = new GeneralPhotos();
                objData.GetGeneralPhotosBySubCategoryID(Convert.ToInt32(Request.QueryString["scatid"].ToString()));
                PagedDataSource pds = new PagedDataSource();
                objData.DefaultView.Sort = "ArTitle asc";
                pds.DataSource = objData.DefaultView;
                pds.AllowPaging = true;
                pds.PageSize = 6;
                pds.CurrentPageIndex = currentPage;
                uiDataListPics.DataSource = pds;
                uiDataListPics.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;
                uiPanelPics.Visible = true;
            }
            else
            {
                Categories scat = new Categories();
                scat.GetCategoriesByTypeID(2);
                PagedDataSource pds = new PagedDataSource();
                pds.DataSource = scat.DefaultView;
                pds.AllowPaging = true;
                pds.PageSize = 6;
                pds.CurrentPageIndex = currentPageSub;
                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;
                uiPanelPics.Visible = false;
            }
        }
Exemplo n.º 4
0
 protected void uiGridViewSubCategories_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditPhoto")
     {
         GeneralPhotos objData = new GeneralPhotos();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         uiTextBoxArName.Text = objData.ArTitle;
         uiTextBoxArDesc.Text = objData.Description;
         //uiDropDownListAllCategories.SelectedValue = objData.SubCategoryID.ToString();
         uiPanelViewSubCategories.Visible = false;
         uiPanelEdit.Visible = true;
         CurrentPhoto = objData;
         uiPanelEdit.Visible = true;
         RequiredFieldValidator3.Enabled = false;
     }
     else if (e.CommandName == "DeletePhoto")
     {
         GeneralPhotos objData = new GeneralPhotos();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         objData.MarkAsDeleted();
         objData.Save();
         CurrentPhoto = null;
         BindData();
     }
 }
Exemplo n.º 5
0
 private void BindData()
 {
     GeneralPhotos objData = new GeneralPhotos();
     if (uiDropDownListSubCats.SelectedIndex > -1)
     {
         objData.GetGeneralPhotosBySubCategoryID(Convert.ToInt32(uiDropDownListSubCats.SelectedValue));
         objData.DefaultView.Sort = "ArTitle asc";
     }
     uiGridViewSubCategories.DataSource = objData.DefaultView;
     uiGridViewSubCategories.DataBind();
 }
Exemplo n.º 6
0
 private void AddNewRecord()
 {
     GeneralPhotos objData = new GeneralPhotos();
     objData.AddNew();
     objData.ArTitle = uiTextBoxArName.Text;
     objData.Description = uiTextBoxArDesc.Text;
     if (uiFileUploadImage.HasFile)
     {
         uiFileUploadImage.SaveAs(Server.MapPath("~/UploadedFiles/PhotoGallery/" + uiFileUploadImage.FileName));
         objData.URL = "/UploadedFiles/PhotoGallery/" + uiFileUploadImage.FileName;
     }
     objData.SubCategoryID = Convert.ToInt32(uiDropDownListSubCats.SelectedValue);
     objData.Save();
 }