Ejemplo n.º 1
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            if (SubmitControls())
            {
                try
                {
                    ProductSearchEngine.EntityClasses.ProductEntity product = new ProductSearchEngine.Business.Adapters.ProductAdapter().AddProduct(ProductTitleTextBox.Text, double.Parse(ProductPriceTextBox.Text), ProductRedirectUrlTextBox.Text
                                                                                                                                                    , int.Parse(SubCategoryDropDownList.SelectedValue), int.Parse(BrandDropDownList.SelectedValue), ProductDetailTextBox.Text, ProductNewItemStatusRadioButtonList.SelectedValue == "1" ? true : false
                                                                                                                                                    , ProductFreeShippingStatusRadioButtonList.SelectedValue == "1" ? true : false, (Session["Member"] as ProductSearchEngine.EntityClasses.MembershipEntity).Stores.FirstOrDefault().Id);
                    ViewState["ProductId"] = product.Id;

                    new ProductSearchEngine.Business.Adapters.ProductAdapter().AddProductPhoto(product.Id, ViewState["PhotoUniqueName"].ToString());
                    GetData(product);

                    SubmitButton.Text = "Save Changes";
                    //Session["PageType"] = "Update";

                    ProductKeywordAddPanel.Visible       = true;
                    ProductPhotoPanel.Visible            = true;
                    ProductSpecificationAddPanel.Visible = true;
                    ProductKeywordPanel.Visible          = true;
                    ProductSpecificationPanel.Visible    = true;
                    SubmitEditButton.Visible             = true;
                    SubmitButton.Visible = false;
                }
                catch
                {
                    ShowAlertMessage("Alanalrı Kontrol");
                }
            }
            else
            {
                ShowAlertMessage("Alanalrı Kontrol");
            }
        }
 public Product GetProductById(int id)
 {
     ProductSearchEngine.EntityClasses.ProductEntity LlblgenProduct = new ProductSearchEngine.Business.Adapters.ProductAdapter().GetProductById(id);
     return(new Product()
     {
         Id = LlblgenProduct.Id,
         Description = LlblgenProduct.DetailDescription,
         Price = (double)LlblgenProduct.Price,
         Title = LlblgenProduct.Title,
         PhotoGuid = "slider" + LlblgenProduct.Id
                     //PhotoGuid = item.ProductPhotos.FirstOrDefault().UniqueName
     });
 }
 public Product GetProductById(int id)
 {
     ProductSearchEngine.EntityClasses.ProductEntity LlblgenProduct = new ProductSearchEngine.Business.Adapters.ProductAdapter().GetProductById(id);
     return new Product()
        {
        Id = LlblgenProduct.Id,
        Description = LlblgenProduct.DetailDescription,
        Price = (double)LlblgenProduct.Price,
        Title = LlblgenProduct.Title,
        PhotoGuid = "slider" + LlblgenProduct.Id
        //PhotoGuid = item.ProductPhotos.FirstOrDefault().UniqueName
        };
 }
        private void GetData(int id)
        {
            ProductSearchEngine.EntityClasses.ProductEntity product = new ProductSearchEngine.Business.Adapters.ProductAdapter().GetProductById(id);

            ProductTitle              = product.Title;
            ProductTitleTextBox.Text  = product.Title;
            ProductDetailTextBox.Text = product.DetailDescription;
            ProductFreeShippingStatusRadioButtonList.SelectedIndex = (bool)product.IsFreeShipping ? 1 : 0;
            ProductNewItemStatusRadioButtonList.SelectedIndex      = (bool)product.IsNewItem ? 1 : 0;
            ProductRedirectUrlTextBox.Text             = product.RedirectUrl;
            ProductPriceTextBox.Text                   = product.Price.ToString();
            ProductStatusRadioButtonList.SelectedIndex = (bool)product.Status ? 1 : 0;

            CategoryDropDownList.DataSource     = new ProductSearchEngine.Business.Adapters.CategoryAdapter().GetMainCategories();
            CategoryDropDownList.DataTextField  = "Name";
            CategoryDropDownList.DataValueField = "Id";
            CategoryDropDownList.DataBind();

            CategoryDropDownList.Items.FindByValue(((int)new ProductSearchEngine.Business.Adapters.CategoryAdapter().GetMainCatehoryIdBySubCategoryId((int)product.CategoryId)).ToString()).Selected = true;
            CategoryDropDownList_DataBound();
            ListItem liSubCategory = SubCategoryDropDownList.Items.FindByValue(product.CategoryId.ToString());

            if (liSubCategory != null)
            {
                liSubCategory.Selected = true;
            }
            BrandDropDownList.DataSource     = new ProductSearchEngine.Business.Adapters.BrandAdapter().GetBrandList();
            BrandDropDownList.DataTextField  = "Name";
            BrandDropDownList.DataValueField = "Id";
            BrandDropDownList.DataBind();

            ListItem li = BrandDropDownList.Items.FindByValue(product.BrandId.ToString());

            if (li != null)
            {
                li.Selected = true;
            }

            ProductPhotosRepeater.DataSource = product.ProductPhotos;
            ProductPhotosRepeater.DataBind();

            ProductSpecificationsRepeater.DataSource = product.ProductSpecifications;
            ProductSpecificationsRepeater.DataBind();

            ProductKeywordRepeater.DataSource = product.ProductKeywords;
            ProductKeywordRepeater.DataBind();
        }
        public IList <Product> GetProductsByKeyword(string keyword)
        {
            ProductCollection LlblgenKeywordProducts = new ProductSearchEngine.Business.Adapters.ProductAdapter().GetProductsByKeyword(keyword);

            IList <Product> returnProductList = new List <Product>();

            foreach (var item in LlblgenKeywordProducts)
            {
                returnProductList.Add(new Product()
                {
                    Id          = item.Id,
                    Description = item.DetailDescription,
                    Price       = (double)item.Price,
                    Title       = item.Title,
                    PhotoGuid   = "slider" + item.Id
                                  //PhotoGuid = item.ProductPhotos.FirstOrDefault().UniqueName
                });
            }

            return(returnProductList);
        }
        public IList<Surragates.Product> GetSliderProducts()
        {
            ProductCollection LlblgenSliderProducts = new ProductSearchEngine.Business.Adapters.ProductAdapter().GetSliderProducts();

               IList<Product> returnProductList = new List<Product>();

               foreach (var item in LlblgenSliderProducts)
               {
               returnProductList.Add(new Product()
               {
                   Id = item.Id,
                   Description=item.DetailDescription,
                   Price =(double)item.Price,
                   Title=item.Title,
                   PhotoGuid="slider"+item.Id
                   //PhotoGuid = item.ProductPhotos.FirstOrDefault().UniqueName
               });
               }

               return returnProductList;
        }
        private void GetData(int id)
        {
            ProductSearchEngine.EntityClasses.ProductEntity product = new ProductSearchEngine.Business.Adapters.ProductAdapter().GetProductById(id);

            ProductTitle = product.Title;
            ProductTitleTextBox.Text = product.Title;
            ProductDetailTextBox.Text = product.DetailDescription;
            ProductFreeShippingStatusRadioButtonList.SelectedIndex = (bool)product.IsFreeShipping ? 1 : 0;
            ProductNewItemStatusRadioButtonList.SelectedIndex = (bool)product.IsNewItem ? 1 : 0;
            ProductRedirectUrlTextBox.Text = product.RedirectUrl;
            ProductPriceTextBox.Text = product.Price.ToString();
            ProductStatusRadioButtonList.SelectedIndex = (bool)product.Status ? 1 : 0;

            CategoryDropDownList.DataSource = new ProductSearchEngine.Business.Adapters.CategoryAdapter().GetMainCategories();
            CategoryDropDownList.DataTextField = "Name";
            CategoryDropDownList.DataValueField = "Id";
            CategoryDropDownList.DataBind();

            CategoryDropDownList.Items.FindByValue(((int)new ProductSearchEngine.Business.Adapters.CategoryAdapter().GetMainCatehoryIdBySubCategoryId((int)product.CategoryId)).ToString()).Selected = true;
            CategoryDropDownList_DataBound();
            ListItem liSubCategory = SubCategoryDropDownList.Items.FindByValue(product.CategoryId.ToString());
            if (liSubCategory != null)
                liSubCategory.Selected = true;
            BrandDropDownList.DataSource = new ProductSearchEngine.Business.Adapters.BrandAdapter().GetBrandList();
            BrandDropDownList.DataTextField = "Name";
            BrandDropDownList.DataValueField = "Id";
            BrandDropDownList.DataBind();

            ListItem li = BrandDropDownList.Items.FindByValue(product.BrandId.ToString());
            if (li != null)
                li.Selected = true;

            ProductPhotosRepeater.DataSource = product.ProductPhotos;
            ProductPhotosRepeater.DataBind();

            ProductSpecificationsRepeater.DataSource = product.ProductSpecifications;
            ProductSpecificationsRepeater.DataBind();

            ProductKeywordRepeater.DataSource = product.ProductKeywords;
            ProductKeywordRepeater.DataBind();
        }
 private void GetTotalProducts()
 {
     TotalProducts = new ProductSearchEngine.Business.Adapters.ProductAdapter().GetTotalProducts();
 }
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            if (SubmitControls())
            {
                try
                {
                    ProductSearchEngine.EntityClasses.ProductEntity product = new ProductSearchEngine.Business.Adapters.ProductAdapter().AddProduct(ProductTitleTextBox.Text, double.Parse(ProductPriceTextBox.Text), ProductRedirectUrlTextBox.Text
                        , int.Parse(SubCategoryDropDownList.SelectedValue), int.Parse(BrandDropDownList.SelectedValue), ProductDetailTextBox.Text, ProductNewItemStatusRadioButtonList.SelectedValue == "1" ? true : false
                        , ProductFreeShippingStatusRadioButtonList.SelectedValue == "1" ? true : false, (Session["Member"] as ProductSearchEngine.EntityClasses.MembershipEntity).Stores.FirstOrDefault().Id);
                    ViewState["ProductId"] = product.Id;

                    new ProductSearchEngine.Business.Adapters.ProductAdapter().AddProductPhoto(product.Id, ViewState["PhotoUniqueName"].ToString());
                    GetData(product);

                    SubmitButton.Text = "Save Changes";
                    //Session["PageType"] = "Update";

                    ProductKeywordAddPanel.Visible = true;
                    ProductPhotoPanel.Visible = true;
                    ProductSpecificationAddPanel.Visible = true;
                    ProductKeywordPanel.Visible = true;
                    ProductSpecificationPanel.Visible = true;
                    SubmitEditButton.Visible = true;
                    SubmitButton.Visible = false;
                }
                catch
                {
                    ShowAlertMessage("Alanalrı Kontrol");
                }
            }
            else
                ShowAlertMessage("Alanalrı Kontrol");
        }
 private void GetTotalProducts()
 {
     TotalProducts = new ProductSearchEngine.Business.Adapters.ProductAdapter().GetTotalProducts();
 }