Esempio n. 1
0
        /// <summary>
        /// Get HReft theo từng level của Product
        /// </summary>
        /// <param name="data"></param>
        /// <param name="LangInt"></param>
        /// <param name="LangId"></param>
        /// <returns>ArrayList</returns>
        ///  item 0: HRef
        public static Dictionary <string, object> GetHRefByLevel(PNK_Product data, int LangInt, string LangId, CultureInfo Ci)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            try
            {
                //string link = UtilityLocal.GetPathTreeNameUrl(data.CategoryId, LangInt, LangId);
                string                      link  = string.Empty;
                ProductCategoryBLL          pcBll = new ProductCategoryBLL();
                IList <PNK_ProductCategory> lst   = pcBll.GetListTree(LangInt, string.Empty, string.Empty, int.MinValue, data.CategoryId.ToString(), string.Empty, 1, true, string.Empty, 1, 9999, out total);
                if (lst.Count > 0)
                {
                    link = AppendLanguage(lst[0].ProductCategoryDesc.TreeNameUrlDesc, LangId);
                    dic.Add("HRef", LinkHelper.GetLink(link, data.ProductDesc.TitleUrl));
                }
            }
            catch (Exception ex)
            {
            }

            return(dic);
        }
Esempio n. 2
0
        protected void rptCommentCustomer_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                PNK_Product data = e.Item.DataItem as PNK_Product;

                HtmlImage img = e.Item.FindControl("img") as HtmlImage;
                img.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Image);

                Literal ltrTitle = e.Item.FindControl("ltrTitle") as Literal;
                ltrTitle.Text = img.Alt = img.Attributes["title"] = data.ProductDesc.Title;

                Literal ltrBrief = e.Item.FindControl("ltrBrief") as Literal;
                ltrBrief.Text = data.ProductDesc.Brief;

                Literal ltrDetail = e.Item.FindControl("ltrDetail") as Literal;
                ltrDetail.Text = DBHelper.getTruncate(data.ProductDesc.Detail, 20);// SanitizeHtml.Sanitize(data.ProductDesc.Detail);

                HtmlAnchor hypImg = e.Item.FindControl("hypImg") as HtmlAnchor;
                hypImg.HRef = data.ProductDesc.Position;
            }
        }
Esempio n. 3
0
        protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                PNK_Product data     = e.Item.DataItem as PNK_Product;
                HtmlAnchor  hypImg   = e.Item.FindControl("hypImg") as HtmlAnchor;
                HtmlAnchor  hypTitle = e.Item.FindControl("hypTitle") as HtmlAnchor;
                HtmlAnchor  hypDate  = e.Item.FindControl("hypDate") as HtmlAnchor;

                cid = Utils.GetParameter("cid", string.Empty);
                string link  = UtilityLocal.GetPathTreeNameUrl(data.CategoryId, LangInt, LangId);
                int    level = link.Count(i => i.Equals('/'));

                if (level == 3)
                {
                    hypDate.HRef = hypTitle.HRef = hypImg.HRef = LinkHelper.GetLink(pageName, LangId, cid, data.CategoryUrlDesc, data.ProductDesc.TitleUrl);
                }
                else if (level == 2)
                {
                    hypDate.HRef = hypTitle.HRef = hypImg.HRef = LinkHelper.GetLink(link, LocalizationUtility.GetText("linktmp", Ci), data.ProductDesc.TitleUrl);
                }
                else if (level == 1)
                {
                    hypDate.HRef = hypTitle.HRef = hypImg.HRef = LinkHelper.GetLink(UtilityLocal.GetPathTreeNameUrl(data.CategoryId, LangInt, LangId), LocalizationUtility.GetText("linkCate", Ci), LocalizationUtility.GetText("linktmp", Ci), data.ProductDesc.TitleUrl);
                }

                HtmlImage img = e.Item.FindControl("img") as HtmlImage;
                img.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Image);

                Literal ltrTitle = e.Item.FindControl("ltrTitle") as Literal;
                hypImg.Title = ltrTitle.Text = img.Alt = img.Attributes["title"] = data.ProductDesc.Title;

                Literal ltrBrief = e.Item.FindControl("ltrBrief") as Literal;
                ltrBrief.Text = data.ProductDesc.Brief;

                Literal ltrDate = e.Item.FindControl("ltrDate") as Literal;
                ltrDate.Text = data.PostDate.ToString("dd/MM/yyyy");
            }
        }
Esempio n. 4
0
        protected void rptProject_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                PNK_Product data = e.Item.DataItem as PNK_Product;

                HtmlAnchor hypImg   = e.Item.FindControl("hypImg") as HtmlAnchor;
                HtmlAnchor hypTitle = e.Item.FindControl("hypTitle") as HtmlAnchor;

                Dictionary <string, object> dic = UtilityLocal.GetHRefByLevel(data, LangInt, LangId, Ci);
                hypImg.HRef = hypTitle.HRef = dic["HRef"].ToString();

                HtmlImage img = e.Item.FindControl("img") as HtmlImage;
                img.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Image);

                Literal ltrTitle = e.Item.FindControl("ltrTitle") as Literal;
                hypImg.Title = ltrTitle.Text = img.Alt = img.Attributes["title"] = data.ProductDesc.Title;

                Literal ltrBrief = e.Item.FindControl("ltrBrief") as Literal;
                ltrBrief.Text = data.ProductDesc.Brief;
            }
        }
