Ejemplo n.º 1
0
        public void listrelatedproucts_databound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                asc.product myproduct = (asc.product)e.Item.DataItem;



                HtmlImage img = (HtmlImage)e.Item.FindControl("img");


                img.Alt = String.Format(
                    asc.language.getforfrontfromdictionaryincurrentlanguage("preview.products.tooltip.see.details"),
                    myproduct.Nameforfrontincurrentlanguage);

                img.Src = "~/image.aspx?type=0&id=" + myproduct.Id.ToString();
                ((HtmlAnchor)e.Item.FindControl("linkimg")).HRef = ResolveUrl(myproduct.Linkart);

                HyperLink linkartname = ((HyperLink)e.Item.FindControl("linkartname"));
                linkartname.Text        = myproduct.Nameforfrontincurrentlanguage;
                linkartname.NavigateUrl = ResolveUrl(myproduct.Linkart);
                linkartname.ToolTip     = String.Format(
                    asc.language.getforfrontfromdictionaryincurrentlanguage("preview.products.tooltip.see.details"),
                    myproduct.Nameforfrontincurrentlanguage);



                Label lblPrezzoArticolo = ((Label)e.Item.FindControl("lblPrezzoArticolo"));


                lblPrezzoArticolo.Text = myproduct.Finalpriceformatted;
            }
        }
Ejemplo n.º 2
0
        public static List <asc.product> get(string sql, params OleDbParameter[] list)
        {
            List <product> worklistproducts = new List <product>();
            DataTable      dt = new DataTable();

            using (OleDbConnection cnn = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["strcnn"].ConnectionString))
            {
                OleDbCommand cmd = new OleDbCommand(sql, cnn);
                for (int rip = 0; rip < list.Length; rip++)
                {
                    cmd.Parameters.Add(list[rip]);
                }
                OleDbDataAdapter da = new OleDbDataAdapter(cmd);
                da.Fill(dt);
            }

            foreach (DataRow dr in dt.Rows)
            {
                asc.product workprod = new asc.product
                                       (
                    (int)dr["art_id"],
                    (string)dr["art_cod"],
                    (string)dr["art_name"],
                    (double)dr["art_rawprice"],
                    (double)dr["art_discount"],
                    (int)dr["art_pricestartingfrom"],
                    (int)dr["art_idcat"],
                    (string)dr["art_brand"],
                    (string)dr["art_description"],
                    (string)dr["art_metadescription"],
                    (string)dr["art_metakeywords"],
                    (int)dr["art_taxnotappliable"]
                                       );

                worklistproducts.Add(workprod);
            }

            return(worklistproducts);
        }
