Exemplo n.º 1
0
        public ActionResult DeleteManufactures(int id)
        {
            if (ClsCheckRole.CheckQuyen(8, 3, int.Parse(Request.Cookies["Username"].Values["UserID"])) == true)
            {
                tblManufacture tblmanu = db.tblManufactures.Find(id);
                var            result  = string.Empty;
                db.tblManufactures.Remove(tblmanu);
                db.SaveChanges();
                var ListManu = db.tblConnectManuProducts.Where(p => p.idManu == id).ToList();
                for (int i = 0; i < ListManu.Count; i++)
                {
                    db.tblConnectManuProducts.Remove(ListManu[i]);
                    db.SaveChanges();
                }
                clsSitemap.DeteleSitemap(id.ToString(), "Manufactures");

                result = "Bạn đã xóa thành công.";
                return(Json(new { result = result }));
            }
            else
            {
                var result = string.Empty;
                result = "Bạn không có quyền thay đổi tính năng này";
                return(Json(new { result = result }));
            }
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
0
        public ActionResult Edit(tblManufacture tblmanufacture, int id, FormCollection collection, int[] MutilMenu)
        {
            if (ModelState.IsValid)
            {
                tblmanufacture.Tag             = StringClass.NameToTag(tblmanufacture.Name);
                db.Entry(tblmanufacture).State = EntityState.Modified;
                db.SaveChanges();
                var ListManu = db.tblConnectManuProducts.Where(p => p.idManu == id).ToList();
                for (int i = 0; i < ListManu.Count; i++)
                {
                    db.tblConnectManuProducts.Remove(ListManu[i]);
                    db.SaveChanges();
                }
                if (MutilMenu != null)
                {
                    foreach (var idCates in MutilMenu)
                    {
                        tblConnectManuProduct tblmanufactures = new tblConnectManuProduct();
                        tblmanufactures.idCate = idCates;
                        tblmanufactures.idManu = id;
                        db.tblConnectManuProducts.Add(tblmanufactures);
                        db.SaveChanges();
                    }
                }
                clsSitemap.UpdateSitemap("hang-san-xuat/" + tblmanufacture.Tag, id.ToString(), "Manufactures");
                #region [Updatehistory]
                Updatehistoty.UpdateHistory("Edit tblmanufactures", Request.Cookies["Username"].Values["FullName"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString());
                #endregion
                if (collection["btnSave"] != null)
                {
                    Session["Thongbao"] = "<div  class=\"alert alert-info alert1\">Bạn đã sửa  thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>";

                    return(Redirect("/Manufacturesad/Index"));
                }
                if (collection["btnSaveCreate"] != null)
                {
                    Session["Thongbao"] = "<div  class=\"alert alert-info\">Bạn đã thêm thành công, mời bạn thêm mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>";
                    return(Redirect("/Manufacturesad/Create"));
                }
            }
            return(View(tblmanufacture));
        }
Exemplo n.º 4
0
        public ActionResult Edit(int id = 0)
        {
            if ((Request.Cookies["Username"] == null))
            {
                return(RedirectToAction("LoginIndex", "Login"));
            }
            if (ClsCheckRole.CheckQuyen(8, 2, int.Parse(Request.Cookies["Username"].Values["UserID"])) == true)
            {
                tblManufacture tblmanu = db.tblManufactures.Find(id);

                //int idCate = int.Parse(tblcriteria.idCate.ToString());
                var menuModel = db.tblGroupProducts.Where(m => m.ParentID == null && m.Active == true).OrderBy(m => m.Ord).ToList();
                carlist.Clear();
                string strReturn = "---";
                foreach (var item in menuModel)
                {
                    carlist.Add(new SelectListItem {
                        Text = item.Name, Value = item.id.ToString()
                    });
                    StringClass.DropDownListFor(item.id, carlist, strReturn);
                    strReturn = "---";
                }
                var        ListManu = db.tblConnectManuProducts.Where(p => p.idManu == id).ToList();
                List <int> mang     = new List <int>();
                for (int i = 0; i < ListManu.Count; i++)
                {
                    mang.Add(int.Parse(ListManu[i].idCate.ToString()));
                }
                ViewBag.MutilMenu = new MultiSelectList(carlist, "Value", "Text", mang);
                if (tblmanu == null)
                {
                    return(HttpNotFound());
                }
                return(View(tblmanu));
            }
            else
            {
                return(Redirect("/Users/Erro"));
            }
        }
Exemplo n.º 5
0
        public ActionResult Create(tblManufacture tblmanu, FormCollection collection, int[] MutilMenu)
        {
            tblmanu.Tag = StringClass.NameToTag(tblmanu.Name);
            db.tblManufactures.Add(tblmanu);
            db.SaveChanges();
            var ListManu = db.tblManufactures.OrderByDescending(p => p.id).Take(1).ToList();
            int idManu   = int.Parse(ListManu[0].id.ToString());

            if (MutilMenu != null)
            {
                foreach (var idCate in MutilMenu)
                {
                    tblConnectManuProduct tblManufactures = new tblConnectManuProduct();
                    tblManufactures.idCate = idCate;
                    tblManufactures.idManu = idManu;
                    db.tblConnectManuProducts.Add(tblManufactures);
                    db.SaveChanges();
                }
            }
            var ListManufac = db.tblManufactures.OrderByDescending(p => p.id).Take(1).ToList();

            clsSitemap.CreateSitemap("hang-san-xuat/" + ListManufac[0].Tag, ListManufac[0].id.ToString(), "Manufactures");

            Updatehistoty.UpdateHistory("Add tblManufactures", Request.Cookies["Username"].Values["FullName"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString());
            if (collection["btnSave"] != null)
            {
                Session["Thongbao"] = "<div  class=\"alert alert-info alert1\">Bạn đã thêm thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>";
                return(Redirect("/Manufacturesad/Index"));
            }
            if (collection["btnSaveCreate"] != null)
            {
                Session["Thongbao"] = "<div  class=\"alert alert-info\">Bạn đã thêm thành công, mời bạn thêm mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>";
                return(Redirect("/Manufacturesad/Create"));
            }
            return(Redirect("Index"));
        }
Exemplo n.º 6
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));
        }