Esempio n. 5
0
        protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                PNK_Product data   = e.Item.DataItem as PNK_Product;
                HtmlAnchor  hypImg = e.Item.FindControl("hypImg") as HtmlAnchor;
                //HtmlAnchor hypTitle = e.Item.FindControl("hypTitle") as HtmlAnchor;
                //HtmlAnchor hypBrief = e.Item.FindControl("hypBrief") as HtmlAnchor;
                cid = Utils.GetParameter("cid", string.Empty);
                string link  = UtilityLocal.GetPathTreeNameUrl(data.CategoryId, LangInt, LangId);
                int    level = link.Count(i => i.Equals('/'));

                if (level == 3)
                {
                    hypImg.HRef = LinkHelper.GetLink(pageName, LangId, cid, data.CategoryUrlDesc, data.ProductDesc.TitleUrl);
                }
                else if (level == 2)
                {
                    //link = link + "/" + LocalizationUtility.GetText("linktmp", Ci);
                    hypImg.HRef = LinkHelper.GetLink(link, LocalizationUtility.GetText("linktmp", Ci), data.ProductDesc.TitleUrl);
                }
                else if (level == 1)
                {
                    hypImg.HRef = LinkHelper.GetLink(UtilityLocal.GetPathTreeNameUrl(data.CategoryId, LangInt, LangId), LocalizationUtility.GetText("linkCate", Ci), LocalizationUtility.GetText("linktmp", Ci), data.ProductDesc.TitleUrl);
                }

                HtmlImage img = e.Item.FindControl("img") as HtmlImage;
                img.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Image);
                img.Attributes.Add("data-lazysrc", WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Image));

                Literal ltrTitle = e.Item.FindControl("ltrTitle") as Literal;
                hypImg.Title = ltrTitle.Text = img.Alt = img.Attributes["title"] = data.ProductDesc.Title;

                HtmlControl liTilte = e.Item.FindControl("liTilte") as HtmlControl;
                liTilte.Attributes.Add("data-title", "data.ProductDesc.Title");
                liTilte.Attributes.Add("class", string.Format("filterall filter-{0} eg-w_jason-wrapper eg-post-id-5874", data.CategoryUrlDesc));
            }
        }
Esempio n. 6
0
        protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                PNK_Product data = e.Item.DataItem as PNK_Product;

                HtmlAnchor hypImg   = e.Item.FindControl("hypImg") as HtmlAnchor;
                HtmlAnchor hypTitle = e.Item.FindControl("hypTitle") as HtmlAnchor;

                Dictionary <string, object> dic = UtilityLocal.GetHRefByLevel(data, LangInt, LangId, Ci);
                hypImg.HRef = string.Format("https://www.youtube.com/watch?v={0}", UtilityLocal.GetVideoList(data.Id));
                //  hypImg.HRef = dic["HRef"].ToString();

                HtmlImage img = e.Item.FindControl("img") as HtmlImage;
                img.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Image);
                img.Attributes.Add("data-lazysrc", WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Image));

                Literal ltrTitle = e.Item.FindControl("ltrTitle") as Literal;
                ltrTitle.Text = data.ProductDesc.Title;

                //GetVideoList(data.Id);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Get HReft theo từng level của Product
        /// </summary>
        /// <param name="data"></param>
        /// <param name="LangInt"></param>
        /// <param name="LangId"></param>
        /// <returns>ArrayList</returns>
        ///  item 0: HRef
        public static Dictionary <string, object> GetHRefByLevel(PNK_Product data, int LangInt, string LangId, CultureInfo Ci)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            try
            {
                string link  = UtilityLocal.GetPathTreeNameUrl(data.CategoryId, LangInt, LangId);
                int    level = link.Count(i => i.Equals('/'));

                if (level == 1)
                {
                    dic.Add("HRef", LinkHelper.GetLink(UtilityLocal.GetPathTreeNameUrl(data.CategoryId, LangInt, LangId), LocalizationUtility.GetText("linkCate", Ci), LocalizationUtility.GetText("linktmp", Ci), data.ProductDesc.TitleUrl));
                    // list.Add(LinkHelper.GetLink(UtilityLocal.GetPathTreeNameUrl(data.CategoryId, LangInt, LangId), LocalizationUtility.GetText("linkCate", Ci), LocalizationUtility.GetText("linktmp", Ci), data.ProductDesc.TitleUrl));
                }
                else if (level == 2)
                {
                    dic.Add("HRef", LinkHelper.GetLink(link, LocalizationUtility.GetText("linktmp", Ci), data.ProductDesc.TitleUrl));
                    //list.Add(LinkHelper.GetLink(link, LocalizationUtility.GetText("linktmp", Ci), data.ProductDesc.TitleUrl));
                }
                else if (level == 3)
                {
                    dic.Add("HRef", LinkHelper.GetLink(link, data.ProductDesc.TitleUrl));
                    //list.Add(LinkHelper.GetLink(link, data.ProductDesc.TitleUrl));
                }
                else if (level == 4)
                {
                    dic.Add("HRef", LinkHelper.GetLink(link, data.ProductDesc.TitleUrl));
                    //list.Add(LinkHelper.GetLink(link, data.ProductDesc.TitleUrl));
                }
            }
            catch (Exception ex)
            {
            }

            return(dic);
        }
