Ejemplo n.º 1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (cl.checkRole(Session["userid_hcc"].ToString(), codeModule, 1))
        {
            if (txtTitle.Text.Trim() == "") Mess("Nhập tiêu đề bài viết", "");
            else if (txtDescription.Text.Trim() == "") Mess("Nhập nội dung tóm tắt bài viết", "");
            else if (fckContent.Value.Trim() == "") Mess("Nhập nội dung bài viết", "");
            else if (!fileImage.HasFile) Mess("Chọn file ảnh", "");
            else
            {
                string filename = DateTime.Now.ToString("ddMMyyyyhhmmss"), file_ex = "";
                try
                {
                    tNew n = new tNew();
                    n.Title = txtTitle.Text.Trim();
                    n.Description = txtDescription.Text.Trim();
                    n.Body = fckContent.Value;
                    n.MenuId = int.Parse(dlMenu.SelectedValue.Trim());
                    n.Tag = txtTag.Text.Trim();
                    n.IsActive = ckActive.Checked;
                    n.CreateAt = DateTime.Now;
                    n.CreateBy = int.Parse(Session["userid_hcc"].ToString());

                    if (fileImage.HasFile)
                    {
                        file_ex = fileImage.FileName.Trim();
                        file_ex = file_ex.Substring(file_ex.LastIndexOf('.'));
                        n.Image = "/wp-content/uploads/news/" + filename + file_ex;
                    }
                    db.tNews.InsertOnSubmit(n);
                    db.SubmitChanges();
                    if (fileImage.HasFile)
                        fileImage.SaveAs(Server.MapPath("/wp-content/uploads/news/" + filename + file_ex));

                    var check_news = from m in db.tNews where m.MenuId == int.Parse(dlMenu.SelectedValue.Trim()) select new { m.Id };

                    //Update link menu
                    var update_menu = from u in db.tMenus where u.Id == int.Parse(dlMenu.SelectedValue) select u;
                    if (update_menu.Count() > 0)
                    {
                        if (check_news.Count() == 1)
                            update_menu.FirstOrDefault().Link = "/bai-viet/" + n.Id.ToString() + "/" + cl.ConvertToUnSign(txtTitle.Text.Trim().ToLower()) + ".hcc";
                        else
                            update_menu.FirstOrDefault().Link = null;
                        db.SubmitChanges();
                    }
                    //end update
                    ResetControl();
                    LoadGrid();
                    Mess("Lưu bài viết thành công", "");
                }
                catch (Exception ax)
                {
                    Mess(ax.Message, "");
                }
            }
        }
        else Mess("Bạn không có quyền sử dụng chức năng này", "/adhome");
    }
Ejemplo n.º 2
0
    string LoadChildMenu(int parentId)
    {
        string kq = "";

        var mn = from x in db.tMenus where x.IsActive == true && x.ParentId == parentId orderby x.Position select new { x.Name, x.Code, x.Id, x.ParentId, x.Link };

        if (mn.Count() > 0)
        {
            kq += "<ul class=\"sub-menu\">";
            int count = 10;
            foreach (var i in mn.ToList())
            {
                kq += "<li id=\"menu-item-" + count.ToString() + "\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-" + count.ToString() + "\">";
                if (i.Link != null)
                {
                    kq += "<a href=\"" + i.Link.Trim() + "\">" + i.Name.ToUpper().Trim() + "</a></li>";
                }
                else
                {
                    kq += "<a href=\"/tin-tuc/" + i.Id.ToString() + "/" + cl.ConvertToUnSign(i.Name.Trim().ToLower()) + ".hcc\">" + i.Name.ToUpper().Trim() + "</a></li>";
                }
                count++;
            }
            kq += "</ul>";
        }
        return(kq);
    }
Ejemplo n.º 3
0
    string LoadNews()
    {
        string kq    = "";
        var    n     = (from x in db.tNews where x.IsActive == true orderby x.CreateAt descending select new { x.Id, x.Title, x.Description, x.Image, x.MenuId }).Skip(0).Take(8);
        int    count = 1;

        foreach (var item in n.ToList())
        {
            if (count == 1 || count % 4 == 1)
            {
                kq += "<div class=\"row\" style='margin-top:10px;'>";
            }
            kq += "<div class=\"col-md-3 col-sm-3\"><div class=\"post-box\"><div class=\"thumb\" style='height:230px;'><div class=\"post_featured_image thumbnail_image\">";
            kq += "<img width=\"275px\" height=\"260px\" src=\"" + item.Image.Trim() + "\" class=\"wp-post-image\" alt=\"\" /></div>";
            kq += "<div class=\"caption\"><a href=\"#\" class=\"link\"><i class=\"fa fa-link\" aria-hidden=\"true\"></i></a></div></div><div class=\"text-box\" style='max-height:203px;'>";
            kq += "<h5><a href=\"/bai-viet/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title.Trim()) + ".hcc" + "\">" + item.Title + "</a></h5>";
            kq += "<p class=\"description\">" + item.Description + "</p>";
            //kq += "<a href=\"#\" class=\"more\"><b><i class=\"fa fa-plus\" aria-hidden=\"true\"></i></b><span>Xem thêm</span></a>";
            kq += "</div></div></div>";
            if (count % 4 == 0)
            {
                kq += "</div>";
            }
            count++;
        }
        return(kq);
    }
Ejemplo n.º 4
0
    private void loadTrend(int id)
    {
        try
        {
            var    n      = (from x in db.tNews from y in db.tAccounts where x.CreateBy == y.Id && x.Status == 1 && x.Type == 2 && x.Id != id select new { x.Id, x.Title, x.Description, x.Image, x.CreateAt, y.FullName }).Skip(0).Take(8);
            string result = "";
            foreach (var item in n.ToList())
            {
                result += "<div class='row_items'><div class='articles-inner'><div class='articles-date'><p class='date'>";
                result += item.CreateAt.Value.ToString("dd - MM - yyyy") + "</p><p class='author'>Đăng bởi: <span class='author-name'>" + item.FullName + "</span></p>";
                result += "</div><div class='articles-image'>";
                result += "<a href='/xu-huong/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title) + ".html'>";
                result += "<img src='" + item.Image + "' alt='" + item.Title + "' class='img-responsive lazy' /></a></div><div class='aritcles-content'>";
                result += "<div class='articles-tit'><a class='articles-name' href='/xu-huong/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title) + ".html'>";
                result += item.Title + "</a></div><div class='articles-intro'>";
                result += "<p>" + item.Description + "</p></div>";
                result += "</div></div></div>";
            }

            lbNews.Text = result;
        }
        catch
        {
            Response.Redirect("/notfound");
        }
    }
Ejemplo n.º 5
0
    private void loadNews(int id)
    {
        try
        {
            var    n      = (from x in db.tNews from y in db.tAccounts where x.BranchTypeId == branchTypeId && x.CreateBy == y.Id && x.Status == 1 && x.Type == 0 && x.Id != id select new { x.Id, x.Title, x.Description, x.Image, x.CreateAt, y.FullName }).Skip(0).Take(8);
            string result = "";
            foreach (var item in n.ToList())
            {
                result += "<div class='row_items'><div class='articles-inner'><div class='articles-date'><p class='date'>";
                result += item.CreateAt.Value.ToString("dd-MM-yyyy") + "</p><p class='author'>Đăng bởi: <span class='author-name'>" + item.FullName + "</span></p>";
                result += "</div><div class='articles-image'>";
                result += "<a href='/cnice/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title) + ".html'>";
                result += "<img src='" + item.Image + "' alt='" + item.Title + "' /></a></div><div class='aritcles-content'>";
                result += "<div class='articles-tit'><a class='articles-name' href='/article/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title) + ".html'>";
                result += item.Title + "</a></div><div class='articles-intro' style='max-height:110px;'>";
                result += "<p style='font-size:13px;'>" + item.Description + "</p></div>";
                result += "<a class='read-more' href='/cnice/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title) + ".html'>Xem thêm</a></div></div></div>";
            }

            lbNews.Text = result;
        }
        catch
        {
            Response.Redirect("/notfound");
        }
    }
