public PartialViewResult AdwLeftExt()
        {
            tblConfig config = db.tblConfigs.First();
            string    chuoi  = "";

            if (config.PopupSupport == true)
            {
                var listImage = db.tblImages.Where(p => p.Active == true && p.idCate == 8).OrderByDescending(p => p.Ord).Take(1).ToList();
                if (listImage.Count > 0)
                {
                    chuoi += "<div class=\"float-ck\" style=\"left: 0px\">";
                    chuoi += "<div id=\"hide_float_left\">";
                    chuoi += "<a href=\"javascript:hide_float_left()\">Tắt Quảng Cáo [X]</a>";
                    chuoi += "</div>";
                    chuoi += "<div id=\"float_content_left\"> ";
                    if (listImage[0].Link == true)
                    {
                        chuoi += "<a href=\"" + listImage[0].Url + "\" target=\"_blank\" title=\"" + listImage[0].Name + "\"><img src=\"" + listImage[0].Images + "\" alt=\"" + listImage[0].Name + "\"/></a>";
                    }
                    else
                    {
                        chuoi += "<a href=\"" + listImage[0].Url + "\" target=\"_blank\" title=\"" + listImage[0].Name + "\" rel=\"" + listImage[0].Link + "\"><img src=\"" + listImage[0].Images + "\" alt=\"" + listImage[0].Name + "\"/></a>";
                    }

                    chuoi += "</div>";
                    chuoi += "</div>";
                }
            }
            ViewBag.popupSuport = chuoi;
            return(PartialView());
        }
Example #2
0
        public PartialViewResult SupportPartial()
        {
            tblConfig tblconfig   = db.tblConfigs.Find(1);
            string    chuoisuport = "";
            var       listSupport = db.tblSupports.Where(p => p.Active == true).OrderBy(p => p.Ord).ToList();

            chuoisuport += " <div id=\"Support\">";
            chuoisuport += "<div id=\"Top_Support\"> <span>Hỗ trợ trực tuyến</span></div>";
            chuoisuport += "<div id=\"Bottom_Support\">";
            for (int i = 0; i < listSupport.Count; i++)
            {
                chuoisuport += "<div class=\"Tear_Support\">";
                chuoisuport += "<div class=\"Left\">";
                chuoisuport += "<span class=\"sp1\">" + listSupport[i].Mission + " :</span>";
                chuoisuport += "<span class=\"sp2\">" + listSupport[i].Name + " :</span>";
                chuoisuport += "</div>";
                chuoisuport += "<div class=\"Right\">";
                chuoisuport += "<div class=\"Yahoo\">";
                chuoisuport += "<a href=\"ymsgr:sendim?" + listSupport[i].Yahoo + "\">";
                chuoisuport += "<img src=\"http://opi.yahoo.com/online?u=" + listSupport[i].Yahoo + "&m=g&t=1\" alt=\"Yahoo\" class=\"imgYahoo\" />";
                chuoisuport += " </a>";
                chuoisuport += "</div>";
                chuoisuport += " <div class=\"Skype\">";
                chuoisuport += "<a href=\"Skype:" + listSupport[i].Skyper + "?chat\">";
                chuoisuport += "<img class=\"imgSkyper\" src=\"/Content/Display/iCon/skype-icon.png\" title=\"Kangaroo\" alt=\"Skyper\">";
                chuoisuport += "</a>";
                chuoisuport += "</div>";
                chuoisuport += "</div>";
                chuoisuport += " </div>";
            }
            chuoisuport  += "</div><div class=\"Clear\"></div> </div>";
            ViewBag.chuoi = chuoisuport;
            return(PartialView(tblconfig));
        }
        public PartialViewResult Popup()
        {
            tblConfig config = db.tblConfigs.First();
            string    chuoi  = "";

            if (config.Popup == true)
            {
                var listImage = db.tblImages.Where(p => p.Active == true && p.idCate == 7).OrderByDescending(p => p.Ord).Take(1).ToList();
                if (listImage.Count > 0)
                {
                    chuoi += "<div id=\"myModal\" class=\"linhnguyen-modal\">";
                    chuoi += "<a class=\"close-linhnguyen-modal\" title=\"đóng\">X</a>";
                    if (listImage[0].Link == true)
                    {
                        chuoi += "<a href=\"" + listImage[0].Url + "\" target=\"_blank\" title=\"" + listImage[0].Name + "\"><img src=\"" + listImage[0].Images + "\" alt=\"" + listImage[0].Name + "\"/></a>";
                    }
                    else
                    {
                        chuoi += "<a href=\"" + listImage[0].Url + "\" target=\"_blank\" title=\"" + listImage[0].Name + "\" rel=\"" + listImage[0].Link + "\"><img src=\"" + listImage[0].Images + "\" alt=\"" + listImage[0].Name + "\"/></a>";
                    }

                    chuoi += "</div>";
                }
            }
            ViewBag.Popup = chuoi;
            return(PartialView());
        }
Example #4
0
        public PartialViewResult Partialsidebar()
        {
            tblConfig tblconfig = db.tblConfigs.First();
            var       listMenu  = db.tblGroupProducts.Where(p => p.Active == true && p.ParentID == null).OrderBy(p => p.Ord).ToList();
            string    chuoi     = "";

            for (int i = 0; i < listMenu.Count; i++)
            {
                string tag = listMenu[i].Tag;

                chuoi += " <li class=\"li1\">";

                chuoi += " <a href=\"/" + listMenu[i].Tag + ".html\" title=\"" + listMenu[i].Name + "\">› " + listMenu[i].Name + "</a>";

                int idCate    = listMenu[i].id;
                var listMenu1 = db.tblGroupProducts.Where(p => p.ParentID == idCate && p.Active == true).OrderBy(p => p.Ord).ToList();
                if (listMenu1.Count > 0)
                {
                    chuoi += "<ul>";
                    for (int j = 0; j < listMenu1.Count; j++)
                    {
                        chuoi += "<li><a href=\"/" + listMenu1[j].Tag + ".html\" title=\"" + listMenu1[j].Name + "\">" + listMenu1[j].Name + "</a></li>";
                    }
                    chuoi += "</ul>";
                }


                chuoi += "</li>";
            }
            ViewBag.chuoi = chuoi;
            return(PartialView(tblconfig));
        }
Example #5
0
        public ActionResult Index()
        {
            if ((Request.Cookies["Username"] == null))
            {
                return(RedirectToAction("LoginIndex", "Login"));
            }

            if (ClsCheckRole.CheckQuyen(1, 0, int.Parse(Request.Cookies["Username"].Values["UserID"])) == true)
            {
                tblConfig tblconfig = db.tblConfigs.First();


                if (tblconfig == null)
                {
                    return(HttpNotFound());
                }
                if (Session["Thongbao"] != "")
                {
                    ViewBag.thongbao    = Session["Thongbao"];
                    Session["Thongbao"] = "";
                }
                return(View(tblconfig));
            }
            else
            {
                Session["Role"] = "<script>$(document).ready(function(){ alert('Bạn không có quyền truy cập vào tính năng này !') });</script>";
            }
            return(Redirect("/Users/Erro"));
        }
        public ActionResult Index()
        {
            tblConfig config = db.tblConfigs.First();

            ViewBag.Title       = "<title>" + config.Title + "</title>";
            ViewBag.dcTitle     = "<meta name=\"DC.title\" content=\"" + config.Title + "\" />";
            ViewBag.Description = "<meta name=\"description\" content=\"" + config.Description + "\"/>";
            ViewBag.Keyword     = "<meta name=\"keywords\" content=\"" + config.Keywords + "\" /> ";
            ViewBag.h1          = "<h1 class=\"h1\">" + config.Title + "</h1>";
            ViewBag.canonical   = "<link rel=\"canonical\" href=\"http://viglacerahanoi.com\" />";
            string meta = "";

            meta         += "<meta itemprop=\"name\" content=\"" + config.Name + "\" />";
            meta         += "<meta itemprop=\"url\" content=\"" + Request.Url.ToString() + "\" />";
            meta         += "<meta itemprop=\"description\" content=\"" + config.Description + "\" />";
            meta         += "<meta itemprop=\"image\" content=\"http://viglacerahanoi.com" + config.Logo + "\" />";
            meta         += "<meta property=\"og:title\" content=\"" + config.Title + "\" />";
            meta         += "<meta property=\"og:type\" content=\"product\" />";
            meta         += "<meta property=\"og:url\" content=\"" + Request.Url.ToString() + "\" />";
            meta         += "<meta property=\"og:image\" content=\"http://viglacerahanoi.com" + config.Logo + "\" />";
            meta         += "<meta property=\"og:site_name\" content=\"http://Loiloc\" />";
            meta         += "<meta property=\"og:description\" content=\"" + config.Description + "\" />";
            meta         += "<meta property=\"fb:admins\" content=\"\" />";
            ViewBag.Meta  = meta;
            ViewBag.chuoi = config.Content;
            return(View());
        }
        public ActionResult Index()
        {
            tblConfig tblconfig = db.tblConfigs.First();

            ViewBag.Title       = "<title>" + tblconfig.Title + "</title>";
            ViewBag.dcTitle     = "<meta name=\"DC.title\" content=\"" + tblconfig.Title + "\" />";
            ViewBag.Description = "<meta name=\"description\" content=\"" + tblconfig.Description + "\"/>";
            ViewBag.Keyword     = "<meta name=\"keywords\" content=\"" + tblconfig.Keywords + "\" /> ";
            ViewBag.canonical   = "<link rel=\"canonical\" href=\"http://Thietbivesinhcaesar.vn\" />";
            string meta = "";

            meta         += "<meta itemprop=\"name\" content=\"" + tblconfig.Name + "\" />";
            meta         += "<meta itemprop=\"url\" content=\"" + Request.Url.ToString() + "\" />";
            meta         += "<meta itemprop=\"description\" content=\"" + tblconfig.Description + "\" />";
            meta         += "<meta itemprop=\"image\" content=\"http://Thietbivesinhcaesar.vn" + tblconfig.Logo + "\" />";
            meta         += "<meta property=\"og:title\" content=\"" + tblconfig.Title + "\" />";
            meta         += "<meta property=\"og:type\" content=\"product\" />";
            meta         += "<meta property=\"og:url\" content=\"" + Request.Url.ToString() + "\" />";
            meta         += "<meta property=\"og:image\" content=\"http://Thietbivesinhcaesar.vn" + tblconfig.Logo + "\" />";
            meta         += "<meta property=\"og:site_name\" content=\"http://Thietbivesinhcaesar.vn\" />";
            meta         += "<meta property=\"og:description\" content=\"" + tblconfig.Description + "\" />";
            meta         += "<meta property=\"fb:admins\" content=\"\" />";
            ViewBag.Meta  = meta;
            Session["h1"] = "<h1 class=\"h1\">" + tblconfig.Title + "</h1>";
            return(View());
        }
