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<OutputItemModel> listItems = null;
            MCodeCom mCodeCom = null;
            OutputItemModel item = null;

            // Variable initialize
            responseModel = new InitResponseModel();
            listItems = new List<OutputItemModel>();
            mCodeCom = new MCodeCom();

            // Get value
            var itemDivName = string.Empty;
            var deleteFlagName = string.Empty;
            foreach (var obj in resultObject.ListItems)
            {
                item = new OutputItemModel();

                item.ItemCd = DataHelper.ToString(obj.ItemCd);
                item.ItemName = DataHelper.ToString(obj.ItemName);
                item.CategoryCd = DataHelper.ToString(obj.CategoryCd);
                item.CategoryName = DataHelper.ToString(obj.Category.CategoryName);
                item.AgeCd = DataHelper.ToString(obj.AgeCd);
                item.AgeName = DataHelper.ToString(obj.Age.AgeName);
                item.GenderCd = DataHelper.ToString(obj.GenderCd);
                item.GenderName = DataHelper.ToString(obj.Gender.GenderName);
                item.BrandCd = DataHelper.ToString(obj.BrandCd);
                item.BrandName = DataHelper.ToString(obj.Brand.BrandName);
                item.CountryCd = DataHelper.ToString(obj.CountryCd);
                item.CountryName = DataHelper.ToString(obj.Country.CountryName);
                item.UnitCd = DataHelper.ToString(obj.UnitCd);
                item.UnitName = DataHelper.ToString(obj.Unit.UnitName);
                item.ItemDiv = DataHelper.ToString(obj.ItemDiv);
                itemDivName = mCodeCom.GetCodeName(Logics.GROUP_ITEM_DIV, item.ItemDiv);
                item.ItemDivName = DataHelper.ToString(itemDivName);
                item.UpdateDate = DataHelper.ToString(Formats.UPDATE_DATE, obj.UpdateDate);
                item.DeleteFlag = DataHelper.ToString(obj.DeleteFlag);
                deleteFlagName = mCodeCom.GetCodeName(Logics.GROUP_DELETE_FLAG, item.DeleteFlag);
                item.DeleteFlagName = DataHelper.ToString(deleteFlagName);

                listItems.Add(item);
            }

            // Set value
            var cbCategory = MCodeCom.ToComboItems(resultObject.ListCategory, null);
            responseModel.ListCategory = cbCategory.ListItems;
            responseModel.CategoryCd = cbCategory.SeletedValue;
            var cbAge = MCodeCom.ToComboItems(resultObject.ListAge, null);
            responseModel.ListAge = cbAge.ListItems;
            responseModel.AgeCd = cbAge.SeletedValue;
            var cbGender = MCodeCom.ToComboItems(resultObject.ListGender, null);
            responseModel.ListGender = cbGender.ListItems;
            responseModel.GenderCd = cbGender.SeletedValue;
            var cbBrand = MCodeCom.ToComboItems(resultObject.ListBrand, null);
            responseModel.ListBrand = cbBrand.ListItems;
            responseModel.BrandCd = cbBrand.SeletedValue;
            var cbCountry = MCodeCom.ToComboItems(resultObject.ListCountry, null);
            responseModel.ListCountry = cbCountry.ListItems;
            responseModel.CountryCd = cbCountry.SeletedValue;
            var cbUnit = MCodeCom.ToComboItems(resultObject.ListUnit, null);
            responseModel.ListUnit = cbUnit.ListItems;
            responseModel.UnitCd = cbUnit.SeletedValue;
            var cbItemDiv = MCodeCom.ToComboItems(resultObject.ListItemDiv, null);
            responseModel.ListItemDiv = cbItemDiv.ListItems;
            responseModel.ItemDiv = cbItemDiv.SeletedValue;
            var cbDeleteFlag = MCodeCom.ToComboItems(resultObject.ListDeleteFlag, null);
            responseModel.ListDeleteFlag = cbDeleteFlag.ListItems;
            responseModel.DeleteFlag = cbDeleteFlag.SeletedValue;
            responseModel.ListItems = listItems;

            // 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);

            // Check infomation
            Check(inputObject);

            // Get infomation
            resultObject = GetInfo(inputObject);

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

            return responseModel;
        }