public VMRol RegistrarRol(string nombre, string descripcion, int idPais, int idRol = 0) { try { IDAORol iDaoRol = new DAORol(); VMRol Rol = new VMRol(); RespuestaBD resp = iDaoRol.RegistrarEditarRol(idRol, descripcion, nombre, idPais, true); if (resp.EXISTE_ERROR) { throw new Exception(resp.MENSAJE); } else { Rol.Descripcion = descripcion; Rol.Nombre = nombre; Rol.IdPais = idPais; Rol.IdRol = Convert.ToInt32(resp.dataSet.Tables[0].Rows[0]["fi_id_Rol"].ToString()); Rol.Pais = resp.dataSet.Tables[0].Rows[0]["fc_pais"].ToString(); return(Rol); } } catch (Exception ex) { throw new Exception(new Util().ObtenerMsjExcepcion(ex)); } }
public ActionResult BuscarTreeView(string S_IDRol) { var _VMRol = new VMRol(); var model = GetTreeData(S_IDRol); var jsonModel = new JavaScriptSerializer().Serialize(model); _VMRol.javaSerial = jsonModel; return(Json(model)); }
public ActionResult Update(VMRol model) { var result = new Resultado(); try { if (string.IsNullOrEmpty(model.Rol.S_Descripcion)) { return(View(model)); } model.Rol.S_UsuarioModificacion = VMDatosUsuario.GetUserAlias(); model.Rol.S_Estado = model.Rol.S_Estado.Equals("True") ? "A" : "I"; var Resultado = _RolService.Update(model.Rol); result.Codigo = Resultado.N_IDRol; } catch (System.Exception ex) { result.EsExito = false; result.Mensaje = ex.Message; return(View()); } return(Json(result)); }