Ejemplo n.º 3
0
        void Page_Load()
        {
            idart = Convert.ToInt32(Page.RouteData.Values["idart"]);
            string         sql0 = "select " + asc.products.commaseparatedfields + " from tproducts where art_id=@idart";
            List <product> l    = asc.products.get(sql0, new OleDbParameter("idart", idart));

            if (l.Count < 1)
            {
                HttpContext.Current.Response.Status     = "404 Not Found";
                HttpContext.Current.Response.StatusCode = 404;
                HttpContext.Current.Response.End();
            }
            else
            {
                product = l[0];

                lblprodname.Text = product.Nameforfrontincurrentlanguage;

                lblCodArticolo.Text = product.Code;

                string artdescription = asc.language.getforfrontfromstringincurrentlanguage(product.Description);

                if (artdescription != "")
                {
                    lblDescrizioneArticolo.Text = artdescription;
                    tabpaneldescrizione.Visible = true;
                }



                string brand = product.Brand;
                if (brand != "")
                {
                    lblbrand.Text        = brand;
                    pholderbrand.Visible = true;
                }

                mainimg.Src = ResolveUrl("~/image.aspx?type=0&id=" + idart.ToString());

                // show.product.price



                if (product.Finalpriceformatted == "")
                {
                    pholderprice.Visible = false;
                }
                lblPrezzoArticolo.Text = product.Finalpriceformatted;



                using (OleDbConnection cnn = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["strcnn"].ConnectionString))
                {
                    OleDbCommand    cmd;
                    OleDbDataReader dr;
                    cnn.Open();



                    // additional fields
                    string sql1 = "select b.value as b_value, a.name as a_name from tadditionalfields a inner join tadditionalfields_tarticoli b on a.id = b.idfield where b.idart = @idart order by a.id";
                    cmd = new OleDbCommand(sql1, cnn);
                    cmd.Parameters.AddWithValue("idart", idart);
                    dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        string addfieldvalue = asc.language.getforfrontfromstringincurrentlanguage(dr["b_value"].ToString());
                        if (addfieldvalue != "")
                        {
                            lbladdfields.Text += "<div class='feature'><b>" + asc.language.getforfrontfromstringincurrentlanguage(dr["a_name"].ToString()) + "</b>: " + addfieldvalue + "</div>";
                        }
                    }


                    // other images
                    string sql2 = "SELECT z_id, z_text, z_w, z_h FROM tzoom WHERE z_idart=@idart ORDER BY z_id";
                    cmd = new OleDbCommand(sql2, cnn);
                    cmd.Parameters.AddWithValue("idart", idart);
                    dr = cmd.ExecuteReader();
                    DataTable workdt = new DataTable();
                    workdt.Load(dr);
                    dr.Close();
                    if (workdt.Rows.Count > 0)
                    {
                        listsecondaryimages.DataSource = workdt;
                        listsecondaryimages.DataBind();
                    }
                }

                // related products
                string         sql3      = "SELECT " + asc.products.commaseparatedfields + " from tcorrelati c inner join tproducts a on a.art_id=c.idartcorr where idart=@idart and art_visibile=1";
                List <product> lrelprods = asc.products.get(sql3, new OleDbParameter("idart", idart));
                if (lrelprods.Count > 0)
                {
                    tabpanelrelatedproducts.Visible = true;
                    listrelatedproucts.DataSource   = lrelprods;
                    listrelatedproucts.DataBind();
                }



                buttinfo.DataBind();

                if (!Page.IsPostBack)
                {
                    // request info module
                    tboxinfosubject.Text = asc.language.getforfrontfromdictionaryincurrentlanguage("product.request.info.subject.predefined") + " " + product.Code;


                    // aggiunge product alla coda articoli gia visti
                    List <product> coda = (List <product>)Session["coda"];
                    foreach (product a in coda)
                    {
                        if (a.Id == idart)
                        {
                            coda.Remove(a);
                            break;
                        }
                    }
                    coda.Add(product);
                    if (coda.Count >= 4)
                    {
                        coda.RemoveAt(0);
                    }
                    Session["coda"]      = coda;
                    Session["lastVisit"] = HttpContext.Current.Request.RawUrl;
                }



                //}
                // end product details ****************************************************************************************************



                Page.Header.DataBind();
                Label lblbreadcrumbsMaster = (Label)(Master.FindControl("lblbreadcrumbs"));

                int idcat = product.Idcat;

                DataTable      dtcat = (DataTable)Application["dtcat"];
                List <DataRow> ParentCatsIncludingCurrent = new List <DataRow>();
                int            loopidcat = idcat;
                while (true)
                {
                    DataRow foundrow = dtcat.Rows.Find(loopidcat);
                    ParentCatsIncludingCurrent.Add(foundrow);

                    if ((int)foundrow["cat_idpadre"] == 0)
                    {
                        break;
                    }
                    loopidcat = (int)foundrow["cat_idpadre"];
                }

                // output where are you **************************************************************************************************************
                lblbreadcrumbsMaster.Text = common.linkescaped(asc.language.getforfrontfromdictionaryincurrentlanguage("inallthepages.you.are.here.home"), ResolveUrl("~/shop/main.aspx"), "breadcrumbs");
                for (int rip = ParentCatsIncludingCurrent.Count - 1; rip >= 0; rip--)
                {
                    lblbreadcrumbsMaster.Text +=
                        "&nbsp;&raquo;&nbsp;" +
                        "<a class=breadcrumbs" +
                        " href='" + asc.Category.Linkforrouting((int)ParentCatsIncludingCurrent[rip]["cat_id"], (string)ParentCatsIncludingCurrent[rip]["cat_nome"]) + "'>" +
                        asc.language.getforfrontfromstringincurrentlanguage(ParentCatsIncludingCurrent[rip]["cat_nome"].ToString()) +
                        "</a>";
                }
                lblbreadcrumbsMaster.Text += "&nbsp;&raquo;&nbsp;<span class='breadcrumbs'>" + product.Nameforfrontincurrentlanguage + "</span>";
                // *************************************************************************************************************************************


                // page title
                string worktitle = "";
                worktitle  = asc.language.getforfrontfromstringindefaultlanguage(product.Namealllang) + " | " + Application["config_nomesito"].ToString();
                Page.Title = filtertext.getonlyallowedcharsfortitleandmetatag(worktitle);


                Page.MetaDescription =
                    filtertext.getonlyallowedcharsfortitleandmetatag(
                        product.Metadescription
                        .Replace("{site_name}", Application["config_nomesito"].ToString())
                        .Replace("{product_name}", asc.language.getfromstringandlanguagename(product.Namealllang, System.Configuration.ConfigurationManager.AppSettings["defaultfrontlanguage"]))
                        .Replace(
                            "{product_category}",
                            asc.language.getfromstringandlanguagename(ParentCatsIncludingCurrent[ParentCatsIncludingCurrent.Count - 1]["cat_nome"].ToString(), System.Configuration.ConfigurationManager.AppSettings["defaultfrontlanguage"]))
                        .Replace("{product_brand}", product.Brand
                                 )
                        );


                // meta keywords
                Page.MetaKeywords =
                    filtertext.getonlyallowedcharsfortitleandmetatag(
                        product.Metakeywords
                        .Replace("{site_name}", Application["config_nomesito"].ToString())
                        .Replace("{product_name}", asc.language.getfromstringandlanguagename(product.Namealllang, System.Configuration.ConfigurationManager.AppSettings["defaultfrontlanguage"]))
                        .Replace("{product_category}", asc.language.getfromstringandlanguagename(ParentCatsIncludingCurrent[ParentCatsIncludingCurrent.Count - 1]["cat_nome"].ToString(), System.Configuration.ConfigurationManager.AppSettings["defaultfrontlanguage"]))
                        .Replace("{product_brand}", product.Brand
                                 )
                        );
            }
        } // page load