Esempio n. 8
0
        protected void rptServiceLeft_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                PNK_Product data = e.Item.DataItem as PNK_Product;

                Literal ltrImge = e.Item.FindControl("ltrImge") as Literal;
                ltrImge.Text = Common.UtilityLocal.ImagePathByFont(data);

                HtmlAnchor hypTitle = e.Item.FindControl("hypTitle") as HtmlAnchor;

                Dictionary <string, object> dic = UtilityLocal.GetHRefByLevel(data, LangInt, LangId, Ci);
                hypTitle.HRef = LinkHelper.GetLink(UtilityLocal.GetPathTreeNameUrl(data.CategoryId, LangInt, LangId), data.ProductDesc.TitleUrl);

                Literal ltrTitle = e.Item.FindControl("ltrTitle") as Literal;
                ltrTitle.Text = hypTitle.Title = data.ProductDesc.Title;

                Literal ltrBrief = e.Item.FindControl("ltrBrief") as Literal;
                ltrBrief.Text = data.ProductDesc.Brief;

                //Literal ltrContinus = e.Item.FindControl("ltrContinus") as Literal;
                //ltrContinus.Text = LocalizationUtility.GetText(ltrContinus.ID);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Get Image theo sản phẩm
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static string ImagePathByFont(PNK_Product data, HttpRequest request)
        {
            string result = string.Empty, id = string.Empty, pathTreeSub = string.Empty, LangId = data.ProductDesc.LangId == 1 ? "vn" : "eng";

            string imagePath = data.Image == "" ? "breadcrumb-bg.jpg" : data.Image;
            int    imageType = data.ImageType;

            switch (imageType)
            {
            case 1:
                string strHtml = WebUtils.GetMailTemplate(Path.Combine(request.PhysicalApplicationPath, "TemplateMail/CategoryHeader.txt"));
                result = string.Format(strHtml
                                       , WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Image)//Image
                                       , data.ProductDesc.Title
                                       );
                break;

            case 2:
                result = data.ImageFont;
                break;
            }

            return(result);
        }
Esempio n. 10
0
        protected void rptService_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                PNK_Product data = e.Item.DataItem as PNK_Product;

                //   HtmlAnchor hypContinus = e.Item.FindControl("hypContinus") as HtmlAnchor;

                //Dictionary<string, object> dic = UtilityLocal.GetHRefByLevel(data, LangInt, LangId, Ci);
                //hypContinus.HRef = dic["HRef"].ToString();

                //HtmlImage img = e.Item.FindControl("img") as HtmlImage;
                //img.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Image);

                Literal ltrServiceIcon = e.Item.FindControl("ltrServiceIcon") as Literal;
                ltrServiceIcon.Text = data.ImageFont;

                Literal ltrSeriveTitle = e.Item.FindControl("ltrSeriveTitle") as Literal;
                ltrSeriveTitle.Text = data.ProductDesc.Title;

                Literal ltrServiceBrief = e.Item.FindControl("ltrServiceBrief") as Literal;
                ltrServiceBrief.Text = data.ProductDesc.Brief;
            }
        }
Esempio n. 11
0
        /// <summary>
        /// get data for insert update
        /// </summary>
        /// <param name="userObj"></param>
        /// <returns></returns>
        private PNK_Product GetDataObjectParent(PNK_Product productcatObj)
        {
            try
            {
                productcatObj.Published = chkPublished.Checked ? "1" : "0";
                productcatObj.Hot       = chkPublishedHot.Checked ? "1" : "0";
                productcatObj.Feature   = chkPublishedFeature.Checked ? "1" : "0";
                productcatObj.Price     = chkProjectNew.Checked ? "1" : "0";

                //File upload
                //   productcatObj.Bathroom = fileUpload1.FileName;

                productcatObj.Cost = drpCost.SelectedValue;
                //productcatObj.District = drpDistrict.SelectedItem == null ? string.Empty : drpDistrict.SelectedItem.Text;
                productcatObj.Bedroom = txtBedRoom.Value;

                //productcatObj.Code = txtToDate.Text;
                productcatObj.Area = cboArea.SelectedItem.Text;

                //nguyên giá
                productcatObj.Website = txtWebsite.Text;
                //giá khuyến mãi
                productcatObj.Post = txtPost.Text;
                //Điểm đến
                productcatObj.Status = txtStatus.Value;

                productcatObj.Province   = drpProvince.SelectedItem == null ? string.Empty : drpProvince.SelectedItem.Text;
                productcatObj.UpdateDate = DateTime.Now;
                productcatObj.CategoryId = DBConvert.ParseInt(drpCategory.SelectedValue);


                productcatObj.Longitude = txtLongitude.Value;//Kinh do
                productcatObj.Latitude  = txtLatitude.Value;
                productcatObj.Page      = txtPage.Text.Trim();

                //update by
                if (Session[Global.SESS_USER] != null)
                {
                    PNK_User user = (PNK_User)Session[Global.SESS_USER];
                    productcatObj.UpdateBy = user.Username;
                }

                #region Get image

                HtmlControl txtFontName = block_baseimage.FindControl("txtFontName") as HtmlControl;
                productcatObj.ImageFont = string.IsNullOrEmpty(txtFontName.Attributes["value"]) == true ? string.Empty : txtFontName.Attributes["value"];

                HtmlControl rdImageFont = block_baseimage.FindControl("rdImageFont") as HtmlControl;
                if (rdImageFont != null && rdImageFont.Attributes["checked"] == "checked")
                {
                    productcatObj.ImageType = DBConvert.ParseInt(rdImageFont.Attributes["value"]);
                }
                else
                {
                    productcatObj.ImageType = 1;
                }

                HtmlControl hddImageName = block_baseimage.FindControl("hddImageName") as HtmlControl;
                if (hddImageName != null && hddImageName.Attributes["value"] != null)
                {
                    productcatObj.Image = hddImageName.Attributes["value"].ToString();
                }
                else
                {
                    productcatObj.Image = "";
                }

                #endregion

                HtmlControl hddNameFileUpload = block_uploadfile.FindControl("hddNameFileUpload") as HtmlControl;
                if (hddNameFileUpload != null && hddNameFileUpload.Attributes["value"] != null)
                {
                    productcatObj.Bathroom = hddNameFileUpload.Attributes["value"].ToString();
                }
                else
                {
                    productcatObj.Bathroom = "";
                }
            }
            catch (Exception ex)
            {
                Write2Log.WriteLogs("GetDataObjectParent", "admin_editproduct", ex.Message);
            }

            return(productcatObj);
        }
