Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt;

        if (Session["GioHang"] == null)
        {
            dt = cls.GetDataTable();
        }
        else
        {
            dt = (DataTable)Session["GioHang"];
        }
        int dem = 0;

        dem            = dt.Rows.Count;
        lbGioHang.Text = dem.ToString();
        //lbMax.Text = SPmax();
        DataTable tb    = cls.LoadDuLieuPKN("SELECT top(3)ProductID, ImageURL, ProductName, Manufacturer, SoLuong FROM SPbanchay WHERE (SoLuong >= ANY(SELECT SoLuong AS Expr1 FROM SPbanchay AS SPbanchay_1 GROUP BY SoLuong))");
        string    chuoi = "";
        string    img   = "";

        foreach (DataRow dr in tb.Rows)
        {
            chuoi  = "<div class='panelTable'>";
            chuoi += "<div style='text-align:center;height:110px'>";
            chuoi += "<img src='" + dr[1].ToString() + "' Height='120px' Width='140px' />";
            chuoi += "</div>";
            chuoi += "<div class='menu' style='width:auto;text-align:center;background-color:white;height:60px;'>";
            chuoi += "<a href='ProductDetails.aspx?ProductID=" + dr[0].ToString() + "' style='color:#0066FF;font-weight:bold; width:190px'>";
            chuoi += dr[2].ToString();
            chuoi += "</a>";
            chuoi += "</div>";
            chuoi += "</div>";
            Show1.AddHtmlPanel(chuoi);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["ProductId"] != null)
            {
                //   ViewState["Productid"] = Request.QueryString["ProductId"].ToString();
                ViewState["Productid"] = 41;

                string         strcln = " SELECT * from  ProductMaster where ProductId= '" + ViewState["Productid"] + "' ";
                SqlCommand     cmdcln = new SqlCommand(strcln, con);
                DataTable      dtcln  = new DataTable();
                SqlDataAdapter adpcln = new SqlDataAdapter(cmdcln);
                adpcln.Fill(dtcln);

                if (dtcln.Rows.Count > 0)
                {
                    ImageButton1.ImageUrl = "~/Productimage/" + dtcln.Rows[0]["Pimage"].ToString() + " ";

                    //ImageButton1.ImageUrl="~/images/" + dt.Rows[0]["CompanyLogo"].ToString()+" ";
                    lblproduct.Text = dtcln.Rows[0]["ProductName"].ToString();
                    lblproductdescription123.Text = dtcln.Rows[0]["Description"].ToString();

                    string         strcln123 = " select Productfeaturetbl.* from Productfeaturetbl inner join VersionInfoMaster on VersionInfoMaster.VersionInfoId=Productfeaturetbl.productversionid inner join  ProductMaster on ProductMaster.ProductId=VersionInfoMaster.ProductId where ProductMaster.ProductId= '" + ViewState["Productid"] + "' ";
                    SqlCommand     cmdcln123 = new SqlCommand(strcln123, con);
                    DataTable      dtcln123  = new DataTable();
                    SqlDataAdapter adpcln123 = new SqlDataAdapter(cmdcln123);
                    adpcln123.Fill(dtcln123);

                    GridView1.DataSource = dtcln123;
                    GridView1.DataBind();

                    Image1.ImageUrl = "~/Productimage/" + dtcln.Rows[0]["Topimg"].ToString();
                    Image2.ImageUrl = "~/Productimage/" + dtcln.Rows[0]["Bottomimage"].ToString();
                    Image3.ImageUrl = "~/Productimage/" + dtcln.Rows[0]["Rightimage"].ToString();
                    Image4.ImageUrl = "~/Productimage/" + dtcln.Rows[0]["Leftimage"].ToString();
                    Image5.ImageUrl = "~/Productimage/" + dtcln.Rows[0]["Frontimage"].ToString();
                    Image6.ImageUrl = "~/Productimage/" + dtcln.Rows[0]["Backimage"].ToString();



                    string     str = "SELECT Topimg,Bottomimage,Rightimage,Leftimage,Frontimage,Backimage,Description from  ProductMaster where ProductId= '" + ViewState["Productid"] + "' ";
                    SqlCommand cmd = new SqlCommand(str, con);
                    con.Open();
                    SqlDataReader dr = cmd.ExecuteReader();
                    //768*576
                    //string sTemplate = "<table><tr><td><img src='{pImage}' width='912' height='684'  /></td></tr><tr><td><div>{pView}</div></td></tr></table>";
                    string sTemplate  = "<table><tr><td><img src='{pImage}'  width='200' height='100'  /></td></tr><tr><td><div>{pView}</div></td></tr></table>";
                    string sTemplate2 = "<table><tr><td><img src= '{pImage1}' width='200' height='100'  /></td></tr><tr><td><div>{pView1}</div></td></tr></table>";
                    string sTemplate3 = "<table><tr><td><img src= '{pImage2}' width='200' height='100'  /></td></tr><tr><td><div>{pView2}</div></td></tr></table>";
                    string sTemplate4 = "<table><tr><td><img src= '{pImage3}' width='200' height='100'  /></td></tr><tr><td><div>{pView3}</div></td></tr></table>";
                    string sTemplate5 = "<table><tr><td><img src= '{pImage4}' width='200' height='100'  /></td></tr><tr><td><div>{pView4}</div></td></tr></table>";
                    string sTemplate6 = "<table><tr><td><img src= '{pImage5}' width='200' height='100'  /></td></tr><tr><td><div>{pView5}</div></td></tr></table>";

                    if (dr.HasRows == true)
                    {
                        while (dr.Read())
                        {
                            string pImage = dr.GetString(0);
                            string pView  = dr.GetString(0);

                            string pImage1 = dr.GetString(1);
                            string pView1  = dr.GetString(1);

                            string pImage2 = dr.GetString(2);
                            string pView2  = dr.GetString(2);

                            string pImage3 = dr.GetString(3);
                            string pView3  = dr.GetString(3);

                            string pImage4 = dr.GetString(4);
                            string pView4  = dr.GetString(4);

                            string pImage5 = dr.GetString(5);
                            string pView5  = dr.GetString(5);


                            StringBuilder tpl = new StringBuilder();
                            tpl.Append(sTemplate);
                            tpl.Replace("{pImage}", pImage);
                            tpl.Replace("{pView}", pView);



                            StringBuilder tp2 = new StringBuilder();
                            tp2.Append(sTemplate2);
                            tp2.Replace("{pImage1}", pImage1);
                            tp2.Replace("{pView1}", pView1);

                            StringBuilder tp3 = new StringBuilder();
                            tp3.Append(sTemplate3);
                            tp3.Replace("{pImage2}", pImage2);
                            tp3.Replace("{pView2}", pView2);

                            StringBuilder tp4 = new StringBuilder();
                            tp4.Append(sTemplate4);
                            tp4.Replace("{pImage3}", pImage3);
                            tp4.Replace("{pView3}", pView3);

                            StringBuilder tp5 = new StringBuilder();
                            tp5.Append(sTemplate5);
                            tp5.Replace("{pImage4}", pImage4);
                            tp5.Replace("{pView4}", pView4);

                            StringBuilder tp6 = new StringBuilder();
                            tp6.Append(sTemplate6);
                            tp6.Replace("{pImage5}", pImage5);
                            tp6.Replace("{pView5}", pView5);


                            Show1.AddHtmlPanel(tpl.ToString());
                            Show1.AddHtmlPanel(tp2.ToString());
                            Show1.AddHtmlPanel(tp3.ToString());

                            Show1.AddHtmlPanel(tp4.ToString());

                            Show1.AddHtmlPanel(tp5.ToString());

                            Show1.AddHtmlPanel(tp6.ToString());


                            //lblMsg.Visible = false;
                        }
                    }
                    else
                    {
                        //lblMsg.Visible = true;
                        //lblMsg.Text = "No Images to Display";
                        return;
                    }
                    Show1.StyleFolder = "style5";
                    //Show1.Width = "450px";
                    //Show1.Height = "450px";
                    Show1.ShowType      = ShowType.Show;
                    Show1.ManualChanger = false;
                    //Show1.Changer.Width = 625;
                    //Show1.Changer.Height = 40;
                    Show1.Changer.Type            = ChangerType.Both;
                    Show1.Changer.HorizontalAlign = ChangerHorizontalAlign.Center;
                    //Show1.Changer.Height = 40;
                    //Show1.Changer.Width = 625;
                    dr.Close();
                    con.Close();
                }
            }
        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageConn pgcon = new PageConn();

        con = pgcon.dynconn;

        if (Request.QueryString["Id"] != null)
        {
            string str = "select image,image as ID from BusinessDetails2 where detailid='" + Request.QueryString["Id"].ToString() + "'";

            SqlCommand cmd = new SqlCommand(str, con);
            con.Open();
            SqlDataReader dr = cmd.ExecuteReader();

            //string sTemplate = "<table><tr><td><img src=\"{pImage}\" border=\"0\" Width=\"300px\" Height=\"500px\" / ></td></tr><tr><td><div>{pView}</div></td></tr></table>";

            string sTemplate = "<table width=\"100%\"><tr><td align=\"center\"><div>Slideshow</div></td></tr><tr><td align=\"center\"><img src='{pImage}' /></td></tr></table>";



            if (dr != null)
            {
                while (dr.Read())
                {
                    //string me = dr.GetString(0);

                    string pImage = "http://" + Request.Url.Host.ToString() + dr.GetString(0).Replace('~', ' ').Trim();

                    //me = me.Replace('~', ' ');

                    //string pImage = "http://" + Request.Url.Host.ToString() + me.TrimStart();

                    //string pView = dr.GetString(1).Replace("~/ShoppingCart/images/", "");

                    StringBuilder tpl = new StringBuilder();
                    tpl.Append(sTemplate);
                    tpl.Replace("{pImage}", pImage);
                    //tpl.Replace("{pView}", "Slideshow");

                    Show1.AddHtmlPanel(tpl.ToString());
                }
            }
            else
            {
                return;
            }

            Show1.StyleFolder = "style51";
            //Show1.Width = "450px";
            //Show1.Height = "450px";
            Show1.ShowType      = ShowType.Show;
            Show1.ManualChanger = true;
            //Show1.Changer.Width = 625;
            //Show1.Changer.Height = 40;
            Show1.Changer.Type            = ChangerType.Both;
            Show1.Changer.HorizontalAlign = ChangerHorizontalAlign.Center;
            //Show1.Changer.Height = 40;
            //Show1.Changer.Width = 625;
            dr.Close();
            con.Close();
        }
    }