Example #8
0
        public ActionResult baoGiaList(string tag)
        {
            tblConfig tblconfig = db.tblConfigs.First();

            tblGroupProduct groupproduct = db.tblGroupProducts.FirstOrDefault(p => p.Tag == tag);
            int             idmenu       = int.Parse(groupproduct.id.ToString());
            int             idManu       = int.Parse(db.tblConnectManuProducts.FirstOrDefault(p => p.idCate == idmenu).idManu.ToString());
            tblManufacture  manufacture  = db.tblManufactures.Find(idManu);

            ViewBag.Namemanu  = manufacture.Name;
            ViewBag.name      = groupproduct.Name; ViewBag.favicon = " <link href=\"" + manufacture.Favicon + "\" rel=\"icon\" type=\"image/x-icon\" />";
            ViewBag.imagemanu = manufacture.Images;
            string moth  = "";
            int    moths = int.Parse(DateTime.Now.Month.ToString());

            if (moths <= 3)
            {
                moth = "Tháng 1,2,3 ";
            }
            else if (moths > 3 && moths <= 6)
            {
                moth = "Tháng 4,5,6 ";
            }
            else if (moths > 6 && moths <= 9)
            {
                moth = "Tháng 7,8,9 ";
            }
            else if (moths >= 9 && moths <= 12)
            {
                moth = "Tháng 10,11,12 ";
            }
            ViewBag.Title       = "<title>Bảng báo giá " + groupproduct.Name + " " + moth + "năm " + DateTime.Now.Year + "</title>";
            ViewBag.Description = "<meta name=\"description\" content=\"" + tblconfig.Name + " là nhà phân phối chính thức của " + manufacture.Name + " . Chúng tôi xin gửi tới quý khách hàng bảng báo giá  " + groupproduct.Name + ".\"/>";
            ViewBag.Keyword     = "<meta name=\"keywords\" content=\"Bảng Báo giá sản phẩm " + groupproduct.Name + "\" /> ";
            string chuoi       = "";
            var    listproduct = db.tblProducts.Where(p => p.Active == true && p.idCate == idmenu).OrderBy(p => p.Ord).ToList();

            for (int i = 0; i < listproduct.Count; i++)
            {
                chuoi += "<tr>";
                chuoi += "<td class=\"Ords\">" + (i + 1) + "</td>";
                chuoi += "<td class=\"Names\">";
                chuoi += "<a href=\"/" + listproduct[i].Tag + ".htm\" title=\"" + listproduct[i].Name + "\">" + listproduct[i].Name + "</a></span>";
                chuoi += "<span class=\"n2\">Chức năng : " + listproduct[i].Func + "</span>";
                chuoi += " </td>";
                chuoi += "<td class=\"Codes\"> " + listproduct[i].Code + " </td>";
                chuoi += "<td class=\"Prices\">" + string.Format("{0:#,#}", listproduct[i].PriceSale) + "đ</td>";
                chuoi += "<td class=\"Qualitys\">01</td>";
                chuoi += "<td class=\"SumPrices\">" + string.Format("{0:#,#}", listproduct[i].PriceSale) + "đ</td>";
                chuoi += "<td class=\"Images\"><a href=\"/" + listproduct[i].Tag + ".htm\" title=\"" + listproduct[i].Name + "\"><img src=\"" + listproduct[i].ImageLinkThumb + "\" alt=\"" + listproduct[i].Name + "\" title=\"" + listproduct[i].Name + "\"/></a<</td>";
                chuoi += "</tr>";
            }
            ViewBag.chuoi = chuoi;
            ViewBag.nUrl  = "<a href=\"/\" title=\"Trang chủ\" rel=\"nofollow\"><span class=\"iCon\"></span> Trang chủ</a><i></i> Báo giá " + groupproduct.Name + "";

            return(View(tblconfig));
        }
        public ActionResult ListProductAgency(string tag)
        {
            var listManufacture = db.tblManufactures.First(p => p.Tag == tag);
            int idManu          = int.Parse(listManufacture.id.ToString());
            var MenuParent      = db.tblGroupProducts.Where(p => p.ParentID == idManu && p.Active == true).OrderBy(p => p.Ord).ToList();

            ViewBag.Title       = "<title>" + listManufacture.Name + "</title>";
            ViewBag.Description = "<meta name=\"description\" content=\"" + listManufacture.Description + "\"/>";
            ViewBag.Keyword     = "<meta name=\"keywords\" content=\"" + listManufacture.Name + "\" /> ";
            string chuoi = "";

            chuoi += " <div class=\"Box_Manufactures\">";
            chuoi += "<img src=\"" + listManufacture.Images + "\" alt=\"" + listManufacture.Name + "\" />";
            chuoi += "<h1>" + listManufacture.Name + "</h1>";

            chuoi += "</div>";
            for (int i = 0; i < MenuParent.Count; i++)
            {
                chuoi += "<div class=\"ListProduct\">";
                chuoi += "<div class=\"nVar2\">";
                chuoi += "<div class=\"Names\"><h2> <a href=\"/0/" + MenuParent[i].Tag + "\" title=\"" + MenuParent[i].Name + "\">" + MenuParent[i].Name + "</a></h2></div>";
                chuoi += "<hr />";
                chuoi += "</div>";
                chuoi += "<div class=\"Product_Tear\">";
                int idCate      = int.Parse(MenuParent[i].id.ToString());
                var listProduct = db.tblProducts.Where(p => p.Active == true && p.idCate == idCate).OrderBy(p => p.Ord).ToList();
                for (int j = 0; j < listProduct.Count; j++)
                {
                    chuoi += "<div class=\"Tear_1\">";
                    chuoi += "<div class=\"img\">";
                    chuoi += "<div class=\"content_img\"><a href=\"/1/" + listProduct[j].Tag + "\" title=\"" + listProduct[j].Name + "\"><img src=\"" + listProduct[j].ImageLinkThumb + "\" alt=\"" + listProduct[j].Name + "\" /></a></div>";

                    chuoi += "<div class=\"detail\">";
                    chuoi += "<span class=\"title\">" + listProduct[j].Name + "</span>";
                    chuoi += "<p>" + listProduct[j].Info + "</p>";
                    chuoi += " <a href=\"/1/" + listProduct[j].Tag + "\" title=\"" + listProduct[j].Name + "\">Xem tiếp</a>";
                    chuoi += " </div>";
                    chuoi += "</div>";
                    chuoi += "<h3><a href=\"/1/" + listProduct[j].Tag + "\" class=\"Name\" title=\"" + listProduct[j].Name + "\">" + listProduct[j].Name + "</a></h3>";
                    chuoi += "<span class=\"Price\">Giá : " + string.Format("{0:#,#}", listProduct[j].Price) + "đ</span>";
                    chuoi += "<span class=\"PriceSale\"><img /> " + string.Format("{0:#,#}", listProduct[j].PriceSale) + "đ</span>";
                    chuoi += "</div>";
                }
                chuoi += "</div>";
                chuoi += "</div>";
            }

            ViewBag.chuoi = chuoi;
            ViewBag.nUrl  = "<ol itemscope itemtype=\"http://schema.org/BreadcrumbList\">   <li itemprop=\"itemListElement\" itemscope  itemtype=\"http://schema.org/ListItem\"> <a itemprop=\"item\" href=\"http://Thayloilocnuoc.com\">  <span itemprop=\"name\">Trang chủ</span></a> <meta itemprop=\"position\" content=\"1\" />  </li>   ›" + UrlProduct(idManu) + "</ol> ";

            tblConfig tblconfig = db.tblConfigs.First();

            ViewBag.favicon = " <link href=\"" + tblconfig.Favicon + "\" rel=\"icon\" type=\"image/x-icon\" />";

            return(View());
        }
        public ActionResult baoGiaList(string tag)
        {
            tblConfig tblconfig = db.tblConfigs.First();

            tblGroupProduct groupproduct = db.tblGroupProducts.FirstOrDefault(p => p.Tag == tag);
            int             idmenu       = int.Parse(groupproduct.id.ToString());
            List <string>   Mang         = new List <string>();

            Mang = Arrayid(idmenu);
            Mang.Add(idmenu.ToString());
            ViewBag.name = groupproduct.Name;
            string moth  = "";
            int    moths = int.Parse(DateTime.Now.Month.ToString());

            if (moths <= 3)
            {
                moth = "Tháng 1,2,3 ";
            }
            else if (moths > 3 && moths <= 6)
            {
                moth = "Tháng 4,5,6 ";
            }
            else if (moths > 6 && moths <= 9)
            {
                moth = "Tháng 7,8,9 ";
            }
            else if (moths >= 9 && moths <= 12)
            {
                moth = "Tháng 10,11,12 ";
            }
            ViewBag.Title       = "<title>Bảng báo giá " + groupproduct.Name + " " + moth + "năm " + DateTime.Now.Year + "</title>";
            ViewBag.Description = "<meta name=\"description\" content=\" Bảng báo giá  " + groupproduct.Name + " chính hãng Viglacera. Báo giá mới nhất sản phẩm " + groupproduct.Name + " mới nhất được cập nhật ngày " + DateTime.Now.Day + " tháng " + DateTime.Now.Month + " năm " + DateTime.Now.Year + ".\"/>";
            ViewBag.Keyword     = "<meta name=\"keywords\" content=\"Bảng Báo giá sản phẩm " + groupproduct.Name + "\" /> ";
            string chuoi       = "";
            var    listproduct = db.tblProducts.Where(p => p.Active == true && Mang.Contains(p.idCate.ToString())).OrderBy(p => p.idCate).ToList();

            for (int i = 0; i < listproduct.Count; i++)
            {
                chuoi += "<tr>";
                chuoi += "<td class=\"Ords\">" + (i + 1) + "</td>";
                chuoi += "<td class=\"Names\">";
                chuoi += "<a href=\"/" + listproduct[i].Tag + ".htm\" title=\"" + listproduct[i].Name + "\">" + listproduct[i].Name + "</a></span>";
                chuoi += " </td>";
                chuoi += "<td class=\"Codes\"> " + listproduct[i].Code + " </td>";
                chuoi += "<td class=\"Prices\">" + string.Format("{0:#,#}", listproduct[i].PriceSale) + "đ</td>";
                chuoi += "<td class=\"Qualitys\">01</td>";
                chuoi += "<td class=\"SumPrices\">" + string.Format("{0:#,#}", listproduct[i].PriceSale) + "đ</td>";
                chuoi += "<td class=\"Images\"><a href=\"/" + listproduct[i].Tag + ".htm\" title=\"" + listproduct[i].Name + "\"><img src=\"" + listproduct[i].ImageLinkThumb + "\" alt=\"" + listproduct[i].Name + "\" title=\"" + listproduct[i].Name + "\"/></a<</td>";
                chuoi += "</tr>";
            }
            ViewBag.chuoi = chuoi;
            ViewBag.nUrl  = " <ol itemscope itemtype=\"http://schema.org/BreadcrumbList\" >  <li itemprop=\"itemListElement\" itemscope itemtype=\"http://schema.org/ListItem\"><a itemprop=\"item\" href=\"/\"> <span itemprop=\"name\">Trang chủ</span></a> <meta itemprop=\"position\" content=\"1\" />  </li> › </ol><h2>Bảng báo giá " + groupproduct.Name + "</h2>";

            return(View(tblconfig));
        }
        public PartialViewResult PartialFootter()
        {
            tblConfig tblconfig = db.tblConfigs.First();



            string chuoipartner = "";
            var    listPartner  = db.tblPartners.Where(p => p.Active == true).OrderBy(p => p.Ord).ToList();

            for (int i = 0; i < listPartner.Count; i++)
            {
                chuoipartner += "<h4>" + listPartner[i].Name + "</h4>";
                chuoipartner += "<span class=\"Address_Company\">Địa chỉ : " + listPartner[i].Address + "</span>";
                chuoipartner += "<span class=\"Mobile_Company\">Điện thoại :" + listPartner[i].Mobile + " Hotline : " + listPartner[i].Hotline + "</span>";
                chuoipartner += "<span class=\"Email_Company\">Email : " + listPartner[i].Email + "</span>";
            }
            ViewBag.chuoipartner = chuoipartner;


            //sản phẩm chính\

            var    listsanphamchinh = db.tblGroupProducts.Where(p => p.Active == true && p.Priority == true).OrderBy(p => p.Ord).ToList();
            string sanphamchinh     = "";

            for (int i = 0; i < listsanphamchinh.Count; i++)
            {
                sanphamchinh += "<a href=\"/0/" + listsanphamchinh[i].Tag + "-" + listsanphamchinh[i].id + ".aspx\" title=\"" + listsanphamchinh[i].Name + "\">" + listsanphamchinh[i].Name + "</a>";
            }
            ViewBag.sanphamchinh = sanphamchinh;


            //Chính sách dịch vụ
            var    listchinhsach = db.tblNews.Where(p => p.Active == true && p.idCate == 19).OrderBy(p => p.Ord).ToList();
            string chinhsach     = "";

            for (int i = 0; i < listchinhsach.Count; i++)
            {
                chinhsach += "<a href=\"/2/" + listchinhsach[i].Tag + "-" + listchinhsach[i].id + ".aspx\" rel=\"nofollow\" title=\"" + listchinhsach[i].Name + "\">" + listchinhsach[i].Name + "</a>";
            }
            ViewBag.chinhsach = chinhsach;

            // Load Maps
            var map = db.tblMaps.First();

            ViewBag.maps = map.Content;

            var Imagesadw = db.tblImages.Where(p => p.Active == true && p.idCate == 7).OrderByDescending(p => p.Ord).Take(1).ToList();

            if (Imagesadw.Count > 0)
            {
                ViewBag.Chuoiimg = "<a href=\"" + Imagesadw[0].Url + "\" title=\"" + Imagesadw[0].Name + "\"><img src=\"" + Imagesadw[0].Images + "\" alt=\"" + Imagesadw[0].Name + "\" style=\"max-width:100%;\" /> </a>";
            }
            return(PartialView(tblconfig));
        }
        public ActionResult NewsDetail(string tag)
        {
            int    idNew;
            string Chuoi = tag;

            string[] Mang   = Chuoi.Split('-');
            int      one    = int.Parse(Mang.Length.ToString());
            string   chuoi1 = Mang[one - 1].ToString();

            string[] Mang1 = chuoi1.Split('.');
            idNew = int.Parse(Mang1[0].ToString());
            tblNew tblnew   = db.tblNews.Find(idNew);
            string chuoinew = "";
            var    listnew  = db.tblNews.Where(p => p.idCate == tblnew.idCate && p.id != tblnew.id && p.Active == true).OrderByDescending(p => p.Ord).Take(3).ToList();

            for (int i = 0; i < listnew.Count; i++)
            {
                chuoinew += "<a href=\"/2/" + listnew[i].Tag + "-" + listnew[i].id + ".aspx\" title=\"" + listnew[i].Name + "\"> - " + listnew[i].Name + "</a>";
            }
            ViewBag.chuoinew    = chuoinew;
            ViewBag.Title       = "<title>" + tblnew.Title + "</title>";
            ViewBag.dcTitle     = "<meta name=\"DC.title\" content=\"" + tblnew.Title + "\" />";
            ViewBag.Description = "<meta name=\"description\" content=\"" + tblnew.Description + "\"/>";
            ViewBag.Keyword     = "<meta name=\"keywords\" content=\"" + tblnew.Keyword + "\" /> ";
            ViewBag.canonical   = "<link rel=\"canonical\" href=\"http://Thietbivesinhcaesar.vn/2/" + tblnew.Tag + "-" + tblnew.id + ".aspx\" />";
            string meta = "";

            meta        += "<meta itemprop=\"name\" content=\"" + tblnew.Name + "\" />";
            meta        += "<meta itemprop=\"url\" content=\"" + Request.Url.ToString() + "\" />";
            meta        += "<meta itemprop=\"description\" content=\"" + tblnew.Description + "\" />";
            meta        += "<meta itemprop=\"image\" content=\"http://Thietbivesinhcaesar.vn" + tblnew.Images + "\" />";
            meta        += "<meta property=\"og:title\" content=\"" + tblnew.Title + "\" />";
            meta        += "<meta property=\"og:type\" content=\"product\" />";
            meta        += "<meta property=\"og:url\" content=\"" + Request.Url.ToString() + "\" />";
            meta        += "<meta property=\"og:image\" content=\"http://Thietbivesinhcaesar.vn" + tblnew.Images + "\" />";
            meta        += "<meta property=\"og:site_name\" content=\"http://Thietbivesinhcaesar.vn\" />";
            meta        += "<meta property=\"og:description\" content=\"" + tblnew.Description + "\" />";
            meta        += "<meta property=\"fb:admins\" content=\"\" />";
            ViewBag.Meta = meta;

            var Groupnews = db.tblGroupNews.First(p => p.id == tblnew.idCate);
            int idCate    = Groupnews.id;

            ViewBag.nUrl = "<a href=\"/\" title=\"Trang chu\" rel=\"nofollow\"><span class=\"iCon\"></span>Trang chủ</a> / " + UrlNews(idCate) + " " + tblnew.Name;
            tblConfig tblconfig = db.tblConfigs.FirstOrDefault();

            if (tblconfig.Coppy == true)
            {
                ViewBag.coppy = " <script src=\"/Scripts/disable-copyright.js\"></script> <link href=\"/Content/Display/Css/Coppy.css\" rel=\"stylesheet\" />";
            }
            return(View(tblnew));
        }
