private void InitCategoup(INFOR_MASTERModel model) { var parentModuleData = INFOR_CATEGORIESSService.INFOR_CATEGORIESList.Where(t => t.ParentID == "") .Select(t => new INFOR_MASTERModel { ID = t.ID, InforCategoryName = t.InforCategoryName }); foreach (var item in parentModuleData) { model.Categrouies.Add(new SelectListItem { Text = item.InforCategoryName, Value = item.ID }); var childs = INFOR_CATEGORIESSService.INFOR_CATEGORIESList.Where(t => t.ParentID == item.ID); if (childs.Count() > 0) { foreach (var citem in childs) { model.Categrouies.Add(new SelectListItem { Text = "|-- " + citem.InforCategoryName, Value = citem.ID }); } } } }
public ActionResult Create(INFOR_MASTERModel model) { if (ModelState.IsValid) { //this.CreateBaseData<INFOR_MASTERModel>(model); model.ID = CombHelper.NewComb().ToString("N"); model.CreateDate = DateTime.Now; model.Creator = base.GetCurrentUser().Userid; OperationResult result = INFOR_MASTERService.Insert(model); if (result.ResultType == OperationResultType.Success) { return(Json(result)); } else { InitCategoup(model); return(PartialView(model)); } } else { InitCategoup(model); return(PartialView(model)); } }
public ActionResult Create() { var model = new INFOR_MASTERModel(); InitCategoup(model); return(PartialView(model)); }
public OperationResult Update(INFOR_MASTERModel model) { var entity = INFOR_MASTERList.First(t => t.ID == model.ID); entity.ID = model.ID; entity.InforSubject = model.InforSubject; entity.InforCategoryID = model.InforCategoryID; entity.Introduction = model.Introduction; entity.Author = model.Author; entity.ViewTimes = model.ViewTimes; entity.Description = model.Description; entity.Creator = model.Creator; entity.CreateDate = model.CreateDate; entity.Modifier = model.Modifier; entity.ModiDate = model.ModiDate; entity.DisplayOrder = model.DisplayOrder; entity.Status = model.Status; entity.Item01 = model.Item01; entity.Item02 = model.Item02; entity.Item03 = model.Item03; entity.Item04 = model.Item04; entity.Item05 = model.Item05; entity.IsOuterLink = model.IsOuterLink; entity.ActiveLink = model.ActiveLink; entity.Target = model.Target; entity.LinkTitle = model.LinkTitle; entity.LinkText = model.LinkText; entity.LinkStyle = model.LinkStyle; entity.ParentID = model.ParentID; INFOR_MASTERRepository.Update(entity); return(new OperationResult(OperationResultType.Success, "update completed")); }
public OperationResult Insert(INFOR_MASTERModel model) { var entity = new INFOR_MASTER { ID = model.ID, InforSubject = model.InforSubject, InforCategoryID = model.InforCategoryID, Introduction = model.Introduction, Author = model.Author, ViewTimes = model.ViewTimes, Description = model.Description, Creator = model.Creator, CreateDate = model.CreateDate, Modifier = model.Modifier, ModiDate = model.ModiDate, DisplayOrder = model.DisplayOrder, Status = model.Status, Item01 = model.Item01, Item02 = model.Item02, Item03 = model.Item03, Item04 = model.Item04, Item05 = model.Item05, IsOuterLink = model.IsOuterLink, ActiveLink = model.ActiveLink, Target = model.Target, LinkTitle = model.LinkTitle, LinkText = model.LinkText, LinkStyle = model.LinkStyle, ParentID = model.ParentID, }; INFOR_MASTERRepository.Insert(entity); return(new OperationResult(OperationResultType.Success, "Added successfully")); }
public ActionResult Index() { base.SetDisplayBtn(); base.SetCreateBtn(); base.SetEditBtn(); base.SetDeleteBtn(); var model = new INFOR_MASTERModel(); InitCategoupForSearchModel(model.SearchModel); return(View(model)); }
public ActionResult Edit(string ID) { var model = new INFOR_MASTERModel(); var entity = INFOR_MASTERService.INFOR_MASTERList.FirstOrDefault(t => t.ID == ID); if (null != entity) { model = new INFOR_MASTERModel { ID = entity.ID, InforSubject = entity.InforSubject, InforCategoryID = entity.InforCategoryID, Introduction = entity.Introduction, Author = entity.Author, ViewTimes = entity.ViewTimes, Description = entity.Description, Creator = entity.Creator, CreateDate = entity.CreateDate, Modifier = entity.Modifier, ModiDate = entity.ModiDate, DisplayOrder = entity.DisplayOrder, Status = entity.Status, Item01 = entity.Item01, Item02 = entity.Item02, Item03 = entity.Item03, Item04 = entity.Item04, Item05 = entity.Item05, IsOuterLink = entity.IsOuterLink, ActiveLink = entity.ActiveLink, Target = entity.Target, LinkTitle = entity.LinkTitle, LinkText = entity.LinkText, LinkStyle = entity.LinkStyle, ParentID = entity.ParentID, InforCategoryName = entity.InforCategory != null ? entity.InforCategory.InforCategoryName : "" }; InitCategoup(model); } return(PartialView(model)); }
public ActionResult Edit(INFOR_MASTERModel model) { if (ModelState.IsValid) { //this.UpdateBaseData<UpdateINFOR_MASTERModel>(model); model.ModiDate = DateTime.Now; model.Modifier = base.GetCurrentUser().Userid; OperationResult result = INFOR_MASTERService.Update(model); if (result.ResultType == OperationResultType.Success) { return(Json(result)); } else { InitCategoup(model); return(PartialView(model)); } } else { InitCategoup(model); return(PartialView(model)); } }