Beispiel #1
0
    public void getbeveragerepeater()
    {
        string    nameEn   = "";
        string    nameCH   = "";
        int       Category = int.Parse(Request.QueryString["Category"]);
        DataTable dt       = new DataTable();

        dt.Columns.Add("IDProduct");
        dt.Columns.Add("Name");
        dt.Columns.Add("ImageURL");
        dt.Columns.Add("Detail");
        dt.Columns.Add("Price");
        dt.Columns.Add("PromotionPrice");
        dt.Columns.Add("NameEn");
        CommonClassLibrary.CommonDataSet.ProductCateDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.ProductCateTableAdapter().GetDataByCategory(Category);
        foreach (CommonClassLibrary.CommonDataSet.ProductCateRow item in collection)
        {
            string name      = "";
            string imageUrl  = "Image/no_image_available.jpg";
            string detail    = "";
            string price     = "";
            string promotion = "";
            CommonClassLibrary.CommonDataSet.ProductDetailDataTable collection2 = new CommonClassLibrary.CommonDataSetTableAdapters.ProductDetailTableAdapter().GetDataByProduct(item.Product);
            foreach (CommonClassLibrary.CommonDataSet.ProductDetailRow item2 in collection2)
            {
                if (item2.KeyName == "Name")
                {
                    name = item2.KeyValue;
                    CommonClassLibrary.CommonDataSet.TextContentDataTable collection3 = new CommonClassLibrary.CommonDataSetTableAdapters.TextContentTableAdapter().GetDataById(long.Parse(item2.KeyValue));
                    foreach (CommonClassLibrary.CommonDataSet.TextContentRow item3 in collection3)
                    {
                        name   = item3.Thai;
                        nameEn = item3.English;
                    }
                }
                else if (item2.KeyName == "Picture")
                {
                    if (item2.KeyValue == "")
                    {
                        imageUrl = "no_image_available.jpg";
                    }
                    else
                    {
                        imageUrl = item2.KeyValue;
                    }
                }
                else if (item2.KeyName == "Detail")
                {
                    detail = item2.KeyValue;
                }
                else if (item2.KeyName == "Price")
                {
                    price = double.Parse(item2.KeyValue).ToString("#.###") + ".-";
                }
                else if (item2.KeyName == "PromotionPrice")
                {
                    if (item2.KeyValue == "-")
                    {
                        promotion = (item2.KeyValue);
                    }
                    else
                    {
                        promotion = double.Parse(item2.KeyValue).ToString("#.###") + ".-";
                    }
                }
            }
            dt.Rows.Add(item.Product, name, imageUrl, detail, price, promotion, nameEn);
        }
        this.BeverageRepeater.DataSource = dt;
        this.BeverageRepeater.DataBind();
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            System.Web.UI.HtmlControls.HtmlGenericControl Services = (System.Web.UI.HtmlControls.HtmlGenericControl)Master.FindControl("Li1");
            Services.Attributes.Add("class", "active");

            int IDProduct = int.Parse(Request.QueryString["IDProduct"]);
            getcategorycheckbox();


            CommonClassLibrary.CommonDataSet.ProductDetailDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.ProductDetailTableAdapter().GetDataByProductShowName(IDProduct);
            foreach (CommonClassLibrary.CommonDataSet.ProductDetailRow item in collection)
            {
                Label4.Text = item.KeyValue;
                CommonClassLibrary.CommonDataSet.TextContentDataTable collection111 = new CommonClassLibrary.CommonDataSetTableAdapters.TextContentTableAdapter().GetDataById(long.Parse(item.KeyValue));
                foreach (CommonClassLibrary.CommonDataSet.TextContentRow item111 in collection111)
                {
                    this.Name_TextBox.Text   = item111.Thai;
                    this.NameEN_TextBox.Text = item111.English;
                }
            }

            CommonClassLibrary.CommonDataSet.ProductDetailDataTable collection2 = new CommonClassLibrary.CommonDataSetTableAdapters.ProductDetailTableAdapter().GetDataByProductShowDetail(IDProduct);
            foreach (CommonClassLibrary.CommonDataSet.ProductDetailRow item2 in collection2)
            {
                Label5.Text = item2.KeyValue;

                CommonClassLibrary.CommonDataSet.TextContentDataTable collection222 = new CommonClassLibrary.CommonDataSetTableAdapters.TextContentTableAdapter().GetDataById(long.Parse(item2.KeyValue));

                foreach (CommonClassLibrary.CommonDataSet.TextContentRow item222 in collection222)
                {
                    this.Detail_TextBox.Text   = item222.Thai;
                    this.DetailEN_TextBox.Text = item222.English;
                }
            }

            CommonClassLibrary.CommonDataSet.ProductDetailDataTable collection3 = new CommonClassLibrary.CommonDataSetTableAdapters.ProductDetailTableAdapter().GetDataByProductShowPrice(IDProduct);
            foreach (CommonClassLibrary.CommonDataSet.ProductDetailRow item3 in collection3)
            {
                this.Price_TextBox.Text = item3.KeyValue;
            }

            CommonClassLibrary.CommonDataSet.ProductDetailDataTable collection4 = new CommonClassLibrary.CommonDataSetTableAdapters.ProductDetailTableAdapter().GetDataByProductShowPromotionPrice(IDProduct);
            foreach (CommonClassLibrary.CommonDataSet.ProductDetailRow item4 in collection4)
            {
                if (item4.KeyValue != "-")
                {
                    this.PromotionPrice_TextBox.Text = item4.KeyValue;
                }
            }



            CommonClassLibrary.CommonDataSet.ProductCateDataTable collection6 = new CommonClassLibrary.CommonDataSetTableAdapters.ProductCateTableAdapter().GetDataByProduct(IDProduct);
            foreach (CommonClassLibrary.CommonDataSet.ProductCateRow item6 in collection6)
            {
                radiobutton.SelectedValue = Request.QueryString["Category"]; //setselect
            }

            getImage();
            getMenu();
        }
    }