Ejemplo n.º 6
0
    private void loadCart()
    {
        string       result = "";
        ShoppingCart cart   = (ShoppingCart)Session["Cart"];

        result += "<table class='table'>";
        double total = 0;

        for (int i = 0; i < cart.Rows.Count; i++)
        {
            result += "<tr><td class='text-center'>";
            result += "<a href='/detail/" + cart.Rows[i]["ID"].ToString() + "/" + cl.ConvertToUnSign(cart.Rows[i]["ProductName"].ToString()) + ".html'>";
            result += "<img src='" + cart.Rows[i]["Image"].ToString() + "'";
            result += "alt='" + cart.Rows[i]["ProductName"].ToString() + "' width='100px' height='100px' title='" + cart.Rows[i]["ProductName"].ToString() + "' /></a></td>";
            result += "<td class='text-left info-item'>";
            result += "<a class='cart-name' href='/detail/" + cart.Rows[i]["ID"].ToString() + "/" + cl.ConvertToUnSign(cart.Rows[i]["ProductName"].ToString()) + ".html'>" + cart.Rows[i]["ProductName"].ToString() + "</a><p class='cart-quantity'>" + cart.Rows[i]["Quantity"].ToString() + " x ";
            result += "</p><p class='cart-price'> " + string.Format("{0:0,0}", cart.Rows[i]["Price"]) + "</p></td></tr>";
            total  += double.Parse(cart.Rows[i]["TotalPrice"].ToString());
        }
        result += "</table>";
        if (cart.Rows.Count > 0)
        {
            lbCart.Text     = result;
            lbTotal.Text    = string.Format("{0:0,0 đ}", total);
            sfooter.Visible = true;
            liCart.Visible  = true;
            liEmpty.Visible = false;
        }
        else
        {
            sfooter.Visible = false;
            liCart.Visible  = false;
            liEmpty.Visible = true;
        }
    }
Ejemplo n.º 7
0
    string LoadNews(int menuId, int page)
    {
        string kq    = "";
        var    count = (from n in db.tNews where n.IsActive == true && n.MenuId == menuId select new { n.Id }).Count();
        var    news  = (from x in db.tNews
                        where x.IsActive == true && x.MenuId == menuId
                        orderby x.CreateAt descending
                        select new { x.Id, x.Title, x.Description, x.Image, x.CreateAt }).Skip((page - 1) * recordPage).Take(recordPage);

        foreach (var item in news.ToList())
        {
            kq += "<div class=\"col-md-4 col-sm-6\"><div class=\"post-box\"><div class=\"thumb\" style='height:320px;'><div class=\"post_featured_image thumbnail_image\">";
            kq += "<img width=\"370px\" height=\"260px\" src=\"" + item.Image.Trim() + "\" class=\"wp-post-image\" alt=\"\">";
            kq += "</div><div class=\"caption\"><a href=\"#\" class=\"link\"><i class=\"fa fa-link\" aria-hidden=\"true\"></i></a></div></div><div class=\"text-box\">";
            kq += "<h4 style='height:80px;'><a href=\"/bai-viet/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title.Trim()) + ".hcc" + "\">" + item.Title + "</a></h4>";
            kq += "<p style='height:89px;text-overflow: ellipsis;' class='description'>" + item.Description + "</p>";
            kq += "<a href=\"/bai-viet/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title.Trim()) + ".hcc" + "\" class=\"more\"><b><i class=\"fa fa-plus\" aria-hidden=\"true\"></i></b><span>Xem thêm</span></a></div></div></div>";
        }
        if (count > recordPage)
        {
            int c_page = count / recordPage; int next_page = count % recordPage == 0 ? 0 : 1;
            lbPage.Text = "<ul class=\"pagination\">";
            if (next_page > 0)
            {
                c_page++;
            }
            for (int i = 1; i <= c_page; i++)
            {
                lbPage.Text += "<li><a class=\"page-numbers\" href=\"/tin-tuc/" + menuId.ToString() + "/page-" + i.ToString() + "/" + cl.ConvertToUnSign(hdTin.Value) + ".html\">" + i.ToString() + "</a></li>";
            }
            lbPage.Text += "</ul>";
        }
        return(kq);
    }
Ejemplo n.º 8
0
    public static result addCartByProductId(string id, string name, string quantity, string sale)
    {
        CNManagerDataContext db = new CNManagerDataContext();
        clsProcess           cl = new clsProcess();

        var r = new result();

        try
        {
            ShoppingCart cart  = (ShoppingCart)HttpContext.Current.Session["Cart"];
            string       idPro = id;
            if (cart.ReturnID(idPro))
            {
                cart.Update(idPro, cart.GetCurrentQuantity(idPro));
                HttpContext.Current.Session["cart_count"] = r._content = cart.GetTotalQuantity.ToString();
                r._mess = "Đã cập nhật số lượng sản phẩm [" + name + "] vào giỏ hàng";
            }
            else
            {
                var pro = db.sp_web_cn_loadProductDetail(branchTypeId.ToString(), int.Parse(id.Trim())).FirstOrDefault();

                cart.AddProduct(id.ToString(), cl.ConvertToUnSign(pro.ProductName), pro.ProductCode, pro.ProductName,
                                (pro.Image == null || pro.Image == "" ? "/image/image-coming-soon.png" : pro.Image), int.Parse(quantity), pro.Price.Value, 0, pro.Score != null ? pro.Score.Value : 0,
                                pro.BrandName, pro.CountryName, sale == "1" ? true : false);

                HttpContext.Current.Session["cart_count"] = r._content = cart.GetTotalQuantity.ToString();
                r._mess = "Đã thêm sản phẩm [" + name + "] vào giỏ hàng";
            }
        }
        catch (Exception ax)
        {
            r._mess = ax.Message;
        }
        return(r);
    }
Ejemplo n.º 9
0
    public static List <product> mb_getproduct(string type, string from, string to, string status)
    {
        var p = new List <product>();

        if (!string.IsNullOrEmpty(Convert.ToString(HttpContext.Current.Session["cn_mb_user_id"])))
        {
            CNManagerDataContext db = new CNManagerDataContext();
            clsProcess           cl = new clsProcess();
            string userid           = HttpContext.Current.Session["cn_mb_user_id"].ToString();
            int    count            = 0;
            var    n = db.sp_web_cn_mb_getproduct(int.Parse(userid), int.Parse(type), DateTime.Parse(cl.returnDatetime(from)), DateTime.Parse(cl.returnDatetime(to)), status);
            foreach (var item in n.ToList())
            {
                count++;
                var x = new product();
                x.CustomerName = item.CustomerName;
                x.Brand        = item.Brand;
                x.Code         = item.ProductCode;
                x.CodeOrder    = item.OrderCode;
                x.CreateAt     = item.CreatedAt.Value.ToString("dd/MM/yyyy");
                x.ID           = item.Id.ToString();
                x.Image        = item.Image;
                if (item.MemberId != null)
                {
                    x.MemberId = item.MemberId.ToString();
                }
                x.Name     = item.ProductName;
                x.OrderId  = item.OrderId.ToString();
                x.pPrice   = string.Format("{0:0,0 đ}", item.pPrice.Value);
                x.Price    = string.Format("{0:0,0}", item.Price.Value);
                x.Score    = item.Score.ToString();
                x.pScore   = item.pScore.ToString();
                x.Quantity = item.Quantity.ToString();
                if (item.RefId != null)
                {
                    x.RefId = item.RefId.ToString();
                }
                x.Mess     = cl.ConvertToUnSign(item.ProductName);
                x.Status   = item.Status.ToString();
                x.StatusId = item.StatusId.ToString();
                x.OK       = true;

                p.Add(x);
            }
            if (count == 0)
            {
                p.Add(new product {
                    OK = false, Mess = "Không có dữ liệu nào phù hợp"
                });
            }
        }
        else
        {
            p.Add(new product {
                OK = false, Mess = "Phiên đăng nhập hết hạn, vui lòng đăng nhập lại"
            });
        }
        return(p);
    }