Esempio n. 12
0
        /// <summary>
        /// ShowProduct
        /// </summary>
        private void ShowProduct()
        {
            if (this.productcategoryId != int.MinValue)
            {
                PNK_Product productcatObj = new PNK_Product();
                string[]    fields        = { "Id" };
                productcatObj.Id            = this.productcategoryId;
                productcatObj               = generic2CBLL.Load(productcatObj, fields, Constant.DB.LangId);
                chkPublished.Checked        = productcatObj.Published == "1" ? true : false;
                chkPublishedHot.Checked     = productcatObj.Hot == "1" ? true : false;
                chkPublishedFeature.Checked = productcatObj.Feature == "1" ? true : false;
                // chkNewInHome.Checked = productcatObj.Bathroom == "1" ? true : false;

                txtBedRoom.Value = DBConvert.ParseString(productcatObj.Bedroom);

                txtToDate.Text  = productcatObj.Code;
                txtStatus.Value = productcatObj.Status;
                try
                {
                    this.drpProvince.SelectedValue = productcatObj.Province == string.Empty ? "" : drpProvince.Items.FindByText(productcatObj.Province).Value;
                    //this.drpDistrict.SelectedValue = productcatObj.District == string.Empty ? "" : drpDistrict.Items.FindByText(productcatObj.District).Value;
                }
                catch (Exception)
                {
                    drpProvince.SelectedIndex = 0;
                }
                this.drpCategory.SelectedValue = productcatObj.CategoryId.ToString();

                chkProjectNew.Checked = productcatObj.Price == "1" ? true : false;

                drpCost.SelectedValue = DBConvert.ParseString(productcatObj.Cost);
                txtWebsite.Text       = productcatObj.Website;
                txtPost.Text          = productcatObj.Post;

                txtLatitude.Value  = productcatObj.Latitude;
                txtLongitude.Value = productcatObj.Longitude;
                txtPage.Text       = productcatObj.Page == "" ? ConfigurationManager.AppSettings["pagePathProductDetail"] : productcatObj.Page;

                #region Set image

                block_baseimage.ImageName = productcatObj.Image;

                if (productcatObj.ImageType == 1 || productcatObj.ImageType == null)
                {
                    HtmlControl rdImage = block_baseimage.FindControl("rdImage") as HtmlControl;
                    rdImage.Attributes["checked"] = "checked";
                }
                if (productcatObj.ImageType == 2)
                {
                    HtmlControl txtFontName = block_baseimage.FindControl("txtFontName") as HtmlControl;
                    txtFontName.Attributes["value"] = productcatObj.ImageFont;

                    HtmlControl rdImageFont = block_baseimage.FindControl("rdImageFont") as HtmlControl;
                    rdImageFont.Attributes["checked"] = "checked";
                }

                try
                {
                    cboArea.SelectedValue = productcatObj.Area == string.Empty ? "1" : cboArea.Items.FindByText(productcatObj.Area).Value;
                }
                catch (Exception)
                {
                    cboArea.SelectedIndex = 0;
                }
                //cboArea.Items.FindByText(productcatObj.Area).Selected = true;

                #endregion

                block_uploadfile.ImageName = productcatObj.Bathroom;

                IList <PNK_ProductDesc> lst = genericDescBLL.GetAllBy(new PNK_ProductDesc(), string.Format(" where mainid = {0}", this.productcategoryId), null);
                foreach (PNK_ProductDesc item in lst)
                {
                    switch (item.LangId)
                    {
                    case 1:
                        this.txtName.Value           = item.Title;
                        this.txtIntro.Text           = item.Brief;
                        this.txtDetailVi.Text        = Server.HtmlDecode(item.Detail);
                        this.txtPositionVi.Text      = item.Position;
                        this.txtUtilityVi.Text       = item.Utility;
                        this.txtPicturesVi.Text      = item.Pictures;
                        this.txtDesignVi.Text        = item.Design;
                        this.txtPaymentVi.Text       = item.Payment;
                        this.txtContactVi.Text       = item.Contact;
                        this.txtMetaTitle.Text       = item.MetaTitle;
                        this.txtMetaDescription.Text = item.Metadescription;
                        this.txtMetaKeyword.Text     = item.MetaKeyword;
                        this.txtH1.Text = item.H1;
                        this.txtH2.Text = item.H2;
                        this.txtH3.Text = item.H3;
                        break;

                    case 2:
                        this.txtNameEng.Value     = item.Title;
                        this.txtIntroEng.Text     = item.Brief;
                        this.txtDetailEng.Text    = item.Detail;
                        this.txtUtilityEng.Text   = item.Utility;
                        this.txtPicturesEng.Text  = item.Pictures;
                        this.txtDesignEng.Text    = item.Design;
                        this.txtPaymentEng.Text   = item.Payment;
                        this.txtContactEng.Text   = item.Contact;
                        this.txtMetaTitleEng.Text = item.MetaTitle;
                        this.txtMetaTitleEng.Text = item.Metadescription;
                        this.txtMetaTitleEng.Text = item.MetaKeyword;
                        this.txtMetaTitleEng.Text = item.MetaKeyword;
                        this.txtH1Eng.Text        = item.H1;
                        this.txtH2Eng.Text        = item.H2;
                        this.txtH3Eng.Text        = item.H3;
                        break;
                    }
                }
            }
        }