Example #13
0
        public ActionResult Index(tblConfig model, HttpPostedFileBase Logo)
        {
            // Logo
            if (Logo != null)
            {
                String newName = Logo.FileName.Insert(Logo.FileName.LastIndexOf('.'), String.Format("{0:_ddMMyyyy}", DateTime.Now));
                String path    = Server.MapPath("~/Images/" + newName);
                Logo.SaveAs(path);
                model.Logo = newName;
            }
            _db.Entry(model).State = System.Data.Entity.EntityState.Modified;
            _db.SaveChanges();

            return(View(model));
        }
        public PartialViewResult PartialTop()
        {
            tblConfig tblconfig = db.tblConfigs.First();
            int       Date1     = int.Parse(DateTime.Now.Hour.ToString());


            ViewBag.Chuoihotline = "<p><span class=\"icon_Phone\"></span> : " + tblconfig.MobileIN + "</p> <p><span class=\"icon_Hotline\"></span> : Hotline : " + tblconfig.HotlineIN + " - Tổng đài bán hàng : " + tblconfig.HotlineOUT + "</p>";

            var           ListSupport = db.tblSupports.Where(p => p.Active == true).OrderBy(p => p.Ord).ToList();
            StringBuilder Yahoo       = new StringBuilder();
            StringBuilder Skype       = new StringBuilder();

            for (int i = 0; i < ListSupport.Count; i++)
            {
                //Yahoo
                Yahoo.Append("<div class=\"Tear_Yahoo\">");
                Yahoo.Append("<div class=\"Left_Tear_Yahoo\">");
                Yahoo.Append("<span class=\"Func\">" + ListSupport[i].Name + " :</span>");
                Yahoo.Append("</div>");
                Yahoo.Append("<div class=\"Right_Tear_Yahoo\">");
                Yahoo.Append("<a href=\"ymsgr:sendim?" + ListSupport[i].Yahoo + "\">");
                Yahoo.Append("<img src=\"http://opi.yahoo.com/online?u=" + ListSupport[i].Yahoo + "&m=g&t=1\" alt=\"Yahoo\" class=\"imgYahoo\" />");
                Yahoo.Append("</a>");
                Yahoo.Append("</div>");
                Yahoo.Append("</div> ");
                //Skype
                Skype.Append("<div class=\"Tear_Skype\">");
                Skype.Append("<div class=\"Left_Tear_Skype\">");
                Skype.Append("<span class=\"Func\">" + ListSupport[i].Name + " :</span>");

                Skype.Append("</div>");
                Skype.Append("<div class=\"Right_Tear_Skype\">");
                Skype.Append("<a href=\"Skype:" + ListSupport[i].Skyper + "?chat\">");
                Skype.Append("<img class=\"imgSkyper\" src=\"/Content/Display/iCon/skype-icon.png\" title=\"" + ListSupport[i].Name + "\" alt=\"" + ListSupport[i].Skyper + "\">");
                Skype.Append("</a>");
                Skype.Append("</div>");
                Skype.Append("</div>");
            }
            ViewBag.yahoo = Yahoo;
            ViewBag.skype = Skype;
            if (Session["h1"] != null)
            {
                ViewBag.h1    = Session["h1"];
                Session["h1"] = null;
            }

            return(PartialView(tblconfig));
        }
