public ActionResult Edit(TechniqueViewModel model) { if (ModelState.IsValid) { if (Request["Submit"] == "Save") { var Technique = TechniqueRepository.GetTechniqueById(model.Id); AutoMapper.Mapper.Map(model, Technique); Technique.ModifiedUserId = WebSecurity.CurrentUserId; Technique.ModifiedDate = DateTime.Now; TechniqueRepository.UpdateTechnique(Technique); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.UpdateSuccess; if (Request["IsPopup"] == "true" || Request["IsPopup"] == "True") { ViewBag.closePopup = "true"; // model.Id = Technique.Id; //model.RankList = Helpers.SelectListHelper.GetSelectList_Category("rank", model.Rank, "Name", App_GlobalResources.Wording.Empty); return(View(model)); } } return(View(model)); } return(View(model)); //if (Request.UrlReferrer != null) // return Redirect(Request.UrlReferrer.AbsoluteUri); //return RedirectToAction("Index"); }
public ActionResult Admin(int employeeid) { List <TechniqueViewModel> Techniqueviewmodellist = new List <TechniqueViewModel>(); List <Technique> employeetechlist = TechniqueService.GetByEmployee(employeeid); using var context = new SqlLiteContext(); List <Technique> techlist = context.Techniques.ToList(); foreach (Technique t in techlist) { TechniqueViewModel tvm = new TechniqueViewModel(); tvm.TechniqueId = t.TechniqueId; tvm.EmployeeId = employeeid; tvm.Name = t.Name; tvm.Connected = false; foreach (Technique te in employeetechlist) { if (t.TechniqueId == te.TechniqueId) { tvm.Connected = true; } } Techniqueviewmodellist.Add(tvm); } var sortedlist = Techniqueviewmodellist.OrderBy(foo => foo.Name).ToList(); var arv = new BindEmployeeTechniqueViewModel(sortedlist); return(View(arv)); }
public ViewResult Create(int?StaffId) { var model = new TechniqueViewModel(); model.StaffId = StaffId; //model.RankList = Helpers.SelectListHelper.GetSelectList_Category("rank", null, "Name", App_GlobalResources.Wording.Empty); return(View(model)); }
public List <TechniqueViewModel> GetTechniqueView(int employee) { List <TechniqueViewModel> TechniqueViewModels = new List <TechniqueViewModel>(); List <Technique> targetData = TechniqueService.GetByEmployee(employee); if (targetData == null) { return(TechniqueViewModels); } foreach (Technique target in targetData) { TechniqueViewModel evm = new TechniqueViewModel { TechniqueId = target.TechniqueId, Name = target.Name }; TechniqueViewModels.Add(evm); } return(TechniqueViewModels); }
public ActionResult Edit(int?Id) { var Technique = TechniqueRepository.GetTechniqueById(Id.Value); if (Technique != null && Technique.IsDeleted != true) { var model = new TechniqueViewModel(); AutoMapper.Mapper.Map(Technique, model); //model.RankList = Helpers.SelectListHelper.GetSelectList_Category("rank", model.Rank, "Name", App_GlobalResources.Wording.Empty); //if (model.CreatedUserId != Erp.BackOffice.Helpers.Common.CurrentUser.Id && Erp.BackOffice.Helpers.Common.CurrentUser.UserTypeId != 1) //{ // TempData["FailedMessage"] = "NotOwner"; // return RedirectToAction("Index"); //} return(View(model)); } if (Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.AbsoluteUri)); } return(RedirectToAction("Index")); }
public ActionResult Create(TechniqueViewModel model) { if (ModelState.IsValid) { var Technique = new Domain.Staff.Entities.Technique(); AutoMapper.Mapper.Map(model, Technique); Technique.IsDeleted = false; Technique.CreatedUserId = WebSecurity.CurrentUserId; Technique.ModifiedUserId = WebSecurity.CurrentUserId; Technique.CreatedDate = DateTime.Now; Technique.ModifiedDate = DateTime.Now; TechniqueRepository.InsertTechnique(Technique); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess; if (Request["IsPopup"] == "true" || Request["IsPopup"] == "True") { ViewBag.closePopup = "true"; model.Id = Technique.Id; //model.RankList = Helpers.SelectListHelper.GetSelectList_Category("rank", null, "Name", App_GlobalResources.Wording.Empty); return(View(model)); } } return(View(model)); }
public TechniqueViewModel Load(TechniqueViewModel filtering) { filtering.Keyword = filtering.Keyword?.Trim().ToLower(); filtering.KeywordKana = filtering.KeywordKana?.Trim().ToLower(); var result = new TechniqueViewModel(); var technique = _context.MstTechniques.Where(x => !x.IsDeleted); if (!string.IsNullOrEmpty(filtering.Keyword)) { technique = technique.Where(x => x.Name.ToLower().Contains(filtering.Keyword) || x.NameKana.ToLower().Contains(filtering.KeywordKana) || x.NameKana.ToLower().Contains(filtering.Keyword) || x.Code.ToLower().Contains(filtering.Keyword)); } result.TotalRowsAfterFiltering = technique.Count(); //sort And paging technique = Filtering(technique, filtering); result.Techniques = technique .Select(x => new { x.Cd, x.Code, x.Name, x.NameKana }) .AsEnumerable() .Select(x => new TechniqueModel { Code = x.Code, Cd = x.Cd, Name = x.Name, NameKana = x.NameKana }).ToList(); return(result); }