protected void uiGridViewCats_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditCat")
            {
                Categories objData = new Categories();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                uiTextBoxEnName.Text = objData.CatNameEng;
                uiTextBoxArName.Text = objData.CatNameAr;

                uiPanelAllCats.Visible = false;
                uiPanelEditCat.Visible = true;
                CurrentCat = objData;

                BindCats();
            }
            else if (e.CommandName == "DeleteCat")
            {
                try
                {
                    Categories objData = new Categories();
                    objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                    objData.MarkAsDeleted();
                    objData.Save();
                    CurrentCat = null;
                    BindCats();
                }
                catch (Exception ex)
                {
                    uipanelError.Visible = true;
                }
            }
        }
 private void LoadCats()
 {
     Categories cats = new Categories();
     cats.LoadAll();
     uiRepeaterCats.DataSource = cats.DefaultView;
     uiRepeaterCats.DataBind();
 }
Beispiel #3
0
 private string LoadCats(int p)
 {
     string submenu = "";
     Categories scat = new Categories();
     scat.GetCatsByMainCatID(p);
     if (scat.RowCount > 0)
     {
         submenu = "<ul>";
         for (int i = 0; i < scat.RowCount; i++)
         {
             submenu += "<li><a href='browse.aspx?catid=" + scat.CategoryID.ToString() + (scat.IsPartySupplier ? "&ps=true" : "") + "'>" + scat.CatNameEng + "</a> </li>";
             scat.MoveNext();
         }
         submenu += "</ul>";
     }
     return submenu;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (CardID != 0)
                {
                    Cards card = new Cards();
                    card.LoadByPrimaryKey(CardID);
                    uiLabelName.Text = card.CardNameEng;
                    uiLabelPriceFrom.Text = card.PriceBefore.ToString();
                    if (card.PriceBefore == 0 || (card.PriceBefore <= card.PriceNow))
                        uiPlaceholderPriceFrom.Visible = false;
                    else
                        uiPlaceholderPriceFrom.Visible = true;
                    uiLabelPriceTo.Text = card.PriceNow.ToString();
                    uiImagemain.ImageUrl = card.GeneralPreviewPhoto;
                    uiLabelDate.Text = card.UploadDate.ToString("dd/MM/yyyy");
                    uiLiteralDesc.Text = card.DescriptionEng;
                    if (card.IsPartySupplier)
                    {
                        uipanelIsCard.Visible = false;
                        uiLinkButtonCustomize.Visible = false;
                        uiLinkButtonAddToCart.Visible = true;
                        uipanelImages.Visible = true;
                        uiImagemain.Visible = false;

                        PartySupplierImages images = new PartySupplierImages();
                        images.Where.CardID.Value = card.CardID;
                        images.Where.CardID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                        images.Query.Load();
                        images.AddNew();
                        images.CardID = card.CardID;
                        images.ImagePath = card.GeneralPreviewPhoto;
                        uiRepeaterImages.DataSource = images.DefaultView;
                        uiRepeaterImages.DataBind();

                        uiRepeaterthumbs.DataSource = images.DefaultView;
                        uiRepeaterthumbs.DataBind();

                    }
                    else
                    {
                        uipanelImages.Visible = false;
                        CardColor colors = new CardColor();
                        colors.GetCardColorsByCardID(card.CardID);
                        uiRepeaterColor.DataSource = colors.DefaultView;
                        uiRepeaterColor.DataBind();
                        uiLinkButtonCustomize.PostBackUrl = "customize.aspx?cid=" + card.CardID;
                    }
                    BindReviews();

                    Master.PageTitle = card.CardNameEng;

                    Categories cat = new Categories();
                    cat.LoadByPrimaryKey(card.CategoryID);

                    MainCat mcat = new MainCat();
                    mcat.LoadByPrimaryKey(cat.MainCatId);

                    TopLevelCat tcat = new TopLevelCat();
                    tcat.LoadByPrimaryKey(mcat.TopLevelCatID);

                    Master.Path = "<li><a href='#'>" + tcat.NameEng + "</a></li>" + "<li><a href='#'>" + mcat.NameEng + "</a></li>";
                    Master.ViewPath = true;

                }
                else
                {
                    Response.Redirect("~/browse.aspx");
                }
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (IsPartySupplier)
                {
                    ucSearch1.Visible = false;
                }

                BindData();
                if (CatID != 0)
                {
                    Categories cat = new Categories();
                    cat.LoadByPrimaryKey(CatID);
                    Master.PageTitle = cat.CatNameAr;

                    MainCat Mcat = new MainCat();
                    Mcat.LoadByPrimaryKey(cat.MainCatId);

                    TopLevelCat Tcat = new TopLevelCat();
                    Tcat.LoadByPrimaryKey(Mcat.TopLevelCatID);

                    Master.Path = "<li><a href='#'>" + Tcat.NameAr + "</a></li>" + "<li><a href='#'>" + Mcat.NameAr + "</a></li>";

                    Master.ViewPath = true;
                }
                else if (MainCatID != 0)
                {
                    MainCat cat = new MainCat();
                    cat.LoadByPrimaryKey(MainCatID);
                    Master.PageTitle = cat.NameAr;

                    TopLevelCat Tcat = new TopLevelCat();
                    Tcat.LoadByPrimaryKey(cat.TopLevelCatID);

                    Master.Path = "<li><a href='#'>" + Tcat.NameAr + "</a></li>";

                    Master.ViewPath = true;
                }
                else if (TopCatID != 0)
                {
                    TopLevelCat cat = new TopLevelCat();
                    cat.LoadByPrimaryKey(TopCatID);
                    Master.PageTitle = cat.NameAr;

                    Master.ViewPath = true;
                }

            }
        }
        private void BindData()
        {
            if (TopCatID != 0 && MainCatID != 0 && IsPartySupplier)
            {
                Categories cats = new Categories();
                cats.Where.IsPartySupplier.Value = true;
                cats.Where.IsPartySupplier.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                cats.Where.MainCatId.Value = MainCatID;
                cats.Where.MainCatId.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;

                cats.Sort = "CatNameAr";
                cats.Query.Load();
                PagedDataSource pds = new PagedDataSource();
                pds.DataSource = cats.DefaultView;
                pds.AllowPaging = true;
                pds.PageSize = 12;
                pds.CurrentPageIndex = currentPage;
                uiRepeaterCats.DataSource = cats.DefaultView;
                uiRepeaterCats.DataBind();
            }
            else if (TopCatID != 0 && MainCatID != 0 && !IsPartySupplier)
            {
                Categories cats = new Categories();
                cats.Where.IsPartySupplier.Value = true;
                cats.Where.IsPartySupplier.Operator = MyGeneration.dOOdads.WhereParameter.Operand.NotEqual;
                cats.Where.MainCatId.Value = MainCatID;
                cats.Where.MainCatId.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;

                cats.Sort = "CatNameAr";
                cats.Query.Load();
                PagedDataSource pds = new PagedDataSource();
                pds.DataSource = cats.DefaultView;
                pds.AllowPaging = true;
                pds.PageSize = 12;
                pds.CurrentPageIndex = currentPage;
                uiRepeaterCats.DataSource = cats.DefaultView;
                uiRepeaterCats.DataBind();
            }
            else if (TopCatID != 0 && MainCatID == 0 && IsPartySupplier)
            {
                MainCat cats = new MainCat();
                cats.Where.IsPartySupplier.Value = true;
                cats.Where.IsPartySupplier.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                cats.Where.TopLevelCatID.Value = TopCatID;
                cats.Where.TopLevelCatID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;

                cats.Sort = "NameAr";
                cats.Query.Load();
                PagedDataSource pds = new PagedDataSource();
                pds.DataSource = cats.DefaultView;
                pds.AllowPaging = true;
                pds.PageSize = 12;
                pds.CurrentPageIndex = currentPage;
                uiRepeaterCats.DataSource = cats.DefaultView;
                uiRepeaterCats.DataBind();
            }
            else if (TopCatID != 0 && MainCatID == 0 && !IsPartySupplier)
            {
                MainCat cats = new MainCat();
                cats.Where.IsPartySupplier.Value = true;
                cats.Where.IsPartySupplier.Operator = MyGeneration.dOOdads.WhereParameter.Operand.NotEqual;
                cats.Where.TopLevelCatID.Value = TopCatID;
                cats.Where.TopLevelCatID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
                cats.Sort = "NameAr";
                cats.Query.Load();
                PagedDataSource pds = new PagedDataSource();
                pds.DataSource = cats.DefaultView;
                pds.AllowPaging = true;
                pds.PageSize = 12;
                pds.CurrentPageIndex = currentPage;
                uiRepeaterCats.DataSource = cats.DefaultView;
                uiRepeaterCats.DataBind();
            }
        }
 protected void uiLinkButtonAdd_Click(object sender, EventArgs e)
 {
     ClearFields();
     CurrentCat = null;
     uiPanelEditCat.Visible = true;
     uiPanelAllCats.Visible = false;
 }
 private void BindCats()
 {
     Categories cats = new Categories();
     if (uiDropDownListMainCats.SelectedIndex != -1)
         cats.GetCatsByMainCatID(Convert.ToInt32(uiDropDownListMainCats.SelectedValue));
     cats.Sort = "CatNameEng";
     uiGridViewCats.DataSource = cats.DefaultView;
     uiGridViewCats.DataBind();
 }
        protected void uiLinkButtonOK_Click(object sender, EventArgs e)
        {
            Categories cat = new Categories();
            if (CurrentCat == null)
                cat.AddNew();
            else
                cat = CurrentCat;

            cat.CatNameEng = uiTextBoxEnName.Text;
            cat.CatNameAr = uiTextBoxArName.Text;

            if (uiFileUploadImage.HasFile)
            {
                string filepath = "/images/Category/" + DateTime.Now.ToString("ddMMyyyyhhmmss") + "_" + uiFileUploadImage.FileName;
                uiFileUploadImage.SaveAs(Server.MapPath("~" + filepath));
                cat.CatImage = filepath;
            }
            if (uiFileUploadHover.HasFile)
            {
                string filepath = "/images/Category/" + DateTime.Now.ToString("ddMMyyyyhhmmss") + "_" + uiFileUploadHover.FileName;
                uiFileUploadHover.SaveAs(Server.MapPath("~" + filepath));
                cat.HoverImage = filepath;
            }
            cat.MainCatId = Convert.ToInt32(uiDropDownListMainCats.SelectedValue);
            cat.Save();
            ClearFields();
            CurrentCat = null;
            uiPanelEditCat.Visible = false;
            uiPanelAllCats.Visible = true;
            BindCats();
        }
 private void LoadCats()
 {
     Categories cats = new Categories();
     if (uiDropDownListMainCats.SelectedIndex != -1)
         cats.GetCatsByMainCatID(Convert.ToInt32(uiDropDownListMainCats.SelectedValue));
     uiDropDownListCats.DataSource = cats.DefaultView;
     uiDropDownListCats.DataTextField = "CatNameEng";
     uiDropDownListCats.DataValueField = "CategoryID";
     uiDropDownListCats.DataBind();
     BindData();
 }
        private void LoadCardInfo()
        {
            CardLayouts layout = new CardLayouts();
            layout.GetCardLayoutByCardID(CardID);
            for (int i = 0; i < layout.RowCount; i++)
            {
                uiRadioButtonListLayouts.Items.Add(new ListItem(String.Format("<img src='{0}' style='width:100px' />", ".." + layout.LayoutImage), ".." + layout.LayoutImage + "#" + ".." + layout.LayeoutBackImage));
                layout.MoveNext();
            }

            if (uiRadioButtonListLayouts.Items.Count > 0)
                uiRadioButtonListLayouts.Items[0].Selected = true;

            CardColor colors = new CardColor();
            colors.GetCardColorsByCardID(CardID);
            uiRepeaterColors.DataSource = colors.DefaultView;
            uiRepeaterColors.DataBind();

            Dimension dims = new Dimension();
            dims.GetAllDims();
            uiRepeaterSizes.DataSource = dims.DefaultView;
            uiRepeaterSizes.DataBind();

            CardText texts = new CardText();
            texts.GetCardTxtByCardID(CardID);
            uiDataListCardText.DataSource = texts.DefaultView;
            uiDataListCardText.DataBind();

            CardImages images = new CardImages();
            images.GetCardImageByCardID(CardID);
            if (images.RowCount > 0)
            {
                uiDataListImages.DataSource = images.DefaultView;
                uiDataListImages.DataBind();
                uiPanelNoImages.Visible = false;
            }
            else
            {
                uiDataListImages.Visible = false;
                uiPanelNoImages.Visible = true;
            }

            Cards card = new Cards();
            card.LoadByPrimaryKey(CardID);

            Categories cat = new Categories();
            cat.LoadByPrimaryKey(card.CategoryID);

            MainCat mcat = new MainCat();
            mcat.LoadByPrimaryKey(cat.MainCatId);

            TopLevelCat tcat = new TopLevelCat();
            tcat.LoadByPrimaryKey(mcat.TopLevelCatID);

            uiImageMain.ImageUrl = "../" + card.GeneralPreviewPhoto;
            FullPath = tcat.NameEng + " > " + mcat.NameEng + " > " + cat.CatNameEng;
        }