Пример #1
0
        public List <DataObject.RuleSet> List()
        {
            List <DataObject.RuleSet> ruleSetList = new List <DataObject.RuleSet>();

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();

                string query = "Exec [BusinessRule].[ListActiveRuleSet]";

                using (SqlCommand command = new SqlCommand(query, connection))
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            DataObject.RuleSet dataObjectRuleSet = new DataObject.RuleSet();
                            dataObjectRuleSet.Id        = int.Parse(reader.GetValue(0).ToString());
                            dataObjectRuleSet.Name      = reader.GetValue(1).ToString();
                            dataObjectRuleSet.Version   = reader.GetValue(2).ToString();
                            dataObjectRuleSet.DateAdded = Convert.ToDateTime(reader.GetValue(3).ToString());
                            dataObjectRuleSet.IsActive  = true;

                            ruleSetList.Add(dataObjectRuleSet);
                        }
                    }
                }
            }

            return(ruleSetList);
        }
Пример #2
0
        public DataObject.RuleSet Get(int Id)
        {
            DataObject.RuleSet dataObjectRuleSet = null;

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();

                string query = "Exec [BusinessRule].[GetActiveRuleSet] {0}";

                using (SqlCommand command = new SqlCommand(string.Format(query, Id), connection))
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            dataObjectRuleSet = new DataObject.RuleSet();
                            dataObjectRuleSet.Id = int.Parse(reader.GetValue(0).ToString());
                            dataObjectRuleSet.Name = reader.GetValue(1).ToString();
                            dataObjectRuleSet.Version = reader.GetValue(2).ToString();
                            dataObjectRuleSet.DateAdded = Convert.ToDateTime(reader.GetValue(3).ToString());
                            dataObjectRuleSet.IsActive = true;
                        }
                    }
                }
            }

            return dataObjectRuleSet;
        }
Пример #3
0
        public DataObject.RuleSet Get(int Id)
        {
            DataObject.RuleSet dataObjectRuleSet = null;

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();

                string query = "Exec [BusinessRule].[GetActiveRuleSet] {0}";

                using (SqlCommand command = new SqlCommand(string.Format(query, Id), connection))
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            dataObjectRuleSet           = new DataObject.RuleSet();
                            dataObjectRuleSet.Id        = int.Parse(reader.GetValue(0).ToString());
                            dataObjectRuleSet.Name      = reader.GetValue(1).ToString();
                            dataObjectRuleSet.Version   = reader.GetValue(2).ToString();
                            dataObjectRuleSet.DateAdded = Convert.ToDateTime(reader.GetValue(3).ToString());
                            dataObjectRuleSet.IsActive  = true;
                        }
                    }
                }
            }

            return(dataObjectRuleSet);
        }
Пример #4
0
        public List<DataObject.RuleSet> List()
        {
            List<DataObject.RuleSet> ruleSetList = new List<DataObject.RuleSet>();

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();

                string query = "Exec [BusinessRule].[ListActiveRuleSet]";

                using (SqlCommand command = new SqlCommand(query, connection))
                {
                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            DataObject.RuleSet dataObjectRuleSet = new DataObject.RuleSet();
                            dataObjectRuleSet.Id = int.Parse(reader.GetValue(0).ToString());
                            dataObjectRuleSet.Name = reader.GetValue(1).ToString();
                            dataObjectRuleSet.Version = reader.GetValue(2).ToString();
                            dataObjectRuleSet.DateAdded = Convert.ToDateTime(reader.GetValue(3).ToString());
                            dataObjectRuleSet.IsActive = true;

                            ruleSetList.Add(dataObjectRuleSet);
                        }
                    }
                }
            }

            return ruleSetList;
        }