Ejemplo n.º 10
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (cl.checkRole(Session["userid_hcc"].ToString(), codeModule, 1))
     {
         if (txtName.Text.Trim().Equals(""))
         {
             Mess("Nhập tên menu", "");
         }
         else
         {
             try
             {
                 tMenu t = new tMenu();
                 if (!dlParentMenu.SelectedValue.Trim().Equals(""))
                 {
                     t.ParentId = int.Parse(dlParentMenu.SelectedValue.Trim());
                 }
                 t.Name = txtName.Text.Trim();
                 if (!txtLink.Text.Trim().Equals(""))
                 {
                     t.Link = txtLink.Text.Trim();
                 }
                 t.CreateAt = DateTime.Now;
                 t.Position = double.Parse(txtPosition.Text.Trim());
                 t.IsActive = ckActive.Checked;
                 t.Code     = cl.ConvertToUnSign(txtName.Text.Trim().ToLower());
                 db.tMenus.InsertOnSubmit(t);
                 db.SubmitChanges();
                 ResetControl();
                 LoadGrid();
                 Mess("Lưu thành công", "");
             }
             catch (Exception ax)
             {
                 Mess(ax.Message, "");
             }
         }
     }
     else
     {
         Mess("Bạn không có quyền sử dụng chức năng này", "/adhome");
     }
 }
Ejemplo n.º 11
0
    void loadIntroNews()
    {
        string result = "<ul class='list-unstyled text-content'>";

        result += "";
        var n = from x in db.tNews
                where x.BranchTypeId == branchTypeId && x.Status == 1 && x.Type == 0
                select new { x.Id, x.Title };

        foreach (var item in n.ToList())
        {
            result += "<li><a href='/cfashion/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title) + ".html'>- " + item.Title + "</a></li>";
        }
        result          += "</ul>";
        lbIntroNews.Text = result;
    }
Ejemplo n.º 12
0
    private void loadNews()
    {
        var n = from x in db.tNews
                where x.BranchTypeId == branchTypeId && x.Status == 1 && x.Type == 1
                select new { x.Id, x.Title, x.Description, x.Image, x.CreateAt };
        string result = "";

        foreach (var item in n.ToList())
        {
            result += "<div class='row_items'><div class='articles-inner'><div class='articles-image'>";
            result += "<a href='/article/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title) + ".html'>";
            result += "<img src='" + item.Image + "' alt='" + item.Title + "' class='img-responsive lazy' /></a></div><div class='aritcles-content'>";
            result += "<div class='articles-tit'><a class='articles-name' href='/article/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title) + ".html'>";
            result += item.Title + "</a></div><div class='articles-intro'>";
            result += "<p>" + item.Description + "</p></div>";
            result += "</div></div></div>";
        }
        lbNews.Text = result;
    }
Ejemplo n.º 13
0
    private void loadNews()
    {
        var    n      = from x in db.tNews from y in db.tAccounts where x.BranchTypeId == branchTypeId && x.CreateBy == y.Id && x.Status == 1 select new { x.Id, x.Title, x.Description, x.Image, x.CreateAt, y.FullName };
        string result = "";

        foreach (var item in n.ToList())
        {
            result += "<div class='row_items'><div class='articles-inner'><div class='articles-date'><p class='date'>";
            result += item.CreateAt.Value.ToString("MMM yyyy") + "</p><p class='author'>Đăng bởi: <span class='author-name'>" + item.FullName + "</span></p>";
            result += "</div><div class='articles-image'>";
            result += "<a href='/article/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title) + ".html'>";
            result += "<img src='" + item.Image + "' alt='" + item.Title + "' /></a></div><div class='aritcles-content'>";
            result += "<div class='articles-tit'><a class='articles-name' href='/NewsDetail.aspx?Id=" + item.Id.ToString() + "'>";
            result += item.Title + "</a></div><div class='articles-intro'>";
            result += "<p>" + item.Description + "</p></div>";
            result += "<a class='read-more' href='/article/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title) + ".html'>Xem thêm</a></div></div></div>";
        }
        lbNews.Text = result;
    }
Ejemplo n.º 14
0
    private void loadProduct(int page)
    {
        try
        {
            string result     = "";
            string ref_member = getRefMember();
            var    p          = db.sp_web_cf_loadProductSale(branchTypeId.ToString()).ToList();
            foreach (var item in p.Skip((page - 1) * recordPage).Take(recordPage).ToList())
            {
                result += "<div class='product-layout product-list '><div class='item itemi'>";
                result += "<div class='item-inner'><div class='col-image'><div class='images-container'>";
                if (item.NoteSale != null && item.NoteSale != "")
                {
                    result += "<div class='label-pro-new'><span>" + item.NoteSale + "</span></div>";
                }
                result += "<a href='/" + ref_member + "detail/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.ProductName) + ".html'><img src='" + (item.Image == null || item.Image == "" ? "/image/image-coming-soon.png" : item.Image) + "' alt='" + item.ProductName + "' title='" + item.ProductName + "' class='img-responsive lazy' /></a>";

                result += "</div></div><div class='col-des'><div class='des-container'>";
                result += "<p class='tags-product'>";
                if (item.Tag != null && item.Tag != "")
                {
                    if (item.Tag.Contains(","))
                    {
                        var t = item.Tag.Split(',');
                        foreach (var tg in t)
                        {
                            result += "<a href='/search/?k=" + Server.UrlEncode(tg) + "'>#" + tg + "</a>";
                        }
                    }
                    else
                    {
                        result += "<a href='/search/?k=" + Server.UrlEncode(item.Tag.Trim()) + "'>#" + item.Tag.Trim() + "</a>";
                    }
                }
                else
                {
                    result += "<a href='#'></a>";
                }

                result += "</p>";
                result += "<h2 class='product-name'><a href='/" + ref_member + "detail/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.ProductName) + ".html'>" + item.ProductTypeCode + " - " + item.ProductName + "</a></h2>";
                result += "<div class='price-box box-special'>";
                result += "<p class='special-price'><span class='price'>" + (item.Price.Value == 0 ? "---" : string.Format("{0:0,0 đ}", item.Price)) + "</span></p>";

                result += "</div>";
                result += "<p class='product-des'>" + item.Description + "</p>";
                result += "<button class='button btn-cart' type='button' data-toggle='tooltip' onclick=\"addCart(" + item.Id.ToString() + ",'" + item.ProductName + "','1'" + ",'" + item.Image + "','" + string.Format("{0:0,0}", item.Price) + "',0)\" title='Thêm nhanh vào giỏ hàng'><span><span>Thêm vào giỏ hàng</span></span></button>";
                result += "<div class='box-hover'><div class='ratings'><div class='rating-box'><div class='rating5'>rating</div>";
                result += "</div></div></div></div></div></div></div></div>";
            }

            int record = p.Count();
            if (record > recordPage)
            {
                lbPage.Text += "<ul class=\"pagination pagination-large\">";

                lbPage.Text += "<li><a href='/page-1/sale'>«</a></li>";
                string active = ""; int p_start = 1;
                int    spage = record % recordPage == 0 ? record / recordPage : (record / recordPage) + 1;

                int max_page = p_start + 4;

                if (page >= 3)
                {
                    p_start  = page - 2;
                    max_page = page + 2;
                }
                if (max_page > spage)
                {
                    max_page = spage;
                }

                for (int i = p_start; i <= max_page; i++)
                {
                    if (i == page)
                    {
                        active = "class='active'";
                    }
                    else
                    {
                        active = "";
                    }

                    lbPage.Text += "<li " + active + "><a href='/page-" + i.ToString() + "/sale'>" + i.ToString() + "</a></li>";
                }
                lbPage.Text += "<li><a href='/page-" + spage.ToString() + "/sale'>»</a></li>";

                lbPage.Text += "</ul>";
            }

            lbProduct.Text = result;
        }
        catch
        {
            Response.Redirect("/notfound");
        }
    }
