private void BindDSProducts() { // ------------------------------------------------------------------------ // Implement paging based upon the lettering filter specified BPProducts bp = new BPProducts(); if (ddlProductCategories.SelectedValue == "-1") { DSProducts = bp.SelectAllWithProductCategories(); } else { DSProducts = bp.SelectByProductCategoryID(Convert.ToInt32(ddlProductCategories.SelectedValue)); } DSProducts.tbl_Products.DefaultView.RowFilter = RowFilter("ProductName", "ProductActive"); DSProducts.tbl_Products.DefaultView.Sort = "ProductName"; letters_Bind(); dgProduct.DataBind(); SetPagerButtons(); if (DSProducts.tbl_Products.DefaultView.Count == 0) { lblError.Visible = true; lblError.Text = "0 Records found."; } else { lblError.Visible = false; lblError.Text = ""; } }
private void LoadAttributes(int ProductID) { BPProducts bp = new BPProducts(); DSProducts = bp.SelectActiveProductAttributesByProductID(ProductID); dgAttributes.DataBind(); }
private void rptProductsList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { BEProducts.tbl_ProductsRow product = (BEProducts.tbl_ProductsRow) ((DataRowView) e.Item.DataItem).Row; Image imgProductThumb = (Image) e.Item.FindControl("imgProductThumb"); if (product.IsProductImageIDNull()) { imgProductThumb.Visible = false; } BEProducts dsAttributes = new BEProducts(); BPProducts bp = new BPProducts(); dsAttributes = bp.SelectActiveProductAttributesByProductID(product.ProductID); dgAttributes.DataBind(); DropDownList tmpDropDown = ((DropDownList)e.Item.FindControl("ddlAttributes")); if (dsAttributes.tbl_ProductAttributes.Rows.Count == 0) { e.Item.FindControl("lnkChooseAttribute").Visible = false; tmpDropDown.Visible = false; }else { tmpDropDown.DataSource = dsAttributes.tbl_ProductAttributes; tmpDropDown.DataTextField = "ProductAttributeName"; tmpDropDown.DataValueField = "ProductAttributeID"; tmpDropDown.DataBind(); tmpDropDown.Items.Insert(0,new ListItem("Choose A Color","0")); } } }
protected void BindProductsList() { BPProducts bp = new BPProducts(); DSProducts = bp.SelectActiveByProductCategoryID(ProductCategoryID); foreach (BEProducts.tbl_ProductsRow applications in DSProducts.tbl_Products) { DSProducts.Merge(bp.SelectProductsByID(applications.ProductID)); } rptProductsList.DataBind(); pnlProductsList.Visible = true; }
private string GetProductTitle(int ProductID) { BPProducts bp = new BPProducts(); DSProducts = bp.SelectProductsByID(ProductID); BEProducts.tbl_ProductsRow title; title = DSProducts.tbl_Products.FindByProductID(ProductID); if (DSProducts.tbl_Products.Count > 0) { return title.ProductName; } else { return ""; } }
private void ViewProductAttributes() { BPProducts bp = new BPProducts(); DSProducts = bp.SelectProductAttributesByProductID(ProductID); dgProductAttributes.DataBind(); dgProductAttributes.SelectedIndex = -1; tabViewProductAttributes.Attributes["class"] = "current"; tabAddProductAttributes.Attributes["class"] = ""; pnlAddProductAttributes.Visible = false; pnlViewProductAttributes.Visible = true; }
private void SaveRelatedProducts() { ArrayList _NewRelatedProductIDs = SelectedProductsList; BEProducts.tbl_RelatedProductsRow relatedProduct; BPProducts bp = new BPProducts(); BEProducts DSProducts = new BEProducts(); bp.DeleteRelatedProductsByProductID(ProductID); foreach (object tmpProdID in _NewRelatedProductIDs) { relatedProduct = DSProducts.tbl_RelatedProducts.Newtbl_RelatedProductsRow(); relatedProduct.ProductID = ProductID; relatedProduct.RelatedProductID = Convert.ToInt32(tmpProdID); relatedProduct.DateCreated = DateTime.Now; relatedProduct.DateModified = DateTime.Now; relatedProduct.ModifiedByAdminID = Convert.ToInt32(CarrielUser.CarrielIdentity.MemberID); DSProducts.tbl_RelatedProducts.Addtbl_RelatedProductsRow(relatedProduct); } bp.UpdateRelatedProducts(DSProducts); ViewRelatedProducts(); }
private void FillCheckBoxes() { BPProducts bp = new BPProducts(); BEProducts products = new BEProducts(); products = bp.SelectProductShippingMethodsByProductID(ProductID); dlCheckBoxes.DataSource = products; dlCheckBoxes.DataMember = "tbl_ProductShippingMethods"; dlCheckBoxes.DataBind(); }
private void CreateCheckBoxes() { BEProducts products = new BEProducts(); BPShippingMethods bp = new BPShippingMethods(); DSShippingMethods = bp.SelectAllActive(); foreach (BEShipping.tbl_ShippingMethodsRow methods in DSShippingMethods.tbl_ShippingMethods) { for (int j=1; j<=5; j++) { BEProducts.tbl_ProductShippingMethodsRow dr; dr = products.tbl_ProductShippingMethods.Newtbl_ProductShippingMethodsRow(); dr.ProductID=ProductID; dr.ShippingMethodID = methods.ShippingMethodID; dr.ShippingRegionID = j; dr.ProductShippingMethodActive = true; products.tbl_ProductShippingMethods.Addtbl_ProductShippingMethodsRow(dr); } } dlCheckBoxes.DataSource = products; dlCheckBoxes.DataMember = "tbl_ProductShippingMethods"; dlCheckBoxes.DataBind(); }
protected void FillSelectedRelatedProducts() { if (ProductID > 0) { ddlSelectedProducts.Items.Clear(); BPProducts bp = new BPProducts(); DSProducts = bp.SelectRelatedProductsByProductID(ProductID); if (DSProducts.tbl_RelatedProducts.Count > 0) { ddlSelectedProducts.DataTextField = "ProductName"; ddlSelectedProducts.DataValueField = "RelatedProductID"; ddlSelectedProducts.DataBind(); foreach (BEProducts.tbl_RelatedProductsRow content in DSProducts.tbl_RelatedProducts) { SelectedProducts.Value += content.ProductID + ","; } } } }
protected void FillAvailableProducts() { ddlAvailableProducts.Items.Clear(); BPProducts bp = new BPProducts(); if (ddlRelatedProductsCategories.SelectedIndex == 0) { DSProducts = bp.SelectNonRelatedProductsByProductID(ProductID); }else{ DSProducts = bp.SelectNonRelatedProductsByProductIDAndProductCategoryID(ProductID,Convert.ToInt32(ddlRelatedProductsCategories.SelectedValue)); } DSProducts.tbl_Products.DefaultView.Sort = "ProductName"; ddlAvailableProducts.DataTextField = "ProductName"; ddlAvailableProducts.DataValueField = "RelatedProductID"; ddlAvailableProducts.DataBind(); }
private void ViewRelatedProducts() { BPProducts bp = new BPProducts(); DSProducts = bp.SelectRelatedProductsByProductID(ProductID); dgRelatedProducts.DataBind(); }
private void btnDelete_Click(object sender, EventArgs e) { BPProducts bp = new BPProducts(); BEProducts.tbl_ProductsRow Product; DSProducts = bp.SelectProductsByID(ProductID); Product = DSProducts.tbl_Products.FindByProductID(ProductID); Product.Delete(); bp.Update(DSProducts); Response.Redirect("BrowseProducts.aspx"); }
private void btnSubmit_ServerClick(object sender, EventArgs e) { BPProducts bp = new BPProducts(); BEProducts.tbl_ProductsRow Product; DSProducts = new BEProducts(); if (ProductID == 0) { // Add new product Product = DSProducts.tbl_Products.Newtbl_ProductsRow(); hdnProductInventoryLevel.Value = txtProductInventoryLevel.Text; } else { // Edit a Product DSProducts = bp.SelectProductsByID(ProductID); Product = DSProducts.tbl_Products.FindByProductID(ProductID); } //all content to be updated/inserted between here Editor ProductDescription = edtProductDescription; string strProductDescription = Request.Form[ProductDescription.Editor_HiddenField].ToString(); Product.ProductName = txtProductName.Text; Product.ProductDescription = strProductDescription; Product.ProductCategoryID = Convert.ToInt32(ddlProductCategories.SelectedValue); if(Product.ProductCategoryID == -1) { Product.ProductCategoryID = 0; } if(txtProductPrice.Text != "") { Product.ProductPrice = Convert.ToDecimal(txtProductPrice.Text); } else { Product.ProductPrice = 0; } if(txtProductSalePrice.Text != "") { Product.ProductSalePrice = Convert.ToDecimal(txtProductSalePrice.Text); } else { Product.ProductPrice = 0; } if (dtStart.SelectedDate != DateTime.MinValue) { Product.ProductSaleStartDate = Convert.ToDateTime(dtStart.SelectedDate); } else { Product.ProductSaleStartDate = DateTime.Now; } if (dtEnd.SelectedDate != DateTime.MinValue) { Product.ProductSaleEndDate = Convert.ToDateTime(dtEnd.SelectedDate); } else { Product.ProductSaleEndDate = DateTime.Now; } Product.ProductChargeTax = chkProductChargeTax.Checked; Product.ProductSize = txtProductSize.Text; Product.ProductInventoryLevel = Convert.ToInt32(hdnProductInventoryLevel.Value); if(txtProductReorderLevel.Text !="") { Product.ProductReorderLevel = Convert.ToInt32(txtProductReorderLevel.Text); } else { Product.ProductReorderLevel = 0; } if(txtShippingSurcharge.Text != "") { Product.ProductShippingSurcharge = Convert.ToDecimal(txtShippingSurcharge.Text); } else { Product.ProductShippingSurcharge = 0; } ImageWizard ddlImageSelector = Page.FindControl("ddlImageSelector") as ImageWizard; if (ddlImageSelector.SelectedImage > 0) { Product.ProductImageID = Convert.ToInt32(ddlImageSelector.SelectedImage); } else { Product.SetProductImageIDNull(); } Product.ProductActive = chkProductActive.Checked; Product.DateModified = DateTime.Now; Product.ModifiedByAdminID = Convert.ToInt32(CarrielUser.CarrielIdentity.MemberID); //all content to be updated/inserted between here if (ProductID == 0) { //Add new Application Category Product.DateCreated = DateTime.Now; DSProducts.tbl_Products.Addtbl_ProductsRow(Product); } bp.Update(DSProducts); int tmpProductID = Product.ProductID; if (hdnShippingMethodsChanged.Value == "true" || ProductID == 0) { DSProducts.Merge(bp.SelectProductShippingMethodsByProductID(tmpProductID)); hdnShippingMethodsChanged.Value = "false"; BEProducts.tbl_ProductShippingMethodsRow dr; for(int i = 0; i < dlCheckBoxes.Items.Count; i++) { HtmlInputCheckBox tmpChk = dlCheckBoxes.Items[i].FindControl("checkBox") as HtmlInputCheckBox; if (ProductID == 0) { dr = DSProducts.tbl_ProductShippingMethods.Newtbl_ProductShippingMethodsRow(); dr.ProductID = tmpProductID; dr.ShippingMethodID = Convert.ToInt32(tmpChk.Attributes["ShippingMethodID"]); dr.ShippingRegionID = Convert.ToInt32(tmpChk.Attributes["ShippingRegionID"]); dr.ProductShippingMethodActive = tmpChk.Checked; DSProducts.tbl_ProductShippingMethods.Addtbl_ProductShippingMethodsRow(dr); } else { dr = DSProducts.tbl_ProductShippingMethods.FindByProductShippingMethodID(Convert.ToInt32(tmpChk.Attributes["ProductShippingMethodID"])); if(dr.ProductShippingMethodActive != tmpChk.Checked) { dr.ProductShippingMethodActive = tmpChk.Checked; } } } } bp.UpdateProductShippingMethods(DSProducts); //CreateResizedImage(BEImages DSImages, int ImageID, string prefix, int width, int height, Page page) if (!Product.IsProductImageIDNull()) { MWUtility.CreateResizedImage(Product.ProductImageID, "p", "tn", imageSize, thumbSize, this); } //save Document //exit page if (ProductID == 0) { Response.Redirect("EditProducts.aspx?ProductID=" + Product.ProductID); } else { Response.Redirect("BrowseProducts.aspx"); } }
// private void lstActive_SelectedIndexChanged(object sender, System.EventArgs e) // { // int active; // if (lstActive != null) // { // active = Convert.ToInt32(lstActive.SelectedValue); // } // else // { // active = -1; // } // } protected void txtInv_TextChanged(object sender, EventArgs e) { lblError.Text = string.Empty; lblError.Visible = false; try { int prodID = Convert.ToInt32(((LinkButton)((TextBox)sender).Parent.Parent.FindControl("lnkName")).CommandArgument); BPProducts bp = new BPProducts(); BEProducts.tbl_ProductsRow product; DSProducts = new BEProducts(); DSProducts = bp.SelectProductsByID(prodID); product = DSProducts.tbl_Products.FindByProductID(prodID); product.ProductInventoryLevel = Convert.ToInt32(((TextBox)sender).Text); bp.Update(DSProducts); } catch (FormatException) { lblError.Text = "Please enter a number under unit count."; lblError.Visible = true; } }