Exemplo n.º 1
0
        public ActionResult List(string reasonCode, int productId, int reasonCodeTypeId, int?page, string sortField, int?sortOrder)
        {
            //Get ReasonCodeProductType
            ReasonCodeProductType reasonCodeProductType = new ReasonCodeProductType();

            reasonCodeProductType = reasonCodeProductTypeRepository.GetReasonCodeProductType(reasonCode, productId, reasonCodeTypeId);

            //Check Exists
            if (reasonCodeProductType == null)
            {
                ViewData["ActionMethod"] = "ListGet";
                return(View("RecordDoesNotExistError"));
            }

            //Set Access Rights
            ViewData["Access"] = "WriteAccess";

            //Parent Information
            ViewData["ReasonCode"]       = reasonCode;
            ViewData["ReasonCodeTypeId"] = reasonCodeTypeId;
            ViewData["ProductId"]        = productId;

            ProductRepository productRepository = new ProductRepository();
            Product           product           = new Product();

            product = productRepository.GetProduct(productId);
            ReasonCodeTypeRepository reasonCodeTypeRepository = new ReasonCodeTypeRepository();
            ReasonCodeType           reasonCodeType           = new ReasonCodeType();

            reasonCodeType = reasonCodeTypeRepository.GetItem(reasonCodeTypeId);
            ReasonCodeItemRepository reasonCodeItemRepository = new ReasonCodeItemRepository();
            ReasonCodeItem           reasonCodeItem           = new ReasonCodeItem();

            reasonCodeItem             = reasonCodeItemRepository.GetItem(1);
            ViewData["ReasonCodeItem"] = reasonCode + "/" + reasonCodeType.ReasonCodeTypeDescription + "/" + product.ProductName;


            //SortField+SortOrder settings
            if (sortField != "ReasonCodeProductTypeTravelerDescription")
            {
                sortField = "LanguageName";
            }
            if (sortOrder == 1)
            {
                ViewData["NewSortOrder"]     = 0;
                ViewData["CurrentSortOrder"] = 1;
            }
            else
            {
                ViewData["NewSortOrder"]     = 1;
                ViewData["CurrentSortOrder"] = 0;
                sortOrder = 0;
            }

            //Get data
            var cwtPaginatedList = reasonCodeProductTypeTravelerDescriptionRepository.PageReasonCodeProductTypeTravelerDescriptions(reasonCode, productId, reasonCodeTypeId, page ?? 1, sortField, sortOrder ?? 0);

            return(View(cwtPaginatedList));
        }
