public ActionResult ChuyenNhanVienTheoDoi(string CategoryGuid, int?UserId, string MoTaNoiDungChuyen) { shCategoryService _category = new shCategoryService(); shCategory category = _category.FindByKey(CategoryGuid); _category.ThemMoi_HieuChinhCategory( category.CategoryGuid, null, category.CategoryName, category.ParentId, UserId, category.Status, category.CreatedDate, category.MetaTitle, category.Description, category.SortOrder, category.FileName); if (Request.IsAjaxRequest()) { return(Json("OK", JsonRequestBehavior.AllowGet)); } return(RedirectToAction("Index")); }
public ActionResult Create(string DanhMucGuid, int?DanhMucId, string CategoryName, string CategoryGuid, bool?Status, string Description, int?SortOrder, string FileName) { shCategory category = new shCategory(); using (var context = new ShopOnlineDb()) { using (var dbContextTransaction = context.Database.BeginTransaction()) { try { // Insert- update Category shCategoryService _category = new shCategoryService(); category = _category.ThemMoi_HieuChinhCategory( DanhMucGuid, null, CategoryName, CategoryGuid, null, Status, DateTime.Now, null, Description, SortOrder, FileName); // Insesrt Image if (!string.IsNullOrEmpty(FileName) || !string.IsNullOrWhiteSpace(FileName)) { shCategoryImageService _categoryImage = new shCategoryImageService(); shCategoryImage categoryImage = _categoryImage.Insert_UpdateCategoryImage( null, null, category.CategoryGuid, FileName, null, User.Identity.GetUserLogin().Userid, true, DateTime.Now, null ); } dbContextTransaction.Commit(); } catch (Exception ex) { dbContextTransaction.Rollback(); } } } int?page = CommonHelper.FindPageCategory(category.CategoryGuid, category.CategoryId); return(RedirectToAction("Index", new { page = page })); }
public ActionResult ChuyenNhanVienTheoDoi(string CategoryGuid) { shCategoryService _category = new shCategoryService(); shCategory category = _category.FindByKey(CategoryGuid); qtUserService _user = new qtUserService(); IEnumerable <qtUser> ds = _user.DanhSachUser(null, TypeHelper.ToInt32(User.Identity.GetUserLogin().Unitid), null); ViewBag.UserId = new SelectList(ds, "UserId", "UserName", category.UserId); return(PartialView("ChuyenNhanVienTheoDoi", category)); }
public ActionResult Index(int?id) { shCategoryService _category = new shCategoryService(); if (!id.HasValue) { // Nếu link truyền vào không có id ( ví dụ link tổng quát: san-pham thì mặc định lấy trang danh mục đầu tiên) id = _category.DanhSachCategory().FirstOrDefault().CategoryId; } shCategory category = _category.FindList().Where(x => x.CategoryId == id).FirstOrDefault(); ViewBag.CategoryGuid = category.CategoryGuid; DsProduct(category.CategoryGuid, 1); return(View(category)); }
public static string LamDanhMucHienThiView(string CategoryGuid) { string html = string.Empty; shCategoryService _category = new shCategoryService(); shCategory category = _category.FindByKey(CategoryGuid); while (!string.IsNullOrWhiteSpace(category.ParentId) || !string.IsNullOrEmpty(category.ParentId)) { category = _category.FindByKey(category.ParentId); //html += StringHelper.ConvertToTitleCase(category.CategoryName) + " » "; html += category.CategoryName + " » "; } return(html); }
public static MvcHtmlString NhanVienXuLyDanhMuChinh(this HtmlHelper helper, shCategory category) { qtUserService _user = new qtUserService(); string UserName = string.Empty; if (!string.IsNullOrEmpty(category.ParentId) || !string.IsNullOrWhiteSpace(category.ParentId)) { shCategoryService _category = new shCategoryService(); shCategory parent = _category.FindByKey(category.ParentId); if (parent != null) { UserName = "******" + _user.UserName(parent.UserId) + " » </span>"; } } UserName += "<span data-toggle='tooltip' title='Theo dõi chính' data-original-title='Theo dõi chính' style='font-weight: 600; color: #72afd2;'>" + _user.UserName(category.UserId) + "</span>"; return new MvcHtmlString(UserName); }
public ActionResult Create(string DanhMucGuid, int?DanhMucId, string CategoryName, string CategoryGuid, bool?Status, string Description, int?SortOrder, string FileName) { // Insert Category shCategoryService _category = new shCategoryService(); shCategory category = _category.ThemMoi_HieuChinhCategory( DanhMucGuid, null, CategoryName, CategoryGuid, HttpContext.User.Identity.GetUserLogin().Userid, Status, DateTime.Now, null, Description, SortOrder, FileName); // Insesrt Image if (!string.IsNullOrEmpty(FileName) || !string.IsNullOrWhiteSpace(FileName)) { shCategoryImageService _categoryImage = new shCategoryImageService(); shCategoryImage categoryImage = _categoryImage.Insert_UpdateCategoryImage( null, null, category.CategoryGuid, FileName, null, User.Identity.GetUserLogin().Userid, true, DateTime.Now, null ); } int?page = CommonHelper.FindPageCategory(category.CategoryGuid, category.CategoryId); return(RedirectToAction("Index", new { page = page })); }
public ActionResult Create(string id) { if (!string.IsNullOrWhiteSpace(id)) { shCategoryService _category = new shCategoryService(); shCategory category = _category.FindByKey(id); if (category != null) { ViewBag.DanhMucId = category.CategoryId; ViewBag.DanhMucGuid = category.CategoryGuid; ViewBag.ParentId = category.ParentId; return(View(category)); } else { return(View(new shCategory())); } } ViewBag.CategoryId = id; return(View(new shCategory())); }
public static string GetUrlTheFirst(string CategoryGuid) { shCategoryService _category = new shCategoryService(); shCategory category = new shCategory(); string controller = CategoryGuid; if (!string.IsNullOrWhiteSpace(CategoryGuid) || !string.IsNullOrEmpty(CategoryGuid)) { category = _category.FindByKey(CategoryGuid); if (!string.IsNullOrWhiteSpace(category.ParentId) || !string.IsNullOrEmpty(category.ParentId)) { controller = GetUrlTheFirst(category.ParentId); } else { controller = category.CategoryGuid; } } return(controller); }