示例#1
0
        public Dictionary<State, int> MemberChart_State(bool? gender, int? fromAge, int? toAge)
        {
            ExecutionUnit unit = new ExecutionUnit("MemberChart_State");
            unit.AddParameter("@Gender", SqlDbType.Bit, ParameterDirection.Input, gender.HasValue ? (object)(gender.Value ? 1 : 0) : null);
            unit.AddParameter("@FromAge", SqlDbType.Int, ParameterDirection.Input, fromAge);
            unit.AddParameter("@ToAge", SqlDbType.Int, ParameterDirection.Input, toAge);

            using (IDataReader reader = DatabaseAccessEngine.ExecuteDataReader(unit))
            {
                Dictionary<State, int> summarybyState = new Dictionary<State, int>();
                while (reader.Read())
                {
                    State country = new State();
                    country.ID = DatabaseAccessEngine.GetInt32(reader, "ID");
                    country.Name = DatabaseAccessEngine.GetString(reader, "Name");

                    summarybyState.Add(country, DatabaseAccessEngine.GetInt32(reader, "MemberCount"));
                }

                return summarybyState;
            }
        }
示例#2
0
        public List<State> GetStates(string sortExp)
        {
            ExecutionUnit unit = new ExecutionUnit("GetStates");
            unit.AddParameter("@SortExpression", SqlDbType.VarChar, ParameterDirection.Input, sortExp);

            List<State> states = new List<State>();
            using (IDataReader reader = DatabaseAccessEngine.ExecuteDataReader(unit))
            {
                while (reader.Read())
                {
                    State state = new State();
                    state.ID = DatabaseAccessEngine.GetInt32(reader, "ID");
                    state.Name = DatabaseAccessEngine.GetString(reader, "Name");
                    states.Add(state);
                }
            }

            return states;
        }