public ActionResult Index() { var lstCate = _daCategory.GetChildByParentId(false); ViewBag.lstCate = lstCate; return(View()); }
public ActionResult Index() { var ltsAllCategory = _categoryDa.GetChildByParentId(true); var model = new ModelCategoryItem { ListItem = ltsAllCategory, }; return(View(model)); }
public ActionResult AjaxForm() { var model = new Category { IsShow = true, Sort = 0, ParentId = (ArrId.Any()) ? ArrId.FirstOrDefault() : 0, }; var lstCate = _categoryDa.GetChildByParentId(false); ViewBag.lstCate = lstCate; ViewBag.Action = DoAction; ViewBag.ActionText = ActionText; var item = lstCate.FirstOrDefault(c => c.ID == model.ParentId); if (DoAction == ActionType.Edit) { model = _categoryDa.GetById(ArrId.FirstOrDefault()); ViewBag.ParentId = item != null ? item.IsLevel : 0; } else { ViewBag.ParentId = item != null ? item.IsLevel + 1 : 1; } return(View(model)); }
//#region Dùng trong Upload ảnh ///// <summary> ///// Dùng khi submit ///// </summary> ///// <returns></returns> //[HttpPost] //public ActionResult AjaxFormPictureSubmit() //{ // var date = DateTime.Now; // var msg = new JsonMessage(false, "Thêm mới hình ảnh thành công."); // var folder = date.Year + "\\" + date.Month + "\\" + date.Day + "\\"; // var fileinsert = date.Year + "/" + date.Month + "/" + date.Day + "/"; // var folderinsert = fileinsert; // var urlFolder = ConfigData.TempFolder; // var lstFile = Request["lstFile"]; // var lstP = JsonConvert.DeserializeObject<List<FileUploadItem>>(lstFile); // try // { // foreach (var item in lstP) // { // var fileName = item.Url; // var imageSource = Image.FromFile(urlFolder + fileName); // var checkfolder = false; // if (Request["ckImage_" + (int)FolderImage.Originals] != null) // { // checkfolder = true; // ImageProcess.CreateForder(ConfigData.OriginalFolder); // tạo forder Năm / Tháng / Ngày // if (imageSource.Width > ConfigData.ImageFullHdFile.Width) // { // var image = ImageProcess.ResizeImage(imageSource, ConfigData.ImageFullHdFile); // ImageProcess.SaveJpeg(ConfigData.OriginalFolder + folder + fileName, new Bitmap(image), 92L); // Save file Original // } // else // { // System.IO.File.Copy(urlFolder + fileName, ConfigData.OriginalFolder + folder + fileName); // } // folderinsert = "Originals/" + fileinsert; // } // if (Request["ckImage_" + (int)FolderImage.Images] != null) // { // checkfolder = true; // ImageProcess.CreateForder(ConfigData.ImageFolder); // tạo forder Năm / Tháng / Ngày // if (imageSource.Width > ConfigData.ImageHdFile.Width) // { // var image = ImageProcess.ResizeImage(imageSource, ConfigData.ImageHdFile); // ImageProcess.SaveJpeg(ConfigData.ImageFolder + folder + fileName, new Bitmap(image), 92L); // Save file Images // } // else // { // System.IO.File.Copy(ConfigData.ImageFolder + fileName, ConfigData.ImageFolder + folder + fileName); // } // folderinsert = "Images/" + fileinsert; // } // //Resize ảnh 640 // if (Request["ckImage_" + (int)FolderImage.Mediums] != null) // { // checkfolder = true; // ImageProcess.CreateForder(ConfigData.ImageUploadMediumFolder); // tạo forder Năm / Tháng / Ngày // if (imageSource.Width > ConfigData.ImageMediumFile.Width) // { // var image = ImageProcess.ResizeImage(imageSource, ConfigData.ImageFullHdFile); // ImageProcess.SaveJpeg(ConfigData.ImageUploadMediumFolder + folder + fileName, new Bitmap(image), 92L); // Save file Medium // } // else // { // System.IO.File.Copy(urlFolder + fileName, ConfigData.ImageUploadMediumFolder + folder + fileName); // } // folderinsert = "Mediums/" + fileinsert; // } // if (!checkfolder) // { // folderinsert = "Thumbs/" + fileinsert; // } // if (Request["ckImage_" + (int)FolderImage.Thumbs] != null) // { // ImageProcess.CreateForder(ConfigData.ThumbsFolder); // } // if (imageSource.Width < ConfigData.ImageThumbsSize.Width) // { // ImageProcess.SaveJpeg(ConfigData.ThumbsFolder + folder + fileName, new Bitmap(imageSource), 92L); // Save file Thumbs // } // else // { // imageSource = ImageProcess.ResizeImage(imageSource, ConfigData.ImageThumbsSize); // ImageProcess.SaveJpeg(ConfigData.ThumbsFolder + folder + fileName, new Bitmap(imageSource), 92L); // Save file Thumbs // } // imageSource.Dispose(); // //Lấy thông tin cần thiết // var picture = new Gallery_Picture // { // Type = !string.IsNullOrEmpty(Request["type"]) ? Convert.ToInt32(Request["type"]) : 0, // CategoryID = // !string.IsNullOrEmpty(Request["CategoryID"]) ? Convert.ToInt32(Request["CategoryID"]) : 1, // Folder = folderinsert, // Name = item.Name, // DateCreated = DateTime.Now, // IsShow = true, // Url = fileName, // IsDeleted = false // }; // _da.Add(picture); // } // _da.Save(); // try // { // var di = new DirectoryInfo(urlFolder); // foreach (var file in di.GetFiles()) // { // file.Delete(); // } // foreach (var dir in di.GetDirectories()) // { // dir.Delete(true); // } // } // catch { } // } // catch (Exception ex) // { // msg.Erros = true; // msg.Message = "Thêm mới hình ảnh thất bại."; // } // return Json(msg, JsonRequestBehavior.AllowGet); //} ///// <summary> ///// Sau khi upload xong, cập nhật thông tin cho picture ///// </summary> ///// <returns></returns> //public ActionResult AjaxFormPictureUpdate() //{ // var arrFile = Request["fileData"]; // var oSerializer = new JavaScriptSerializer(); // var ltsFileobj = oSerializer.Deserialize<List<FileObj>>(arrFile); // var type = Request["Type"]; // var categoryId = Request["CategoryID"]; // var model = new ModelFileObj // { // ListCategoryItem = _categoryDa.GetChildByParentId(false), // ListItem = ltsFileobj, // Type = !string.IsNullOrEmpty(type) ? Convert.ToInt32(type) : 0, // CategoryId = !string.IsNullOrEmpty(categoryId) ? Convert.ToInt32(categoryId) : 0, // Action = DoAction.ToString() // }; // return View(model); //} public ActionResult AjaxFormFiles() { var model = _categoryDa.GetChildByParentId(false, (int)ModuleType.Document); ViewBag.Action = DoAction; return(View(model)); }
public ActionResult AjaxForm() { var questionModel = new FAQ_Question { IsShow = true }; if (DoAction == ActionType.Edit) { questionModel = _questionDa.GetById(ArrId.FirstOrDefault()); } ViewBag.CategoryID = _categoryDa.GetChildByParentId(false, (int)ModuleType.FAQ); ViewData.Model = questionModel; ViewBag.Action = DoAction; ViewBag.ActionText = ActionText; return(View()); }
/// <summary> /// Sau khi upload xong, cập nhật thông tin cho picture /// </summary> /// <returns></returns> public ActionResult AjaxFormPictureUpdate() { var arrFile = Request["fileData"]; var oSerializer = new JavaScriptSerializer(); var ltsFileobj = oSerializer.Deserialize <List <FileObj> >(arrFile); var type = Request["Type"]; var categoryId = Request["CategoryID"]; var model = new ModelFileObj { ListCategoryItem = _categoryDa.GetChildByParentId(false), ListItem = ltsFileobj, Type = !string.IsNullOrEmpty(type) ? Convert.ToInt32(type) : 0, CategoryId = !string.IsNullOrEmpty(categoryId) ? Convert.ToInt32(categoryId) : 0, Action = DoAction.ToString() }; return(View(model)); }
public ActionResult AjaxForm() { var document = new DocumentItem(); if (DoAction == ActionType.Edit) { document = _da.GetDocumentItem(ArrId.FirstOrDefault()); } ViewBag.CategoryId = _categoryDa.GetChildByParentId(false, (int)ModuleType.Document); ViewData.Model = document; ViewBag.Action = DoAction; ViewBag.ActionText = ActionText; return(View()); }
/// <summary> /// Form dùng cho thêm mới, sửa. Load bằng Ajax dialog /// </summary> /// <returns></returns> public ActionResult AjaxForm() { var model = new Menu { IsShow = true, Sort = 0, ParentId = (ArrId.Any()) ? ArrId.FirstOrDefault() : 0 }; if (DoAction == ActionType.Edit) { model = _da.GetById(ArrId.FirstOrDefault()); } ViewBag.ParentID = _da.GetListByParentId(groupid, Utility.AgencyId); ViewBag.CategoryID = _categoryDa.GetChildByParentId(false); ViewBag.PageID = _sysPageDa.GetChildByParentId(); ViewBag.Action = DoAction; ViewBag.ActionText = ActionText; return(View(model)); }
public ActionResult Index() { var model = _categoryDa.GetChildByParentId(false); return(View(model)); }
public ActionResult GetChildByParentId(string key, bool setTitle) { var obj = key != Keyapi ? new List <CategoryItem>() : _da.GetChildByParentId(setTitle); return(Json(obj, JsonRequestBehavior.AllowGet)); }