Ejemplo n.º 15
0
    public void productFeature()
    {
        clsProcess           cl = new clsProcess();
        CNManagerDataContext db = new CNManagerDataContext();
        var    pro = db.sp_web_cn_loadProductFeature(branchTypeId.ToString());
        string result = ""; int count = 0;
        string ref_member = getRefMember();

        foreach (var item in pro.ToList())
        {
            count++;
            if (count == 1 || count % 2 == 1)
            {
                result += "<div class='row_items'>";
            }

            result += "<div class='item'><div class='item-inner'><div class='images-container'>";
            if (item.NoteSale != null && item.NoteSale != "")
            {
                result += "<div class='label-pro-new'><span>" + item.NoteSale + "</span></div>";
            }

            string img = item.Image.Trim() == "" ? "/image/image-coming-soon.png" : item.Image.Trim();
            result += "<a class='product-image' href='/" + ref_member + "detail/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.ProductName) + ".html'><img src='" + img + "' alt='" + item.ProductName + "' /></a>";

            result += "</div><div class='des-container'>";
            result += "<p class='tags-product'>";
            if (item.Tag != null && item.Tag != "")
            {
                if (item.Tag.Contains(","))
                {
                    var t = item.Tag.Split(',');
                    foreach (var tg in t)
                    {
                        result += "<a href='/search/?k=" + Server.UrlEncode(tg) + "'>#" + tg + "</a>";
                    }
                }
                else
                {
                    result += "<a href='/search/?k=" + Server.UrlEncode(item.Tag.Trim()) + "'>#" + item.Tag.Trim() + "</a>";
                }
            }

            result += "</p>";
            result += "<h2 class='product-name' style='height:36px;'><a href='/" + ref_member + "detail/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.ProductName) + ".html'>" + item.ProductName + "</a></h2>";
            result += "<div class='price-box box-special'><p class='special-price'><span class='price'>" + string.Format("{0:0,0 đ}", item.Price) + "</span></p>";

            result += "</div><button class='button btn-cart' type='button' onclick=\"addCart(" + item.Id.ToString() + ",'" + item.ProductName + "',1" + ",'" + item.Image + "','" + string.Format("{0:0,0}", item.Price) + "',0)\" data-toggle='tooltip' title='Thêm nhanh vào giỏ hàng'>";
            result += "<span><span>Thêm vào giỏ hàng</span></span></button>";
            result += "<div class='box-hover'><div class='ratings'><div class='rating-box'><div class='rating5'>rating</div>";
            result += "</div></div></div></div></div></div>";

            if (count % 2 == 0)
            {
                result += "</div>";
            }
        }
        lbFProduct.Text = result;
    }
Ejemplo n.º 16
0
    private void loadGallery(int page)
    {
        try
        {
            string result = "";
            var    n      = from x in db.tGalleries from y in db.tAccounts where x.BranchTypeId == branchTypeId && x.CreateBy == y.Id && x.Status == 1
                            orderby x.CreateAt descending
                            select new { x.Id, x.GalleryName, x.Description, x.Image1, x.Image2, x.CreateAt, y.FullName };
            foreach (var item in n.Skip((page - 1) * recordPage).Take(recordPage).ToList())
            {
                result += "<div class='article-layout article-list'><div class='article-item'><div class='article-item-inner row'><div class='article-image col-sm-5'>";
                result += "<a href='/lb-detail/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.GalleryName) + ".html'><img class=' lazy'  src='" + item.Image1 + "' alt='" + item.GalleryName + "'/></a></div>";
                result += "<div class='article-intro col-sm-7'><div class='article-name'>";
                result += "<a href='/lb-detail/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.GalleryName) + ".html'>" + item.GalleryName + "</a></div><p class='articledate'>";
                result += "<i class='fa fa-clock-o' aria-hidden='true'></i>" + item.CreateAt.Value.ToString("dd/MM/yyyy HH:mm:ss") + " / Đăng bởi: " + item.FullName + "</p><div class='intro-content'>";
                result += "<p>" + item.Description + "</p>";
                result += "</div><a class='readmore-page' href='/lb-detail/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.GalleryName) + ".html'>Xem thêm<i class='fa fa-arrow-right' aria-hidden='true'></i></a></div></div></div></div>";
            }

            lbNews.Text = result;
            int record = n.Count();
            if (record > recordPage)
            {
                lbPage.Text += "<ul class=\"pagination pagination-large\">";
                lbPage.Text += "<li><a href='/page/lookbook/1'>«</a></li>";
                string active = ""; int p_start = 1;
                int    spage = record % recordPage == 0 ? record / recordPage : (record / recordPage) + 1;

                int max_page = p_start + 4;

                if (page >= 3)
                {
                    p_start  = page - 2;
                    max_page = page + 2;
                }
                if (max_page > spage)
                {
                    max_page = spage;
                }

                for (int i = p_start; i <= max_page; i++)
                {
                    if (i == page)
                    {
                        active = "class='active'";
                    }
                    else
                    {
                        active = "";
                    }
                    lbPage.Text += "<li " + active + "><a href='/page/lookbook/" + i.ToString() + "'>" + i.ToString() + "</a></li>";
                }
                lbPage.Text += "<li><a href='/page/lookbook/" + spage.ToString() + "'>»</a></li>";
                lbPage.Text += "</ul>";
            }
        }
        catch
        {
            Response.Redirect("/notfound");
        }
    }
Ejemplo n.º 17
0
    public string loadGallery(string branchType)
    {
        string result = ""; int i = 1;

        var m = from x in db.tGalleries where x.BranchTypeId == int.Parse(branchType.Trim()) && x.Status == 1 select new { x.Id, x.GalleryName, x.Description };

        foreach (var item in m.ToList())
        {
            result += "<tr class='detail-rows' id='" + item.Id.ToString() + "' title='Click để xem chi tiết'>";
            result += "<td class='center childrows'></td>";
            result += "<td><span style='font-weight:bold;'><a href='/gl-detail/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.GalleryName) + ".html'>" + item.GalleryName + "</a></span></br><span style='font-size:11px; font-style:italic;'>" + item.Description + "</span></td>";
            result += "</tr>";
            i++;
        }
        return(result);
    }
Ejemplo n.º 18
0
    public void productTab()
    {
        clsProcess           cl = new clsProcess();
        CFManagerDataContext db = new CFManagerDataContext();
        string result = "", content = "";
        var    type = from x in db.tProductTypes where x.BranchTypeId == branchTypeId && x.ParentTypeId == null && x.Status == 1 select x;

        foreach (var item in type.ToList())
        {
            result  += "<li rel='" + cl.ConvertToUnSign(item.ProductTypeName) + "'><span>" + item.ProductTypeName + "</span></li>";
            content += "<div id='" + cl.ConvertToUnSign(item.ProductTypeName) + "' class='tab_content'><div class='owl-demo-tabproduct'>";
            string ref_member = getRefMember();
            var    pro        = db.sp_web_cf_loadProductByType(branchTypeId.ToString(), item.Id);

            foreach (var x in pro.ToList())
            {
                content += "<div class='row_items'><div class='item'><div class='item-inner'><div class='images-container'>";
                if (x.NoteSale != null && x.NoteSale != "")
                {
                    content += "<div class='label-pro-new'><span>" + x.NoteSale + "</span></div>";
                }

                content += "<a class='product-image' href='/" + ref_member + "detail/" + x.Id.ToString() + "/" + cl.ConvertToUnSign(x.ProductName) + ".html'><div class='product-image'>";
                content += "<img src='" + (x.Image == null || x.Image == "" ? "/image/image-coming-soon.png" : x.Image) + "' alt='" + x.ProductName + "' class='img-responsive lazy imgzoom' /></div></a>";

                content += "</div><div class='des-container'>";
                content += "<p class='tags-product'>";
                if (x.Tag != null && x.Tag != "")
                {
                    if (x.Tag.Contains(","))
                    {
                        var t = x.Tag.Split(',');
                        foreach (var tg in t)
                        {
                            content += "<a href='/search/?k=" + Server.UrlEncode(tg) + "'>#" + tg + "</a>";
                        }
                    }
                    else
                    {
                        content += "<a href='/search/?k=" + Server.UrlEncode(x.Tag.Trim()) + "'>#" + x.Tag.Trim() + "</a>";
                    }
                }
                else
                {
                    result += "<a href='#'></a>";
                }

                content += "</p>";
                content += " <h2 class='product-name'>";
                content += "<a href='/" + ref_member + "detail/" + x.Id.ToString() + "/" + cl.ConvertToUnSign(x.ProductName) + ".html'>" + x.ProductTypeCode + " - " + x.ProductName + "</a></h2>";
                content += "<div class='price-box'>";
                content += "<p class='special-price'>";
                if (x.PriceSale == 0 || x.PriceSale == x.Price)
                {
                    content += "<span class='price'>" + string.Format("{0:0,0 đ}", x.Price) + "</span>";
                }
                else
                {
                    content += "<span class='price'>" + string.Format("{0:0,0 đ}", x.PriceSale) + "</span><span class='price' style='font-size:12px;padding-left:5px;'><del>" + string.Format("{0:0,0 đ}", x.Price) + "</del></span>";
                }
                content += "</p>";
                content += "</div>";
                content += "<button class='button btn-cart' type='button' onclick=\"addCart(" + x.Id.ToString() + ",'" + x.ProductName + "',1" + ",'" + x.Image + "','" + string.Format("{0:0,0}", (x.Price == x.PriceSale ? x.Price.Value : x.PriceSale.Value)) + "',0)\" data-toggle='tooltip' title='Thêm nhanh vào giỏ hàng'>";
                content += "<span>Giỏ hàng</span></button>-";
                content += "<button class='button btn-quick' type='button' data-toggle='modal' data-target='#addQuickModal' onclick=\"showAddQuick(" + x.Id.ToString() + ",'" + x.ProductName + "','" + string.Format("{0:0,0}", (x.Price == x.PriceSale ? x.Price.Value : x.PriceSale.Value)) + "'," + (x.Price == x.PriceSale ? x.Price.ToString() : x.PriceSale.ToString()) + ")\" data-toggle='tooltip' title='Thử đồ sản phẩm này'>";
                content += "<span><span>Thử đồ</span></span></button>";
                content += "<div class='box-hover'><div class='ratings'><div class='rating-box'><div class='rating5'>";
                content += "rating</div></div></div></div></div></div></div></div>";
            }
            content += "</div></div>";
        }
        lbTab.Text     = result;
        lbProduct.Text = content;
    }
