public ActionResult BuscarITem(int idTrain, int idFuncionario) { tblMatrizFuncXTreinamentoTemp matrizFuncXTrainTemp = new tblMatrizFuncXTreinamentoTemp(); matrizFuncXTrainTemp.idTreinamento = idTrain; matrizFuncXTrainTemp.idFuncionario = idFuncionario; if (idTrain != 0 && idFuncionario != 0) { List <tblPerfilItens> itensList = new List <tblPerfilItens>(); List <tblPerfilAtividadeXPerfilAtItem> perfilItemXPerfil = new List <tblPerfilAtividadeXPerfilAtItem>(); var profileID = _training.GetTrainingById(idTrain).idPerfilTreinamento; var itemXProfile = _profileTraining.GetTrainingProfileById(profileID).tblPerfilTreinamentoxPerfilItem; var itens = new tblPerfilItens(); foreach (var iXp in itemXProfile) { itens = _profileItemTraining.GetProfileItemById(iXp.IdPerfilItem); itensList.Add(itens); } ViewBag.PerfilITem = itensList; } else { ViewBag.PerfilITem = new List <tblPerfilItens>(); } return(PartialView("_ModalTrein", matrizFuncXTrainTemp)); }
public ActionResult BuscarItemAtiv(int idActivity, int idFuncionario) { tblMatrizFuncXAtividadesTemp matrizFuncXTrainTemp = new tblMatrizFuncXAtividadesTemp(); matrizFuncXTrainTemp.idAtividade = idActivity; matrizFuncXTrainTemp.idFuncionario = idFuncionario; if (idActivity != 0 && idFuncionario != 0) { List <tblPerfilItens> itensList = new List <tblPerfilItens>(); var itemXProfile = _activity.GetActivityById(idActivity).tblPerfis.tblPerfilAtividadeXPerfilAtItem; var itens = new tblPerfilItens(); foreach (var iXp in itemXProfile) { itens = _profileItemActivity.GetActivityProfileItemById(iXp.idPerfilAtivItem); itensList.Add(itens); } ViewBag.PerfilITem = itensList; } else { ViewBag.PerfilITem = new List <tblPerfilItens>(); } return(PartialView("_ModalActivity", matrizFuncXTrainTemp)); }
public tblPerfilItens CreateActivityProfileItem(tblPerfilItens ActivityProfileItem) { _db.tblPerfilItens.Add(ActivityProfileItem); _db.SaveChanges(); return(ActivityProfileItem); }
public tblPerfilItens CreateProfileItem(tblPerfilItens ProfileItem) { _db.tblPerfilItens.Add(ProfileItem); _db.SaveChanges(); return(ProfileItem); }
public IEnumerable <tblPerfilItens> GetActivityProfileItemByType(tblPerfilItens ActivityProfileItem) { IEnumerable <tblPerfilItens> activityProfile; var query = from f in _db.tblPerfilItens orderby f.Sigla ascending where f.Tipo == "A" select f; activityProfile = query.AsEnumerable(); return(activityProfile); }
public bool checkIfActivityProfileItemAlreadyExits(tblPerfilItens ActivityProfileItem) { var query = from f in _db.tblPerfilItens where f.Sigla == ActivityProfileItem.Sigla orderby f.Sigla ascending select f; if (query.Count() == 1 && query.FirstOrDefault().IdPerfilItem != ActivityProfileItem.IdPerfilItem) { return(true); } return(false); }
public tblPerfilItens UpdateProfileItem(tblPerfilItens ProfileItem) { var trainingToUpdate = _db.tblPerfilItens.Find(ProfileItem.IdPerfilItem); trainingToUpdate.Sigla = ProfileItem.Sigla; trainingToUpdate.Descricao = ProfileItem.Descricao; _db.Entry(trainingToUpdate).State = EntityState.Modified; _db.SaveChanges(); return(trainingToUpdate); }
public ActionResult Create(tblPerfilItens activityProfile) { var exits = _activityProfileItem.checkIfActivityProfileItemAlreadyExits(activityProfile); activityProfile.Tipo = "A"; if (ModelState.IsValid) { if (!exits) { _activityProfileItem.CreateActivityProfileItem(activityProfile); return(RedirectToAction("Index")); } } if (exits) { ModelState.AddModelError("Nome", "Item de Perfil de Atividade já existe"); } return(View("Create", activityProfile)); }
public ActionResult Edit(tblPerfilItens profileItem, int id) { profileItem.IdPerfilItem = id; var exits = _ProfileItem.checkIfProfileItemAlreadyExits(profileItem); if (ModelState.IsValid) { if (!exits) { _ProfileItem.UpdateProfileItem(profileItem); return(RedirectToAction("Index")); } } if (exits) { ModelState.AddModelError("Nome", "Perfil de Treinamento já existe"); } return(View(profileItem)); }
public ActionResult Edit(tblPerfilItens activityProfile, int id) { activityProfile.IdPerfilItem = id; var exits = _activityProfileItem.checkIfActivityProfileItemAlreadyExits(activityProfile); if (ModelState.IsValid) { if (!exits) { _activityProfileItem.UpdateActivityProfileItem(activityProfile); return(RedirectToAction("Index")); } } if (exits) { ModelState.AddModelError("Nome", "Item de Perfil de Atividade já existe"); } return(View(activityProfile)); }
public ActionResult Create(tblPerfilItens profileItem) { var exits = _ProfileItem.checkIfProfileItemAlreadyExits(profileItem); profileItem.Tipo = "T"; if (ModelState.IsValid) { if (!exits) { _ProfileItem.CreateProfileItem(profileItem); return(RedirectToAction("Index")); } } if (exits) { ModelState.AddModelError("Nome", "Perfil de Treinamento já existe"); } return(View("Create", profileItem)); }