예제 #1
0
        protected void OnDataBindingImge(object sender, RepeaterItemEventArgs e)
        {
            ProductInfo         item             = (ProductInfo)e.Item.DataItem;
            ProductTokenReplace newsTokenReplace = new ProductTokenReplace(item);
            string  str = newsTokenReplace.ReplaceProductInfo(tempService.GetContentTempFromDB(TypeTemp.Image));
            Literal lt  = new Literal();

            lt.Text = str;
            e.Item.Controls.Add(lt);
        }
예제 #2
0
        protected void OnDataBinding(object sender, RepeaterItemEventArgs e)
        {
            count++;
            NewsInfo         item             = (NewsInfo)e.Item.DataItem;
            NewsTokenReplace newsTokenReplace = new NewsTokenReplace(item);
            string           str = newsTokenReplace.ReplaceNewsInfo(tempService.GetContentTempFromDB(TypeTemp.List));
            Literal          lt  = new Literal();

            lt.Text = str;
            e.Item.Controls.Add(lt);
            if (count % Column == 0)
            {
                HtmlGenericControl g = new HtmlGenericControl("div");
                g.Attributes.Add("class", "clear");
                e.Item.Controls.Add(g);
            }
        }
예제 #3
0
        public void DataBinding()
        {
            var product = (from p in V_Base.Data.CV_Products
                           where p.ProductID == ProductID
                           select new ProductInfo
            {
                Content = p.Content,
                CreateDate = p.CreatedDate.Value,
                Id = p.ProductID,
                ImageOrgUrl = GetWebImgOf(LocationImage.Product, p.ImageName),
                ImageThumUrl = GetWebImageOfThumb(LocationImage.Product, p.ImageName),
                Price = ConvertPrice(p.Price),
                ShortContent = p.ShortContent,
                Title = p.Title,
                Url = ListProduct.WriteUrl(ListProduct.TabId.ToString(), "detailproduct", p.ProductID.ToString(), p.Title)
            }

                           ).FirstOrDefault();

            if (product != null)
            {
                // hien thi chi tiet san pham
                ProductTokenReplace newsTokenReplace = new ProductTokenReplace(product);
                string  str = newsTokenReplace.ReplaceProductInfo(TempService.GetContentTempFromDB(TypeTemp.Detail));
                Literal lt  = new Literal();
                lt.Text = str;
                plhDetail.Controls.Add(lt);


                // hien thi cac anh gioi thieu san pham
                var imgs = from im in V_Base.Data.CV_ImageProducts
                           where im.ProductID == ProductID
                           select new ImageInfo
                {
                    ImageOrgUrl  = GetWebImgOf(LocationImage.Product, im.FileName),
                    ImageThumUrl = GetWebImageOfThumb(LocationImage.Product, im.FileName)
                };

                rptImgProduct.DataSource = imgs;
                rptImgProduct.DataBind();


                //lay cac san pham lien quan

                var pronewer = (from pr in V_Base.Data.CV_Products
                                join cat_ in V_Base.Data.CV_CatProducts on pr.CatID equals cat_.CatID
                                where pr.ProductID > ProductID && (cat_.PortalID == PortalId)
                                orderby pr.ProductID ascending
                                select new ProductInfo
                {
                    Content = pr.Content,
                    CreateDate = pr.CreatedDate.Value,
                    Id = pr.ProductID,
                    ImageOrgUrl = GetWebImgOf(LocationImage.Product, pr.ImageName),
                    ImageThumUrl = GetWebImageOfThumb(LocationImage.Product, pr.ImageName),
                    Price = ConvertPrice(pr.Price),
                    ShortContent = pr.ShortContent,
                    Title = pr.Title,
                    Url = ListProduct.WriteUrl(ListProduct.TabId.ToString(), "detailproduct", pr.ProductID.ToString(), pr.Title)
                }
                                ).Take(10);

                var proolder = (from pr in V_Base.Data.CV_Products
                                join cat_ in V_Base.Data.CV_CatProducts on pr.CatID equals cat_.CatID
                                where pr.ProductID < ProductID && (cat_.PortalID == PortalId)
                                orderby pr.ProductID descending
                                select new ProductInfo
                {
                    Content = pr.Content,
                    CreateDate = pr.CreatedDate.Value,
                    Id = pr.ProductID,
                    ImageOrgUrl = GetWebImgOf(LocationImage.Product, pr.ImageName),
                    ImageThumUrl = GetWebImageOfThumb(LocationImage.Product, pr.ImageName),
                    Price = ConvertPrice(pr.Price),
                    ShortContent = pr.ShortContent,
                    Title = pr.Title,
                    Url = ListProduct.WriteUrl(ListProduct.TabId.ToString(), "detailproduct", pr.ProductID.ToString(), pr.Title)
                }).Take(10);
                List <ProductInfo> p = pronewer.ToList();
                p.AddRange(proolder.ToList());
                rptRelative.DataSource = p;
                rptRelative.DataBind();
            }
        }
        public override void LoadSettings()
        {
            base.LoadSettings();

            int _tabfw = TabId;
            if (Settings["TabForward"] != null)
            {
                if (!int.TryParse(Settings["TabForward"].ToString(), out _tabfw))
                {
                    _tabfw = TabId;
                }
            }

            int _size = new V_Base().PageSize;
            if (Settings["PageSize"] != null)
            {
                if (!int.TryParse(Settings["PageSize"].ToString(), out _size) || _size < 1)
                {
                    _size = new V_Base().PageSize;
                }
            }

            int _cat = -1;
            if (Settings["CatProduct"] != null)
            {
                if (!int.TryParse(Settings["CatProduct"].ToString(), out _cat))
                {
                    _cat = -1;
                }
            }

            if (Settings["NoPrice"] != null)
            {
                txtNoPrice.Text = Settings["NoPrice"].ToString();
            }
            else
            {
                txtNoPrice.Text = "Call";
            }

            //string _listType = Settings["filenamelist"] == null ? "default" : Settings["filenamelist"].ToString();

            TempService tsService = new TempService(this);

            //List
            List<string> lt = tsService.GetFileLists(TypeTemp.List, "gif");
            List<ItemTemp> itemTemps = new List<ItemTemp>();
            for (int i = 0; i < lt.Count; i++)
            {
                itemTemps.Add(new ItemTemp { NameImage = lt[i], NameTemp = lt[i].Replace(".gif", ".htm") });
            }
            rptList.DataSource = itemTemps;
            rptList.DataBind();
            txtList.Text = tsService.GetContentTempFromDB(TypeTemp.List);

            //detail
            lt = tsService.GetFileLists(TypeTemp.Detail, "gif");
            itemTemps.Clear();
            for (int i = 0; i < lt.Count; i++)
            {
                itemTemps.Add(new ItemTemp { NameImage = lt[i], NameTemp = lt[i].Replace(".gif", ".htm") });
            }
            rptDetail.DataSource = itemTemps;
            rptDetail.DataBind();
            txtDetail.Text = tsService.GetContentTempFromDB(TypeTemp.Detail);

            //Relative
            lt = tsService.GetFileLists(TypeTemp.Relative, "gif");
            itemTemps.Clear();
            for (int i = 0; i < lt.Count; i++)
            {
                itemTemps.Add(new ItemTemp { NameImage = lt[i], NameTemp = lt[i].Replace(".gif", ".htm") });
            }
            rptRelative.DataSource = itemTemps;
            rptRelative.DataBind();
            txtRelative.Text = tsService.GetContentTempFromDB(TypeTemp.Relative);

            //tao cat
            LoadCat(_cat);
            this.txtSize.Text = _size.ToString();
            LoadTab(_tabfw);
        }
        public override void LoadSettings()
        {
            base.LoadSettings();

            int _tabfw = TabId;

            if (Settings["TabForward"] != null)
            {
                if (!int.TryParse(Settings["TabForward"].ToString(), out _tabfw))
                {
                    _tabfw = TabId;
                }
            }

            int _size = new V_Base().PageSize;

            if (Settings["PageSize"] != null)
            {
                if (!int.TryParse(Settings["PageSize"].ToString(), out _size) || _size < 1)
                {
                    _size = new V_Base().PageSize;
                }
            }

            int _cat = -1;

            if (Settings["CatProduct"] != null)
            {
                if (!int.TryParse(Settings["CatProduct"].ToString(), out _cat))
                {
                    _cat = -1;
                }
            }

            if (Settings["NoPrice"] != null)
            {
                txtNoPrice.Text = Settings["NoPrice"].ToString();
            }
            else
            {
                txtNoPrice.Text = "Call";
            }


            //string _listType = Settings["filenamelist"] == null ? "default" : Settings["filenamelist"].ToString();

            TempService tsService = new TempService(this);

            //List
            List <string>   lt        = tsService.GetFileLists(TypeTemp.List, "gif");
            List <ItemTemp> itemTemps = new List <ItemTemp>();

            for (int i = 0; i < lt.Count; i++)
            {
                itemTemps.Add(new ItemTemp {
                    NameImage = lt[i], NameTemp = lt[i].Replace(".gif", ".htm")
                });
            }
            rptList.DataSource = itemTemps;
            rptList.DataBind();
            txtList.Text = tsService.GetContentTempFromDB(TypeTemp.List);

            //detail
            lt = tsService.GetFileLists(TypeTemp.Detail, "gif");
            itemTemps.Clear();
            for (int i = 0; i < lt.Count; i++)
            {
                itemTemps.Add(new ItemTemp {
                    NameImage = lt[i], NameTemp = lt[i].Replace(".gif", ".htm")
                });
            }
            rptDetail.DataSource = itemTemps;
            rptDetail.DataBind();
            txtDetail.Text = tsService.GetContentTempFromDB(TypeTemp.Detail);

            //Relative
            lt = tsService.GetFileLists(TypeTemp.Relative, "gif");
            itemTemps.Clear();
            for (int i = 0; i < lt.Count; i++)
            {
                itemTemps.Add(new ItemTemp {
                    NameImage = lt[i], NameTemp = lt[i].Replace(".gif", ".htm")
                });
            }
            rptRelative.DataSource = itemTemps;
            rptRelative.DataBind();
            txtRelative.Text = tsService.GetContentTempFromDB(TypeTemp.Relative);

            //tao cat
            LoadCat(_cat);
            this.txtSize.Text = _size.ToString();
            LoadTab(_tabfw);
        }