Ejemplo n.º 19
0
    public void productFeature()
    {
        clsProcess           cl = new clsProcess();
        CFManagerDataContext db = new CFManagerDataContext();
        var    pro = db.sp_web_cf_loadProductFeature(branchTypeId.ToString());
        string result = ""; int count = 0;
        string ref_member = getRefMember();

        foreach (var item in pro.ToList())
        {
            count++;
            if (count == 1 || count % 2 == 1)
            {
                result += "<div class='row_items'>";
            }

            result += "<div class='item'><div class='item-inner'><div class='images-container'>";
            if (item.NoteSale != null && item.NoteSale != "")
            {
                result += "<div class='label-pro-new'><span>" + item.NoteSale + "</span></div>";
            }

            result += "<a class='product-image' href='/" + ref_member + "detail/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.ProductName) + ".html'><img src='" + (item.Image == null || item.Image == "" ? "/image/image-coming-soon.png" : item.Image) + "' alt='" + item.ProductName + "' class='img-responsive lazy imgzoom' /></a>";

            result += "</div><div class='des-container'>";
            result += "<p class='tags-product'>";
            if (item.Tag != null && item.Tag != "")
            {
                if (item.Tag.Contains(","))
                {
                    var t = item.Tag.Split(',');
                    foreach (var tg in t)
                    {
                        result += "<a href='/search/?k=" + Server.UrlEncode(tg) + "'>#" + tg + "</a>";
                    }
                }
                else
                {
                    result += "<a href='/search/?k=" + Server.UrlEncode(item.Tag.Trim()) + "'>#" + item.Tag.Trim() + "</a>";
                }
            }
            else
            {
                result += "<a href='#'></a>";
            }

            result += "</p>";
            result += "<h2 class='product-name'><a href='/" + ref_member + "detail/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.ProductName) + ".html'>" + item.ProductTypeCode + " - " + item.ProductName + "</a></h2>";
            result += "<div class='price-box box-special'><p class='special-price'>";

            if (item.PriceSale == 0 || item.Price == item.PriceSale)
            {
                result += "<span class='price'>" + string.Format("{0:0,0 đ}", item.Price) + "</span>";
            }
            else
            {
                result += "<span class='price'>" + string.Format("{0:0,0 đ}", item.PriceSale) + "</span><span class='price' style='font-size:12px;padding-left:5px;'><del>" + string.Format("{0:0,0 đ}", item.Price) + "</del></span>";
            }
            result += "</p></div>";


            result += "<button class='button btn-cart' type='button' onclick=\"addCart(" + item.Id.ToString() + ",'" + item.ProductName + "',1" + ",'" + item.Image + "','" + string.Format("{0:0,0}", (item.Price == item.PriceSale ? item.Price.Value : item.PriceSale.Value)) + "',0)\" data-toggle='tooltip' title='Thêm nhanh vào giỏ hàng'>";
            result += "<span><span>Giỏ hàng</span></span></button>-";
            result += "<button class='button btn-quick' type='button' data-toggle='modal' data-target='#addQuickModal' onclick=\"showAddQuick(" + item.Id.ToString() + ",'" + item.ProductName + "','" + string.Format("{0:0,0}", (item.Price == item.PriceSale ? item.Price.Value : item.PriceSale.Value)) + "'," + (item.Price == item.PriceSale ? item.Price.ToString() : item.PriceSale.ToString()) + ")\" data-toggle='tooltip' title='Thử đồ sản phẩm này'>";
            result += "<span><span>Thử đồ</span></span></button>";
            result += "<div class='box-hover'><div class='ratings'><div class='rating-box'><div class='rating5'>rating</div>";
            result += "</div></div></div></div></div></div>";

            if (count % 2 == 0)
            {
                result += "</div>";
            }
        }
        lbFProduct.Text = result;
    }
Ejemplo n.º 20
0
    public string loadNews(string branchType)
    {
        string result = ""; int i = 1;

        var m = db.sp_web_loadNews(branchType);

        foreach (var item in m.ToList())
        {
            result += "<tr class='detail-rows' id='" + item.Id.ToString() + "' title='Click để xem chi tiết'>";

            result += "<td><img width='120px' height='80px' ";
            if (item.Image != null)
            {
                if (branchType == "1")
                {
                    result += "src ='" + item.Image.Replace("/upload/", "/upload/cnice/") + "' alt='" + item.Title + "'></td>";
                }
                else if (branchType == "2")
                {
                    result += "src ='" + item.Image.Replace("/upload/", "/upload/cfashion/") + "' alt='" + item.Title + "'></td>";
                }
            }
            else
            {
                result += "src ='' alt='" + item.Title + "'></td>";
            }
            result += "<td><span style='font-weight:bold;'><a href='/detail-news/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title) + ".html'>" + item.Title + "</a></span></br><span style='font-size:11px; font-style:italic;'>" + item.Description + "</span></td>";
            result += "<td style='width:200px;'>" + item.Type + "</td>";
            result += "<td style='width:100px;'>" + item.Status + "</td>";
            result += "<td style='width:100px;'>" + item.CreateAt + "</td>";
            result += "<td style='width:100px;'>" + item.CreateBy + "</td>";
            result += "</tr>";
            i++;
        }
        return(result);
    }
Ejemplo n.º 21
0
    private void loadMenuCN()
    {
        string mn = "";
        var    m  = from x in db.tNews
                    where x.BranchTypeId == branchTypeId && x.Status == 1 && x.Type == 0
                    select new { x.Id, x.Title };

        foreach (var item in m.ToList())
        {
            mn += "<div class='column' style='width: 405px;'><div class='itemMenu level1'><a class='itemMenuName level0 actParent' href='/cnice/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.Title) + ".html' style='font-size:14px;'><span>" + item.Title + "</span></a></div></div>";
        }
        lbCF.Text = mn;
    }
