private void InitData()
    {
        int nID = ConvertData.ConvertToInt(Request.QueryString["pid"]);

        try
        {

            Products obj = new Products();
            obj.LoadById(nID);
            lblProductName.Text = obj.Data.ProductName;
            lblPrice.Text = ConvertData.ConvertToString(Support.FormatCurrency(obj.Data.Price)) + " " + "vn₫";
            lblContent.Text = obj.Data.MainContent;

            int nCat = obj.Data.ProductCategoryID;

            lblIDAdd.Text = ConvertData.ConvertToString(nID);
            lblNameAdd.Text = obj.Data.ProductName;
            lblPriceAdd.Text = ConvertData.ConvertToString(obj.Data.Price);

            DataTable dtb = new DataTable();
            dtb = obj.Search_byItemID(0, nID, "", 0, 1000000000, nCat, 1, 1, 5, ref nPageCount);
            rptRelated.DataSource = dtb;
            rptRelated.DataBind();

            DataTable dtbFile = new DataTable();
            ProductFile objProductFile = new ProductFile();
            dtbFile = objProductFile.SearchByIDProduct(nID, 1, 10, ref nPageCount);
            rptProductFile.DataSource = dtbFile;
            rptProductFile.DataBind();

            if (dtbFile.Rows.Count == 0)
            {
                lblFile.Visible = false;
                div_file.Style.Add("display", "none");
            }

            //StaticPages objStaticPage = new StaticPages();
            //objStaticPage.LoadById(13);
            //ltrContentThuTuc.Text = objStaticPage.Data.PageContent;

        }
        catch { Response.Redirect("Default.aspx"); }
    }
예제 #2
0
    private void SetProductFileToRepeater(int ProductID)
    {
        if (ProductID > 0)
        {
            int nPageCount = 0;
            DataTable dtbSetColor = new DataTable();
            ProductFile objSetColor = new ProductFile();
            dtbSetColor = objSetColor.SearchByIDProduct(ProductID, 1, 10000, ref nPageCount);
            int nCount = dtbSetColor.Rows.Count;

            int nCountColor = rptProducFile.Items.Count;
            for (int i = 1; i <= nCountColor; i++)
            {
                HtmlInputCheckBox chk = (HtmlInputCheckBox)rptProducFile.Items[i - 1].FindControl("chkFile");
                Label lblID = (Label)rptProducFile.Items[i - 1].FindControl("lblProductFileID");
                for (int j = 1; j <= nCount; j++)
                {
                    int nColorID = (int)dtbSetColor.Rows[j - 1][1];
                    if (nColorID == ConvertData.ConvertToInt(lblID.Text))
                    {
                        chk.Checked = true;
                    }
                }
            }
        }
    }
예제 #3
0
    protected void rptProducts_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Products objProducts = new Products();
        DataTable dtbFile = new DataTable();
        ProductFile objProductFile = new ProductFile();
        int nPageCount = 0;
        if ((e.Item.ItemType != ListItemType.Header) && (e.Item.ItemType != ListItemType.Footer))
        {
            Label lnkFileName = (Label)e.Item.FindControl("lblFileName");
            Repeater rptFile = (Repeater)e.Item.FindControl("rptFile");
            int nID = ConvertData.ConvertToInt(DataBinder.Eval(e.Item.DataItem, "ID"));
            objProducts.LoadById(nID);
            lnkFileName.Text = objProducts.Data.ProductName;

            dtbFile = objProductFile.SearchByIDProduct(nID, 1, 10, ref nPageCount);

            if(dtbFile.Rows.Count==0){
                lnkFileName.Visible = false;
            }
            rptFile.DataSource = dtbFile;
            rptFile.DataBind();
        }
    }