Exemplo n.º 1
0
        /// <summary>
        /// Execute convert ouput.
        /// </summary>
        /// <param name="resultObject">DataModel</param>
        /// <returns>ResponseModel</returns>
        private InitResponseModel Convert(InitDataModel resultObject)
        {
            // Local variable declaration
            InitResponseModel responseModel = null;
            IList<OutputCategoryModel> listToys = null;
            IList<OutputCategoryModel> listLearningTools = null;
            IList<OutputCategoryModel> listBooks = null;
            IList<OutputAgeModel> listAges = null;
            IList<OutputGenderModel> listGenders = null;
            IList<OutputBrandModel> listBrands = null;
            IList<OutputCountryModel> listCountries = null;

            // Variable initialize
            responseModel = new InitResponseModel();
            listToys = new List<OutputCategoryModel>();
            listLearningTools = new List<OutputCategoryModel>();
            listBooks = new List<OutputCategoryModel>();
            listAges = new List<OutputAgeModel>();
            listGenders = new List<OutputGenderModel>();
            listBrands = new List<OutputBrandModel>();
            listCountries = new List<OutputCountryModel>();

            // Get value
            OutputCategoryModel toy = null;
            foreach (var obj in resultObject.ListToys)
            {
                toy = new OutputCategoryModel();

                toy.CategoryCd = DataHelper.ToString(obj.CategoryCd);
                toy.CategoryName = DataHelper.ToString(obj.CategoryName);

                listToys.Add(toy);
            }

            OutputCategoryModel learningTool = null;
            foreach (var obj in resultObject.ListLearningTools)
            {
                learningTool = new OutputCategoryModel();

                learningTool.CategoryCd = DataHelper.ToString(obj.CategoryCd);
                learningTool.CategoryName = DataHelper.ToString(obj.CategoryName);

                listLearningTools.Add(learningTool);
            }

            OutputCategoryModel book = null;
            foreach (var obj in resultObject.ListBooks)
            {
                book = new OutputCategoryModel();

                book.CategoryCd = DataHelper.ToString(obj.CategoryCd);
                book.CategoryName = DataHelper.ToString(obj.CategoryName);

                listBooks.Add(book);
            }

            OutputAgeModel age = null;
            foreach (var obj in resultObject.ListAge)
            {
                age = new OutputAgeModel();

                age.AgeCd = DataHelper.ToString(obj.AgeCd);
                age.AgeName = DataHelper.ToString(obj.AgeName);

                listAges.Add(age);
            }

            OutputGenderModel gender = null;
            foreach (var obj in resultObject.ListGender)
            {
                gender = new OutputGenderModel();

                gender.GenderCd = DataHelper.ToString(obj.GenderCd);
                gender.GenderName = DataHelper.ToString(obj.GenderName);

                listGenders.Add(gender);
            }

            OutputBrandModel brand = null;
            foreach (var obj in resultObject.ListBrand)
            {
                brand = new OutputBrandModel();

                brand.BrandCd = DataHelper.ToString(obj.BrandCd);
                brand.BrandName = DataHelper.ToString(obj.BrandName);

                listBrands.Add(brand);
            }

            OutputCountryModel country = null;
            foreach (var obj in resultObject.ListCountry)
            {
                country = new OutputCountryModel();

                country.CountryCd = DataHelper.ToString(obj.CountryCd);
                country.CountryName = DataHelper.ToString(obj.CountryName);

                listCountries.Add(country);
            }

            // Set value
            responseModel.CartCount = DataHelper.ToString(Formats.NUMBER, resultObject.CartCount);
            responseModel.Email = DataHelper.ToString(resultObject.Email);
            responseModel.ListToys = listToys;
            responseModel.ListLearningTools = listLearningTools;
            responseModel.ListBooks = listBooks;
            responseModel.ListAges = listAges;
            responseModel.ListGenders = listGenders;
            responseModel.ListBrands = listBrands;
            responseModel.ListCountries = listCountries;

            // Return value
            return responseModel;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Execute processing.
        /// </summary>
        /// <param name="request">RequestModel</param>
        /// <returns>ResponseModel</returns>
        private InitResponseModel Execute(InitRequestModel request)
        {
            // Local variable declaration
            InitResponseModel responseModel = null;
            InitDataModel inputObject = null;
            InitDataModel resultObject = null;

            // Variable initialize
            responseModel = new InitResponseModel();

            // Execute convert input.
            inputObject = Convert(request);

            // Get infomation
            resultObject = GetInfo(inputObject);

            // Execute convert ouput.
            responseModel = Convert(resultObject);

            return responseModel;
        }