Ejemplo n.º 22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                try
                {
                    string id = Request.QueryString["id"];
                    int    sId, menuId;
                    bool   checkId = int.TryParse(id, out sId);
                    if (checkId)
                    {
                        var details = from x in db.tNews where x.Id == sId select new { x.Title, x.Description, x.Body, x.CreateAt, x.ModifiedAt, x.Image, x.MenuId, x.Tag };
                        if (details != null)
                        {
                            lbTitle.Text = lbTitle2.Text = details.FirstOrDefault().Title;
                            lbBody.Text  = details.FirstOrDefault().Body;
                            Title        = lbTitle.Text;
                            lbImage.Text = "<img width=\"835px\" height=\"auto\" src=\"" + details.FirstOrDefault().Image.Trim() + "\" class=\"attachment-full size-full wp-post-image\" alt=\"\" sizes=\"100vw\">";
                            menuId       = details.FirstOrDefault().MenuId.Value;
                            var ct = from n in db.tMenus where n.Id == menuId select new { n.Name, n.ParentId, n.Id };
                            if (ct != null)
                            {
                                if (ct.FirstOrDefault().ParentId != null)
                                {
                                    var par = from m in db.tMenus where m.Id == ct.FirstOrDefault().ParentId select new { m.Name };
                                    lbSubmenu.Text += "<li><a href=\"#\">" + par.FirstOrDefault().Name + "</a></li>";
                                }
                                lbSubmenu.Text += "<li><a href=\"/tin-tuc/" + ct.FirstOrDefault().Id.ToString() + "/" + cl.ConvertToUnSign(ct.FirstOrDefault().Name) + ".hcc" + "\">" + ct.FirstOrDefault().Name + "</a></li>";
                            }
                            var tag = details.FirstOrDefault().Tag;
                            if (tag != null && tag.Trim().Contains(","))
                            {
                                var t = details.FirstOrDefault().Tag.Split(',');
                                foreach (var t1 in t.ToList())
                                {
                                    lbTag.Text  += "<a href=\"/keyword/" + cl.ConvertToUnSign(t1) + "\" rel=\"tag\">" + t1 + "</a>";
                                    lbTag2.Text += "<a href=\"/keyword/" + cl.ConvertToUnSign(t1) + "\" class=\"tag-cloud-link tag-link-14 tag-link-position-8\" style=\"font-size: 22pt;\" aria-label=\"Tags (10 items)\">" + t1 + "</a>";
                                }
                            }
                            else
                            {
                                lbTag.Text += "<a href=\"/keyword/" + cl.ConvertToUnSign(tag) + "\" rel=\"tag\">" + tag + "</a>";
                            }
                            var news_popular = (from k in db.tNews
                                                from n in db.tAccounts
                                                where k.IsActive == true && k.Id != sId && k.MenuId == menuId && k.CreateBy == n.Id
                                                select new { k.Id, k.Title, k.CreateAt, Name = n.FullName }).Skip(0).Take(5);
                            lbNewsPopular.Text = "<ul>";
                            foreach (var v in news_popular.ToList())
                            {
                                lbNewsPopular.Text += "<li><a href=\"/bai-viet/" + v.Id.ToString() + "/" + cl.ConvertToUnSign(v.Title.Trim()) + ".hcc" + "\">" + v.Title + "</a><span>Viết bởi:<b> " + v.Name + "</b></span><span>" + v.CreateAt.Value.ToString("dd/MM/yyyy hh:mm") + "</span></li>";
                            }
                            lbNewsPopular.Text += "</ul>";

                            var news_recent = (from k in db.tNews from n in db.tAccounts where k.Id != sId && k.IsActive == true && k.CreateBy == n.Id orderby k.CreateAt descending select new { k.Id, k.Image, k.Title, k.CreateAt, Name = n.FullName }).Skip(0).Take(5);
                            lbNewsRecent.Text = "<ul>";
                            foreach (var g in news_recent.ToList())
                            {
                                lbNewsRecent.Text += "<li><div class=\"img-thumb\"> <img width=\"80\" height=\"80\" src=\"" + g.Image.Trim() + "\" class=\"wp-post-image\" alt=\"\" sizes=\"(max-width: 80px) 100vw, 80px\"></div><div class=\"text-col\">";
                                lbNewsRecent.Text += "<a href=\"/bai-viet/" + g.Id.ToString() + "/" + cl.ConvertToUnSign(g.Title.Trim()) + ".hcc" + "\">" + g.Title + "</a><span>Viết bởi:<b> " + g.Name + "</b></span><span>" + g.CreateAt.Value.ToString("dd/MM/yyyy hh:mm") + "</span></div></li>";
                            }
                            lbNewsRecent.Text += "</ul>";
                        }
                    }
                    else
                    {
                        Response.Redirect("/home");
                    }
                }
                catch (Exception ax)
                {
                    Response.Redirect("/home");
                }
            }
        }
    }
