コード例 #1
0
        public ActionResult Delete(string reasonCode, int productId, int reasonCodeTypeId, string languageCode)
        {
            //Get Item
            ReasonCodeProductTypeTravelerDescription reasonCodeProductTypeTravelerDescription = new ReasonCodeProductTypeTravelerDescription();

            reasonCodeProductTypeTravelerDescription = reasonCodeProductTypeTravelerDescriptionRepository.GetItem(languageCode, reasonCode, productId, reasonCodeTypeId);

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

            //Add Linked Information
            reasonCodeProductTypeTravelerDescriptionRepository.EditItemForDisplay(reasonCodeProductTypeTravelerDescription);

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

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

            //Return View
            return(View(reasonCodeProductTypeTravelerDescription));
        }
コード例 #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));
        }
        //Delete From DB
        public void Delete(ReasonCodeProductTypeTravelerDescription reasonCodeProductTypeTravelerDescription)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            db.spDesktopDataAdmin_DeleteReasonCodeProductTypeTravelerDescription_v1(
                reasonCodeProductTypeTravelerDescription.ReasonCode,
                reasonCodeProductTypeTravelerDescription.ProductId,
                reasonCodeProductTypeTravelerDescription.ReasonCodeTypeId,
                reasonCodeProductTypeTravelerDescription.LanguageCode,
                adminUserGuid,
                reasonCodeProductTypeTravelerDescription.VersionNumber
                );
        }
コード例 #4
0
        //GET: View
        public ActionResult View(string reasonCode, int productId, int reasonCodeTypeId, string languageCode)
        {
            ReasonCodeProductTypeTravelerDescription reasonCodeProductTypeTravelerDescription = new ReasonCodeProductTypeTravelerDescription();

            reasonCodeProductTypeTravelerDescription = reasonCodeProductTypeTravelerDescriptionRepository.GetItem(languageCode, reasonCode, productId, reasonCodeTypeId);
            if (reasonCodeProductTypeTravelerDescription == null)
            {
                ViewData["ActionMethod"] = "ViewGet";
                return(View("RecordDoesNotExistError"));
            }
            reasonCodeProductTypeTravelerDescriptionRepository.EditItemForDisplay(reasonCodeProductTypeTravelerDescription);
            return(View(reasonCodeProductTypeTravelerDescription));
        }
 //Add Data From Linked Tables for Display
 public void EditItemForDisplay(ReasonCodeProductTypeTravelerDescription reasonCodeProductTypeTravelerDescription)
 {
     //Add LanguageName
     if (reasonCodeProductTypeTravelerDescription.LanguageCode != null)
     {
         LanguageRepository languageRepository = new LanguageRepository();
         Language           language           = new Language();
         language = languageRepository.GetLanguage(reasonCodeProductTypeTravelerDescription.LanguageCode);
         if (language != null)
         {
             reasonCodeProductTypeTravelerDescription.LanguageName = language.LanguageName;
         }
     }
 }
コード例 #6
0
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(ReasonCodeTravelerDescription reasonCodeTravelerDescription)
        {
            //Add LanguageName
            if (reasonCodeTravelerDescription.LanguageCode != null)
            {
                LanguageRepository languageRepository = new LanguageRepository();
                Language           language           = new Language();
                language = languageRepository.GetLanguage(reasonCodeTravelerDescription.LanguageCode);
                if (language != null)
                {
                    reasonCodeTravelerDescription.LanguageName = language.LanguageName;
                }
            }

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

            reasonCodeItem = reasonCodeItemRepository.GetItem(reasonCodeTravelerDescription.ReasonCodeItemId);
            if (reasonCodeItem != null)
            {
                reasonCodeItemRepository.EditItemForDisplay(reasonCodeItem);
                reasonCodeTravelerDescription.ReasonCodeItemDisplayOrder = reasonCodeItem.DisplayOrder;

                //ReasonCodeProductTypeTravelerDescription
                ReasonCodeProductTypeTravelerDescriptionRepository reasonCodeProductTypeTravelerDescriptionRepository = new ReasonCodeProductTypeTravelerDescriptionRepository();
                ReasonCodeProductTypeTravelerDescription           reasonCodeProductTypeTravelerDescription           = new ReasonCodeProductTypeTravelerDescription();
                reasonCodeProductTypeTravelerDescription = reasonCodeProductTypeTravelerDescriptionRepository.GetItem(
                    "en-GB",
                    reasonCodeItem.ReasonCode,
                    reasonCodeItem.ProductId,
                    reasonCodeItem.ReasonCodeTypeId
                    );

                if (reasonCodeProductTypeTravelerDescription != null)
                {
                    reasonCodeTravelerDescription.ReasonCodeProductTypeTravelerDescription = reasonCodeProductTypeTravelerDescription;
                }
                else
                {
                    reasonCodeTravelerDescription.ReasonCodeProductTypeTravelerDescription = new ReasonCodeProductTypeTravelerDescription();
                }
            }
        }
