Exemplo n.º 1
0
        public List <DataObject.Condition> List()
        {
            List <DataObject.Condition> conditionList = null;

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

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

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

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            DataObject.Condition dataObjectCondition = new DataObject.Condition();
                            dataObjectCondition.Id          = int.Parse(reader.GetValue(0).ToString());
                            dataObjectCondition.Value       = reader.GetValue(1).ToString();
                            dataObjectCondition.Description = reader.GetValue(2).ToString();

                            conditionList.Add(dataObjectCondition);
                        }
                    }
                }
            }

            return(conditionList);
        }
Exemplo n.º 2
0
        public List<DataObject.Condition> List()
        {
            List<DataObject.Condition> conditionList = null;

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

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

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

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            DataObject.Condition dataObjectCondition = new DataObject.Condition();
                            dataObjectCondition.Id = int.Parse(reader.GetValue(0).ToString());
                            dataObjectCondition.Value = reader.GetValue(1).ToString();
                            dataObjectCondition.Description = reader.GetValue(2).ToString();

                            conditionList.Add(dataObjectCondition);
                        }
                    }
                }
            }

            return conditionList;
        }
Exemplo n.º 3
0
        public DataObject.Condition Get(int Id)
        {
            DataObject.Condition dataObjectCondition = null;

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

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

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

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            dataObjectCondition             = new DataObject.Condition();
                            dataObjectCondition.Id          = int.Parse(reader.GetValue(0).ToString());
                            dataObjectCondition.Value       = reader.GetValue(1).ToString();
                            dataObjectCondition.Description = reader.GetValue(2).ToString();
                        }
                    }
                }
            }

            return(dataObjectCondition);
        }
Exemplo n.º 4
0
        public DataObject.Condition Get(int Id)
        {
            DataObject.Condition dataObjectCondition = null;

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

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

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

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            dataObjectCondition = new DataObject.Condition();
                            dataObjectCondition.Id = int.Parse(reader.GetValue(0).ToString());
                            dataObjectCondition.Value = reader.GetValue(1).ToString();
                            dataObjectCondition.Description = reader.GetValue(2).ToString();
                        }
                    }
                }
            }

            return dataObjectCondition;
        }