Ejemplo n.º 23
0
    public void getDetailProduct(int id)
    {
        try
        {
            var p = db.sp_web_cf_loadProductDetail(branchTypeId.ToString(), id).ToList();
            if (p.Count() > 0)
            {
                //lbProductCode.Text = p.FirstOrDefault().ProductCode;
                //lbCountryName.Text = p.FirstOrDefault().CountryName;
                hdProductTypeCode.Value = p.FirstOrDefault().ProductTypeCode;
                //lbProductCodeId.Text = p.FirstOrDefault().SKU;
                //lbBrand.Text = p.FirstOrDefault().BrandName;
                lbCodeId.Text      = p.FirstOrDefault().CodeId;
                lbDescription.Text = p.FirstOrDefault().Description;
                lbInfoProduct.Text = p.FirstOrDefault().Content;
                hdColorName.Value  = p.FirstOrDefault().ColorName;
                hdSizeName.Value   = p.FirstOrDefault().SizeName;

                if (p.FirstOrDefault().NoteSale != null && p.FirstOrDefault().NoteSale != "")
                {
                    lbNoteSale.Text = "Khuyến mại: <span style='color:#114404;font-weight:bold;'>" + p.FirstOrDefault().NoteSale + "</span>";
                }
                else
                {
                    lbNoteSale.Text = "";
                }
                var size = p.FirstOrDefault().SizeList;

                if (size.Contains("#"))
                {
                    var tmp    = size.Split('#');
                    var active = "";
                    for (int i = 0; i < tmp.Length - 1; i++)
                    {
                        var z     = tmp[i];
                        var cId   = z.Split('@')[0];
                        var cName = z.Split('@')[1];

                        if (p.FirstOrDefault().SizeId == int.Parse(cId.Trim()))
                        {
                            active = " active";
                        }
                        else
                        {
                            active = "";
                        }

                        if (active != "")
                        {
                            lbSize.Text += "<label onclick='return setSize(\"" + cId + "\",\"" + cName + "\");' class='btn" + active + "'><input type='radio' name='size' value='" + cId + "' checked><span> " + cName + "</span></label>";
                        }
                        else
                        {
                            lbSize.Text += "<label onclick='return setSize(\"" + cId + "\",\"" + cName + "\");' class='btn" + active + "'><input type='radio' name='size' value='" + cId + "'><span> " + cName + "</span></label>";
                        }
                    }
                }
                else
                {
                    var z     = size.Split('@');
                    var cId   = z[0];
                    var cName = z[1];
                    lbSize.Text = "<label onclick='return setSize(\"" + cId + "\",\"" + cName + "\");' class='btn active'><input type='radio' name='size' value='" + cId + "' checked><span> " + cName + "</span></label>";
                }

                var color = p.FirstOrDefault().ColorList;
                if (color.Contains("#"))
                {
                    var tmp    = color.Split('#');
                    var active = "";
                    for (int i = 0; i < tmp.Length - 1; i++)
                    {
                        var z     = tmp[i];
                        var cId   = z.Split('@')[0];
                        var cName = z.Split('@')[1];

                        if (p.FirstOrDefault().ColorId == int.Parse(cId.Trim()))
                        {
                            active = " active";
                        }
                        else
                        {
                            active = "";
                        }

                        if (active != "")
                        {
                            lbColor.Text += "<label onclick='return setColor(\"" + cId + "\",\"" + cName + "\");' class='btn" + active + "'><input type='radio' name='color' checked><span> " + cName + "</span></label>";
                        }
                        else
                        {
                            lbColor.Text += "<label onclick='return setColor(\"" + cId + "\",\"" + cName + "\");' class='btn" + active + "'><input type='radio' name='color'><span> " + cName + "</span></label>";
                        }
                    }
                }
                else
                {
                    var z     = color.Split('@');
                    var cId   = z[0];
                    var cName = z[1];
                    lbColor.Text = "<label onclick='return setColor(\"" + cId + "\",\"" + cName + "\");' class='btn active'><input type='radio' name='color' value='" + cId + "' checked><span> " + cName + "</span></label>";
                }
                string imgZoomFirst = (p.FirstOrDefault().ImageZoom == null || p.FirstOrDefault().ImageZoom == "") ? (p.FirstOrDefault().Image == null || p.FirstOrDefault().Image == "" ? "/image/image-coming-soon.png" : p.FirstOrDefault().Image) : p.FirstOrDefault().ImageZoom;
                if (imgZoomFirst.Contains("#"))
                {
                    imgZoomFirst = imgZoomFirst.Split('#')[0];
                }
                lbImage.Text       = "<a class='thumbnail' title='" + p.FirstOrDefault().ProductName + "'><img id='img_product' src='" + imgZoomFirst + "' data-zoom-image='" + imgZoomFirst + "' title='" + p.FirstOrDefault().ProductName + "' alt='" + p.FirstOrDefault().ProductName + "' /></a>";
                Title              = lbLinkProduct.Text = lbProductName.Text = hdProductName.Value = p.FirstOrDefault().ProductTypeCode + " - " + p.FirstOrDefault().ProductName;
                liID.Text          = hdProductId.Value = p.FirstOrDefault().Id.ToString();
                liProductCode.Text = p.FirstOrDefault().ProductCode;
                liImage.Text       = hdImage.Value = p.FirstOrDefault().Image;
                liScore.Text       = p.FirstOrDefault().Score == null ? "0" : p.FirstOrDefault().Score.ToString();

                if (p.FirstOrDefault().Price == p.FirstOrDefault().PriceSale)
                {
                    lbPrice.Text = "<p class='special-price'><span class='price'>" + string.Format("{0:0,0 đ}", p.FirstOrDefault().Price) + "</span></p>";
                }
                else
                {
                    lbPrice.Text = "<p class='special-price'><span class='price'>" + string.Format("{0:0,0 đ}", p.FirstOrDefault().PriceSale) + "</span><span class='price' style='font-size:15px;padding-left:5px;'><del>" + string.Format("{0:0,0 đ}", p.FirstOrDefault().Price) + "</del></span></p>";
                }
                //if (p.FirstOrDefault().Price.Value >999)
                //    lbPrice.Text = "<p class='special-price'><span class='price'>" + string.Format("{0:0,0 đ}", p.FirstOrDefault().Price) + "</span></p>";
                //else
                //    lbPrice.Text = "<p class='special-price'><span class='price'>" + (p.FirstOrDefault().Price.Value==0 ? "---" : p.FirstOrDefault().Price.ToString() + " đ") + "</span></p>";

                hdColor.Value    = p.FirstOrDefault().ColorId.ToString();
                hdSize.Value     = p.FirstOrDefault().SizeId.ToString();
                hdSale.Value     = "0";
                liPriceSale.Text = "0";
                liPrice.Text     = p.FirstOrDefault().PriceSale == p.FirstOrDefault().Price ? p.FirstOrDefault().Price.ToString() : p.FirstOrDefault().PriceSale.ToString();
                hdPrice.Value    = string.Format("{0:0,0 đ}", (p.FirstOrDefault().PriceSale == p.FirstOrDefault().Price ? p.FirstOrDefault().Price : p.FirstOrDefault().PriceSale));

                string tag = p.FirstOrDefault().Tag;
                if (tag != null && tag.Contains(","))
                {
                    var m = tag.Split(',');
                    for (int i = 0; i < m.Length; i++)
                    {
                        lbTag.Text += " <a href='/search/?k=" + Server.UrlEncode(m[i]) + "'>#" + m[i] + "</a>";
                    }
                }
                else
                {
                    lbTag.Text = "<a href='/search/?k=" + Server.UrlEncode(tag) + "'>#" + tag + "</a>";
                }
                //loadImageZoom((p.FirstOrDefault().ImageZoom == null || p.FirstOrDefault().ImageZoom =="") ? (p.FirstOrDefault().Image == null || p.FirstOrDefault().Image == "" ? "/image/image-coming-soon.png" : p.FirstOrDefault().Image) : p.FirstOrDefault().ImageZoom, p.FirstOrDefault().ProductName);
                loadImageZoom(p.FirstOrDefault().ListImage.Length < 5 ? "/image/image-coming-soon.png" : p.FirstOrDefault().ListImage, p.FirstOrDefault().ProductName);
                loadProductRandom(id);

                HtmlMeta seo_key = new HtmlMeta();
                seo_key.Name    = "keywords";
                seo_key.Content = "cfashion, thời trang, thoi trang, công sở, cong so,";
                Header.Controls.Add(seo_key);

                HtmlMeta seo_auth = new HtmlMeta();
                seo_auth.Name    = "description";
                seo_auth.Content = lbDescription.Text;
                Header.Controls.Add(seo_auth);

                HtmlMeta seo_copy = new HtmlMeta();
                seo_copy.Name    = "copyright";
                seo_copy.Content = "CFASHION.VN";
                Header.Controls.Add(seo_copy);

                HtmlMeta seo_des = new HtmlMeta();
                seo_des.Name    = "Author";
                seo_des.Content = "CFASHION.VN";
                Header.Controls.Add(seo_des);

                HtmlMeta seo_robot = new HtmlMeta();
                seo_robot.Name    = "robots";
                seo_robot.Content = "index,follow";
                Header.Controls.Add(seo_robot);

                HtmlMeta seo_url = new HtmlMeta();
                seo_url.Name    = "url";
                seo_url.Content = "http://cfashion.vn/detail/" + p.FirstOrDefault().Id.ToString() + "/" + cl.ConvertToUnSign(p.FirstOrDefault().ProductName) + ".html";
                Header.Controls.Add(seo_url);

                HtmlMeta seo_iden = new HtmlMeta();
                seo_iden.Name    = "identifier-URL";
                seo_iden.Content = "http://cfashion.vn";
                Header.Controls.Add(seo_iden);

                var seo_img = Convert.ToString(p.FirstOrDefault().ImageZoom);
                if (seo_img.Contains("#"))
                {
                    seo_img = seo_img.Substring(0, seo_img.IndexOf('#'));
                }
                HtmlMeta seo_og_img = new HtmlMeta();
                seo_og_img.Name    = "og:image";
                seo_og_img.Content = seo_img.Replace("/upload/", "http://cf.hcco.vn/upload/cfashion/");
                Header.Controls.Add(seo_og_img);

                HtmlMeta seo_og_url = new HtmlMeta();
                seo_og_url.Name    = "og:url";
                seo_og_url.Content = "http://cfashion.vn/detail/" + p.FirstOrDefault().Id.ToString() + "/" + cl.ConvertToUnSign(p.FirstOrDefault().ProductName) + ".html";
                Header.Controls.Add(seo_og_url);

                HtmlMeta seo_og_title = new HtmlMeta();
                seo_og_title.Name    = "og:title";
                seo_og_title.Content = lbProductName.Text;
                Header.Controls.Add(seo_og_title);

                HtmlMeta seo_og_site = new HtmlMeta();
                seo_og_site.Name    = "og:site_name";
                seo_og_site.Content = "CFASHION.VN";
                Header.Controls.Add(seo_og_site);

                HtmlMeta seo_fbid = new HtmlMeta();
                seo_fbid.Name    = "fb:page_id";
                seo_fbid.Content = "308537856275021";
                Header.Controls.Add(seo_fbid);

                HtmlMeta seo_email = new HtmlMeta();
                seo_email.Name    = "og:email";
                seo_email.Content = "*****@*****.**";
                Header.Controls.Add(seo_email);

                HtmlMeta seo_phone = new HtmlMeta();
                seo_phone.Name    = "og:phone_number";
                seo_phone.Content = "024 22 18 95 95";
                Header.Controls.Add(seo_phone);
            }
            else
            {
                Response.Redirect("/notfound");
            }
        }
        catch
        {
            Response.Redirect("/notfound");
        }
    }
