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

                uiTextBoxEnName.Text = objData.NameEng;
                uiTextBoxArName.Text = objData.NameAr;

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

                BindCats();
            }
            else if (e.CommandName == "DeleteCat")
            {
                try
                {
                    MainCat objData = new MainCat();
                    objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                    objData.MarkAsDeleted();
                    objData.Save();
                    CurrentMainCat = null;
                    BindCats();
                }
                catch (Exception ex)
                {
                    uipanelError.Visible = true;
                }
            }
        }
Beispiel #2
0
 private string LoadMainCats(int p)
 {
     string submenu = "";
     MainCat scat = new MainCat();
     scat.GetMaincatByTopLevelCatId(p);
     if (scat.RowCount > 0)
     {
         submenu = "<ul>";
         for (int i = 0; i < scat.RowCount; i++)
         {
             submenu += "<li><a href='browsec.aspx?tcid=" + scat.TopLevelCatID.ToString() + "&mcid=" + scat.MainCatID.ToString() + (scat.IsPartySupplier ? "&ps=true" : "") + "'>" + scat.NameEng + "</a>";
             submenu += LoadCats(scat.MainCatID);
             submenu += " </li>";
             scat.MoveNext();
         }
         submenu += "</ul>";
     }
     return submenu;
 }
        private void LoadCats()
        {
            MainCat Invcats = new MainCat();
            Invcats.Where.IsPartySupplier.Value = true;
            Invcats.Where.IsPartySupplier.Operator = MyGeneration.dOOdads.WhereParameter.Operand.NotEqual;
            Invcats.Sort = "NameEng";
            Invcats.Query.Top = 4;
            Invcats.Query.Load();
            uiRepeaterCats.DataSource = Invcats.DefaultView;
            uiRepeaterCats.DataBind();

            MainCat PScats = new MainCat();
            PScats.Where.IsPartySupplier.Value = true;
            PScats.Where.IsPartySupplier.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
            PScats.Sort = "NameEng";
            PScats.Query.Top = 4;
            PScats.Query.Load();
            uiRepeaterPS.DataSource = PScats.DefaultView;
            uiRepeaterPS.DataBind();
        }
        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");
                }
            }
        }
 protected void uiLinkButtonBack_Click(object sender, EventArgs e)
 {
     ClearFields();
     CurrentMainCat = null;
     uiPanelEditCat.Visible = false;
     uiPanelAllCats.Visible = true;
     BindCats();
 }
 private void BindCats()
 {
     MainCat cats = new MainCat();
     if (uiDropDownListTLCats.SelectedIndex != -1)
         cats.GetMaincatByTopLevelCatId(Convert.ToInt32(uiDropDownListTLCats.SelectedValue));
     cats.Sort = "NameEng";
     uiGridViewCats.DataSource = cats.DefaultView;
     uiGridViewCats.DataBind();
 }
        protected void uiLinkButtonOK_Click(object sender, EventArgs e)
        {
            MainCat cat = new MainCat();
            if (CurrentMainCat == null)
            {
                cat.AddNew();
                cat.IsPartySupplier = true;
            }
            else
                cat = CurrentMainCat;

            cat.NameEng = uiTextBoxEnName.Text;
            cat.NameAr = uiTextBoxArName.Text;

            if (uiFileUploadImage.HasFile)
            {
                string filepath = "/images/Category/" + DateTime.Now.ToString("ddMMyyyyhhmmss") + "_" + uiFileUploadImage.FileName;
                uiFileUploadImage.SaveAs(Server.MapPath("~" + filepath));
                cat.ImagePath = filepath;
            }
            if (uiFileUploadHover.HasFile)
            {
                string filepath = "/images/Category/" + DateTime.Now.ToString("ddMMyyyyhhmmss") + "_" + uiFileUploadHover.FileName;
                uiFileUploadHover.SaveAs(Server.MapPath("~" + filepath));
                cat.HoverImage = filepath;
            }
            cat.TopLevelCatID = Convert.ToInt32(uiDropDownListTLCats.SelectedValue);
            cat.Save();
            ClearFields();
            CurrentMainCat = null;
            uiPanelEditCat.Visible = false;
            uiPanelAllCats.Visible = true;
            BindCats();
        }
Beispiel #8
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;
                }

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
                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;
                }
            }
        }
Beispiel #10
0
        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();
            }
        }
 private void LoadMainCat()
 {
     MainCat Tcats = new MainCat();
     if(uiDropDownListTC.SelectedIndex != -1)
         Tcats.GetMaincatByTopLevelCatId(Convert.ToInt32(uiDropDownListTC.SelectedValue));
     uiDropDownListMainCats.DataSource = Tcats.DefaultView;
     uiDropDownListMainCats.DataTextField = "NameEng";
     uiDropDownListMainCats.DataValueField = "MainCatID";
     uiDropDownListMainCats.DataBind();
     BindCats();
 }
        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;
        }