예제 #1
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)
            {
                if (Session["Thongbao"] != "")
                {
                    ViewBag.thongbao    = Session["Thongbao"];
                    Session["Thongbao"] = "";
                }
                TblConfig TblConfig = db.TblConfig.FirstOrDefault();


                if (TblConfig == null)
                {
                    return(HttpNotFound());
                }
                else
                {
                    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 DtoTblConfig(TblConfig config, HttpStatusCode statusEffect)
        {
            id     = config.id;
            JwtKey = config.JwtKey;

            StatusEffect = statusEffect;
        }
예제 #3
0
        public async Task <TblConfig> AddConfig(TblConfig config)
        {
            HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync("api/ConfigCore/AddConfig", config);

            TblConfig ans = await httpResponseMessage.Content.ReadAsAsync <TblConfig>();

            return(ans);
        }
        public ActionResult ListProductAgency(string tag)
        {
            var listManufacture = db.SelectListItem.First(p => p.Tag == tag);
            int idManu          = int.Parse(listManufacture.id.ToString());
            var listIdCate      = db.tblConnectManuProducts.Where(p => p.idManu == idManu).Select(p => p.idCate).ToList();
            var MenuParent      = db.tblGroupProducts.Where(p => listIdCate.Contains(p.id) && 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://Kangaroochinhhang.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());
        }
예제 #5
0
        public async Task <bool> UpdateConfig(TblConfig config, int logId)
        {
            List <object> configAndLogId = new List <object>();

            configAndLogId.Add(config);
            configAndLogId.Add(logId);
            HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync("api/ConfigCore/UpdateConfig", configAndLogId);

            bool ans = await httpResponseMessage.Content.ReadAsAsync <bool>();

            return(ans);
        }
예제 #6
0
        public ActionResult Index(TblConfig TblConfig, int id = 1)
        {
            if (ModelState.IsValid)
            {
                TblConfig.Id = id;

                #region [Updatehistory]
                #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));
        }
예제 #7
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));
        }
        public IHttpActionResult AddConfig(TblConfig config)
        {
            var task = Task.Run(() => new ConfigService().AddConfig(config));

            if (task.Wait(TimeSpan.FromSeconds(10)))
            {
                if (task.Result.id != -1)
                {
                    return(Ok(new DtoTblConfig(task.Result, HttpStatusCode.OK)));
                }
                else
                {
                    return(Conflict());
                }
            }
            return(StatusCode(HttpStatusCode.RequestTimeout));
        }
        public IHttpActionResult UpdateConfig(List <object> configLogId)
        {
            TblConfig config = JsonConvert.DeserializeObject <TblConfig>(configLogId[0].ToString());
            int       logId  = JsonConvert.DeserializeObject <int>(configLogId[1].ToString());
            var       task   = Task.Run(() => new ConfigService().UpdateConfig(config, logId));

            if (task.Wait(TimeSpan.FromSeconds(10)))
            {
                if (task.Result)
                {
                    return(Ok(true));
                }
                else
                {
                    return(Conflict());
                }
            }
            return(StatusCode(HttpStatusCode.RequestTimeout));
        }
예제 #10
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://Kangaroochinhhang.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://Kangaroochinhhang.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://Kangaroochinhhang.com" + TblConfig.Logo + "\" />";
            meta           += "<meta property=\"og:site_name\" content=\"http://Kangaroochinhhang.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());
        }
예제 #11
0
        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 bool UpdateConfig(TblConfig config, int logId)
 {
     return new MainProvider().Update(config, logId);
 }
 public TblConfig AddConfig(TblConfig config)
 {
     return (TblConfig) new MainProvider().Add(config);
 }
예제 #14
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)
            {
                Session["idManu"] = "";
                int            idManu      = int.Parse(kiemtra[0].idManu.ToString());
                tblManufacture manufacture = db.SelectListItem.Find(idManu);
                ViewBag.Namemanu  = manufacture.Name;
                ViewBag.Info      = manufacture.Content;
                ViewBag.name      = groupproduct.Name;
                ViewBag.color     = manufacture.Color;
                ViewBag.email     = manufacture.Email;
                ViewBag.website   = manufacture.Website;
                Session["idManu"] = idManu;
                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 + " 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://Kangaroochinhhang.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://Kangaroochinhhang.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://Kangaroochinhhang.com" + groupproduct.Images + "\" />";
                meta        += "<meta property=\"og:site_name\" content=\"http://Kangaroochinhhang.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://Kangaroochinhhang.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();

                var listId = db.tblGroupProducts.Where(p => p.ParentID == idmenu).Select(p => p.id).ToList();
                listId.Add(idmenu);
                string chuoi       = "";
                var    listproduct = db.tblProducts.Where(p => p.Active == true && listId.Contains(p.idCate.Value)).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].NoteInfo + "</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í lắp đặt tại Hà Nội, Miễn phí chuyển hàng 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));
        }