Ejemplo n.º 24
0
    public void getDetailProduct(int id)
    {
        try
        {
            var p = db.sp_web_cn_loadProductDetail(branchTypeId.ToString(), id).ToList();
            if (p.Count() > 0)
            {
                lbProductCode.Text = p.FirstOrDefault().ProductCode;
                lbCountryName.Text = p.FirstOrDefault().CountryName;
                lbBrand.Text       = p.FirstOrDefault().BrandName;
                lbDescription.Text = p.FirstOrDefault().Description;
                lbInfoProduct.Text = p.FirstOrDefault().Content;
                string img = p.FirstOrDefault().Image;
                if (img == "")
                {
                    img = "/image/image-coming-soon.png";
                }
                string img_zoom = p.FirstOrDefault().ImageZoom;
                if (img_zoom == "")
                {
                    img_zoom = "/image/image-coming-soon.png";
                }

                lbImage.Text       = "<a class='thumbnail' title='" + p.FirstOrDefault().ProductName + "'><img src='" + img + "' data-zoom-image='" + img_zoom + "' title='" + p.FirstOrDefault().ProductName + "' alt='" + p.FirstOrDefault().ProductName + "' /></a>";
                Title              = lbLinkProduct.Text = lbProductName.Text = hdProductName.Value = p.FirstOrDefault().ProductName;
                liID.Text          = hdProductId.Value = p.FirstOrDefault().Id.ToString();
                liProductCode.Text = p.FirstOrDefault().ProductCode;
                liImage.Text       = hdImage.Value = img;
                liScore.Text       = p.FirstOrDefault().Score == null ? "0" : p.FirstOrDefault().Score.ToString();
                lbPrice.Text       = "<p class='special-price'><span class='price'>" + string.Format("{0:0,0 đ}", p.FirstOrDefault().Price) + "</span></p>";

                hdSale.Value     = "0";
                liPriceSale.Text = "0";
                liPrice.Text     = p.FirstOrDefault().Price.ToString();
                hdPrice.Value    = string.Format("{0:0,0 đ}", p.FirstOrDefault().Price);

                string tag = p.FirstOrDefault().Tag;
                if (tag != null && tag.Contains(","))
                {
                    var m = tag.Split(',');
                    for (int i = 0; i < m.Length; i++)
                    {
                        lbTag.Text += " <a href='/search/?k=" + Server.UrlEncode(m[i]) + "'>#" + m[i] + "</a>";
                    }
                }
                else
                {
                    lbTag.Text = "<a href='/search/?k=" + Server.UrlEncode(tag) + "'>#" + tag + "</a>";
                }
                loadImageZoom(img_zoom, p.FirstOrDefault().ProductName);

                loadProductRandom(id);

                HtmlMeta seo_key = new HtmlMeta();
                seo_key.Name    = "keywords";
                seo_key.Content = "cnice, mỹ phẩm thiên nhiên, my pham thien nhien";
                Header.Controls.Add(seo_key);

                HtmlMeta seo_auth = new HtmlMeta();
                seo_auth.Name    = "description";
                seo_auth.Content = lbDescription.Text;
                Header.Controls.Add(seo_auth);

                HtmlMeta seo_copy = new HtmlMeta();
                seo_copy.Name    = "copyright";
                seo_copy.Content = "CNICE.VN";
                Header.Controls.Add(seo_copy);

                HtmlMeta seo_des = new HtmlMeta();
                seo_des.Name    = "Author";
                seo_des.Content = "CNICE.VN";
                Header.Controls.Add(seo_des);

                HtmlMeta seo_robot = new HtmlMeta();
                seo_robot.Name    = "robots";
                seo_robot.Content = "index,follow";
                Header.Controls.Add(seo_robot);

                HtmlMeta seo_url = new HtmlMeta();
                seo_url.Name    = "url";
                seo_url.Content = "http://cnice.vn/detail/" + p.FirstOrDefault().Id.ToString() + "/" + cl.ConvertToUnSign(p.FirstOrDefault().ProductName) + ".html";
                Header.Controls.Add(seo_url);

                HtmlMeta seo_iden = new HtmlMeta();
                seo_iden.Name    = "identifier-URL";
                seo_iden.Content = "http://cnice.vn";
                Header.Controls.Add(seo_iden);

                var seo_img = Convert.ToString(p.FirstOrDefault().ImageZoom);
                if (seo_img.Contains("#"))
                {
                    seo_img = seo_img.Substring(0, seo_img.IndexOf('#'));
                }
                HtmlMeta seo_og_img = new HtmlMeta();
                seo_og_img.Name    = "og:image";
                seo_og_img.Content = seo_img.Replace("/upload/", "http://cf.hcco.vn/upload/cnice/");
                Header.Controls.Add(seo_og_img);

                HtmlMeta seo_og_url = new HtmlMeta();
                seo_og_url.Name    = "og:url";
                seo_og_url.Content = "http://cnice.vn/detail/" + p.FirstOrDefault().Id.ToString() + "/" + cl.ConvertToUnSign(p.FirstOrDefault().ProductName) + ".html";
                Header.Controls.Add(seo_og_url);

                HtmlMeta seo_og_title = new HtmlMeta();
                seo_og_title.Name    = "og:title";
                seo_og_title.Content = lbProductName.Text;
                Header.Controls.Add(seo_og_title);

                HtmlMeta seo_og_site = new HtmlMeta();
                seo_og_site.Name    = "og:site_name";
                seo_og_site.Content = "CNICE.VN";
                Header.Controls.Add(seo_og_site);

                HtmlMeta seo_fbid = new HtmlMeta();
                seo_fbid.Name    = "fb:page_id";
                seo_fbid.Content = "232141077312902";
                Header.Controls.Add(seo_fbid);

                HtmlMeta seo_email = new HtmlMeta();
                seo_email.Name    = "og:email";
                seo_email.Content = "*****@*****.**";
                Header.Controls.Add(seo_email);

                HtmlMeta seo_phone = new HtmlMeta();
                seo_phone.Name    = "og:phone_number";
                seo_phone.Content = "024 22 15 73 73";
                Header.Controls.Add(seo_phone);
            }
            else
            {
                Response.Redirect("/notfound");
            }
        }
        catch
        {
            Response.Redirect("/notfound");
        }
    }
Ejemplo n.º 25
0
    private void loadProduct(string keyword)
    {
        try
        {
            string result     = "";
            string ref_member = getRefMember();
            var    p          = db.sp_web_cn_loadProductBySearch(branchTypeId.ToString(), keyword.Trim());
            foreach (var item in p.ToList())
            {
                result += "<div class='product-layout product-list '><div class='item itemi'>";
                result += "<div class='item-inner'><div class='col-image'><div class='images-container'>";

                result += "<div class='label-pro-new'><span>New !</span></div>";
                result += "<a href='/" + ref_member + "detail/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.ProductName) + ".html'><img src='" + item.Image + "' alt='" + item.ProductName + "' title='" + item.ProductName + "' class='img-responsive lazy' /></a>";

                result += "</div></div><div class='col-des'><div class='des-container'>";
                result += "<p class='tags-product'>";
                if (item.Tag != null && item.Tag != "")
                {
                    if (item.Tag.Contains(","))
                    {
                        var t = item.Tag.Split(',');
                        foreach (var tg in t)
                        {
                            result += "<a href='/search/?k=" + Server.UrlEncode(tg) + "'>#" + tg + "</a>";
                        }
                    }
                    else
                    {
                        result += "<a href='/search/?k=" + Server.UrlEncode(item.Tag.Trim()) + "'>#" + item.Tag.Trim() + "</a>";
                    }
                }

                result += "</p>";
                result += "<h2 class='product-name'><a href='/" + ref_member + "detail/" + item.Id.ToString() + "/" + cl.ConvertToUnSign(item.ProductName) + ".html'>" + item.ProductName + "</a></h2>";
                result += "<div class='price-box box-special'>";
                result += "<p class='special-price'><span class='price'>" + string.Format("{0:0,0 đ}", item.Price) + "</span></p>";

                result += "</div>";
                result += "<p class='product-des'>" + item.Description + "</p>";
                result += "<button class='button btn-cart' type='button' data-toggle='tooltip' onclick=\"addCart(" + item.Id.ToString() + ",'" + item.ProductName + "','1'" + ",'" + item.Image + "','" + string.Format("{0:0,0}", item.Price) + "',0)\" title='Thêm nhanh vào giỏ hàng'><span><span>Thêm vào giỏ hàng</span></span></button>";
                result += "<div class='box-hover'><div class='ratings'><div class='rating-box'><div class='rating2'>rating</div>";
                result += "</div></div></div></div></div></div></div></div>";
            }
            lbProduct.Text = result;
        }
        catch
        {
            Response.Redirect("/notfound");
        }
    }