public ActionResult Create(tblAgency tblagency, FormCollection collection) { tblagency.DateCreate = DateTime.Now; string idUser = Request.Cookies["Username"].Values["UserID"]; tblagency.idUser = int.Parse(idUser); tblagency.Tag = StringClass.NameToTag(tblagency.Name); db.tblAgencies.Add(tblagency); db.SaveChanges(); #region [Updatehistory] var Groups = db.tblCapacities.Where(p => p.Active == true).OrderByDescending(p => p.id).Take(1).ToList(); string id = Groups[0].id.ToString(); clsSitemap.CreateSitemap("NhaPhanPhoi/" + StringClass.NameToTag(tblagency.Name) + "-" + tblagency.id + ".aspx", id, "Agency"); Updatehistoty.UpdateHistory("Add tblagency", 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 đã thêm thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Agencyad/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 danh mục mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Agencyad/Create")); } return(Redirect("Index")); }
public ActionResult Create(tblProductSale tblproductsale, FormCollection collection) { tblproductsale.Tag = StringClass.NameToTag(tblproductsale.Name); db.tblProductSales.Add(tblproductsale); db.SaveChanges(); var lisstch = db.tblProductSyns.OrderByDescending(p => p.id).Take(1).First(); int id = lisstch.id; clsSitemap.CreateSitemap("Sale/" + StringClass.NameToTag(tblproductsale.Name), id.ToString(), "ProductSale"); #region [Updatehistory] Updatehistoty.UpdateHistory("Add ProductSalead", 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 đã thêm thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/ProductSalead/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("/ProductSalead/Create")); } return(Redirect("Index")); }
public ActionResult Create(tblCriteria tblcriteria, FormCollection collection, int[] MutilMenu) { db.tblCriterias.Add(tblcriteria); db.SaveChanges(); var listcri = db.tblCriterias.OrderByDescending(p => p.id).Take(1).ToList(); int idCri = int.Parse(listcri[0].id.ToString()); if (MutilMenu != null) { foreach (var idCate in MutilMenu) { tblGroupCriteria tblgroupcrieria = new tblGroupCriteria(); tblgroupcrieria.idCate = idCate; tblgroupcrieria.idCri = idCri; db.tblGroupCriterias.Add(tblgroupcrieria); db.SaveChanges(); } } Updatehistoty.UpdateHistory("Add tblcriteria", 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("/Criteria/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 tiêu trí mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Criteria/Create")); } return(Redirect("Index")); }
public ActionResult Edit(tblProductSale tblproductsale, int id, FormCollection collection) { if (ModelState.IsValid) { tblproductsale.Tag = StringClass.NameToTag(tblproductsale.Name); db.Entry(tblproductsale).State = EntityState.Modified; db.SaveChanges(); clsSitemap.UpdateSitemap("Sale/" + StringClass.NameToTag(tblproductsale.Name), id.ToString(), "ProductSale"); #region [Updatehistory] Updatehistoty.UpdateHistory("Edit tblproductsale", 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("/ProductSalead/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("/ProductSalead/Create")); } } return(View(tblproductsale)); }
public ActionResult Edit(tblInfoCriteria tblcriteria, int id, FormCollection collection) { if (ModelState.IsValid) { int idcate = int.Parse(collection["drMenu"]); tblcriteria.idCri = idcate; db.Entry(tblcriteria).State = EntityState.Modified; db.SaveChanges(); #region [Updatehistory] Updatehistoty.UpdateHistory("Edit tblcriteria", 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("/InfoCriteria/Index?id=" + idcate + "")); } 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("/InfoCriteria/Create?id=" + idcate + "")); } } return(View(tblcriteria)); }
public ActionResult Edit(tblHotline tblhotline, int id, FormCollection collection) { if (ModelState.IsValid) { int type = int.Parse(collection["Type"]); tblhotline.Type = type; db.Entry(tblhotline).State = EntityState.Modified; db.SaveChanges(); #region [Updatehistory] Updatehistoty.UpdateHistory("Edit Hotline", 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("/Hotline/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("/Hotline/Create")); } } return(View(tblhotline)); }
public ActionResult Create(tblWeb tblweb, FormCollection collection, int[] MutilMenu) { db.tblWebs.Add(tblweb); db.SaveChanges(); var Listwebs = db.tblWebs.OrderByDescending(p => p.id).Take(1).ToList(); int idweb = int.Parse(Listwebs[0].id.ToString()); if (MutilMenu != null) { foreach (var idCate in MutilMenu) { tblConnectWeb tblconnectwebs = new tblConnectWeb(); tblconnectwebs.idCate = idCate; tblconnectwebs.idWeb = idweb; db.tblConnectWebs.Add(tblconnectwebs); db.SaveChanges(); } } Updatehistoty.UpdateHistory("Add tblWeb", 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("/Web/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("/Web/Create")); } return(Redirect("Index")); }
public ActionResult Create(tblTag tbltag, FormCollection collection) { tbltag.DateCreate = DateTime.Now; string idUser = Request.Cookies["Username"].Values["UserID"]; tbltag.idUser = int.Parse(idUser); db.tblTags.Add(tbltag); db.SaveChanges(); #region [Updatehistory] Updatehistoty.UpdateHistory("Add tbltag", 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 đã thêm thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Tagsad/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 danh mục mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Tagsad/Create")); } return(Redirect("Index")); }
public ActionResult Create(tblGuarantee tblGuarantee, FormCollection collection, int id, int idCate) { int ids = int.Parse(collection["drDistrict"].ToString()); int idCates = int.Parse(collection["drManu"].ToString()); tblGuarantee.idDistrict = id; tblGuarantee.idManu = idCates; tblGuarantee.DateCreate = DateTime.Now; tblGuarantee.Tag = StringClass.NameToTag(tblGuarantee.Name); db.tblGuarantees.Add(tblGuarantee); db.SaveChanges(); #region [Updatehistory] Updatehistoty.UpdateHistory("Add tblGuarantee", 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 đã thêm thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Guaranteead/Index?id=" + ids + "&idCate=" + idCates + "")); } 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 danh mục mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Guaranteead/Create?id=" + ids + "&idCate=" + idCates + "")); } return(Redirect("Index")); }
public ActionResult Edit(tblTag tbltag, int id, FormCollection collection) { string idUser = Request.Cookies["Username"].Values["UserID"]; tbltag.idUser = int.Parse(idUser); tbltag.DateCreate = DateTime.Now; db.Entry(tbltag).State = EntityState.Modified; db.SaveChanges(); #region [Updatehistory] Updatehistoty.UpdateHistory("Edit Tags", 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("/Tagsad/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("/Tagsad/Create")); } return(View(tbltag)); }
public ActionResult Create(tblImage tblimages, FormCollection collection, int[] MutilMenu) { int idCate = int.Parse(collection["drMenu"]); tblimages.idCate = idCate; db.tblImages.Add(tblimages); db.SaveChanges(); var ListManu = db.tblImages.OrderByDescending(p => p.id).Take(1).ToList(); int idimg = int.Parse(ListManu[0].id.ToString()); if (MutilMenu != null) { foreach (var idMenu in MutilMenu) { tblConnectImage tblconnectimages = new tblConnectImage(); tblconnectimages.idCate = idMenu; tblconnectimages.idImg = idimg; db.tblConnectImages.Add(tblconnectimages); db.SaveChanges(); } } Updatehistoty.UpdateHistory("Add tblimages", 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("/Imagesad/Index?idCate=" + idCate + "")); } 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("/Imagesad/Create?id=" + idCate + "")); } return(Redirect("Index")); }
public ActionResult Edit(tblGroupPrice GroupPrice, int id, FormCollection collection) { if (ModelState.IsValid) { db.Entry(GroupPrice).State = EntityState.Modified; db.SaveChanges(); int nSale = int.Parse(GroupPrice.Sale.ToString()); var listProduct = db.tblProducts.Where(p => p.Group == id).ToList(); foreach (var item in listProduct) { int idp = item.id; tblProduct tblproduct = db.tblProducts.Find(idp); int Price = int.Parse(item.Price.ToString()); tblproduct.PriceSale = Price - ((Price * nSale) / 100); db.SaveChanges(); } #region [Updatehistory] Updatehistoty.UpdateHistory("Edit GroupPrice", 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("/GroupPrice/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("/GroupPrice/Create")); } } return(View(GroupPrice)); }
public ActionResult Edit(tblImage tblimages, int id, FormCollection collection, int[] MutilMenu, int[] mutilManu) { if (ModelState.IsValid) { tblimages.idCate = int.Parse(collection["drMenu"]); int idcate = int.Parse(collection["drMenu"]); db.Entry(tblimages).State = EntityState.Modified; db.SaveChanges(); var ListImages = db.tblConnectImages.Where(p => p.idImg == id).ToList(); for (int i = 0; i < ListImages.Count; i++) { db.tblConnectImages.Remove(ListImages[i]); db.SaveChanges(); } if (MutilMenu != null) { foreach (var idCates in MutilMenu) { tblConnectImage tbllistimages = new tblConnectImage(); tbllistimages.idCate = idCates; tbllistimages.idImg = id; db.tblConnectImages.Add(tbllistimages); db.SaveChanges(); } } var listIdManu = db.tblConnectManuToImages.Where(p => p.idImage == id).ToList(); for (int i = 0; i < listIdManu.Count; i++) { db.tblConnectManuToImages.Remove(listIdManu[i]); db.SaveChanges(); } if (mutilManu != null) { foreach (var idMenu in mutilManu) { tblConnectManuToImage connectimage = new tblConnectManuToImage(); connectimage.idManu = idMenu; connectimage.idImage = id; db.tblConnectManuToImages.Add(connectimage); db.SaveChanges(); } } #region [Updatehistory] Updatehistoty.UpdateHistory("Edit tblimages", 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("/Imagesad/Index?idCate=" + idcate + "")); } 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("/Imagesad/Create?id=" + idcate + "")); } } return(View(tblimages)); }
public ActionResult Edit(tblProductSyn tblProductsyn, int id, FormCollection collection) { if (ModelState.IsValid) { tblProductsyn.Tag = StringClass.NameToTag(tblProductsyn.Name); string[] listarray = tblProductsyn.ImageLinkDetail.Split('/'); string ImageLinkDetail = collection["ImageLinkDetail"]; string imagethum = listarray[listarray.Length - 1]; tblProductsyn.ImageLinkThumb = "/Images/_thumbs/Images/" + imagethum; db.Entry(tblProductsyn).State = EntityState.Modified; db.SaveChanges(); var listsyn = db.ProductConnects.Where(p => p.idSyn == id).ToList(); if (listsyn.Count > 0) { for (int i = 0; i < listsyn.Count; i++) { Int32 idpp = listsyn[i].id; var listchld = db.ProductConnects.First(p => p.id == idpp); db.ProductConnects.Remove(listchld); db.SaveChanges(); } } string Chuoisyn = collection["CodeSyn"]; string[] Mang = Chuoisyn.Split(','); ProductConnect productconnect = new ProductConnect(); var listproductSyn = db.tblProductSyns.OrderByDescending(p => p.id).Take(1).ToList(); int idsyn = int.Parse(listproductSyn[0].id.ToString()); for (int i = 0; i < Mang.Length; i++) { productconnect.idSyn = id; string idpd = Mang[i].ToString(); productconnect.idpd = idpd; db.ProductConnects.Add(productconnect); db.SaveChanges(); } clsSitemap.UpdateSitemap("syn/" + StringClass.NameToTag(tblProductsyn.Name), id.ToString(), "ProductSYN"); #region [Updatehistory] Updatehistoty.UpdateHistory("Edit tblProductsyn", 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("/ProductSYNad/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("/ProductSYNad/Create")); } } return(View(tblProductsyn)); }
public ActionResult Detail(int id) { tblOrder tbldetail = db.tblOrders.Find(id); tbldetail.Status = true; db.SaveChanges(); Updatehistoty.UpdateHistory("Đã check đơn hàng có mã là " + id + " vào lúc " + DateTime.Now + " ", Request.Cookies["Username"].Values["Username"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString()); string chuoi = ""; chuoi += "<table align=\"left\" cellpadding=\"2\">"; chuoi += "<tr class=\"top\">"; chuoi += "<td class=\"Name\">Tên sản phẩm</td>"; chuoi += "<td class=\"Price\">Đơn giá</td>"; chuoi += "<td class=\"Ord\">SL</td>"; chuoi += "<td class=\"PriceSale\">Thành tiền</td>"; chuoi += "</tr>"; var listOrrder = db.tblOrderDetails.Where(p => p.idOrder == id).ToList(); for (int i = 0; i < listOrrder.Count; i++) { chuoi += "<tr class=\"row" + listOrrder[i].id + "\" >"; chuoi += "<td class=\"Name\" >"; int idPro = int.Parse(listOrrder[i].idProduct.ToString()); var product = db.tblProducts.Find(idPro); chuoi += "<a href=\"/San-pham/" + product.Tag + "\" title=\"" + product.Name + "\" target=\"_blank\" id=\"UpdateOrd" + product.id + "\"><img src=\"" + product.ImageLinkThumb + "\" alt=\"" + product.Name + "\" title=\"" + product.Name + "\" /></a>"; chuoi += "<a href=\"/San-pham/" + product.Tag + "\" title=\"" + product.Name + "\" target=\"_blank\" class=\"Namepd\">" + product.Name + "</a>"; chuoi += "</td>"; chuoi += "<td class=\"Price\"><span>" + string.Format("{0:#,#}", listOrrder[i].Price) + " vnđ</span></td>"; chuoi += "<td class=\"Ord\"><input type=\"number\" name=\"Ord\" class=\"txtOrd" + listOrrder[i].id + "\" value=\"" + listOrrder[i].Quantily + "\" /></td>"; chuoi += "<td class=\"PriceSale\"><span id=\"Gia" + listOrrder[i].id + "\">" + string.Format("{0:#,#}", listOrrder[i].SumPrice) + " vnđ</span></td>"; chuoi += "</tr>"; } chuoi += "</table>"; chuoi += " <div class=\"Sum\">"; chuoi += " <div class=\"LeftSUM\">"; chuoi += " <span>Bạn có <span class=\"count\">" + listOrrder.Count + "</span> sản phẩm trong giỏ hàng</span>"; chuoi += " </div>"; chuoi += " <div class=\"RightSUM\">"; chuoi += " <span class=\"Sum1\">Tổng cộng : <span class=\"tt\">" + string.Format("{0:#,#}", db.tblOrders.Find(id).Tolar) + "</span> vnđ </span>"; chuoi += " <span class=\"Sum2\">Thành tiền: <span class=\"tt\">" + string.Format("{0:#,#}", db.tblOrders.Find(id).Tolar) + "</span> vnđ </span>"; chuoi += " </div>"; chuoi += "</div>"; chuoi += "<div class=\"OrderNows\">"; chuoi += " </div>"; ViewBag.chuoi = chuoi; return(View(db.tblOrders.Find(id))); }
public ActionResult Create(tblNew tblnews, FormCollection Collection, string id, int[] MutilMenu) { if ((Request.Cookies["Username"] == null)) { return(RedirectToAction("LoginIndex", "Login")); } string nidCate = Collection["drMenu"]; if (nidCate != "") { tblnews.idCate = int.Parse(nidCate); int idcate = int.Parse(nidCate); tblnews.DateCreate = DateTime.Now; tblnews.Tag = StringClass.NameToTag(tblnews.Name); tblnews.DateCreate = DateTime.Now; string idUser = Request.Cookies["Username"].Values["UserID"]; tblnews.idUser = int.Parse(idUser); StringClass.NewsCreateTag(tblnews.id, tblnews.Keyword); db.tblNews.Add(tblnews); db.SaveChanges(); var listprro = db.tblNews.OrderByDescending(p => p.id).Take(1).ToList(); clsSitemap.CreateSitemap("tin-tuc/" + tblnews.Tag, listprro[0].id.ToString(), "News"); #region [Updatehistory] Updatehistoty.UpdateHistory("Create News", Request.Cookies["Username"].Values["Username"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString()); #endregion var ListNews = db.tblNews.OrderByDescending(p => p.id).Take(1).ToList(); int idNews = int.Parse(ListNews[0].id.ToString()); if (MutilMenu != null) { foreach (var idCate in MutilMenu) { tblConnectNew tblconnectnews = new tblConnectNew(); tblconnectnews.idCate = idCate; tblconnectnews.idNew = idNews; db.tblConnectNews.Add(tblconnectnews); db.SaveChanges(); } } if (Collection["btnSave"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info alert1\">Bạn đã thêm tinthành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Newsad/index?idCate=" + nidCate + "")); } if (Collection["btnSaveCreate"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info\">Bạn đã thêm tin thành công, mời bạn thêm tin mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Newsad/Create?id=" + nidCate + "")); } } return(View()); }
public ActionResult Edit(TblAddress TblAddress, int id, FormCollection collection, int[] mutilManu) { if (ModelState.IsValid) { string drAddress = collection["drAddress"]; if (drAddress == "" && drAddress != null) { TblAddress.idCate = 0; } else { TblAddress.idCate = int.Parse(drAddress); } db.Entry(TblAddress).State = EntityState.Modified; db.SaveChanges(); var listIdManu = db.tblConnectManuToAddresses.Where(p => p.idAdress == id).ToList(); for (int i = 0; i < listIdManu.Count; i++) { db.tblConnectManuToAddresses.Remove(listIdManu[i]); db.SaveChanges(); } if (mutilManu != null) { foreach (var idMenu in mutilManu) { tblConnectManuToAddress connectimage = new tblConnectManuToAddress(); connectimage.idManu = idMenu; connectimage.idAdress = id; db.tblConnectManuToAddresses.Add(connectimage); db.SaveChanges(); } } #region [Updatehistory] Updatehistoty.UpdateHistory("Edit Hotline", 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("/address/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("/address/Create")); } } return(View(TblAddress)); }
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 ActionResult Create(tblGroupNew tblgroupnews, FormCollection collection) { if ((Request.Cookies["Username"] == null)) { return(RedirectToAction("LoginIndex", "Login")); } string drMenu = collection["drMenu"]; string nLevel; if (drMenu == "") { tblgroupnews.ParentID = null; } else { var dbLeve = db.tblGroupNews.Find(int.Parse(drMenu)); tblgroupnews.ParentID = dbLeve.id; } tblgroupnews.DateCreate = DateTime.Now; string idUser = Request.Cookies["Username"].Values["UserID"]; tblgroupnews.idUser = int.Parse(idUser); tblgroupnews.Tag = StringClass.NameToTag(tblgroupnews.Name); db.tblGroupNews.Add(tblgroupnews); db.SaveChanges(); Updatehistoty.UpdateHistory("Add Group Product", Request.Cookies["Username"].Values["FullName"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString()); var Groups = db.tblGroupNews.Where(p => p.Active == true).OrderByDescending(p => p.id).Take(1).ToList(); string id = Groups[0].id.ToString(); clsSitemap.CreateSitemap(StringClass.NameToTag(tblgroupnews.Name), id, "GroupNews"); if (collection["btnSave"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info alert1\">Bạn đã thêm danh mục thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/GroupNews/Index?idCate=" + drMenu)); } if (collection["btnSaveCreate"] != null) { Session["Thongbao"] = "<div class=\"alert alert-info\">Bạn đã thêm danh mục thành công, mời bạn thêm danh mục mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/GroupNews/Create?id=" + drMenu + "")); } return(Redirect("/GroupNews/Index?idCate=" + drMenu)); }
public ActionResult Create(TblAddress TblAddress, FormCollection collection, int[] mutilManu) { string drAddress = collection["drAddress"]; if (drAddress == "" && drAddress != null) { TblAddress.idCate = 0; } else { TblAddress.idCate = int.Parse(drAddress); } db.TblAddress.Add(TblAddress); db.SaveChanges(); var ListManu = db.TblAddress.OrderByDescending(p => p.id).Take(1).ToList(); int id = int.Parse(ListManu[0].id.ToString()); if (mutilManu != null) { foreach (var idMenu in mutilManu) { tblConnectManuToAddress connect = new tblConnectManuToAddress(); connect.idManu = idMenu; connect.idAdress = id; db.tblConnectManuToAddresses.Add(connect); db.SaveChanges(); } } #region [Updatehistory] Updatehistoty.UpdateHistory("Add TblAddress", 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 đã thêm thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/address/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("/address/Create")); } return(Redirect("Index")); }
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)); }
public ActionResult Create(tblGroupImage tblgroupimages, FormCollection collection) { db.tblGroupImages.Add(tblgroupimages); db.SaveChanges(); #region [Updatehistory] Updatehistoty.UpdateHistory("Add tblgroupimages", 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 đã thêm thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/GroupImages/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 danh mục mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/GroupImages/Create")); } return(Redirect("Index")); }
public ActionResult DeleteOrder(int id) { if (ClsCheckRole.CheckQuyen(12, 3, int.Parse(Request.Cookies["Username"].Values["UserID"])) == true) { tblOrder tblorder = db.tblOrders.Find(id); var result = string.Empty; db.tblOrders.Remove(tblorder); db.SaveChanges(); Updatehistoty.UpdateHistory("Đã xóa đơn hàng có mã là " + id + " vào lúc " + DateTime.Now + " ", Request.Cookies["Username"].Values["Username"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString()); 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 })); } }
public ActionResult Edit(tblMap tblmaps, FormCollection collection) { if (ModelState.IsValid) { string idUser = Request.Cookies["Username"].Values["UserID"]; tblmaps.UserID = int.Parse(idUser); tblmaps.DateCreate = DateTime.Now; int id = int.Parse(collection["idMaps"]); tblmaps.id = id; db.Entry(tblmaps).State = EntityState.Modified; db.SaveChanges(); #region [Updatehistory] Updatehistoty.UpdateHistory("Update Maps", Request.Cookies["Username"].Values["Username"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString()); #endregion } return(View(tblmaps)); }
public ActionResult Edit(tblCriteria tblcriteria, int id, FormCollection collection, int[] MutilMenu) { if (ModelState.IsValid) { db.Entry(tblcriteria).State = EntityState.Modified; db.SaveChanges(); var listcri = db.tblGroupCriterias.Where(p => p.idCri == id).ToList(); for (int i = 0; i < listcri.Count; i++) { db.tblGroupCriterias.Remove(listcri[i]); db.SaveChanges(); } if (MutilMenu != null) { foreach (var idCates in MutilMenu) { tblGroupCriteria tblgroupcrieria = new tblGroupCriteria(); tblgroupcrieria.idCate = idCates; tblgroupcrieria.idCri = id; db.tblGroupCriterias.Add(tblgroupcrieria); db.SaveChanges(); } } #region [Updatehistory] Updatehistoty.UpdateHistory("Edit tblcriteria", 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("/Criteria/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("/Criteria/Create")); } } return(View(tblcriteria)); }
public ActionResult Edit(tblAgency tblagency, int id, FormCollection collection) { if (ModelState.IsValid) { string idUser = Request.Cookies["Username"].Values["UserID"]; tblagency.idUser = int.Parse(idUser); bool URL = (collection["URL"] == "false") ? false : true; if (URL == true) { tblagency.Tag = StringClass.NameToTag(tblagency.Name); } else { tblagency.Tag = collection["NameURL"]; } tblagency.DateCreate = DateTime.Now; db.Entry(tblagency).State = EntityState.Modified; db.SaveChanges(); clsSitemap.UpdateSitemap("4/" + StringClass.NameToTag(tblagency.Name) + "-" + tblagency.id + ".aspx", id.ToString(), "Capacity"); #region [Updatehistory] Updatehistoty.UpdateHistory("Edit Agency", 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("/Agencyad/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("/Agencyad/Create")); } } return(View(tblagency)); }
public ActionResult Create(tblService tblservice, FormCollection collection) { tblservice.DateCreate = DateTime.Now; tblservice.Tag = StringClass.NameToTag(tblservice.Name); db.tblServices.Add(tblservice); db.SaveChanges(); #region [Updatehistory] Updatehistoty.UpdateHistory("Add tblservice", 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 đã thêm thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/servicead/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 danh mục mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/servicead/Create")); } return(Redirect("Index")); }
public ActionResult Create(tblInfoCriteria tblcriteria, FormCollection collection) { int idcate = int.Parse(collection["drMenu"]); tblcriteria.idCri = idcate; db.tblInfoCriterias.Add(tblcriteria); db.SaveChanges(); Updatehistoty.UpdateHistory("Add tblcriteria", 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("/InfoCriteria/Index?id=" + idcate + "")); } 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 tiêu trí mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/InfoCriteria/Create?id=" + idcate + "")); } return(Redirect("Index")); }
public ActionResult Edit(tblGuarantee tblGuarantee, int id, FormCollection collection) { if (ModelState.IsValid) { bool URL = (collection["URL"] == "false") ? false : true; int ids = int.Parse(collection["drDistrict"].ToString()); int idCates = int.Parse(collection["drManu"].ToString()); tblGuarantee.idDistrict = ids; tblGuarantee.DateCreate = DateTime.Now; tblGuarantee.idManu = idCates; if (URL == true) { tblGuarantee.Tag = StringClass.NameToTag(tblGuarantee.Name); } else { tblGuarantee.Tag = collection["NameURL"]; } tblGuarantee.Tag = StringClass.NameToTag(tblGuarantee.Name); db.Entry(tblGuarantee).State = EntityState.Modified; db.SaveChanges(); #region [Updatehistory] Updatehistoty.UpdateHistory("Edit tblGuarantee", 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("/Guaranteead/Index?id=" + ids + "&idCate=" + idCates + "")); } 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("/Guaranteead/Create?id=" + ids + "&idCate=" + idCates + "")); } } return(View(tblGuarantee)); }
public ActionResult Create(tblHotline tblhotline, FormCollection collection) { int type = int.Parse(collection["Type"]); tblhotline.Type = type; db.tblHotlines.Add(tblhotline); db.SaveChanges(); #region [Updatehistory] Updatehistoty.UpdateHistory("Add Hotline", 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 đã thêm thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>"; return(Redirect("/Hotline/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("/Hotline/Create")); } return(Redirect("Index")); }