Example #15
0
        public ActionResult Index(tblConfig tblconfig, int id = 1)
        {
            if (ModelState.IsValid)
            {
                tblconfig.ID = id;

                #region [Updatehistory]
                Updatehistoty.UpdateHistory("Config Website", Request.Cookies["Username"].Values["FullName"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString());
                #endregion
                db.Entry(tblconfig).State = EntityState.Modified;
                db.SaveChanges();
                Session["Thongbao"] = "<div  class=\"alert alert-info\">Bạn cập nhật thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>";
                return(RedirectToAction("Index"));
            }
            return(View(tblconfig));
        }
Example #16
0
        public PartialViewResult FootterPartial()
        {
            tblConfig tblconfig      = db.tblConfigs.Find(1);
            string    chinhsach      = "";
            var       listchinhscach = db.tblNews.Where(p => p.idCate == 12 && p.Active == true).OrderBy(p => p.Ord).ToList();

            for (int i = 0; i < listchinhscach.Count; i++)
            {
                chinhsach += "<a href=\"/News/" + listchinhscach[i].Tag + "-" + listchinhscach[i].id + ".aspx\" title=\"" + listchinhscach[i].Name + "\">" + listchinhscach[i].Name + "</a>";
            }
            ViewBag.chinhsach = chinhsach;
            string sanpham     = "";
            var    listProduct = db.tblGroupProducts.Where(p => p.Priority == true && p.Active == true).OrderBy(p => p.Ord).ToList();

            for (int i = 0; i < listProduct.Count; i++)
            {
                sanpham += "<h3><a href=\"/ListProduct/" + listProduct[i].Tag + "-" + listProduct[i].id + ".aspx\" title=\"" + listProduct[i].Title + "\">" + listProduct[i].Name + "</a></h3>";
            }
            ViewBag.sanpham = sanpham;
            tblMap tblmap = db.tblMaps.First();

            ViewBag.maps = tblmap.Content;
            var    listCapacity = db.tblCapacities.Where(p => p.Active == true).OrderBy(p => p.Ord).ToList();
            string dungtich     = "";

            foreach (var item in listCapacity)
            {
                dungtich += "<h3><a href=\"/" + item.Tag + ".html\" title=\"" + item.Title + "\">" + item.Name + "</a></h3>";
            }
            ViewBag.dungtich = dungtich;
            var Imagesadw = db.tblImages.Where(p => p.Active == true && p.idCate == 5).OrderByDescending(p => p.Ord).Take(1).ToList();

            if (Imagesadw.Count > 0)
            {
                ViewBag.Chuoiimg = "<a href=\"" + Imagesadw[0].Url + "\" title=\"" + Imagesadw[0].Name + "\"><img src=\"" + Imagesadw[0].Images + "\" alt=\"" + Imagesadw[0].Name + "\" style=\"max-width:100%;\" /> </a>";
            }
            var           listUrl   = db.tblUrls.Where(p => p.Active == true).OrderBy(p => p.Ord).ToList();
            StringBuilder resultUrl = new StringBuilder();

            for (int i = 0; i < listUrl.Count; i++)
            {
                resultUrl.Append("<h3 style = \"margin:0px; display:inline-block;   font-weight:normal\" ><a style = \"font-size:12px; margin:0px; color:#FFF\" href = \"" + listUrl[i].Url + "\" title = \"" + listUrl[i].Name + "\" > " + listUrl[i].Name + "</a ></h3 >");
            }
            ViewBag.resultUrl = resultUrl.ToString();
            return(PartialView(tblconfig));
        }
        public ActionResult Index(tblContact Contact, FormCollection collection)
        {
            tblConfig config = db.tblConfigs.First();
            // Gmail Address from where you send the mail
            var fromAddress = config.UserEmail;
            // any address where the email will be sending
            var toAddress = config.Email;
            //Password of your gmail address
            string fromPassword = config.PassEmail;
            // Passing the values and make a email formate to display
            string subject = "Bạn có liên hệ mới từ : ";
            string body    = "From: " + collection["name"] + "\n";

            body += "Tên khách hàng: " + collection["Name"] + "\n";
            body += "Địa chỉ: " + collection["Address"] + "\n";
            body += "Điện thoại: " + collection["Mobile"] + "\n";
            body += "Email: " + collection["Email"] + "\n";
            body += "Nội dung: \n" + collection["Content"] + "\n";

            ////string OrderId = clsConnect.sqlselectOneString("select max(idOrder) as MaxID from [Order]");

            //insert vao bang OrderDetail


            var smtp = new System.Net.Mail.SmtpClient();

            {
                smtp.Host           = config.Host;
                smtp.Port           = int.Parse(config.Port.ToString());
                smtp.EnableSsl      = true;
                smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                smtp.Credentials    = new NetworkCredential(fromAddress, fromPassword);
                smtp.Timeout        = int.Parse(config.Timeout.ToString());
            }
            smtp.Send(fromAddress, toAddress, subject, body);


            Contact.Active     = false;
            Contact.DateCreate = DateTime.Now;
            db.tblContacts.Add(Contact);
            db.SaveChanges();
            Session["Status"] = "<script>$(document).ready(function(){ alert('Bạn đã liên hệ thành công !') });</script>";

            return(View());
        }
        public PartialViewResult PartialProductHomes(string idCatess)
        {
            StringBuilder chuoi        = new StringBuilder();
            var           GroupProduct = db.tblGroupProducts.Where(p => p.Active == true && p.Priority == true).OrderBy(p => p.Ord).ToList();

            for (int i = 0; i < GroupProduct.Count; i++)
            {
                chuoi.Append("<div class=\"Product\">");
                chuoi.Append("<div class=\"nVar_Products\">");
                chuoi.Append("<h2> <a href=\"/0/" + GroupProduct[i].Tag + "-" + GroupProduct[i].id + ".aspx\" title=\"" + GroupProduct[i].Name + "\">" + GroupProduct[i].Name + "</a></h2>");
                chuoi.Append("<div class=\"MenuChild\">");
                int idParent   = GroupProduct[i].id;
                var GroupChild = db.tblGroupProducts.Where(p => p.Active == true && p.ParentID == idParent).OrderBy(p => p.Ord).Take(4).ToList();
                for (int j = 0; j < GroupChild.Count; j++)
                {
                    chuoi.Append("<h3><a href=\"/0/" + GroupChild[j].Tag + "-" + GroupChild[j].id + ".aspx\" title=\"" + GroupChild[j].Name + "\" rel=\"nofollow\">" + GroupChild[j].Name + "</a> </h3> ");
                }
                chuoi.Append("</div>");
                chuoi.Append("</div>"); chuoi.Append("<div class=\"Content_Product\">");
                for (int k = 0; k < GroupChild.Count; k++)
                {
                    int idCate      = int.Parse(GroupChild[k].id.ToString());
                    var listProduct = db.tblProducts.Where(p => p.Active == true && p.idCate == idCate && p.ViewHomes == true).OrderBy(p => p.Ord).ToList();
                    for (int x = 0; x < listProduct.Count; x++)
                    {
                        chuoi.Append("    <div class=\"Tear_2\">");
                        chuoi.Append("<div class=\"img_thumb\">");
                        chuoi.Append("<a href=\"/1/" + listProduct[x].Tag + "-" + listProduct[x].id + ".aspx\" title=\"" + listProduct[x].Name + "\"><img src=\"" + listProduct[x].ImageLinkThumb + "\" alt=\"" + listProduct[x].Name + "\" /></a>");
                        chuoi.Append("</div>");
                        chuoi.Append("<h3><a class=\"Name\" href=\"/1/" + listProduct[x].Tag + "-" + listProduct[x].id + ".aspx\" title=\"" + listProduct[x].Name + "\">" + listProduct[x].Name + "</a></h3>");
                        chuoi.Append("<span class=\"Price\">Giá : " + string.Format("{0:#,#}", listProduct[x].Price) + " vnđ</span>");
                        chuoi.Append("<p class=\"PriceSale\"><span class=\"iConKM\"></span>" + string.Format("{0:#,#}", listProduct[x].PriceSale) + " vnđ </p>");
                        chuoi.Append(" </div> ");
                    }
                }
                chuoi.Append("</div>");
                chuoi.Append(" </div>");
            }
            tblConfig tblconfit = db.tblConfigs.First();

            ViewBag.ListProduct = chuoi;
            return(PartialView(tblconfit));
        }
Example #19
0
        public PartialViewResult PartialSupport()
        {
            var       listSuport = db.tblSupports.Where(p => p.Active == true).OrderBy(p => p.Ord).ToList();
            tblConfig tblconfig  = db.tblConfigs.First();
            DateTime  dates      = DateTime.Now;
            int       Date1      = int.Parse(dates.Hour.ToString());


            ViewBag.Hotline    = tblconfig.HotlineIN;
            ViewBag.HotlineOUT = tblconfig.HotlineOUT;
            ViewBag.MobileOUT  = tblconfig.MobileOUT;
            var    listlnk = db.tblUrls.Where(p => p.Active == true).OrderBy(p => p.Ord).ToList();
            string chuoi   = "";

            for (int i = 0; i < listlnk.Count; i++)
            {
                chuoi += "<a href=\"" + listlnk[i].Url + "\" title=\"" + listlnk[i].Name + "\" rel=\"" + listlnk[i].Rel + "\">› " + listlnk[i].Name + "</a> ";
            }
            ViewBag.url = chuoi;
            return(PartialView(listSuport));
        }
Example #20
0
        public ActionResult Index()
        {
            tblConfig tblconfig = db.tblConfigs.First();

            ViewBag.Title       = "<title>" + tblconfig.Title + "</title>";
            ViewBag.Description = "<meta name=\"description\" content=\"" + tblconfig.Description + "\"/>";
            ViewBag.Keyword     = "<meta name=\"keywords\" content=\"" + tblconfig.Keywords + "\" /> ";
            string chuoi = "";

            chuoi          += "<span class=\"gp\">" + tblconfig.Slogan + "</span>";
            chuoi          += "<p>HOTLINE: <span>" + tblconfig.MobileIN + " </span> (Miền Bắc) |<span>" + tblconfig.MobileOUT + " </span>(Miền Nam)</p>";
            ViewBag.Hotline = chuoi;
            ViewBag.favicon = " <link href=\"" + tblconfig.Favicon + "\" rel=\"icon\" type=\"image/x-icon\" />";

            string meta = "";

            ViewBag.canonical = "<link rel=\"canonical\" href=\"http://Thayloilocnuoc.com\" />";

            meta           += "<meta itemprop=\"name\" content=\"" + tblconfig.Name + "\" />";
            meta           += "<meta itemprop=\"url\" content=\"" + Request.Url.ToString() + "\" />";
            meta           += "<meta itemprop=\"description\" content=\"" + tblconfig.Description + "\" />";
            meta           += "<meta itemprop=\"image\" content=\"http://Thayloilocnuoc.com" + tblconfig.Logo + "\" />";
            meta           += "<meta property=\"og:title\" content=\"" + tblconfig.Title + "\" />";
            meta           += "<meta property=\"og:type\" content=\"product\" />";
            meta           += "<meta property=\"og:url\" content=\"" + Request.Url.ToString() + "\" />";
            meta           += "<meta property=\"og:image\" content=\"http://Thayloilocnuoc.com" + tblconfig.Logo + "\" />";
            meta           += "<meta property=\"og:site_name\" content=\"http://Thayloilocnuoc.com\" />";
            meta           += "<meta property=\"og:description\" content=\"" + tblconfig.Description + "\" />";
            meta           += "<meta property=\"fb:admins\" content=\"\" />";
            ViewBag.Meta    = meta;
            ViewBag.content = tblconfig.Content;
            if (Session["Register"] != "")
            {
                ViewBag.Register = Session["Register"];
            }
            Session["Register"] = "";
            ViewBag.h1          = tblconfig.Title;
            return(View());
        }
        public PartialViewResult BannerPatial()
        {
            tblConfig tblconfig = db.tblConfigs.First();
            var       listmenu  = db.tblGroupProducts.Where(p => p.Active == true && p.ParentID == null).OrderBy(p => p.Ord).ToList();
            string    chuoi     = "";

            for (int i = 0; i < listmenu.Count; i++)
            {
                chuoi += "<li class=\"li2\">";
                chuoi += "<a href=\"/0/" + listmenu[i].Tag + "\" title=\"" + listmenu[i].Name + "\">› " + listmenu[i].Name + "</a>";
                int idcate        = listmenu[i].id;
                var listmenuchild = db.tblGroupProducts.Where(p => p.Active == true && p.ParentID == idcate).OrderBy(p => p.Ord).ToList();
                if (listmenuchild.Count > 0)
                {
                    chuoi += "<ul class=\"ul3\">";
                    for (int j = 0; j < listmenuchild.Count; j++)
                    {
                        chuoi += "<li class=\"li3\">";
                        chuoi += "<a href=\"/0/" + listmenuchild[j].Tag + "\" title=\"" + listmenuchild[j].Name + "\">" + listmenuchild[j].Name + "</a>";
                        chuoi += "</li>";
                    }
                    chuoi += "</ul>";
                }
                chuoi += "</li>";
            }
            ViewBag.chuoi = chuoi;
            string baogia     = "";
            var    listbaogia = db.tblGroupProducts.Where(p => p.Active == true && p.Baogia == true).OrderBy(p => p.Ord).ToList();

            for (int i = 0; i < listbaogia.Count; i++)
            {
                baogia += "<li class=\"li2\">";
                baogia += "<a href=\"/Bao-gia/Bao-gia-" + listbaogia[i].Tag + "\" title=\"Bảng Báo giá " + listbaogia[i].Name + "\">› Bảng báo giá " + listbaogia[i].Name + "</a>";
                baogia += "</li>";
            }
            ViewBag.baogia = baogia;
            return(PartialView(tblconfig));
        }
        public ActionResult CreateOrd(string Name, string Address, string DateByy, string Mobile, string Email, string Description)
        {
            var      Sopping = (clsGiohang)Session["giohang"];
            tblOrder order   = new tblOrder();

            order.Name        = Name;
            order.Address     = Address;
            order.DateByy     = DateTime.Parse(DateByy);
            order.Mobile      = Mobile;
            order.Email       = Email;
            order.Description = Description;
            order.Active      = false;
            order.Tolar       = Sopping.CartTotal;
            db.tblOrders.Add(order);
            db.SaveChanges();

            tblOrderDetail orderdetail = new tblOrderDetail();
            var            MaxOrd      = db.tblOrders.OrderByDescending(p => p.id).Take(1).ToList();
            int            idOrder     = MaxOrd[0].id;

            for (int i = 0; i < Sopping.CartItem.Count; i++)
            {
                orderdetail.idProduct = Sopping.CartItem[i].id;
                orderdetail.Name      = Sopping.CartItem[i].Name;
                orderdetail.Price     = Sopping.CartItem[i].Price;
                orderdetail.Quantily  = Sopping.CartItem[i].Ord;
                orderdetail.SumPrice  = Sopping.CartItem[i].SumPrice;
                orderdetail.idOrder   = idOrder;
                db.tblOrderDetails.Add(orderdetail);
                db.SaveChanges();
            }
            //Send mail cho khách

            tblConfig config = db.tblConfigs.First();
            // Gmail Address from where you send the mail
            var fromAddress = config.UserEmail;
            // any address where the email will be sending
            var toAddress = config.Email;
            //Password of your gmail address
            string fromPassword = config.PassEmail;
            // Passing the values and make a email formate to display
            string subject = "Đơn hàng mới từ";
            string body    = "From: " + Name + "\n";

            body += "Tên khách hàng: " + Name + "\n";
            body += "Địa chỉ: " + Address + "\n";
            body += "Điện thoại: " + Mobile + "\n";
            body += "Email: " + Email + "\n";
            body += "Nội dung: \n" + Description + "\n";
            body += "THÔNG TIN ĐƠN ĐẶT HÀNG \n";
            ////string OrderId = clsConnect.sqlselectOneString("select max(idOrder) as MaxID from [Order]");

            //insert vao bang OrderDetail

            for (int i = 0; i < Sopping.CartItem.Count; i++)
            {
                body += "Tên sản phẩm : " + Sopping.CartItem[i].Name + "\n";
                body += "Đơn giá  :" + Sopping.CartItem[i].Price.ToString().Replace(",", "") + "\n";
                body += "Số lượng : " + Sopping.CartItem[i].Ord + "\n";
            }
            body += "Tổng giá trị đơn hàng là " + Sopping.CartTotal;
            var smtp = new System.Net.Mail.SmtpClient();

            {
                smtp.Host           = config.Host;
                smtp.Port           = int.Parse(config.Port.ToString());
                smtp.EnableSsl      = true;
                smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                smtp.Credentials    = new NetworkCredential(fromAddress, fromPassword);
                smtp.Timeout        = int.Parse(config.Timeout.ToString());
            }
            smtp.Send(fromAddress, toAddress, subject, body);


            Session["Status"] = "<script>$(document).ready(function(){ alert('Bạn đã đặt hàng thành công !') });</script>";
            return(RedirectToAction("OrderIndex"));
        }
Example #23
0
        public ActionResult Command(FormCollection collection, string tag)
        {
            if (collection["btnorder"] != null)
            {
                try
                {
                    string   Name        = collection["Name"];
                    string   Address     = collection["Address"];
                    string   DateByy     = collection["DateByy"];
                    string   Mobile      = collection["Mobile"];
                    string   Mobiles     = collection["Mobiles"];
                    string   Email       = collection["Email"];
                    string   Name1       = collection["Name1"];
                    string   Address1    = collection["Address"];
                    string   Mobile1     = collection["Mobile1"];
                    string   Mobile1s    = collection["Mobile1s"];
                    string   Email1      = collection["Email1"];
                    string   rdtt        = collection["rdtt"];
                    string   rdvc        = collection["rdvc"];
                    string   NameCP      = collection["NameCP"];
                    string   AddressCP   = collection["AddressCP"];
                    string   MST         = collection["MST"];
                    string   Description = collection["Description"];
                    var      Sopping     = (clsGiohang)Session["giohang"];
                    tblOrder order       = new tblOrder();
                    order.Name          = Name;
                    order.Name1         = Name1;
                    order.Address       = Address;
                    order.Address1      = Address1;
                    order.DateByy       = DateTime.Now;
                    order.Mobile        = Mobile;
                    order.Mobile1       = Mobile1;
                    order.Mobiles       = Mobiles;
                    order.Mobile1s      = Mobile1s;
                    order.TypePay       = int.Parse(rdtt);
                    order.Email1        = Email1;
                    order.Email         = Email;
                    order.NameCP        = NameCP;
                    order.AddressCP     = AddressCP;
                    order.MST           = MST;
                    order.TypePay       = int.Parse(rdtt);
                    order.TypeTransport = int.Parse(rdvc);
                    order.Status        = false;
                    order.Description   = Description;
                    order.Active        = true;

                    tblOrderDetail orderdetail = new tblOrderDetail();
                    var            MaxOrd      = db.tblOrders.OrderByDescending(p => p.id).Take(1).ToList();
                    int            idOrder     = 1;

                    if (MaxOrd.Count > 0)
                    {
                        idOrder = MaxOrd[0].id;
                    }
                    for (int i = 0; i < Sopping.CartItem.Count; i++)
                    {
                        orderdetail.idProduct = Sopping.CartItem[i].id;
                        orderdetail.Name      = Sopping.CartItem[i].Name;
                        orderdetail.Price     = Sopping.CartItem[i].Price;
                        orderdetail.Quantily  = Sopping.CartItem[i].Ord;
                        orderdetail.SumPrice  = Sopping.CartItem[i].SumPrice;
                        orderdetail.idOrder   = idOrder;
                        db.tblOrderDetails.Add(orderdetail);
                        db.SaveChanges();
                    }
                    tblConfig config       = db.tblConfigs.First();
                    var       fromAddress  = config.UserEmail;
                    var       toAddress    = config.Email;
                    var       orders       = db.tblOrders.OrderByDescending(p => p.id).Take(1).ToList();
                    string    fromPassword = config.PassEmail;
                    string    ararurl      = Request.Url.ToString();
                    var       listurl      = ararurl.Split('/');
                    string    urlhomes     = "";
                    for (int i = 0; i < listurl.Length - 2; i++)
                    {
                        if (i > 0)
                        {
                            urlhomes += "/" + listurl[i];
                        }
                        else
                        {
                            urlhomes += listurl[i];
                        }
                    }
                    order.Tolar = Sopping.CartTotal;
                    db.tblOrders.Add(order);
                    db.SaveChanges();
                    string subject   = "Đơn hàng mới từ " + urlhomes + "";
                    string chuoihtml = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Thông tin đơn hàng</title></head><body style=\"background:#f2f2f2; font-family:Arial, Helvetica, sans-serif\"><div style=\"width:750px; height:auto; margin:5px auto; background:#FFF; border-radius:5px; overflow:hidden\">";
                    chuoihtml += "<div style=\"width:100%; height:40px; float:left; margin:0px; background:#1c7fc4\"><span style=\"font-size:14px; line-height:40px; color:#FFF; margin:auto 20px; float:left\">" + DateTime.Now.Date + "</span><span style=\"font-size:14px; line-height:40px; float:right; margin:auto 20px; color:#FFF; text-transform:uppercase\">Hotline : " + config.Hotline1 + "</span></div>";
                    chuoihtml += "<div style=\"width:100%; height:auto; float:left; margin:0px\"><div style=\"width:35%; height:100%; margin:0px; float:left\"><a href=\"/\" title=\"\"><img src=\"" + urlhomes + "" + config.Logo + "\" alt=\"Logo\" style=\"margin:8px; display:block; max-height:95% \" /></a></div><div style=\"width:60%; height:100%; float:right; margin:0px; text-align:right\"><span style=\"font-size:18px; margin:20px 5px 5px 5px; display:block; color:#ff5a00; text-transform:uppercase\">" + config.Name + "</span><span style=\"display:block; margin:5px; color:#515151; font-size:13px; text-transform:uppercase\">Lớn nhất - Chính hãng - Giá rẻ nhất việt nam</span> </div>  </div>";
                    chuoihtml += "<span style=\"text-align:center; margin:10px auto; font-size:20px; color:#000; font-weight:bold; text-transform:uppercase; display:block\">Thông tin đơn hàng</span>";
                    chuoihtml += " <div style=\"width:90%; height:auto; margin:10px auto; background:#f2f2f2; padding:15px\">";
                    chuoihtml += "<p style=\"font-size:14px; color:#464646; margin:5px 20px\">Đơn hàng từ website : <span style=\"color:#1c7fc4\">" + urlhomes + "</span></p>";
                    chuoihtml += "<p style=\"font-size:14px; color:#464646; margin:5px 20px\">Ngày gửi đơn hàng : <span style=\"color:#1c7fc4\">Vào lúc " + DateTime.Now.Hour + " giờ " + DateTime.Now.Minute + " phút ( ngày " + DateTime.Now.Day + " tháng " + DateTime.Now.Month + " năm " + DateTime.Now.Year + ") </span></p>";
                    chuoihtml += "<p style=\"font-size:14px; color:#464646; margin:5px 20px\">Mã đơn hàng : <span style=\"color:#1c7fc4\">" + idOrder + " </span></p>";
                    chuoihtml += "<p style=\"font-size:14px; color:#1b1b1b; margin:5px 20px; text-decoration:underline; text-transform:uppercase\">Danh sách sản phẩm : </p>";
                    chuoihtml += "<table style=\"width:100%; height:auto; margin:10px auto; background:#FFF; border:1px\" border=\"0\">";
                    chuoihtml += " <tr style=\" background:#1c7fc4; color:#FFF; text-align:center; line-height:25px; font-size:12px\">";

                    chuoihtml += "<td>STT</td>";
                    chuoihtml += "<td>Tên sản phẩm</td>";
                    chuoihtml += "<td>Đơn giá (vnđ)</td>";
                    chuoihtml += "<td>Số lượng</td>";
                    chuoihtml += "<td>Thành tiền (vnđ)</td>";
                    chuoihtml += "</tr>";

                    for (int i = 0; i < Sopping.CartItem.Count; i++)
                    {
                        chuoihtml += "<tr style=\"line-height:20px; font-size:13px; color:#000; text-indent:5px; border-bottom:1px dashed #cecece; margin:1px 0px;\">";
                        chuoihtml += "<td style=\"text-align:center; width:7%\">" + i + "</td>";
                        chuoihtml += "<td style=\"width:45%\">" + Sopping.CartItem[i].Name + "</td>";
                        int gia = Convert.ToInt32(Sopping.CartItem[i].Price.ToString());
                        chuoihtml += "<td style=\"text-align:center; width:15%\">" + gia.ToString().Replace(",", "") + "</td>";
                        chuoihtml += "<td style=\"text-align:center; width:10%\">" + Sopping.CartItem[i].Ord + "</td>";
                        float thanhtien = Sopping.CartItem[i].Price * Sopping.CartItem[i].Ord;
                        chuoihtml += "<td style=\"text-align:center; font-weight:bold\">" + thanhtien.ToString().Replace(",", "") + "</td>";
                        chuoihtml += " </tr>";
                    }
                    chuoihtml += "<tr style=\"font-size:12px; font-weight:bold\">";
                    chuoihtml += "<td colspan=\"4\" style=\"text-align:right\">Tổng giá trị đơn hàng : </td>";
                    chuoihtml += "<td style=\"font-size:14px; color:#F00\">" + Sopping.CartTotal + " vnđ</td>";
                    chuoihtml += " </tr>";
                    chuoihtml += "</table>";
                    chuoihtml += "<div style=\" width:100%; margin:15px 0px\">";
                    chuoihtml += "<div style=\"width:100%; height:auto; float:left; margin:0px; border:1px solid #d5d5d5\">";
                    chuoihtml += "<div style=\" width:100%; height:30px; float:left; background:#1c7fc4; font-size:12px; color:#FFF; text-indent:15px; line-height:30px\">    	Thông tin người gửi     </div>";

                    chuoihtml += "<div style=\"width:100%; height:auto; float:left\">";
                    chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Họ và tên :<span style=\"font-weight:bold\"> " + Name + "</span></p>";
                    chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Địa chỉ :<span style=\"font-weight:bold\"> " + Address + "</span></p>";
                    chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Điện thoại :<span style=\"font-weight:bold\"> " + Mobile + " - " + Mobiles + "</span></p>";
                    chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Email :<span style=\"font-weight:bold\">" + Email + "</span></p>";
                    if (rdtt == "1")
                    {
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Hình thức thanh toán :<span style=\"font-weight:bold\">Chuyển hàng thu tiền tại nhà</span></p>";
                    }
                    if (rdtt == "2")
                    {
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Hình thức thanh toán :<span style=\"font-weight:bold\">Nhận hàng và thanh toán tại Ariston</span></p>";
                    }
                    if (rdtt == "3")
                    {
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Hình thức thanh toán :<span style=\"font-weight:bold\">Chuyển khoản ATM & Ngân hàng</span></p>";
                    }
                    if (rdtt == "4")
                    {
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Hình thức thanh toán :<span style=\"font-weight:bold\">Thanh toán visa, mastercard</span></p>";
                    }
                    if (rdvc == "1")
                    {
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Thời gian giao hàng :<span style=\"font-weight:bold\">Bất kể giờ nào</span></p>";
                    }
                    if (rdvc == "2")
                    {
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Thời gian giao hàng :<span style=\"font-weight:bold\">Trong giờ hàng chính</span></p>";
                    }
                    if (rdvc == "3")
                    {
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Thời gian giao hàng :<span style=\"font-weight:bold\">Ngoài giờ hành chính</span></p>";
                    }

                    chuoihtml += "</div>";
                    chuoihtml += "</div>";
                    if (Name1 != null)
                    {
                        chuoihtml += "<div style=\" width:100%; height:30px; float:left; background:#1c7fc4; font-size:12px; color:#FFF; text-indent:15px; line-height:30px\">    	Người nhận hàng   </div>";

                        chuoihtml += "<div style=\"width:100%; height:auto; float:left\">";
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Họ và tên :<span style=\"font-weight:bold\"> " + Name1 + "</span></p>";
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Địa chỉ :<span style=\"font-weight:bold\"> " + Address1 + "</span></p>";
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Điện thoại :<span style=\"font-weight:bold\"> " + Mobile1 + " - " + Mobile1s + "</span></p>";
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Email :<span style=\"font-weight:bold\">" + Email1 + "</span></p>";
                        chuoihtml += "</div>";
                        chuoihtml += "</div>";
                    }
                    if (NameCP != null)
                    {
                        chuoihtml += "<div style=\" width:100%; height:30px; float:left; background:#1c7fc4; font-size:12px; color:#FFF; text-indent:15px; line-height:30px\">    	Thông tin yêu cầu hóa đơn  </div>";

                        chuoihtml += "<div style=\"width:100%; height:auto; float:left\">";
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Tên công ty :<span style=\"font-weight:bold\"> " + NameCP + "</span></p>";
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Địa chỉ :<span style=\"font-weight:bold\"> " + AddressCP + "</span></p>";
                        chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">MST:<span style=\"font-weight:bold\"> " + MST + "</span></p>";
                        chuoihtml += "</div>";
                        chuoihtml += "</div>";
                    }
                    chuoihtml += "<div style=\"width:90%; height:auto; margin:10px auto; border:1px solid #d5d5d5\">";
                    chuoihtml += "<div style=\" width:100%; height:30px; float:left; background:#1c7fc4; font-size:12px; color:#FFF; text-indent:15px; line-height:30px\">   	Yêu cầu của người gửi       </div>";
                    chuoihtml += " <div style=\"width:100%; height:auto; float:left\">";
                    chuoihtml += "<p style=\"font-size:12px; margin:5px 10px; font-weight:bold; color:#F00\"> - " + Description + "</p>";
                    chuoihtml += "</div>";
                    chuoihtml += "</div>";
                    var listo = db.tblOrders.OrderByDescending(p => p.id).Take(1).ToList();
                    chuoihtml += " <a href=\"" + urlhomes + "/Orderad/ActiveOrder?id=" + listo[0].id + "\" title=\"\" style=\"padding:5px; color:#FFF; background:#F00; display:inline-block; text-align:center; margin:10px auto\">Đã check thông tin >></a>";
                    chuoihtml += "</div>";


                    chuoihtml += "<div style=\"width:100%; height:auto; float:left; margin:0px\">";
                    chuoihtml += "<hr style=\"width:80%; height:1px; background:#d8d8d8; margin:20px auto 10px auto\" />";
                    chuoihtml += "<p style=\"font-size:12px; text-align:center; margin:5px 5px\">" + config.Address1 + "</p>";
                    chuoihtml += "<p style=\"font-size:12px; text-align:center; margin:5px 5px\">Điện thoại : " + config.Mobile1 + " - " + config.Hotline1 + "</p>";
                    chuoihtml += " <p style=\"font-size:12px; text-align:center; margin:5px 5px; color:#ff7800\">Thời gian mở cửa : Từ 7h30 đến 18h30 hàng ngày (làm cả thứ 7, chủ nhật). Khách hàng đến trực tiếp xem hàng giảm thêm giá.</p>";
                    chuoihtml += "</div>";
                    chuoihtml += "<div style=\"clear:both\"></div>";
                    chuoihtml += " </div>";
                    chuoihtml += " <div style=\"width:100%; height:40px; float:left; margin:0px; background:#1c7fc4\">";
                    chuoihtml += "<span style=\"font-size:12px; text-align:center; color:#FFF; line-height:40px; display:block\">Copyright (c) 2002 – 2015 Ariston VIET NAM. All Rights Reserved</span>";
                    chuoihtml += " </div>";
                    chuoihtml += "</div>";
                    chuoihtml += "</body>";
                    chuoihtml += "</html>";
                    string body = chuoihtml;

                    var smtp = new System.Net.Mail.SmtpClient();
                    {
                        smtp.Host           = config.Host;
                        smtp.Port           = int.Parse(config.Port.ToString());
                        smtp.EnableSsl      = true;
                        smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                        smtp.Credentials    = new NetworkCredential(fromAddress, fromPassword);
                        smtp.Timeout        = int.Parse(config.Timeout.ToString());
                    }
                    using (var message = new MailMessage(fromAddress, toAddress)
                    {
                        Subject = subject,
                        Body = body,
                        IsBodyHtml = true,
                    })
                    {
                        smtp.Send(message);
                    }


                    Session["Status"] = "<script>$(document).ready(function(){ alert('Bạn đã đặt hàng thành công !') });</script>";
                    return(RedirectToAction("OrderIndex"));
                }
                catch (Exception ex)
                {
                    Session["Status"] = "<script>$(document).ready(function(){ alert('Bạn đã đặt hàng thành công " + ex.Message + "!') });</script>";
                    return(RedirectToAction("OrderIndex"));
                }
            }
            return(RedirectToAction("OrderIndex"));
        }
        public ActionResult ProductDetail(int id)
        {
            //int idp;
            //string Chuoi = tag;
            //string[] Mang = Chuoi.Split('-');
            //int one = int.Parse(Mang.Length.ToString());
            //string chuoi1 = Mang[one - 1].ToString();
            //string[] Mang1 = chuoi1.Split('.');
            //idp = int.Parse(Mang1[0].ToString());
            tblProduct product   = db.tblProducts.Find(id);
            tblConfig  tblconfig = db.tblConfigs.First();

            ViewBag.Title       = "<title>" + product.Title + "</title>";
            ViewBag.dcTitle     = "<meta name=\"DC.title\" content=\"" + product.Title + "\" />";
            ViewBag.Description = "<meta name=\"description\" content=\"" + product.Description + "\"/>";
            ViewBag.Keyword     = "<meta name=\"keywords\" content=\"" + product.Keyword + "\" /> ";
            ViewBag.canonical   = "<link rel=\"canonical\" href=\"http://Thietbivesinhcaesar.vn/1/" + product.Tag + "-" + product.id + ".aspx\" />";
            string meta = "";

            meta        += "<meta itemprop=\"name\" content=\"" + product.Name + "\" />";
            meta        += "<meta itemprop=\"url\" content=\"" + Request.Url.ToString() + "\" />";
            meta        += "<meta itemprop=\"description\" content=\"" + product.Description + "\" />";
            meta        += "<meta itemprop=\"image\" content=\"http://Thietbivesinhcaesar.vn" + product.ImageLinkThumb + "\" />";
            meta        += "<meta property=\"og:title\" content=\"" + product.Title + "\" />";
            meta        += "<meta property=\"og:type\" content=\"product\" />";
            meta        += "<meta property=\"og:url\" content=\"" + Request.Url.ToString() + "\" />";
            meta        += "<meta property=\"og:image\" content=\"http://Thietbivesinhcaesar.vn" + product.ImageLinkThumb + "\" />";
            meta        += "<meta property=\"og:site_name\" content=\"http://Thietbivesinhcaesar.vn\" />";
            meta        += "<meta property=\"og:description\" content=\"" + product.Description + "\" />";
            meta        += "<meta property=\"fb:admins\" content=\"\" />";
            ViewBag.Meta = meta;

            int idMenu = int.Parse(product.idCate.ToString());

            var GroupProduct = db.tblGroupProducts.First(p => p.id == idMenu);
            int idCate       = GroupProduct.id;

            ViewBag.nUrl = "<a href=\"/\" title=\"Trang chu\" rel=\"nofollow\"><span class=\"iCon\"></span>Trang chủ</a> &raquo;" + UrlProduct(idCate) + " " + product.Name;

            //ListSanphamcungloai
            StringBuilder chuoisplq = new StringBuilder();

            chuoisplq.Append("<div class=\"nVar_Menu\">");
            chuoisplq.Append("<div class=\"Left_nVar_Menu\"></div>");
            chuoisplq.Append("<div class=\"Right_nVar_Menu\">");
            chuoisplq.Append("<h2>" + GroupProduct.Name + "</h2>");
            chuoisplq.Append("</div>");
            chuoisplq.Append("</div>");


            var ListGroups = db.tblGroupProducts.Where(p => p.ParentID == idCate && p.Active == true).OrderBy(p => p.Ord).ToList();

            chuoisplq.Append("<div id=\"Content_MenuLeft\">");
            chuoisplq.Append("<ul class=\"ul2\">");
            for (int i = 0; i < ListGroups.Count; i++)
            {
                chuoisplq.Append("<li class=\"li2\">");
                chuoisplq.Append("<h2><a href=\"/0/" + ListGroups[i].Tag + "-" + ListGroups[i].id + ".aspx\" title=\"" + ListGroups[i].Name + "\"><span></span> " + ListGroups[i].Name + "</a></h2>");
                chuoisplq.Append("</li>");
            }
            chuoisplq.Append("</ul>");

            chuoisplq.Append("</div>");


            ViewBag.chuoisplq = chuoisplq; string address = product.Address.ToString();
            string resultAddress = "";

            if (address != null && address != "")
            {
                int idaddress = int.Parse(address);
                if (db.tblAddresses.FirstOrDefault(p => p.id == idaddress) != null)
                {
                    resultAddress = db.tblAddresses.FirstOrDefault(p => p.id == idaddress).Name;
                }
            }
            ViewBag.address = resultAddress;
            return(View(product));
        }
        public PartialViewResult Boxfacebook()
        {
            tblConfig tblconfig = db.tblConfigs.First();

            return(PartialView(tblconfig));
        }
Example #26
0
        public PartialViewResult PartialRightProductDetail(string tag)
        {
            tblProduct    Product      = db.tblProducts.First(p => p.Tag == tag);
            tblConfig     tblconfig    = db.tblConfigs.First();
            StringBuilder chuoisupport = new StringBuilder();
            var           listSupport  = db.tblSupports.Where(p => p.Active == true).OrderBy(p => p.Ord).ToList();

            for (int i = 0; i < listSupport.Count; i++)
            {
                chuoisupport.Append("<div class=\"Line_Buttom\"></div>");
                chuoisupport.Append("<div class=\"Tear_Supports\">");
                chuoisupport.Append("<div class=\"Left_Tear_Support\">");
                chuoisupport.Append("<span class=\"htv1\">" + listSupport[i].Mission + ":</span>");
                chuoisupport.Append("<span class=\"htv2\">" + listSupport[i].Name + " :</span>");
                chuoisupport.Append("</div>");
                chuoisupport.Append("<div class=\"Right_Tear_Support\">");
                chuoisupport.Append("<div class=\"topTearSupport\">");

                chuoisupport.Append("<a href=\"tel:" + listSupport[i].Mobile + "\" title=\"" + listSupport[i].Name + "\"><img src=\"/Content/Display/iCon/logo_zalo.png\" alt=\"" + listSupport[i].Name + "\" /></a>");
                chuoisupport.Append("<a href=\"tel:" + listSupport[i].Mobile + "\" title=\"" + listSupport[i].Name + "\"><img src=\"/Content/Display/iCon/Viber_logo.png\" alt=\"" + listSupport[i].Name + "\" /></a>");
                chuoisupport.Append("</div>");
                chuoisupport.Append("<div class=\"bottomTearSupport\">");

                chuoisupport.Append("<span>" + listSupport[i].Mobile + "</span>");
                chuoisupport.Append("</div>");
                chuoisupport.Append("</div>");
                chuoisupport.Append("</div>");
            }
            ViewBag.chuoisupport = chuoisupport;

            //lIST Menu
            int             idCate           = int.Parse(Product.idCate.ToString());
            tblGroupProduct grouproduct      = db.tblGroupProducts.Find(idCate);
            int             idParent         = int.Parse(grouproduct.ParentID.ToString());
            string          chuoimenu        = "";
            var             listGroupProduct = db.tblGroupProducts.Where(p => p.ParentID == idParent && p.Active == true).OrderBy(p => p.Ord).ToList();

            for (int i = 0; i < listGroupProduct.Count; i++)
            {
                chuoimenu += "<h2><a href=\"/" + listGroupProduct[i].Tag + ".html\" title=\"\">› " + listGroupProduct[i].Name + "</a><h2>";
            }
            ViewBag.chuoimenu = chuoimenu;
            //Load sản phẩm liên quan
            string        Url          = grouproduct.Tag;
            StringBuilder chuoiproduct = new StringBuilder();
            var           listProduct  = db.tblProducts.Where(p => p.Active == true && p.idCate == idCate).OrderByDescending(p => p.Visit).OrderBy(p => p.Ord).Take(5).ToList();

            for (int i = 0; i < listProduct.Count; i++)
            {
                chuoiproduct.Append(" <div class=\"Tear_1\">");
                chuoiproduct.Append("<div class=\"img\">");
                chuoiproduct.Append("<a href=\"/" + listProduct[i].Tag + "-pd\" title=\"" + listProduct[i].Name + "\">");
                chuoiproduct.Append("<img src=\"" + listProduct[i].ImageLinkThumb + "\" alt=\"" + listProduct[i].Name + "\" />");
                chuoiproduct.Append("</a>");
                chuoiproduct.Append("</div>");
                chuoiproduct.Append("<h3><a href=\"/" + listProduct[i].Tag + "-pd\" title=\"" + listProduct[i].Name + "\" class=\"Name\">" + listProduct[i].Name + "</a><h3>");
                chuoiproduct.Append("<div class=\"Info\">");
                chuoiproduct.Append("<div class=\"LeftInfo\">");
                if (listProduct[i].PriceSale < 10)
                {
                    chuoiproduct.Append("<span class=\"PriceSale\">Liên hệ</span>");
                }
                else
                {
                    chuoiproduct.Append("<span class=\"PriceSale\">" + string.Format("{0:#,#}", listProduct[i].PriceSale) + "đ</span>");
                }
                if (listProduct[i].Price < 10)
                {
                    chuoiproduct.Append("<span class=\"Price\">Liên hệ</span>");
                }
                else
                {
                    chuoiproduct.Append("<span class=\"Price\">" + string.Format("{0:#,#}", listProduct[i].Price) + "đ</span>");
                }
                chuoiproduct.Append(" </div>");
                chuoiproduct.Append("<div class=\"RightInfo\">");
                chuoiproduct.Append("<div class=\"Top_RightInfo\">");
                chuoiproduct.Append("<a href=\"/Order/OrderIndex?idp=" + listProduct[i].id + "\" title=\"" + listProduct[i].Name + "\" rel=\"nofollow\"><span></span></a>");
                chuoiproduct.Append("</div>");
                chuoiproduct.Append("<div class=\"Bottom_RightInfo\">");
                int ids      = int.Parse(listProduct[i].id.ToString());
                var listfuc  = db.tblFunctionProducts.Where(p => p.Active == true).OrderBy(p => p.Ord).ToList();
                var checkfun = db.tblConnectFunProuducts.Where(p => p.idPro == ids).ToList();
                if (checkfun.Count > 0)
                {
                    for (int j = 0; j < listfuc.Count; j++)
                    {
                        int idfun      = int.Parse(listfuc[j].id.ToString());
                        var connectfun = db.tblConnectFunProuducts.Where(p => p.idFunc == idfun && p.idPro == ids).ToList();
                        if (connectfun.Count > 0)
                        {
                            chuoiproduct.Append("<a href=\"" + listfuc[j].Url + "\" rel=\"nofollow\" title=\"" + listfuc[j].Name + "\"><img src=\"" + listfuc[j].Images + "\" alt=\"" + listfuc[j].Name + "\" /></a>");
                        }
                    }
                }
                chuoiproduct.Append("</div>");
                chuoiproduct.Append("</div>");
                chuoiproduct.Append("</div>");
                chuoiproduct.Append("</div>");
            }
            ViewBag.chuoiproduct = chuoiproduct;
            return(PartialView(tblconfig));
        }
 private void setConfig(int id, string value)
 {
     if (db.tblConfigs.Count(c => c.id == id) == 1)
     {
         db.tblConfigs.Single(c => c.id == id).value = value;
         db.SubmitChanges();
     }
     else
     {
         tblConfig c = new tblConfig { id = id, value = value };
         db.tblConfigs.InsertOnSubmit(c);
         db.SubmitChanges();
     }
 }
        public ActionResult Command(FormCollection collection)
        {
            tblRegister register = new tblRegister();

            register.Name    = collection["txtName"];
            register.Mobile  = collection["txtMobile"];
            register.Address = collection["txtAddress"];
            register.Email   = collection["txtEmail"];
            if (collection["txtDatemua"] != null)
            {
                register.DateTimebyy = DateTime.Parse(collection["txtDatemua"]);
            }
            else
            {
                register.DateTimebyy = DateTime.Now;
            }

            if (collection["txtDatethay"] != null)
            {
                register.DateTime = DateTime.Parse(collection["txtDatethay"]);
            }
            else
            {
                register.DateTime = DateTime.Now;
            }

            db.tblRegisters.Add(register);
            db.SaveChanges();

            foreach (string key in Request.Form)
            {
                var checkbox = "";
                if (key.StartsWith("chk_"))
                {
                    checkbox = Request.Form["" + key];
                    if (checkbox != "false")
                    {
                        Int32            idll     = Convert.ToInt32(key.Remove(0, 4));
                        int              idkh     = int.Parse(db.tblRegisters.OrderByDescending(p => p.id).ToList()[0].id.ToString());
                        tblConnectLoiloc clloiloc = new tblConnectLoiloc();
                        clloiloc.idkh = idkh;
                        clloiloc.idll = idll;
                        db.tblConnectLoilocs.Add(clloiloc);
                        db.SaveChanges();
                    }
                }
            }
            tblConfig config       = db.tblConfigs.First();
            var       fromAddress  = config.UserEmail;
            var       toAddress    = config.Email;
            var       MaxRigister  = db.tblRegisters.OrderByDescending(p => p.id).Take(1).ToList();
            string    fromPassword = config.PassEmail;
            string    ararurl      = Request.Url.ToString();
            var       listurl      = ararurl.Split('/');
            string    urlhomes     = "";

            for (int i = 0; i < listurl.Length - 2; i++)
            {
                if (i > 0)
                {
                    urlhomes += "/" + listurl[i];
                }
                else
                {
                    urlhomes += listurl[i];
                }
            }
            int    Makh      = int.Parse(MaxRigister[0].id.ToString());
            string subject   = "Đăng ký thay lõi lọc nước thành công";
            string chuoihtml = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Thông tin đơn hàng</title></head><body style=\"background:#f2f2f2; font-family:Arial, Helvetica, sans-serif\"><div style=\"width:750px; height:auto; margin:5px auto; background:#FFF; border-radius:5px; overflow:hidden\">";

            chuoihtml += "<div style=\"width:100%; height:40px; float:left; margin:0px; background:#1c7fc4\"><span style=\"font-size:14px; line-height:40px; color:#FFF; margin:auto 20px; float:left\">" + DateTime.Now.Date + "</span><span style=\"font-size:14px; line-height:40px; float:right; margin:auto 20px; color:#FFF; text-transform:uppercase\">Hotline : " + config.HotlineIN + "</span></div>";
            chuoihtml += "<div style=\"width:100%; height:auto; float:left; margin:0px\"><div style=\"width:35%; height:100%; margin:0px; float:left\"><a href=\"/\" title=\"\"><img src=\"" + urlhomes + "" + config.Logo + "\" alt=\"Logo\" style=\"margin:8px; display:block; max-height:95% \" /></a></div><div style=\"width:60%; height:100%; float:right; margin:0px; text-align:right\"><span style=\"font-size:18px; margin:20px 5px 5px 5px; display:block; color:#ff5a00; text-transform:uppercase\">" + config.Name + "</span><span style=\"display:block; margin:5px; color:#515151; font-size:13px; text-transform:uppercase\">Lớn nhất - Chính hãng - Giá rẻ nhất việt nam</span> </div>  </div>";
            chuoihtml += "<span style=\"text-align:center; margin:10px auto; font-size:20px; color:#000; font-weight:bold; text-transform:uppercase; display:block\">Thông tin dăng ký</span>";
            chuoihtml += " <div style=\"width:90%; height:auto; margin:10px auto; background:#f2f2f2; padding:15px\">";
            chuoihtml += "<p style=\"font-size:14px; color:#464646; margin:5px 20px\">Website đăng ký : <span style=\"color:#1c7fc4\">" + urlhomes + "</span></p>";
            chuoihtml += "<p style=\"font-size:14px; color:#464646; margin:5px 20px\">Ngày đăng ký : <span style=\"color:#1c7fc4\">Vào lúc " + DateTime.Now.Hour + " giờ " + DateTime.Now.Minute + " phút ( ngày " + DateTime.Now.Day + " tháng " + DateTime.Now.Month + " năm " + DateTime.Now.Year + ") </span></p>";
            chuoihtml += "<p style=\"font-size:14px; color:#464646; margin:5px 20px\">Mã khách hàng : <span style=\"color:#1c7fc4\">" + Makh + " </span></p>";

            chuoihtml += "<div style=\" width:100%; margin:15px 0px\">";
            chuoihtml += "<div style=\"width:90%; height:auto; float:left; margin:0px; border:1px solid #d5d5d5\">";
            chuoihtml += "<div style=\" width:100%; height:30px; float:left; background:#1c7fc4; font-size:12px; color:#FFF; text-indent:15px; line-height:30px\">    	Thông tin đăng ký   </div>";
            chuoihtml += "<div style=\"width:100%; height:auto; float:left\">";
            chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Họ và tên :<span style=\"font-weight:bold\"> " + collection["txtName"] + "</span></p>";
            chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Địa chỉ :<span style=\"font-weight:bold\"> " + collection["txtAddress"] + "</span></p>";
            chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Điện thoại :<span style=\"font-weight:bold\"> " + collection["txtMobile"] + "</span></p>";
            chuoihtml += "<p style=\"font-size:12px; margin:5px 10px\">Email :<span style=\"font-weight:bold\">" + collection["txtEmail"] + "</span></p>";
            chuoihtml += "</div>";
            chuoihtml += "</div>";

            chuoihtml += "</div>";
            chuoihtml += "<div style=\"width:100%; height:auto; float:left; margin:0px\">";
            chuoihtml += "<hr style=\"width:80%; height:1px; background:#d8d8d8; margin:20px auto 10px auto\" />";
            chuoihtml += "<p style=\"font-size:12px; text-align:center; margin:5px 5px\">" + config.Address + "</p>";
            chuoihtml += "<p style=\"font-size:12px; text-align:center; margin:5px 5px\">Điện thoại : " + config.MobileIN + " - " + config.HotlineIN + "</p>";
            chuoihtml += " <p style=\"font-size:12px; text-align:center; margin:5px 5px; color:#ff7800\">Thời gian mở cửa : Từ 7h30 đến 18h30 hàng ngày (làm cả thứ 7, chủ nhật). Hãy liên hệ để được giảm giá.</p>";
            chuoihtml += "</div>";
            chuoihtml += "<div style=\"clear:both\"></div>";
            chuoihtml += " </div>";
            chuoihtml += " <div style=\"width:100%; height:40px; float:left; margin:0px; background:#1c7fc4\">";
            chuoihtml += "<span style=\"font-size:12px; text-align:center; color:#FFF; line-height:40px; display:block\">Copyright (c) 2002 – 2015 VINCOM VIET NAM. All Rights Reserved</span>";
            chuoihtml += " </div>";
            chuoihtml += "</div>";
            chuoihtml += "</body>";
            chuoihtml += "</html>";
            string body = chuoihtml;
            var    smtp = new System.Net.Mail.SmtpClient();

            {
                smtp.Host           = config.Host;
                smtp.Port           = int.Parse(config.Port.ToString());
                smtp.EnableSsl      = true;
                smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                smtp.Credentials    = new NetworkCredential(fromAddress, fromPassword);
                smtp.Timeout        = int.Parse(config.Timeout.ToString());
            }
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body,
                IsBodyHtml = true,
            })
            {
                smtp.Send(message);
            }
            string emails = collection["txtEmail"];

            using (var messages = new MailMessage(fromAddress, emails)
            {
                Subject = subject,
                Body = body,
                IsBodyHtml = true,
            })
            {
                smtp.Send(messages);
            }


            Session["Register"] = "<script>$(document).ready(function(){ alert('Bạn đã đăng ký thành công !') });</script>";
            return(Redirect("/"));
        }
        public PartialViewResult PartialBanner()
        {
            tblConfig tblconfig = db.tblConfigs.First();

            return(PartialView(tblconfig));
        }