Exemplo n.º 2
0
        // GET: /Create
        public ActionResult Create(string reasonCode, int productId, int reasonCodeTypeId)
        {
            //Get Item
            ReasonCodeProductType reasonCodeProductType = new ReasonCodeProductType();

            reasonCodeProductType = reasonCodeProductTypeRepository.GetReasonCodeProductType(reasonCode, productId, reasonCodeTypeId);

            //Check Exists
            if (reasonCodeProductType == null)
            {
                ViewData["ActionMethod"] = "CreateGet";
                return(View("RecordDoesNotExistError"));
            }

            //ReasonCodeProductTypeTravelerDescription
            ReasonCodeProductTypeTravelerDescriptionRepository reasonCodeProductTypeTravelerDescriptionRepository = new ReasonCodeProductTypeTravelerDescriptionRepository();
            ReasonCodeProductTypeTravelerDescription           reasonCodeProductTypeTravelerDescription           = new ReasonCodeProductTypeTravelerDescription();

            //ReasonCodeProductTypeTravelerDescription Label
            ReasonCodeProductTypeTravelerDescription reasonCodeProductTypeTravelerDescriptionLabel = new ReasonCodeProductTypeTravelerDescription();

            reasonCodeProductTypeTravelerDescriptionLabel = reasonCodeProductTypeTravelerDescriptionRepository.GetItem("en-GB", reasonCode, productId, reasonCodeTypeId);
            ViewData["ReasonCodeProductTypeDescription"]  = (reasonCodeProductTypeTravelerDescriptionLabel != null) ?
                                                            reasonCodeProductTypeTravelerDescriptionLabel.ReasonCodeProductTypeTravelerDescription1 : String.Empty;

            //ProductRepository
            ProductRepository productRepository = new ProductRepository();
            Product           product           = new Product();

            product = productRepository.GetProduct(productId);

            //ReasonCodeType
            ReasonCodeTypeRepository reasonCodeTypeRepository = new ReasonCodeTypeRepository();
            ReasonCodeType           reasonCodeType           = new ReasonCodeType();

            reasonCodeType = reasonCodeTypeRepository.GetItem(reasonCodeTypeId);

            //ReasonCodeItem
            ReasonCodeItemRepository reasonCodeItemRepository = new ReasonCodeItemRepository();
            ReasonCodeItem           reasonCodeItem           = new ReasonCodeItem();

            reasonCodeItem             = reasonCodeItemRepository.GetItem(1);
            ViewData["ReasonCodeItem"] = reasonCode + "/" + reasonCodeType.ReasonCodeTypeDescription + "/" + product.ProductName;

            //Language SelectList
            SelectList languageList = new SelectList(reasonCodeProductTypeTravelerDescriptionRepository.GetUnUsedLanguages(reasonCode, productId, reasonCodeTypeId).ToList(), "LanguageCode", "LanguageName");

            ViewData["Languages"] = languageList;

            //Show Create Form
            return(View(reasonCodeProductTypeTravelerDescription));
        }
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(ReasonCodeItem reasonCodeItem)
        {
            ProductRepository productRepository = new ProductRepository();
            Product           product           = new Product();

            product = productRepository.GetProduct(reasonCodeItem.ProductId);
            if (product != null)
            {
                reasonCodeItem.ProductName = product.ProductName;
            }

            ReasonCodeTypeRepository reasonCodeTypeRepository = new ReasonCodeTypeRepository();
            ReasonCodeType           reasonCodeType           = new ReasonCodeType();

            reasonCodeType = reasonCodeTypeRepository.GetItem(reasonCodeItem.ReasonCodeTypeId);
            if (reasonCodeType != null)
            {
                reasonCodeItem.ReasonCodeTypeDescription = reasonCodeType.ReasonCodeTypeDescription;
            }

            ReasonCodeProductTypeDescriptionRepository reasonCodeProductTypeDescriptionRepository = new ReasonCodeProductTypeDescriptionRepository();
            ReasonCodeProductTypeDescription           reasonCodeProductTypeDescription           = new ReasonCodeProductTypeDescription();

            reasonCodeProductTypeDescription = reasonCodeProductTypeDescriptionRepository.GetItem(
                "en-GB",
                reasonCodeItem.ReasonCode,
                reasonCodeItem.ProductId,
                reasonCodeItem.ReasonCodeTypeId
                );
            reasonCodeItem.ReasonCodeDescription = (reasonCodeProductTypeDescription != null) ? reasonCodeProductTypeDescription.ReasonCodeProductTypeDescription1 : String.Empty;

            ReasonCodeGroupRepository reasonCodeGroupRepository = new ReasonCodeGroupRepository();
            ReasonCodeGroup           reasonCodeGroup           = new ReasonCodeGroup();

            reasonCodeGroup = reasonCodeGroupRepository.GetGroup(reasonCodeItem.ReasonCodeGroupId);
            if (reasonCodeGroup != null)
            {
                reasonCodeItem.ReasonCodeGroupName = reasonCodeGroup.ReasonCodeGroupName;
            }
        }
        // GET: /Edit
        public ActionResult Edit(string reasonCode, int productId, int reasonCodeTypeId, string languageCode)
        {
            //Get Item
            ReasonCodeProductTypeDescription reasonCodeProductTypeDescription = new ReasonCodeProductTypeDescription();

            reasonCodeProductTypeDescription = reasonCodeProductTypeDescriptionRepository.GetItem(languageCode, reasonCode, productId, reasonCodeTypeId);

            //Check Exists
            if (reasonCodeProductTypeDescription == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }

            ProductRepository productRepository = new ProductRepository();
            Product           product           = new Product();

            product = productRepository.GetProduct(productId);
            ReasonCodeTypeRepository reasonCodeTypeRepository = new ReasonCodeTypeRepository();
            ReasonCodeType           reasonCodeType           = new ReasonCodeType();

            reasonCodeType = reasonCodeTypeRepository.GetItem(reasonCodeTypeId);
            ReasonCodeItemRepository reasonCodeItemRepository = new ReasonCodeItemRepository();
            ReasonCodeItem           reasonCodeItem           = new ReasonCodeItem();

            reasonCodeItem             = reasonCodeItemRepository.GetItem(1);
            ViewData["ReasonCodeItem"] = reasonCode + "/" + reasonCodeType.ReasonCodeTypeDescription + "/" + product.ProductName;

            //Language SelectList
            SelectList languageList = new SelectList(reasonCodeProductTypeDescriptionRepository.GetUnUsedLanguages(reasonCode, productId, reasonCodeTypeId).ToList(), "LanguageCode", "LanguageName");

            ViewData["Languages"] = languageList;

            reasonCodeProductTypeDescriptionRepository.EditItemForDisplay(reasonCodeProductTypeDescription);
            return(View(reasonCodeProductTypeDescription));
        }
Exemplo n.º 5
0
 public EKAERException(BaseResultType result) : base(result.Msg)
 {
     Result     = result;
     ReasonCode = result.ReasonCode;
 }