예제 #1
0
        private MemberFoodDiaryMeal MemberFoodDiaryMealMap(IDataReader reader)
        {
            try
            {
                int startingIndex = 0;
                MemberFoodDiaryMeal _MemberFoodDiaryMeal = new MemberFoodDiaryMeal();
                _MemberFoodDiaryMeal.Id = reader.GetSafeInt32(startingIndex++);
                _MemberFoodDiaryMeal.FoodDiaryMealTypeId = reader.GetSafeInt32(startingIndex++);
                _MemberFoodDiaryMeal.MealDescription     = reader.GetSafeString(startingIndex++);
                _MemberFoodDiaryMeal.Calories            = reader.GetSafeInt32(startingIndex++);
                _MemberFoodDiaryMeal.Carbs           = reader.GetSafeInt32(startingIndex++);
                _MemberFoodDiaryMeal.Fat             = reader.GetSafeInt32(startingIndex++);
                _MemberFoodDiaryMeal.Protein         = reader.GetSafeInt32(startingIndex++);
                _MemberFoodDiaryMeal.MemberProfileId = reader.GetSafeInt32(startingIndex++);
                _MemberFoodDiaryMeal.CreatedDate     = reader.GetSafeDateTime(startingIndex++);
                _MemberFoodDiaryMeal.ModifiedDate    = reader.GetSafeDateTime(startingIndex++);

                startingIndex++;

                return(_MemberFoodDiaryMeal);
            }
            catch (Exception ex)
            {
                _baseService.LogError(System.Reflection.MethodBase.GetCurrentMethod().Name, ex, "MemberFoodDiaryMealService");
                throw;
            }
        }
예제 #2
0
        public MemberFoodDiaryMeal SelectById(int id = 0)
        {
            try
            {
                MemberFoodDiaryMeal _MemberFoodDiaryMeal = null;

                _baseService.DataProvider.ExecuteCmd(_baseService.GetConnection, "dbo.MemberFoodDiaryMeal_SelectById",
                                                     inputParamMapper : delegate(SqlParameterCollection paramCollection)
                {
                    paramCollection.AddWithValue("@Id", id);//if its not select by id then its null here
                },
                                                     map : delegate(IDataReader reader, short set)
                {
                    _MemberFoodDiaryMeal = MemberFoodDiaryMealMap(reader);
                });
                return(_MemberFoodDiaryMeal);
            }
            catch (Exception ex)
            {
                _baseService.LogError(System.Reflection.MethodBase.GetCurrentMethod().Name, ex, "MemberFoodDiaryMealService");
                throw;
            }
        }