예제 #15
0
        public ActionResult Index(string tag)
        {
            TblConfig tblcongif    = db.TblConfig.First();
            var       groupproduct = db.TblGroupProduct.FirstOrDefault(p => p.Tag == tag);
            int       idmenu       = int.Parse(groupproduct.Id.ToString());

            Session["idManu"] = "";
            ViewBag.name      = groupproduct.Name;
            ViewBag.color     = tblcongif.Color;
            ViewBag.email     = tblcongif.Email;
            ViewBag.website   = "Bontana.vn";
            ViewBag.favicon   = " <link href=\"" + tblcongif.Favicon + "\" rel=\"icon\" type=\"image/x-icon\" />";
            ViewBag.imagemanu = tblcongif.Logo;

            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 Việt Nam</title>";
            ViewBag.Description = "<meta name=\"description\" content=\"Bảng báo giá " + groupproduct.Name + " chính hãng Giá rẻ nhất Việt Nam, Cam kết Bontana Hàng Chất Lượng .\"/>";
            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://Bontana.vn/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 + " chính hãng của Bontana Chính Hãng Giá rẻ nhất Việt Nam\" />";
            meta        += "<meta itemprop=\"image\" content=\"http://Bontana.vn" + 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://Bontana.vn" + groupproduct.Images + "\" />";
            meta        += "<meta property=\"og:site_name\" content=\"http://Bontana.vn\" />";
            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://Bontana.vn\">  <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(" \"" + tblcongif.Logo.Remove(0, 1) + "\"");
            schame.Append(" ]");
            schame.Append("}");
            schame.Append("</script> ");
            ViewBag.schame = schame.ToString();

            var listId = db.TblGroupProduct.Where(p => p.ParentId == idmenu).Select(p => p.Id).ToList();

            listId.Add(idmenu);
            string chuoi       = "";
            var    listproduct = db.TblProduct.Where(p => p.Active == true && listId.Contains(p.IdCate.Value)).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\">";
                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 + "   </a>";
                chuoi += "<span class=\"n2\">Chức năng : " + listproduct[i].Note + "</span>";
                chuoi += "<span class=\"n3\">Sản phẩm Tân Á Đại Thành Chính Hãng </span>";
                chuoi += " </td>";
                chuoi += "<td class=\"Codes\">" + listproduct[i].Code + "</td>";
                chuoi += "<td class=\"Wans\">" + listproduct[i].Warranty + " năm</td>";
                chuoi += "<td class=\"Prices\">" + string.Format("{0:#,#}", listproduct[i].PriceSale) + "đ  <span class=\"n4\">Phân phối toàn quốc - " + listproduct[i].PriceNote + "</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=\"/san-pham/" + 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));
        }
예제 #16
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.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 đơ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 Kangaroochinhhang</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.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). 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 Kangaroochinhhang 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("Success"));
                }
                catch (Exception ex)
                {
                    Session["Status"] = "<script>$(document).ready(function(){ alert('Bạn đã đặt hàng không thành công " + ex.Message + "!') });</script>";
                    return(RedirectToAction("OrderIndex"));
                }
            }
            return(RedirectToAction("OrderIndex"));
        }
예제 #17
0
 public bool UpdateConfig(TblConfig config, int logId)
 {
     return(new ConfigRepo().UpdateConfig(config, logId));
 }
예제 #18
0
        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("/"));
        }
예제 #19
0
 public TblConfig AddConfig(TblConfig config)
 {
     return(new ConfigRepo().AddConfig(config));
 }
예제 #20
0
        public PartialViewResult Boxfacebook()
        {
            TblConfig TblConfig = db.TblConfigs.First();

            return(PartialView(TblConfig));
        }