Esempio n. 13
0
        /// <summary>
        /// ItemDataBound
        /// </summary>
        protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string        img, alt, publishedTask;
                HtmlTableRow  tr  = (HtmlTableRow)e.Item.FindControl("trList");
                HtmlInputText txt = null;
                if (e.Item.ItemIndex % 2 == 0)
                {
                    tr.Attributes.Add("class", "even");
                }
                else
                {
                    tr.Attributes.Add("class", "old");
                }

                try
                {
                    PNK_Product data = (PNK_Product)e.Item.DataItem;

                    //Role
                    Literal ltr = null;
                    ltr      = (Literal)e.Item.FindControl("ltrchk");
                    ltr.Text = string.Format(@"<INPUT class='txt' TYPE='checkbox' ID='cb{0}' NAME='cid[]' value='{1}' onclick='isChecked(this.checked);' >",
                                             e.Item.ItemIndex, data.Id);

                    //ltrNewsCategory
                    ltr      = (Literal)e.Item.FindControl("ltrNewsCategory");
                    ltr.Text = data.CategoryNameDesc;

                    //Sort
                    ltr = (Literal)e.Item.FindControl("ltrSort");
                    string strOrder = string.Empty;
                    string onclick  = string.Empty;

                    //orderDown
                    if (indexItem < this.pager.ItemCount - 1)
                    {
                        onclick   = string.Format("onclick=\"listItemTask('cb{0}', 'orderdown')\"", e.Item.ItemIndex);
                        strOrder += string.Format("<a title='{0}' {1} runat='server' class=\"center-block text-center\" style='cursor:pointer;color:#3C8DBC'><i class=\"fa fa-long-arrow-down\"></i></a> ", Constant.UI.admin_Down, onclick);
                    }
                    //orderUp
                    if (indexItem > 0)
                    {
                        onclick   = string.Format("onclick=\"listItemTask('cb{0}', 'orderup')\"", e.Item.ItemIndex);
                        strOrder += string.Format("<a title='{0}' {1} runat='server' class=\"center-block text-center\" style='cursor:pointer;color:#3C8DBC'><i class=\"fa fa-long-arrow-up\"></i> </a> ", Constant.UI.admin_Up, onclick);
                    }
                    indexItem++;
                    ltr.Text = strOrder;

                    //publish
                    if (data.Published == "1")
                    {
                        img           = "tick.png";
                        alt           = LocalizationUtility.GetText(ltrAdminPublish.Text);
                        publishedTask = "unpublish";
                    }
                    else
                    {
                        img           = "publish_x.png";
                        alt           = LocalizationUtility.GetText(ltrAminUnPublish.Text);
                        publishedTask = "publish";
                    }

                    //Id
                    HtmlInputButton btId = (HtmlInputButton)e.Item.FindControl("btId");
                    btId.Value = DBConvert.ParseString(data.Id);

                    //Base img
                    HtmlImage baseImage = (HtmlImage)e.Item.FindControl("baseImage");
                    baseImage.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Image);
                    HtmlAnchor hypBaseImage = (HtmlAnchor)e.Item.FindControl("hypBaseImage");

                    //set link
                    HyperLink hdflink = new HyperLink();
                    hdflink           = (HyperLink)e.Item.FindControl("hdflink");
                    hypBaseImage.HRef = hdflink.NavigateUrl = template_path + LinkHelper.GetAdminLink("edit_product", data.CategoryId.ToString(), data.Id.ToString());
                    //HtmlTableCell td = (HtmlTableCell)e.Item.FindControl("tdName");
                    //td.Attributes.Add("onclick", string.Format("listItemTask('cb{0}', 'edit')", e.Item.ItemIndex));
                    //td = (HtmlTableCell)e.Item.FindControl("trUpdateDate");
                    //td.Attributes.Add("onclick", string.Format("listItemTask('cb{0}', 'edit')", e.Item.ItemIndex));
                    ImageButton imgctr = (ImageButton)e.Item.FindControl("btnPublish");
                    imgctr.ImageUrl = string.Format("/Admin/images/{0}", img);
                    imgctr.Attributes.Add("alt", alt);
                    HtmlTableCell btn = (HtmlTableCell)e.Item.FindControl("tdbtn");
                    btn.Attributes.Add("onclick", string.Format(" return listItemTask('cb{0}', '{1}')", e.Item.ItemIndex, publishedTask));

                    //Name
                    ltr = (Literal)e.Item.FindControl("ltrName");
                    hypBaseImage.Attributes["title"] = baseImage.Alt = baseImage.Attributes["title"] = ltr.Text = data.ProductDesc.Title;
                    //Server.HtmlDecode(getScmplit(data.Lvl) + "&bull; | " + data.Lvl + " | " + data.ProductCategoryDesc.Name);
                }
                catch { }
            }
        }