Example #30
0
 public void AddTotblConfigs(tblConfig tblConfig)
 {
     base.AddObject("tblConfigs", tblConfig);
 }
Example #31
0
        public PartialViewResult RightProductSyn(string tag)
        {
            var    tblproductSyn = db.tblProductSyns.First(p => p.Tag == tag);
            string chuoisupport  = "";
            var    listSupport   = db.tblSupports.Where(p => p.Active == true).OrderBy(p => p.Ord).ToList();

            for (int i = 0; i < listSupport.Count; i++)
            {
                chuoisupport += "<div class=\"Line_Buttom\"></div>";
                chuoisupport += "<div class=\"Tear_Supports\">";
                chuoisupport += "<div class=\"Left_Tear_Support\">";
                chuoisupport += "<span class=\"htv1\">" + listSupport[i].Mission + ":</span>";
                chuoisupport += "<span class=\"htv2\">" + listSupport[i].Name + " :</span>";
                chuoisupport += "</div>";
                chuoisupport += "<div class=\"Right_Tear_Support\">";
                chuoisupport += "<a href=\"ymsgr:sendim?" + listSupport[i].Yahoo + "\">";
                chuoisupport += "<img src=\"http://opi.yahoo.com/online?u=" + listSupport[i].Yahoo + "&m=g&t=1\" alt=\"Yahoo\" class=\"imgYahoo\" />";
                chuoisupport += " </a>";
                chuoisupport += "<a href=\"Skype:" + listSupport[i].Skyper + "?chat\">";
                chuoisupport += "<img class=\"imgSkype\" src=\"/Content/Display/iCon/skype-icon.png\" title=\"Kangaroo\" alt=\"" + listSupport[i].Name + "\">";
                chuoisupport += "</a>";
                chuoisupport += "</div>";
                chuoisupport += "</div>";
            }
            ViewBag.chuoisupport = chuoisupport;


            //Load sản phẩm liên quan
            string chuoiproduct   = "";
            var    listProductSyn = db.tblProductSyns.Where(p => p.Active == true).OrderBy(p => p.Ord).Take(7).ToList();

            for (int i = 0; i < listProductSyn.Count; i++)
            {
                chuoiproduct += " <div class=\"spdb\">";
                chuoiproduct += " <div class=\"sptb\"></div>";

                chuoiproduct += " <div class=\"img_spdb\">";
                chuoiproduct += " <a href=\"/Syn/" + listProductSyn[i].Tag + "\" title=\"" + listProductSyn[i].Name + "\"><img src=\"" + listProductSyn[i].ImageLinkThumb + "\" alt=\"" + listProductSyn[i].Name + "\" /></a>";
                chuoiproduct += " </div>";
                chuoiproduct += " <a href=\"/Syn/" + listProductSyn[i].Tag + "\" class=\"Name\" title=\"" + listProductSyn[i].Name + "\">" + listProductSyn[i].Name + "</a>";
                chuoiproduct += "<div class=\"Bottom_Tear_Sale\">";
                chuoiproduct += "<div class=\"Price\">";
                chuoiproduct += "<p class=\"PriceSale\">" + string.Format("{0:#,#}", listProductSyn[i].PriceSale) + " <span>đ</span></p>";
                chuoiproduct += "<p class=\"Price_s\">" + string.Format("{0:#,#}", listProductSyn[i].Price) + "</p>";
                chuoiproduct += "</div>";
                chuoiproduct += "<div class=\"sevices\">";
                if (listProductSyn[i].Status == true)
                {
                    chuoiproduct += "<span class=\"Status\"></span>";
                }
                else
                {
                    chuoiproduct += "<span class=\"StatusNo\"></span>";
                }

                chuoiproduct += "<span class=\"Transport\"><span class=\"icon\">";
                if (listProductSyn[i].Transport == true)
                {
                    chuoiproduct += "</span> Toàn quốc</span>";
                }
                else
                {
                    chuoiproduct += "</span> Liên hệ</span>";
                }
                chuoiproduct += "<span class=\"View\"></span>";
                chuoiproduct += "</div>";
                chuoiproduct += "</div>";

                chuoiproduct += "  </div>";
            }
            ViewBag.chuoiproduct = chuoiproduct;
            tblConfig tblconfig = db.tblConfigs.First();

            return(PartialView(tblconfig));
        }
