protected void rptr_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "EditGroup")
        {
            imgPhoto.Visible = true;
            DataSet ds = new DataSet();
            ds = cls.ReturnDataSet("sp_RetriveDataWithField",
                                   new SqlParameter("@Fields", "*"),
                                   new SqlParameter("@TblNm", "ManageAdvertisement"),
                                   new SqlParameter("@WhereClause", "ManageAdvertisement where Id ='" + e.CommandArgument + "' and ManageAdvertisement.IsActive = 1"));

            if (ds.Tables[0].Rows.Count > 0)
            {
                lblId.Text        = e.CommandArgument.ToString();
                imgPhoto.ImageUrl = "../" + ds.Tables[0].Rows[0]["Image"].ToString();
                txtCaption.Text   = ds.Tables[0].Rows[0]["Caption"].ToString();
                txtUrl.Text       = ds.Tables[0].Rows[0]["Url"].ToString();
                ViewState["img"]  = ds.Tables[0].Rows[0]["Image"].ToString();
            }
        }

        if (e.CommandName == "DeleteGroup")
        {
            cls.ExecuteDA("DeleteRecord",
                          new SqlParameter("@TblNm", "ManageAdvertisement"),
                          new SqlParameter("@strField", "Id"),
                          new SqlParameter("@strValue", e.CommandArgument.ToString()));

            clearall();
            lblMsg.Text = "Advertisement Details Deleted Successfully";
            BindAdvertisement();

            cls.ExecuteNonQueryBySQLQuery("delete from AdvImageMap where AdvId='" + e.CommandArgument.ToString() + "'");
        }
    }