Esempio n. 14
0
        protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                PNK_Product data     = e.Item.DataItem as PNK_Product;
                HtmlAnchor  hypImg   = e.Item.FindControl("hypImg") as HtmlAnchor;
                HtmlAnchor  hypTitle = e.Item.FindControl("hypTitle") as HtmlAnchor;

                string link  = UtilityLocal.GetPathTreeNameUrl(data.CategoryId, LangInt, LangId);
                int    level = link.Count(i => i.Equals('/'));

                if (level == 1)
                {
                    hypTitle.HRef = hypImg.HRef = LinkHelper.GetLink(UtilityLocal.GetPathTreeNameUrl(data.CategoryId, LangInt, LangId), LocalizationUtility.GetText("linkCate", Ci), LocalizationUtility.GetText("linktmp", Ci), data.ProductDesc.TitleUrl);
                }
                else if (level == 2)
                {
                    hypTitle.HRef = hypImg.HRef = LinkHelper.GetLink(link, LocalizationUtility.GetText("linktmp", Ci), data.ProductDesc.TitleUrl);
                }
                else if (level == 3)
                {
                    hypTitle.HRef = hypImg.HRef = LinkHelper.GetLink(link, data.ProductDesc.TitleUrl);
                    //hypTitle.HRef = hypImg.HRef = LinkHelper.GetLink(pageName, LangId, cid, data.CategoryUrlDesc, data.ProductDesc.TitleUrl);
                }
                else if (level == 4)
                {
                    hypTitle.HRef = hypImg.HRef = LinkHelper.GetLink(link, data.ProductDesc.TitleUrl);
                }

                HtmlImage img = e.Item.FindControl("img") as HtmlImage;
                img.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Image);
                //img.Attributes.Add("data-lazysrc", WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], data.Image));

                Literal ltrTitle = e.Item.FindControl("ltrTitle") as Literal;
                hypImg.Title = ltrTitle.Text = img.Alt = img.Attributes["title"] = data.ProductDesc.Title;

                Literal ltrBrief = e.Item.FindControl("ltrBrief") as Literal;
                ltrBrief.Text = data.ProductDesc.Brief;

                StringBuilder sbPrice           = new StringBuilder();
                StringBuilder sbPriceFrom       = new StringBuilder();
                StringBuilder sbDiscountPercent = new StringBuilder();
                //Nếu không có giá giảm
                if (string.IsNullOrWhiteSpace(data.Post))
                {
                    string normalPrice = data.Website == "" ? "Call" : string.Format("$USD {0}", data.Website);
                    sbPrice.Append("<div class=\"package-info\"><i class=\"icon-tag\"></i><span class=\"package-price\">" + normalPrice + "</span></div>");
                    sbDiscountPercent.Append("<div class=\"package-ribbon-wrapper\"><div class=\"hidden package-type normal-type\">Learn More</div><div class=\"clear\"></div><div class=\"hidden package-type-gimmick\"></div><div class=\"clear\"></div></div>");
                }
                //Nếu có giá giảm
                else
                {
                    string  normalPrice     = data.Website == "" ? "Call" : string.Format("$USD {0}", data.Website);
                    decimal discountPercent = ((DBConvert.ParseDecimal(data.Website) - DBConvert.ParseDecimal(data.Post)) / DBConvert.ParseDecimal(data.Website)) * 100;
                    sbPrice.Append("<div class=\"package-info last-minute\"><div class=\"package-info-inner\"><span class=\"discount-price\"><i class=\"icon-tag\"></i> $USD " + data.Post + "</span><span class=\"normal-price\">$USD " + data.Website + "</span></div></div>");
                    sbDiscountPercent.Append("<div class=\"package-ribbon-wrapper\"><div class=\"hidden package-type last-minute\"><span class=\"head\">Last Minute</span><span class=\"discount-text\">" + discountPercent + " Off</span></div><div class=\"clear\"></div><div class=\"hidden package-type-gimmick\"></div><div class=\"clear\"></div></div>");

                    //sbPriceFrom.Append("<div class=\"package-info last-minute\"><div class=\"package-info-inner\"><span class=\"discount-price\"><i class=\"icon-tag\"></i>Price from $USD " + data.Post + "</span></div></div>");
                }
                Literal ltrPrice = e.Item.FindControl("ltrPrice") as Literal;
                ltrPrice.Text = sbPrice.ToString();
                Literal ltrDiscountPercent = e.Item.FindControl("ltrDiscountPercent") as Literal;
                ltrDiscountPercent.Text = sbDiscountPercent.ToString();

                Literal ltrPriceFrom = e.Item.FindControl("ltrPriceFrom") as Literal;
                //ltrPriceFrom.Text = sbPriceFrom.ToString();

                //Literal ltrPriceNormal = e.Item.FindControl("ltrPriceNormal") as Literal;
                //ltrPriceNormal.Text = data.Website;

                //Literal ltrPriceDiscount = e.Item.FindControl("ltrPriceDiscount") as Literal;
                //ltrPriceDiscount.Text = data.Latitude;

                Literal ltrDate = e.Item.FindControl("ltrDate") as Literal;
                ltrDate.Text = data.Area == "" ? "Available all year round" : string.Format("{0}; {1}", data.Area, data.Code);
            }
        }