Example #32
0
        public ActionResult Index(string tag)
        {
            tblConfig tblcongif = db.tblConfigs.First();

            tblGroupProduct groupproduct = db.tblGroupProducts.First(p => p.Tag == tag.Substring(8, (tag.Length - 1)));
            int             idmenu       = int.Parse(groupproduct.id.ToString());
            var             kiemtra      = db.tblConnectManuProducts.Where(p => p.idCate == idmenu).ToList();

            if (kiemtra.Count > 0)
            {
                int            idManu      = int.Parse(kiemtra[0].idManu.ToString());
                tblManufacture manufacture = db.tblManufactures.Find(idManu);
                ViewBag.Namemanu  = manufacture.Name;
                ViewBag.Info      = manufacture.Content;
                ViewBag.name      = groupproduct.Name; ViewBag.favicon = " <link href=\"" + groupproduct.Favicon + "\" rel=\"icon\" type=\"image/x-icon\" />";
                ViewBag.imagemanu = manufacture.Images;



                string moth  = "";
                int    moths = int.Parse(DateTime.Now.Month.ToString());
                if (moths <= 3)
                {
                    moth = "tháng 1,2,3 ";
                }
                else if (moths > 3 && moths <= 6)
                {
                    moth = "tháng 4,5,6 ";
                }
                else if (moths > 6 && moths <= 9)
                {
                    moth = "tháng 7,8,9 ";
                }
                else if (moths >= 9 && moths <= 12)
                {
                    moth = "tháng 10,11,12 ";
                }

                ViewBag.Title       = "<title>Bảng báo giá " + groupproduct.Name + " " + moth + "năm " + DateTime.Now.Year + " rẻ nhất HN</title>";
                ViewBag.Description = "<meta name=\"description\" content=\"Bảng báo giá " + groupproduct.Name + ", dịch vụ thay lõi lọc nước " + manufacture.Name + " tại nhà . " + tblcongif.Name + " là nhà phân phối chính thức Lõi máy lọc nước " + manufacture.Name + "  .\"/>";
                ViewBag.Keyword     = "<meta name=\"keywords\" content=\"Bảng Báo giá sản phẩm " + groupproduct.Name + "\" /> ";
                string meta = "";
                ViewBag.canonical = "<link rel=\"canonical\" href=\"http://Thayloilocnuoc.com/bao-gia/" + groupproduct.Tag + "\" />";
                meta        += "<meta itemprop=\"name\" content=\"Bảng báo giá " + groupproduct.Name + " " + moth + "năm " + DateTime.Now.Year + " rẻ nhất HN\" />";
                meta        += "<meta itemprop=\"url\" content=\"" + Request.Url.ToString() + "\" />";
                meta        += "<meta itemprop=\"description\" content=\"Bảng báo giá " + groupproduct.Name + ", dịch vụ thay lõi lọc nước " + manufacture.Name + " tại nhà . " + tblcongif.Name + " là nhà phân phối chính thức Lõi máy lọc nước " + manufacture.Name + "\" />";
                meta        += "<meta itemprop=\"image\" content=\"http://Thayloilocnuoc.com" + groupproduct.Images + "\" />";
                meta        += "<meta property=\"og:title\" content=\"Bảng báo giá " + groupproduct.Name + " " + moth + "năm " + DateTime.Now.Year + " rẻ nhất HN\" />";
                meta        += "<meta property=\"og:type\" content=\"product\" />";
                meta        += "<meta property=\"og:url\" content=\"" + Request.Url.ToString() + "\" />";
                meta        += "<meta property=\"og:image\" content=\"http://Thayloilocnuoc.com" + groupproduct.Images + "\" />";
                meta        += "<meta property=\"og:site_name\" content=\"http://Thayloilocnuoc.com\" />";
                meta        += "<meta property=\"og:description\" content=\"" + groupproduct.Description + "\" />";
                meta        += "<meta property=\"fb:admins\" content=\"\" />";
                ViewBag.Meta = meta;
                ViewBag.nUrl = "<ol itemscope itemtype=\"http://schema.org/BreadcrumbList\">   <li itemprop=\"itemListElement\" itemscope  itemtype=\"http://schema.org/ListItem\"> <a itemprop=\"item\" href=\"http://Thayloilocnuoc.com\">  <span itemprop=\"name\">Trang chủ</span></a> <meta itemprop=\"position\" content=\"1\" />  </li>   › Báo giá " + groupproduct.Name + "</ol> ";

                StringBuilder schame = new StringBuilder();
                schame.Append("<script type=\"application/ld+json\">");
                schame.Append("{");
                schame.Append("\"@context\": \"http://schema.org\",");
                schame.Append("\"@type\": \"NewsArticle\",");
                schame.Append("\"headline\": \"" + groupproduct.Name + "\",");
                schame.Append(" \"datePublished\": \"" + groupproduct.DateCreate + "\",");
                schame.Append("\"image\": [");
                schame.Append(" \"" + manufacture.Images.Remove(0, 1) + "\"");
                schame.Append(" ]");
                schame.Append("}");
                schame.Append("</script> ");

                ViewBag.schame = schame.ToString();
                string chuoi       = "";
                var    listproduct = db.tblProducts.Where(p => p.Active == true && p.idCate == idmenu).OrderBy(p => p.Ord).ToList();
                for (int i = 0; i < listproduct.Count; i++)
                {
                    chuoi += "<tr>";
                    chuoi += "<td class=\"Ords\">" + (i + 1) + "</td>";
                    chuoi += "<td class=\"Names\">";
                    string note = "";
                    if (listproduct[i].Sale != null && listproduct[i].Sale != "")
                    {
                        note = "<span>" + listproduct[i].Access + "</span>";
                    }

                    chuoi += "<a href=\"/1/" + listproduct[i].Tag + "\" title=\"" + listproduct[i].Name + "\">" + listproduct[i].Name + " " + note + " </a>";
                    chuoi += "<span class=\"n2\">Chức năng : " + listproduct[i].Info + "</span>";
                    chuoi += "<span class=\"n3\">Chính hãng " + manufacture.Name + " </span>";
                    chuoi += " </td>";
                    chuoi += "<td class=\"Codes\"><a href=\"/Tabs/" + listproduct[i].Code + "\" title=\"" + listproduct[i].Code + "\">" + listproduct[i].Code + "</a></td>";
                    chuoi += "<td class=\"Wans\"><a href=\"/1/" + listproduct[i].Tag + "\" title=\"" + listproduct[i].Name + "\"><img src=\"" + listproduct[i].ImageLinkThumb + "\" alt=\"" + listproduct[i].Name + "\" title=\"" + listproduct[i].Name + "\"/></a>" + listproduct[i].Time + "</td>";
                    chuoi += "<td class=\"Prices\">" + string.Format("{0:#,#}", listproduct[i].PriceSale) + "đ  <span class=\"n4\">Miễn phí vận chuyển và lắp đặt toàn quốc</span></td>";
                    //chuoi += "<td class=\"Qualitys\">01</td>";
                    //chuoi += "<td class=\"SumPrices\">" + string.Format("{0:#,#}", listproduct[i].PriceSale) + "đ</td>";
                    chuoi += "<td class=\"Images\"><a href=\"/1/" + listproduct[i].Tag + "\" title=\"" + listproduct[i].Name + "\"><img src=\"" + listproduct[i].ImageLinkThumb + "\" alt=\"" + listproduct[i].Name + "\" title=\"" + listproduct[i].Name + "\"/></a></td>";
                    chuoi += "</tr>";
                }
                ViewBag.chuoi = chuoi;
            }
            return(View(tblcongif));
        }
Example #33
0
 public static tblConfig CreatetblConfig(int ID)
 {
     tblConfig tblConfig = new tblConfig();
     tblConfig.ID = ID;
     return tblConfig;
 }