Exemplo n.º 4
0
        private void LoadSlideShow()
        {
            XmlDocument xmlSlConfig = new XmlDocument();

            xmlSlConfig.Load(Server.MapPath("/configurations/SlideShow.config"));
            string CtyId = objSlideShow.CommunityID.Value.ToString();

            switch (objSlideShow.Effect)
            {
            case "None":
                Show1.TransitionType = OboutInc.Show.TransitionType.None;
                break;

            case "FadeFast":
                Show1.TransitionType = OboutInc.Show.TransitionType.Fading;
                try
                {
                    XmlElement xmlEffect = (XmlElement)xmlSlConfig.SelectSingleNode("configuration/Effects/FadeFast");
                    Show1.FadingSpeed = Convert.ToInt32(xmlEffect.GetAttribute("FadingSpeed"));
                    Show1.FadingStep  = Convert.ToInt32(xmlEffect.GetAttribute("FadingStep"));
                }
                catch
                {
                    Show1.FadingSpeed = 5000;
                    Show1.FadingStep  = 5;
                }
                break;

            case "FadeMedium":
                Show1.TransitionType = OboutInc.Show.TransitionType.Fading;
                try
                {
                    XmlElement xmlEffect = (XmlElement)xmlSlConfig.SelectSingleNode("configuration/Effects/FadeMedium");
                    Show1.FadingSpeed = Convert.ToInt32(xmlEffect.GetAttribute("FadingSpeed"));
                    Show1.FadingStep  = Convert.ToInt32(xmlEffect.GetAttribute("FadingStep"));
                }
                catch
                {
                    Show1.FadingSpeed = 1000;
                    Show1.FadingStep  = 3;
                }
                break;

            case "FadeSlow":
                Show1.TransitionType = OboutInc.Show.TransitionType.Fading;
                try
                {
                    XmlElement xmlEffect = (XmlElement)xmlSlConfig.SelectSingleNode("configuration/Effects/FadeSlow");
                    Show1.FadingSpeed = Convert.ToInt32(xmlEffect.GetAttribute("FadingSpeed"));
                    Show1.FadingStep  = Convert.ToInt32(xmlEffect.GetAttribute("FadingStep"));
                }
                catch
                {
                    Show1.FadingSpeed = 100;
                    Show1.FadingStep  = 1;
                }
                break;

            case "ScrollRight":
                Show1.TransitionType  = OboutInc.Show.TransitionType.Scrolling;
                Show1.ScrollDirection = OboutInc.Show.ScrollDirection.Right;
                try
                {
                    XmlElement xmlEffect = (XmlElement)xmlSlConfig.SelectSingleNode("configuration/Effects/ScrollRight");
                    Show1.ScrollingSpeed = Convert.ToInt32(xmlEffect.GetAttribute("ScrollingSpeed"));
                    Show1.ScrollingStep  = Convert.ToInt32(xmlEffect.GetAttribute("ScrollingStep"));
                }
                catch
                {
                    Show1.ScrollingSpeed = 1000;
                    Show1.ScrollingStep  = 3;
                }
                break;

            case "ScrollLeft":
                Show1.TransitionType  = OboutInc.Show.TransitionType.Scrolling;
                Show1.ScrollDirection = OboutInc.Show.ScrollDirection.Left;
                try
                {
                    XmlElement xmlEffect = (XmlElement)xmlSlConfig.SelectSingleNode("configuration/Effects/ScrollLeft");
                    Show1.ScrollingSpeed = Convert.ToInt32(xmlEffect.GetAttribute("ScrollingSpeed"));
                    Show1.ScrollingStep  = Convert.ToInt32(xmlEffect.GetAttribute("ScrollingStep"));
                }
                catch
                {
                    Show1.ScrollingSpeed = 1000;
                    Show1.ScrollingStep  = 3;
                }
                break;

            case "ScrollTop":
                Show1.TransitionType  = OboutInc.Show.TransitionType.Scrolling;
                Show1.ScrollDirection = OboutInc.Show.ScrollDirection.Top;
                try
                {
                    XmlElement xmlEffect = (XmlElement)xmlSlConfig.SelectSingleNode("configuration/Effects/ScrollTop");
                    Show1.ScrollingSpeed = Convert.ToInt32(xmlEffect.GetAttribute("ScrollingSpeed"));
                    Show1.ScrollingStep  = Convert.ToInt32(xmlEffect.GetAttribute("ScrollingStep"));
                }
                catch
                {
                    Show1.ScrollingSpeed = 1000;
                    Show1.ScrollingStep  = 3;
                }
                break;

            case "ScrollDown":
                Show1.TransitionType  = OboutInc.Show.TransitionType.Scrolling;
                Show1.ScrollDirection = OboutInc.Show.ScrollDirection.Bottom;
                try
                {
                    XmlElement xmlEffect = (XmlElement)xmlSlConfig.SelectSingleNode("configuration/Effects/ScrollDown");
                    Show1.ScrollingSpeed = Convert.ToInt32(xmlEffect.GetAttribute("ScrollingSpeed"));
                    Show1.ScrollingStep  = Convert.ToInt32(xmlEffect.GetAttribute("ScrollingStep"));
                }
                catch
                {
                    Show1.ScrollingSpeed = 1000;
                    Show1.ScrollingStep  = 3;
                }
                break;
            }
            DataObjectList <DataObjectPicture> slides = DataObjects.Load <DataObjectPicture>(new QuickParameters {
                RelationParams = new RelationParams {
                    ParentObjectID = objSlideShow.ObjectID
                }, ObjectType = Helper.GetObjectTypeNumericID("Picture"), ShowState = ObjectShowState.Published, Amount = 0, Direction = QuickSortDirection.Asc, PageNumber = 0, PageSize = 999999, SortBy = QuickSort.RelationSortNumber, Udc = udc
            });

            if (slides.Count > 0)
            {
                string sTemplate = string.Empty;
                try
                {
                    XmlElement xmlSlideShowTemplate = ((XmlElement)xmlSlConfig.SelectSingleNode(string.Format("configuration/SlideShowTemplate/Community[@ID='{0}']", objSlideShow.CommunityID.Value)));
                    if (xmlSlideShowTemplate != null)
                    {
                        sTemplate = xmlSlideShowTemplate.InnerText;
                    }
                    else
                    {
                        xmlSlideShowTemplate = ((XmlElement)xmlSlConfig.SelectSingleNode("configuration/SlideShowTemplate/Community[@ID='*']"));
                        sTemplate            = xmlSlideShowTemplate.InnerText;
                    }
                }
                catch
                {
                    sTemplate = "<table><tr><td><img src='##SLImage##' alt='##SLTitle##' /></td></tr><tr><td><div class='SLDescription'>##SLDesc##</div></td></tr></table>";
                }
                foreach (DataObjectPicture slide in slides)
                {
                    string        strImgTitle = slide.Title;
                    string        strImgLg    = slide.GetImage(PictureVersion.L);
                    string        strImgSm    = slide.GetImage(PictureVersion.S);
                    StringBuilder tpl         = new StringBuilder();
                    tpl.Append(sTemplate);
                    tpl.Replace("##SLImage##", string.Format("{0}{1}", SiteConfig.MediaDomainName, strImgLg));
                    tpl.Replace("##SLTitle##", strImgTitle);
                    tpl.Replace("##SLDesc##", strImgTitle);
                    Show1.AddHtmlPanel(tpl.ToString());
                }
                try
                {
                    XmlElement xmlShow = (XmlElement)xmlSlConfig.SelectSingleNode("configuration/Show");
                    Show1.Width  = xmlShow.GetAttribute("Width") + "px";
                    Show1.Height = xmlShow.GetAttribute("Height") + "px";
                }
                catch
                {
                    Show1.Width  = "450px";
                    Show1.Height = "500px";
                }
                try
                {
                    XmlElement xmlStyleFolder = (XmlElement)xmlSlConfig.SelectSingleNode(string.Format("configuration/StyleFolder/Community[@ID='{0}']", CtyId));
                    if (xmlStyleFolder != null)
                    {
                        Show1.StyleFolder = string.Format("{0}", xmlStyleFolder.InnerText);
                    }
                    else
                    {
                        xmlStyleFolder    = ((XmlElement)xmlSlConfig.SelectSingleNode("configuration/StyleFolder/Community[@ID='*']"));
                        Show1.StyleFolder = string.Format("{0}", xmlStyleFolder.InnerText);
                    }
                }
                catch
                {
                    Show1.StyleFolder = string.Format("/Library/OboutControls/show/styles/style1");
                }

                Show1.Changer.Type      = OboutInc.Show.ChangerType.Both;
                Show1.Changer.ArrowType = OboutInc.Show.ArrowType.Side1;
                try
                {
                    XmlElement xmlChanger = (XmlElement)xmlSlConfig.SelectSingleNode("configuration/Changer");
                    Show1.Changer.Height = Convert.ToInt32(xmlChanger.GetAttribute("Height"));
                    Show1.Changer.Width  = Convert.ToInt32(xmlChanger.GetAttribute("Width"));
                    if (xmlChanger.GetAttribute("Status").ToLower() == "on")
                    {
                        Show1.ManualChanger = true;
                    }
                    else
                    {
                        Show1.ManualChanger = false;
                    }
                }
                catch
                {
                    Show1.Changer.Height = 40;
                    Show1.Changer.Width  = 200;
                    Show1.ManualChanger  = true;
                }
                litCtrl.Text    = string.Empty;
                litCtrl.Visible = false;
            }
            else
            {
                Show1.Visible   = false;
                litCtrl.Text    = GuiLanguage.GetGuiLanguage("UserControls.Templates.WebUI.Base").GetString("MessageSlideShowNoPicture");
                litCtrl.Visible = true;
            }
        }