Esempio n. 15
0
        private void GetDetail()
        {
            pcBll = new ProductBLL();
            IList <PNK_Product> lst = null;

            //Loại bỏ dấu ? để lấy link đúng
            string url = Request.RawUrl.Split('?')[0];

            //Cắt url, để lấy product name
            string[] urlArr = url.Split('/').ToArray();
            Array.Reverse(urlArr);
            lastUrl    = urlArr[0];
            forwardUrl = urlArr[1];
            if (lastUrl != string.Empty && lastUrl != "default.aspx" && !string.IsNullOrEmpty(lastUrl))
            {
                lst = pcBll.GetList(LangInt, forwardUrl, string.Empty, string.Empty, lastUrl, null, string.Empty, 1, 9999, out total);
            }

            if (total > 0)
            {
                ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0], Request);

                ltrTitle.Text  = lst[0].ProductDesc.Title;
                ltrBrief.Text  = lst[0].ProductDesc.Brief;
                ltrDetail.Text = lst[0].ProductDesc.Detail;

                ltrTourCode.Text  = lst[0].Status;
                ltrLength.Text    = lst[0].Area;
                ltrStartFrom.Text = lst[0].Bedroom;
                ltrTourType.Text  = lst[0].Province;

                #region Price

                StringBuilder sbPrice = new StringBuilder();
                //Nếu không có giá giảm
                if (string.IsNullOrWhiteSpace(lst[0].Post))
                {
                    string normalPrice = lst[0].Website == "" ? "<ins><span class=\"amount\">Call</span></ins>" : string.Format("{0} USD", lst[0].Website);
                    sbPrice.AppendFormat("<ins><span class=\"amount\">Price from {0}</span></ins>", normalPrice);
                }
                //Nếu có giá giảm
                else
                {
                    string normalPrice = lst[0].Website == "" ? "Call" : string.Format("$USD {0}", lst[0].Website);
                    if (lst[0].Website != "")
                    {
                        decimal discountPercent = ((DBConvert.ParseDecimal(lst[0].Website) - DBConvert.ParseDecimal(lst[0].Post)) / DBConvert.ParseDecimal(lst[0].Website)) * 100;
                        sbPrice.AppendFormat("<ins><span class=\"amount\">Price from {0} USD</span></ins>", lst[0].Post);
                        sbPrice.AppendFormat("<del><span class=\"amount\">{0} USD</span></del>", lst[0].Website);

                        //Show/hidden div Sale alert
                        divIsSale.Style.Add("display", "block");
                        udpAddToCard.Visible = true;
                        imgBuy.Attributes.Add("onclick", string.Format("javascript:return BuyProduct({0},{1})", lst[0].Id, lst[0].Website));
                    }
                    else
                    {
                        sbPrice.Append("<ins><span class=\"amount\">Call</span></ins>");
                    }
                }
                ltrPrice.Text = sbPrice.ToString();

                #endregion

                Session["booking_categoryID"] = lst[0].CategoryId;

                string linkPage = Common.UtilityLocal.GetCateNameByLevel(pageName, cid, cidsub, id);
                hypBookingNow.HRef = LinkHelper.GetLink("booking", LangId, linkPage);

                //set programtour
                block_programtour.ProductId = lst[0].Id.ToString();

                //set price
                block_bookingprice.ProductId = DBConvert.ParseInt(lst[0].Id);

                //Get img slide
                GetListImage(lst[0].Id.ToString());

                #region Get Count review

                string oldCount = string.IsNullOrEmpty(lst[0].District) == true ? "0" : lst[0].District;
                ltrViewCount.Text = string.Format("{0} Reviews", oldCount);

                //Update count view after user forcus detail
                int intOldCount = DBConvert.ParseInt(oldCount);
                int intNewCount = intOldCount + 1;
                Generic <PNK_Product> genericBLL = new Generic <PNK_Product>();
                PNK_Product           productCat = new PNK_Product();
                productCat.Id       = DBConvert.ParseInt(lst[0].Id);
                productCat          = genericBLL.Load(productCat, new string[] { "Id" });
                productCat.Ordering = DBConvert.ParseInt(lst[0].Ordering);
                productCat.District = intNewCount.ToString();
                if (productCat.Ordering > 0)
                {
                    genericBLL.Update(productCat, productCat, new string[] { "Id" });
                }

                #endregion


                WebUtils.SeoPage(lst[0].ProductDesc.MetaTitle, lst[0].ProductDesc.Metadescription, lst[0].ProductDesc.MetaKeyword, this.Page);
                WebUtils.SeoTagH(lst[0].ProductDesc.H1, lst[0].ProductDesc.H2, lst[0].ProductDesc.H3, this.Controls);
            }
        }
