public ActionResult BuscaNaoConformeEmpregado(string valor) { int cat = Convert.ToInt32(valor); ProcedimentosSeg categ = ProcedimentosSegBusiness.Consulta.FirstOrDefault(a => string.IsNullOrEmpty(a.UsuarioExclusao) && a.categoria.Equals(cat)); var Proced = ProcedimentosSegBusiness.Consulta.Where(a => string.IsNullOrEmpty(a.UsuarioExclusao) && a.categoria.Equals(cat)).ToList(); var Inspe = InspecaoSegBusiness.Consulta.Where(a => string.IsNullOrEmpty(a.UsuarioExclusao)).ToList(); ViewBag.totalInspecao = Inspe.Count() + 1; ViewBag.Cate = Proced; return(PartialView("_BuscaNaoConformeEmpregado")); }
public ActionResult Cadastrar(ProcedimentosSeg oProcedimentosSeg) { if (ModelState.IsValid) { try { oProcedimentosSeg.UsuarioInclusao = CustomAuthorizationProvider.UsuarioAutenticado.Login; ProcedimentosSegBusiness.Inserir(oProcedimentosSeg); Extensions.GravaCookie("MensagemSucesso", "O Procedimento '" + oProcedimentosSeg.Procedimento + "' foi cadastrado com sucesso.", 10); return(Json(new { resultado = new RetornoJSON() { URL = Url.Action("Index", "ProcedimentosSeg") } })); } catch (Exception ex) { if (ex.GetBaseException() == null) { return(Json(new { resultado = new RetornoJSON() { Erro = ex.Message } })); } else { return(Json(new { resultado = new RetornoJSON() { Erro = ex.GetBaseException().Message } })); } } } else { return(Json(new { resultado = TratarRetornoValidacaoToJSON() })); } }
public ActionResult RegistrarInspecaoSeg(string UkItens, string UKRegistro) { try { //Guid UK_Registro = Guid.Parse(UKRegistro); if (string.IsNullOrEmpty(UkItens)) { throw new Exception("Nenhum Nome para vincular."); } if (string.IsNullOrEmpty(UKRegistro)) { throw new Exception("Nenhum Registro Encontrado."); } Guid nom1 = Guid.Empty; if (UkItens.Contains(",")) { foreach (string nom in UkItens.Split(',')) { if (!string.IsNullOrEmpty(nom.Trim())) { nom1 = Guid.Parse(nom); ProcedimentosSeg oProced = ProcedimentosSegBusiness.Consulta.FirstOrDefault(a => string.IsNullOrEmpty(a.UsuarioExclusao) && a.UniqueKey.Equals(nom1)); if (InspecaoSegBusiness.Consulta.Where(a => string.IsNullOrEmpty(a.UsuarioExclusao) && a.UKRegistro.Equals(UKRegistro) && a.UKProcedimento.Equals(nom)).Count() == 0) { InspecaoSegBusiness.Inserir(new InspecaoSeg() { UKRegistro = UKRegistro, UKProcedimento = oProced.UniqueKey.ToString(), UsuarioInclusao = CustomAuthorizationProvider.UsuarioAutenticado.Login }); } } } } else { ProcedimentosSeg oProced = ProcedimentosSegBusiness.Consulta.FirstOrDefault(a => string.IsNullOrEmpty(a.UsuarioExclusao) && a.UniqueKey.Equals(nom1)); if (InspecaoSegBusiness.Consulta.Where(a => string.IsNullOrEmpty(a.UsuarioExclusao) && a.UKRegistro.Equals(UKRegistro) && a.UKProcedimento.Equals(UkItens)).Count() == 0) { InspecaoSegBusiness.Inserir(new InspecaoSeg() { UKRegistro = UKRegistro, UKProcedimento = oProced.UniqueKey.ToString(), UsuarioInclusao = CustomAuthorizationProvider.UsuarioAutenticado.Login }); } } return(Json(new { resultado = new RetornoJSON() { Sucesso = "Inspeção registrada com sucesso." } })); } catch (Exception ex) { return(Json(new { resultado = new RetornoJSON() { Erro = ex.Message } })); } }