Пример #2
0
    protected void rptr_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "EditGroup")
        {
            DataSet ds = new DataSet();
            ds = cls.ReturnDataSet("sp_RetriveDataWithField",
                                   new SqlParameter("@Fields", "*"),
                                   new SqlParameter("@TblNm", "ProductSubCategory"),
                                   new SqlParameter("@WhereClause", "ProductSubCategory where Id ='" + e.CommandArgument + "' and ProductSubCategory.IsActive = 1"));
            if (ds.Tables[0].Rows.Count > 0)
            {
                lblId.Text = e.CommandArgument.ToString();
                cls.SetSelctedDropDownListValues(ds.Tables[0].Rows[0]["ProductCategoryid"].ToString(), ddlCategory);
                txtSubCategoryName.Text = ds.Tables[0].Rows[0]["SubCategoryName"].ToString();
                imgPhoto.ImageUrl       = "../" + ds.Tables[0].Rows[0]["Image"].ToString();
                ViewState["img"]        = ds.Tables[0].Rows[0]["Image"].ToString();
                imgBannerPhoto.ImageUrl = "../" + ds.Tables[0].Rows[0]["ImageBanner"].ToString();
                ViewState["imgBanner"]  = ds.Tables[0].Rows[0]["ImageBanner"].ToString();

                imgPhoto.Visible       = true;
                imgBannerPhoto.Visible = true;
            }
        }
        if (e.CommandName == "DeleteGroup")
        {
            if (cls.CheckExistField("CheckExistField", "Product", "ProductSubCategoryId", e.CommandArgument.ToString(), "and IsActive = 1"))
            {
                lblMsg.Text = "This SubCategory exists in Product. First delete products related to this SubCategory.";
                return;
            }
            else
            {
                cls.ExecuteDA("DeleteRecord", new SqlParameter("@TblNm", "ProductSubCategory"),
                              new SqlParameter("@strField", "Id"),
                              new SqlParameter("@strValue", e.CommandArgument.ToString()));
                clearall();
                lblMsg.Text = "Product Sub Category Deleted";
                BindProductSubCategory();

                cls.ExecuteNonQueryBySQLQuery("delete from SubCategoryImageMap where SubCategoryId='" + e.CommandArgument.ToString() + "'");
            }
        }
    }
    protected void rptr_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "EditGroup")
        {
            string isarrival, isspecial, iscod;
            isarrival = "";
            isspecial = "";
            iscod     = "";

            imgPhoto.Visible = true;
            DataSet ds = new DataSet();
            ds = cls.ReturnDataSet("sp_RetriveDataWithField",
                                   new SqlParameter("@Fields", "*"),
                                   new SqlParameter("@TblNm", "Product"),
                                   new SqlParameter("@WhereClause", "Product where Id ='" + e.CommandArgument + "' and Product.IsActive = 1"));
            if (ds.Tables[0].Rows.Count > 0)
            {
                lblId.Text = e.CommandArgument.ToString();
                ddlCategory.SelectedValue = ds.Tables[0].Rows[0]["ProductCategoryId"].ToString();
                //cls.SetSelctedDropDownListValues(ds.Tables[0].Rows[0]["ProductCategoryid"].ToString(), ddlCategory);
                // cls.SetSelctedDropDownListValues(ds.Tables[0].Rows[0]["ProductSubCategoryId"].ToString(), ddlSubCategory);

                ddlSubCategory.ClearSelection();
                cls.BindDropDownList_blankValue(ddlSubCategory, "SubCategoryName", "ID", "bindDropdown", "ProductSubCategory", "where IsActive=1 and ProductCategoryId ='" + ddlCategory.SelectedValue + "' order by SubCategoryName ASC", "Id,SubCategoryName");
                ddlSubCategory.SelectedValue = ds.Tables[0].Rows[0]["ProductSubCategoryId"].ToString();
                // ddlSubCategory.Items.FindByValue(("ProductSubCategoryID").ToString()).Selected = true;

                ddlsupplier.SelectedValue = ds.Tables[0].Rows[0]["SupplierId"].ToString();
                ddlBrand.SelectedValue    = ds.Tables[0].Rows[0]["BrandId"].ToString();
                //cls.SetSelctedDropDownListValues(ds.Tables[0].Rows[0]["SupplierId"].ToString(), ddlsupplier);
                //cls.SetSelctedDropDownListValues(ds.Tables[0].Rows[0]["BrandId"].ToString(), ddlBrand);

                txtProductname.Text  = ds.Tables[0].Rows[0]["ProductName"].ToString();
                txtProductline2.Text = ds.Tables[0].Rows[0]["Productdescp"].ToString();

                txtProductCode.Text    = ds.Tables[0].Rows[0]["ProductCode"].ToString();
                txtSupProductcode.Text = ds.Tables[0].Rows[0]["SupplierProductCode"].ToString();
                txtpacksize.Text       = ds.Tables[0].Rows[0]["PackSize"].ToString();
                //cblSizeoption.Text = ds.Tables[0].Rows[0]["SizeOption"].ToString();

                txtProductcost.Text = ds.Tables[0].Rows[0]["ProductCost"].ToString();
                //cls.SetSelctedDropDownListValues(ds.Tables[0].Rows[0]["UnitId"].ToString(), ddlUnit);
                ddlUnit.SelectedValue = ds.Tables[0].Rows[0]["UnitId"].ToString();
                txtProductweight.Text = ds.Tables[0].Rows[0]["ProductWeight"].ToString();
                imgPhoto.ImageUrl     = "../" + ds.Tables[0].Rows[0]["Image"].ToString();
                ViewState["img"]      = ds.Tables[0].Rows[0]["Image"].ToString();
                txtkeywords.Text      = ds.Tables[0].Rows[0]["KeyWords"].ToString();
                txtCertification.Text = ds.Tables[0].Rows[0]["Certification"].ToString();
                txtDescription.Text   = ds.Tables[0].Rows[0]["Description"].ToString();
                txtmargin.Text        = ds.Tables[0].Rows[0]["Margin"].ToString();

                txtsalescost.Text      = ds.Tables[0].Rows[0]["SalePrice"].ToString();
                txttax.Text            = ds.Tables[0].Rows[0]["Tax"].ToString();
                txtSalesPriceIncl.Text = ds.Tables[0].Rows[0]["SalesPrice_Incl"].ToString();
                txtMRP.Text            = ds.Tables[0].Rows[0]["MRP"].ToString();

                txtDiscount.Text    = ds.Tables[0].Rows[0]["Discount"].ToString();
                txtCalDiscount.Text = ds.Tables[0].Rows[0]["CalDiscount"].ToString();

                txtshippingcost.Text = ds.Tables[0].Rows[0]["ShippingCost"].ToString();

                txtfinalcost.Text     = ds.Tables[0].Rows[0]["FinalSellingPrice"].ToString();
                txttaxfinalprice.Text = ds.Tables[0].Rows[0]["TaxFinalPrice"].ToString();
                txtMinOrdrQty.Text    = ds.Tables[0].Rows[0]["Quantity"].ToString();

                txtShippngDays.Text = ds.Tables[0].Rows[0]["ShippingDays"].ToString();

                isarrival = ds.Tables[0].Rows[0]["IsNewArrival"].ToString();
                isspecial = ds.Tables[0].Rows[0]["IsSpecialOffer"].ToString();
                iscod     = ds.Tables[0].Rows[0]["IsCOD"].ToString();
            }

            //for isnew arriaval
            if (isarrival == "True" || isarrival == "true")
            {
                rbtNewArriaval.SelectedValue = "1";
            }
            else
            {
                rbtNewArriaval.SelectedValue = "0";
            }

            //for is spcial offer
            if (isspecial == "True" || isspecial == "true")
            {
                RbtSpecialOffer.SelectedValue = "1";
            }
            else
            {
                RbtSpecialOffer.SelectedValue = "0";
            }

            //for iscod
            if (iscod == "True" || iscod == "true")
            {
                rbtCOD.SelectedValue = "1";
            }
            else
            {
                rbtCOD.SelectedValue = "0";
            }

            //retrving product colour from db
            DataTable dtcolour = new DataTable();
            dtcolour = cls.ReturnDataTable("Select_ProductColourFromPID", new SqlParameter("@PID", lblId.Text));
            foreach (DataRow dr in dtcolour.Rows)
            {
                foreach (ListItem li in cblColouroption.Items)
                {
                    if (li.Value.ToString() == dr["ColourId"].ToString())
                    {
                        li.Selected = true;
                    }
                }
            }

            DataTable dtSize = new DataTable();
            dtSize = cls.ReturnDataTable("Select_ProductSizeFromPID", new SqlParameter("@PID", lblId.Text));
            foreach (DataRow dr1 in dtSize.Rows)
            {
                foreach (ListItem li in cblSizeoption.Items)
                {
                    if (li.Value.ToString() == dr1["SizeId"].ToString())
                    {
                        li.Selected = true;
                    }
                }
            }
        }
        if (e.CommandName == "DeleteGroup")
        {
            cls.ExecuteDA("DeleteRecord", new SqlParameter("@TblNm", "Product"),
                          new SqlParameter("@strField", "Id"),
                          new SqlParameter("@strValue", e.CommandArgument.ToString()));
            //cls.ExecuteNonQueryBySQLQuery("Update Product set IsActive=0 where Id=" + e.CommandArgument.ToString() + "");
            cls.ExecuteNonQueryBySQLQuery("Update ProductColour set IsActive=0 where ProductId=" + e.CommandArgument.ToString() + "");
            cls.ExecuteNonQueryBySQLQuery("Update ProductSize set IsActive=0 where ProductId=" + e.CommandArgument.ToString() + "");

            //cls.ExecuteDA("Delete_ProductColour", new SqlParameter("@ProductId",e.CommandArgument.ToString()));

            //cls.ExecuteDA("Delete_ProductSize", new SqlParameter("@ProductId", e.CommandArgument.ToString()));
            clearall();
            lblMsg.Text = "Product Deleted";
            BindProduct();
        }
    }