Esempio n. 16
0
        private void GetDetail()
        {
            ProductBLL          pcBll = new ProductBLL();
            IList <PNK_Product> lst   = null;
            string level = string.Empty;

            if (Session["level"] != null)
            {
                switch (level)
                {
                case "1":
                    lst = pcBll.GetList(LangInt, pageName, string.Empty, string.Empty, string.Empty, null, string.Empty, 1, 9999, out total);
                    break;

                case "2":
                    lst = pcBll.GetList(LangInt, cid, string.Empty, string.Empty, string.Empty, null, string.Empty, 1, 9999, out total);
                    break;

                case "3":
                    lst = pcBll.GetList(LangInt, cidsub, string.Empty, string.Empty, string.Empty, null, string.Empty, 1, 9999, out total);
                    break;

                case "4":
                default:
                    if (cid == LocalizationUtility.GetText("linkCate", Ci))
                    {
                        lst = pcBll.GetList(LangInt, pageName, string.Empty, string.Empty, id, null, string.Empty, 1, 9999, out total);
                    }
                    else if (cidsub == LocalizationUtility.GetText("linktmp", Ci))
                    {
                        lst = pcBll.GetList(LangInt, cid, string.Empty, string.Empty, id, null, string.Empty, 1, 9999, out total);
                    }
                    else
                    {
                        lst = pcBll.GetList(LangInt, cidsub, string.Empty, string.Empty, id, null, string.Empty, 1, 9999, out total);
                    }
                    break;
                }
            }

            if (total > 0)
            {
                Session["booking_categoryID"] = lst[0].CategoryId;

                string linkPage = Common.UtilityLocal.GetCateNameByLevel(pageName, cid, cidsub, id);
                //string rawUrl = Request.RawUrl;
                //if (LangInt == 1)
                //{
                //    string[] sep = { "vn" };
                //    string[] test = rawUrl.Split(sep, 0);
                //}
                hypBookingNow.HRef = LinkHelper.GetLink("booking", LangId, linkPage);

                ////set price
                //block_booking booking = new block_booking();
                //booking.Title = lst[0].ProductDesc.Title;

                //Get img slide
                GetListImage(lst[0].Id.ToString());

                //set price
                block_bookingprice.ProductId = DBConvert.ParseInt(lst[0].Id);

                //set map
                //block_googlemap_detail.ProductId = lst[0].Id.ToString();

                //set programtour
                block_programtour.ProductId = lst[0].Id.ToString();
                //if (!string.IsNullOrWhiteSpace(lst[0].Latitude) || !string.IsNullOrWhiteSpace(lst[0].Longitude))
                //{
                //    //block_googlemap_detail.Visible = true;

                //    //block_googlemap_detail.Latitude = lst[0].Latitude;
                //    //block_googlemap_detail.Longitude = lst[0].Longitude;
                //    //block_googlemap_detail.CompanyName = lst[0].ProductDesc.Title;
                //}

                StringBuilder sbPrice           = new StringBuilder();
                StringBuilder sbDiscountPercent = new StringBuilder();
                StringBuilder sbPriceFrom       = new StringBuilder();

                //Ẩn các div k có giá trị bên trong
                if (string.IsNullOrWhiteSpace(lst[0].Status))
                {
                    string hidden = string.IsNullOrWhiteSpace(lst[0].Status) == true ? "display:none" : "display:block";
                    //divDuration.Attributes.Add("style", hidden);
                }
                if (string.IsNullOrWhiteSpace(lst[0].ProductDesc.Position))
                {
                    string hidden = string.IsNullOrWhiteSpace(lst[0].Status) == true ? "display:none" : "display:block";
                    //divTab.Attributes.Add("style", hidden);
                }

                //Nếu không có giá giảm
                if (string.IsNullOrWhiteSpace(lst[0].Post))
                {
                    sbPrice.Append("<div class=\"package-info\"><i class=\"icon-tag\"></i><span class=\"head\">Price: </span>USD " + lst[0].Website + "</div>");
                    string learnHidden = string.IsNullOrWhiteSpace(lst[0].Website) == true ? "hidden" : "";
                    sbDiscountPercent.Append("<div class=\"package-type normal-type " + learnHidden + " \">Learn More</div><div class=\"clear\"></div><div class=\"package-type-gimmick " + learnHidden + "\"></div><div class=\"clear\"></div>");
                    sbPriceFrom.Append("<div class=\"package-info last-minute\"><div class=\"package-info-inner\"><span class=\"discount-price\"><i class=\"icon-tag\"></i>Price from USD " + lst[0].Post + "</span></div></div>");
                }

                //Nếu có giá giảm
                else
                {
                    //if (string.IsNullOrWhiteSpace(lst[0].Website) && string.IsNullOrWhiteSpace(lst[0].Post))
                    //{
                    decimal discountPercent = ((DBConvert.ParseDecimal(lst[0].Website) - DBConvert.ParseDecimal(lst[0].Post)) / DBConvert.ParseDecimal(lst[0].Website)) * 100;
                    sbPrice.Append("<div class=\"package-info\"><i class=\"icon-tag\"></i><span class=\"head\">Price: </span><span class=\"normal-price\">USD " + lst[0].Website + "</span><span class=\"discount-text\">" + discountPercent + " Off</span><span class=\"separator\"> : </span><span class=\"discount-price\">USD " + lst[0].Post + "</span></div>");
                    sbDiscountPercent.Append("<div class=\"package-type last-minute\"><span class=\"head\">Last Minute</span><span class=\"discount-text\"> " + discountPercent + "  Off</span></div><div class=\"clear\"></div><div class=\"package-type-gimmick\"></div><div class=\"clear\"></div>");
                    sbPriceFrom.Append("<div class=\"package-info last-minute\"><div class=\"package-info-inner\"><span class=\"discount-price\"><i class=\"icon-tag fa-fw\"></i>Price from USD " + lst[0].Post + "</span></div></div>");
                    //}
                }

                ltrPriceFrom.Text = sbPriceFrom.ToString();

                ltrTourCode.Text       = lst[0].Status;
                ltrLength.Text         = lst[0].Area;
                ltrStartFrom.Text      = lst[0].Bedroom;
                ltrTourType.Text       = lst[0].Province;
                ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]);

                //chi tiết
                ltrDetail.Text = lst[0].ProductDesc.Detail;

                //Detailed Itinerary
                ltrDetailedItinerary.Text = lst[0].ProductDesc.Utility;
                //Prices and Services
                ltrPriceServices.Text = lst[0].ProductDesc.Design;

                //View and print
                if (lst[0].Bathroom != "" && lst[0].Bathroom != string.Empty)
                {
                    divPdf.Style.Add("display", "block");
                    lbnViewFile.CommandArgument = lst[0].Bathroom;
                    PrintFile(lst[0].Bathroom);
                }

                //Video
                string embed = UtilityLocal.GetVideoList(lst[0].Id);
                if (embed != string.Empty)
                {
                    ifrVideo.Attributes.Add("src", "//www.youtube.com/embed/" + embed + "?rel=0&amp;autoplay=0");
                }
                else
                {
                    ifrVideo.Visible = false;
                }

                WebUtils.SeoPage(lst[0].ProductDesc.MetaTitle, lst[0].ProductDesc.Metadescription, lst[0].ProductDesc.MetaKeyword, this.Page);
                WebUtils.SeoTagH(lst[0].ProductDesc.H1, lst[0].ProductDesc.H2, lst[0].ProductDesc.H3, this.Controls);

                //Get Count review
                string oldCount = string.IsNullOrEmpty(lst[0].District) == true ? "0" : lst[0].District;
                ltrViewCount.Text = string.Format("{0} Reviews", oldCount);

                //Update count view after user forcus detail
                int intOldCount = DBConvert.ParseInt(oldCount);
                int intNewCount = intOldCount + 1;

                Generic <PNK_Product> genericBLL = new Generic <PNK_Product>();
                PNK_Product           productCat = new PNK_Product();
                productCat.Id       = DBConvert.ParseInt(lst[0].Id);
                productCat          = genericBLL.Load(productCat, new string[] { "Id" });
                productCat.Ordering = DBConvert.ParseInt(lst[0].Ordering);
                productCat.District = intNewCount.ToString();
                if (productCat.Ordering > 0)
                {
                    genericBLL.Update(productCat, productCat, new string[] { "Id" });
                }
            }
        }