public Rol_Result Managment_Rol(Rol _Rol, int Action) { P_Rol dao = new P_Rol(); Rol_Result ar = dao.Managment_Rol(_Rol, Action); return(ar); }
public String Managment_Rol(Rol_S _Rol) { B_Rol b_Rol = new B_Rol(); Rol_Result a = b_Rol.Managment_Rol(new Rol(_Rol.rol_RolId, _Rol.rol_Nombre, _Rol.rol_Descripcion, _Rol.rol_Estado), _Rol.Action); var jsonSerialiser = new JavaScriptSerializer(); var json = jsonSerialiser.Serialize(a); return(json); }
public Rol_Result Managment_Rol(Rol _Rol, int Action) { Rol_Result resu = new Rol_Result(); using (SqlConnection connection = new SqlConnection(cadena)) { try { String id = ""; connection.Open(); SqlCommand command = new SqlCommand("VR_Managment_Rol", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@RolId", SqlDbType.Int).Value = _Rol.rol_RolId; command.Parameters.Add("@rol_Nombre", SqlDbType.VarChar).Value = _Rol.rol_Nombre; command.Parameters.Add("@rol_Descripcion", SqlDbType.VarChar).Value = _Rol.rol_Descripcion; command.Parameters.Add("@rol_Estado", SqlDbType.Int).Value = _Rol.rol_Estado; command.Parameters.Add("@Action", SqlDbType.Int).Value = Action; SqlDataReader reader = command.ExecuteReader(CommandBehavior.SingleResult); if (reader.HasRows) { if (reader.Read()) { id = reader.GetValue(0).ToString(); } } reader.Close(); connection.Close(); resu.Result = 1; resu.Message = id; } catch (Exception e) { connection.Close(); resu.Result = 0; resu.Message = e.Message; } } return(resu); }