public DataObject.Rule Get(int Id) { DataObject.Rule dataObjectRule = null; using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); string query = "Exec [BusinessRule].[GetActiveRule] {0}"; using (SqlCommand command = new SqlCommand(string.Format(query, Id), connection)) { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { dataObjectRule = new DataObject.Rule(); dataObjectRule.Id = int.Parse(reader.GetValue(0).ToString()); dataObjectRule.Result = reader.GetValue(2).ToString(); } } } } return(dataObjectRule); }
public List <DataObject.Rule> List(int Id_RuleSet) { List <DataObject.Rule> ruleList = new List <DataObject.Rule>(); using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); string query = "Exec [BusinessRule].[ListActiveRule] {0}"; using (SqlCommand command = new SqlCommand(string.Format(query, Id_RuleSet), connection)) { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { DataObject.Rule dataObjectRule = new DataObject.Rule(); dataObjectRule.Id = int.Parse(reader.GetValue(0).ToString()); dataObjectRule.Condition = reader.GetValue(1).ToString(); dataObjectRule.Result = reader.GetValue(2).ToString(); dataObjectRule.Priority = reader.GetValue(3).ToString(); ruleList.Add(dataObjectRule); } } } } return(ruleList); }
public DataObject.Rule Get(int Id) { DataObject.Rule dataObjectRule = null; using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); string query = "Exec [BusinessRule].[GetActiveRule] {0}"; using (SqlCommand command = new SqlCommand(string.Format(query, Id), connection)) { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { dataObjectRule = new DataObject.Rule(); dataObjectRule.Id = int.Parse(reader.GetValue(0).ToString()); dataObjectRule.Result = reader.GetValue(2).ToString(); } } } } return dataObjectRule; }
public DataObject.Rule GetFromRuleSet(int Id_Ruleset) { DataObject.Rule dataObjectRule = null; using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); string query = "SELECT Id, Condition, Result FROM [BusinessRule].[Rule] Where Id_RuleSet = {0}"; using (SqlCommand command = new SqlCommand(string.Format(query, Id_Ruleset), connection)) { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { dataObjectRule = new DataObject.Rule(); dataObjectRule.Id = int.Parse(reader.GetValue(0).ToString()); dataObjectRule.Result = reader.GetValue(2).ToString(); dataObjectRule.Condition = reader.GetValue(1).ToString(); } } } } return(dataObjectRule); }
public List<DataObject.Rule> List(int Id_RuleSet) { List<DataObject.Rule> ruleList = new List<DataObject.Rule>(); using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); string query = "Exec [BusinessRule].[ListActiveRule] {0}"; using (SqlCommand command = new SqlCommand(string.Format(query,Id_RuleSet), connection)) { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { DataObject.Rule dataObjectRule = new DataObject.Rule(); dataObjectRule.Id = int.Parse(reader.GetValue(0).ToString()); dataObjectRule.Condition = reader.GetValue(1).ToString(); dataObjectRule.Result = reader.GetValue(2).ToString(); ruleList.Add(dataObjectRule); } } } } return ruleList; }
public DataObject.Rule GetFromRuleSet(int Id_Ruleset) { DataObject.Rule dataObjectRule = null; using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); string query = "SELECT Id, Condition, Result FROM [BusinessRule].[Rule] Where Id_RuleSet = {0}"; using (SqlCommand command = new SqlCommand(string.Format(query, Id_Ruleset), connection)) { SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { dataObjectRule = new DataObject.Rule(); dataObjectRule.Id = int.Parse(reader.GetValue(0).ToString()); dataObjectRule.Result = reader.GetValue(2).ToString(); dataObjectRule.Condition = reader.GetValue(1).ToString(); } } } } return dataObjectRule; }