コード例 #7
0
        public ActionResult Delete(string reasonCode, int productId, int reasonCodeTypeId, string languageCode, FormCollection collection)
        {
            //Get Item
            ReasonCodeProductTypeTravelerDescription reasonCodeProductTypeTravelerDescription = new ReasonCodeProductTypeTravelerDescription();

            reasonCodeProductTypeTravelerDescription = reasonCodeProductTypeTravelerDescriptionRepository.GetItem(languageCode, reasonCode, productId, reasonCodeTypeId);

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

            //Delete Item
            try
            {
                reasonCodeProductTypeTravelerDescription.VersionNumber = Int32.Parse(collection["VersionNumber"]);
                reasonCodeProductTypeTravelerDescriptionRepository.Delete(reasonCodeProductTypeTravelerDescription);
            }
            catch (SqlException ex)
            {
                //Versioning Error - go to standard versionError page
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/AirlineAdvice.mvc/Delete?reasonCodeTypeId=" + reasonCodeTypeId.ToString()
                                            + "&languagCode=" + languageCode
                                            + "&reasonCode=" + reasonCode.ToString()
                                            + "&productId=" + productId.ToString()
                                            + "&reasonCodeTypeId=" + reasonCodeTypeId.ToString();
                    return(View("VersionError"));
                }
                //Generic Error
                ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details";
                return(View("Error"));
            }


            //Return
            return(RedirectToAction("List", new { reasonCode = reasonCode, productId = productId, reasonCodeTypeId = reasonCodeTypeId }));
        }
コード例 #8
0
        public ActionResult Create(ReasonCodeProductTypeTravelerDescription reasonCodeProductTypeTravelerDescription)
        {
            //Get Item
            ReasonCodeProductType reasonCodeProductType = new ReasonCodeProductType();

            reasonCodeProductType = reasonCodeProductTypeRepository.GetReasonCodeProductType(reasonCodeProductTypeTravelerDescription.ReasonCode, reasonCodeProductTypeTravelerDescription.ProductId, reasonCodeProductTypeTravelerDescription.ReasonCodeTypeId);

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

            //Update  Model from Form
            try
            {
                UpdateModel(reasonCodeProductTypeTravelerDescription);
            }
            catch
            {
                string n = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        n += error.ErrorMessage;
                    }
                }
                ViewData["Message"] = "ValidationError : " + n;
                return(View("Error"));
            }


            reasonCodeProductTypeTravelerDescriptionRepository.Add(reasonCodeProductTypeTravelerDescription);

            return(RedirectToAction("List", new { reasonCode = reasonCodeProductTypeTravelerDescription.ReasonCode, productId = reasonCodeProductTypeTravelerDescription.ProductId, reasonCodeTypeId = reasonCodeProductTypeTravelerDescription.ReasonCodeTypeId }));
        }
コード例 #9
0
        public ActionResult Edit(string reasonCode, int productId, int reasonCodeTypeId, string languageCode, FormCollection formCollection)
        {
            //Get Item
            ReasonCodeProductTypeTravelerDescription reasonCodeProductTypeTravelerDescription = new ReasonCodeProductTypeTravelerDescription();

            reasonCodeProductTypeTravelerDescription = reasonCodeProductTypeTravelerDescriptionRepository.GetItem(languageCode, reasonCode, productId, reasonCodeTypeId);

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



            //Update Item from Form
            try
            {
                UpdateModel(reasonCodeProductTypeTravelerDescription);
            }
            catch
            {
                string n = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        n += error.ErrorMessage;
                    }
                }
                ViewData["Message"] = "ValidationError : " + n;
                return(View("Error"));
            }



            //Update
            try
            {
                reasonCodeProductTypeTravelerDescriptionRepository.Update(reasonCodeProductTypeTravelerDescription);
            }
            catch (SqlException ex)
            {
                //Versioning Error
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/ReasonCodeProductTypeTravelerDescription.mvc/Edit?reasonCodeTypeId=" + reasonCodeTypeId.ToString()
                                            + "&languagCode=" + languageCode
                                            + "&reasonCode=" + reasonCode.ToString()
                                            + "&productId=" + productId.ToString()
                                            + "&reasonCodeTypeId=" + reasonCodeTypeId.ToString();
                    return(View("VersionError"));
                }

                //Generic Error
                ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details";
                return(View("Error"));
            }

            return(RedirectToAction("List", new { reasonCode = reasonCode, productId = productId, reasonCodeTypeId = reasonCodeTypeId }));
        }