public void LoadRelatedProduct() { if (hdnPKID.Value != "") { tblRelatedProduct objRelatedProduct = new tblRelatedProduct(); objDataTable = objRelatedProduct.LoadRelatedProduct(hdnPKID.Value); if (objDataTable.Rows.Count <= 0) { divRelatedProduct.Style.Add("display", "none"); } RepRelatedProduct.DataSource = objDataTable; RepRelatedProduct.DataBind(); objRelatedProduct = null; } }
private bool Delete(int intPKID) { bool retval = false; objProduct = new tblProduct(); if (objProduct.IsProductInOrder(intPKID.ToString())) { return(retval); } if (objProduct.LoadByPrimaryKey(intPKID)) { tblPixcelCode objPixelCode = new tblPixcelCode(); objPixelCode.Where.AppProductId.Value = intPKID; objPixelCode.Query.Load(); if (objPixelCode.RowCount > 0) { objPixelCode.DeleteAll(); objPixelCode.Save(); } objPixelCode = null; tblProductSubCategory objProductSubCategory = new tblProductSubCategory(); objProductSubCategory.Where.AppProductID.Value = intPKID; objProductSubCategory.Query.Load(); if (objProductSubCategory.RowCount > 0) { objProductSubCategory.DeleteAll(); objProductSubCategory.Save(); } objProductSubCategory = null; tblRelatedProduct objRelatedProduct = new tblRelatedProduct(); objRelatedProduct.Where.AppProductID.Value = intPKID; objRelatedProduct.Query.Load(); if (objRelatedProduct.RowCount > 0) { objRelatedProduct.DeleteAll(); objRelatedProduct.Save(); } objRelatedProduct = null; tblProductProperty objProductProperty = new tblProductProperty(); objProductProperty.Where.AppProductID.Value = intPKID; objProductProperty.Query.Load(); if (objProductProperty.RowCount > 0) { objProductProperty.DeleteAll(); objProductProperty.Save(); } objProductProperty = null; tblProductColor objProductColor = new tblProductColor(); objProductColor.Where.AppProductID.Value = intPKID; objProductColor.Query.Load(); if (objProductColor.RowCount > 0) { while (!(objProductColor.EOF)) { tblProductDetail objProductDetail = new tblProductDetail(); objProductDetail.Where.AppProductColorID.Value = objProductColor.AppProductColorID; objProductDetail.Query.Load(); if (objProductDetail.RowCount > 0) { objProductDetail.DeleteAll(); objProductDetail.Save(); } objProductDetail = null; tblProductImage objProductImage = new tblProductImage(); objProductImage.Where.AppProductColorID.Value = objProductColor.AppProductColorID; objProductImage.Query.Load(); if (objProductImage.RowCount > 0) { //while(! objProductImage.EOF ) //{ // if (System.IO.File.Exists(Server.MapPath(objProductImage.s_AppLargeImage ))) // { // System.IO.File.Delete(Server.MapPath(objProductImage.s_AppLargeImage)); // } // if (System.IO.File.Exists(Server.MapPath(objProductImage.s_AppNormalImage))) // { // System.IO.File.Delete(Server.MapPath(objProductImage.s_AppNormalImage)); // } // if (System.IO.File.Exists(Server.MapPath(objProductImage.s_AppSmallImage))) // { // System.IO.File.Delete(Server.MapPath(objProductImage.s_AppSmallImage)); // } // if (System.IO.File.Exists(Server.MapPath(objProductImage.s_AppThumbImage))) // { // System.IO.File.Delete(Server.MapPath(objProductImage.s_AppLargeImage)); // } // objProductImage.MoveNext(); //} objProductImage.DeleteAll(); objProductImage.Save(); } objProductImage = null; objProductColor.MoveNext(); } objProductColor.DeleteAll(); objProductColor.Save(); } objProductColor = null; string StrFolder = "Uploads/Product/" + objProduct.s_AppProductID + "/"; if (System.IO.Directory.Exists(Server.MapPath("~/admin/" + StrFolder))) { System.IO.Directory.Delete(Server.MapPath("~/admin/" + StrFolder), true); } objProduct.MarkAsDeleted(); objProduct.Save(); } retval = true; objProduct = null; return(retval); }
private void SetValuesToControls() { if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { tblProduct objproduct = new tblProduct(); if (objproduct.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value))) { lblProductCode.Text = objproduct.AppProductCode; lblProductName.Text = objproduct.AppProductName; lblProductTag.Text = objproduct.AppProductTag; divDescription.InnerHtml = objproduct.AppDescription; if (objproduct.s_AppIsColor != "") { if (objproduct.AppIsColor) { lblIsColor.Text = "Yes"; } } if (objproduct.s_AppIsSize != "") { if (objproduct.AppIsSize) { lblIsSize.Text = "Yes"; } } divMetaKeyWord.InnerHtml = objproduct.AppMetaKeyWord; divMetaDescription.InnerHtml = objproduct.AppMetaDescription; tblSubCategory objSubCategory = new tblSubCategory(); objDataTable = objSubCategory.GetAllCategoryProductWise(objproduct.s_AppProductID); dgvCategory.DataSource = null; dgvCategory.DataBind(); if (objDataTable.Rows.Count > 0) { divCategory.Style.Add("display", "block"); dgvCategory.DataSource = objDataTable; dgvCategory.DataBind(); } else { divCategory.Style.Add("display", "none"); } objSubCategory = null; tblProductColor objProductColor = new tblProductColor(); objDataTable = objProductColor.LoadGridData(objproduct.s_AppProductID, "0"); dgvColor.DataSource = null; dgvColor.DataBind(); if (objDataTable.Rows.Count > 0) { divColor.Style.Add("display", "block"); dgvColor.DataSource = objDataTable; dgvColor.DataBind(); } else { divColor.Style.Add("display", "none"); } objProductColor = null; tblRelatedProduct objRelatedProduct = new tblRelatedProduct(); objDataTable = objRelatedProduct.LoadRelatedProduct(objproduct.s_AppProductID); dgvRelatedProduct.DataSource = null; dgvRelatedProduct.DataBind(); if (objDataTable.Rows.Count > 0) { divRelatedProduct.Style.Add("display", "block"); dgvRelatedProduct.DataSource = objDataTable; dgvRelatedProduct.DataBind(); } else { divRelatedProduct.Style.Add("display", "none"); } objRelatedProduct = null; tblProductProperty objProductProperty = new tblProductProperty(); objDataTable = objProductProperty.LoadGridData(hdnPKID.Value); dgvProperty.DataSource = null; dgvProperty.DataBind(); if (objDataTable.Rows.Count > 0) { divProperty.Style.Add("display", "block"); dgvProperty.DataSource = objDataTable; dgvProperty.DataBind(); } else { divProperty.Style.Add("display", "none"); } objProductProperty = null; } objproduct = null; } }