public ActionResult Delete(int id, string languageCode)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            OptionalFieldLanguage optionalFieldLanguage = new OptionalFieldLanguage();

            optionalFieldLanguage = optionalFieldLanguageRepository.GetItem(id, languageCode);

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

            OptionalFieldLanguageVM optionalFieldLanguageVM = new OptionalFieldLanguageVM();

            optionalFieldLanguageVM.OptionalFieldLanguage = optionalFieldLanguage;

            // Need the name for breadcrumbs
            OptionalFieldRepository optionalFieldRespository = new OptionalFieldRepository();
            OptionalField           optionalField            = optionalFieldRespository.GetItem(id);

            ViewData["OptionalFieldName"] = optionalField.OptionalFieldName;

            return(View(optionalFieldLanguageVM));
        }
        // GET: View A Single OptionalFieldLanguage
        public ActionResult View(int id, string languageCode)
        {
            OptionalFieldLanguage optionalFieldLanguage = optionalFieldLanguageRepository.GetItem(id, languageCode);

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

            OptionalFieldLanguageVM optionalFieldLanguageVM = new OptionalFieldLanguageVM();

            optionalFieldLanguageVM.OptionalFieldLanguage = optionalFieldLanguage;

            //Need the name for breadcrumbs
            OptionalFieldRepository optionalFieldRespository = new OptionalFieldRepository();
            OptionalField           optionalField            = optionalFieldRespository.GetItem(id);

            if (optionalField != null)
            {
                ViewData["OptionalFieldName"] = optionalField.OptionalFieldName;
            }

            //Languages
            optionalFieldLanguageVM.OptionalFieldLanguages = new SelectList(optionalFieldLanguageRepository.GetAllAvailableLanguages(id), "LanguageCode", "LanguageName");

            return(View(optionalFieldLanguageVM));
        }
        public ActionResult Delete(int id)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            OptionalField optionalField = new OptionalField();

            optionalField = optionalFieldRepository.GetItem(id);

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

            OptionalFieldVM optionalFieldVM = new OptionalFieldVM();

            //Get the Optional Field Style
            OptionalFieldStyleRepository optionalFieldStyleRepository = new OptionalFieldStyleRepository();

            optionalField.OptionalFieldStyle = optionalFieldStyleRepository.GetStyle(optionalField.OptionalFieldStyleId);

            optionalFieldVM.OptionalField = optionalField;

            return(View(optionalFieldVM));
        }
        // GET: Edit A Single OptionalField
        public ActionResult Edit(int id)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            OptionalField optionalField = optionalFieldRepository.GetItem(id);

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

            OptionalFieldVM optionalFieldVM = new OptionalFieldVM();

            //Get the Optional Field Style
            OptionalFieldStyleRepository optionalFieldStyleRepository = new OptionalFieldStyleRepository();

            optionalFieldVM.OptionalFieldStyles = new SelectList(
                optionalFieldStyleRepository.GetAllOptionalFieldStylesQueryable().ToList(),
                "OptionalFieldStyleId",
                "OptionalFieldStyleDescription",
                optionalField.OptionalFieldStyleId
                );

            optionalFieldVM.OptionalField = optionalField;

            return(View(optionalFieldVM));
        }
        // GET: View A Single OptionalFieldLookupValue
        public ActionResult View(int id)
        {
            OptionalFieldLookupValue optionalFieldLookupValue = optionalFieldLookupValueRepository.GetItem(id);

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

            OptionalFieldLookupValueVM optionalFieldLookupValueVM = new OptionalFieldLookupValueVM();

            optionalFieldLookupValueVM.OptionalFieldLookupValue = optionalFieldLookupValue;

            //Language
            OptionalFieldLookupValueLanguage optionalFieldLookupValueLanguage = new OptionalFieldLookupValueLanguage();

            optionalFieldLookupValueLanguage = optionalFieldLookupValueLanguageRepository.GetItem(optionalFieldLookupValue.OptionalFieldLookupValueId);
            if (optionalFieldLookupValueLanguage != null)
            {
                optionalFieldLookupValueVM.OptionalFieldLookupValueLanguage = optionalFieldLookupValueLanguage;
            }

            //Need the name for breadcrumbs
            OptionalFieldRepository optionalFieldRespository = new OptionalFieldRepository();
            OptionalField           optionalField            = optionalFieldRespository.GetItem(optionalFieldLookupValue.OptionalFieldId);

            if (optionalField != null)
            {
                ViewData["OptionalFieldName"] = optionalField.OptionalFieldName;
            }

            return(View(optionalFieldLookupValueVM));
        }
        // GET: Create A Single OptionalFieldLanguage
        public ActionResult Create(int id)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            OptionalFieldLanguageVM optionalFieldLanguageVM = new OptionalFieldLanguageVM();

            //Need the name for breadcrumbs
            OptionalFieldRepository optionalFieldRespository = new OptionalFieldRepository();
            OptionalField           optionalField            = optionalFieldRespository.GetItem(id);

            if (optionalField != null)
            {
                ViewData["OptionalFieldName"] = optionalField.OptionalFieldName;
            }

            //Set Default Option Size
            OptionalFieldLanguage optionalFieldLanguage = new OptionalFieldLanguage();

            optionalFieldLanguage.OptionalFieldId         = id;
            optionalFieldLanguage.OptionalFieldSize       = 0;
            optionalFieldLanguageVM.OptionalFieldLanguage = optionalFieldLanguage;

            //Languages
            optionalFieldLanguageVM.OptionalFieldLanguages = new SelectList(optionalFieldLanguageRepository.GetAllAvailableLanguages(id), "LanguageCode", "LanguageName");

            return(View(optionalFieldLanguageVM));
        }
 public OptionalFieldItemSequencesVM(CWTPaginatedList <spDesktopDataAdmin_SelectOptionalFieldItemSequences_v1Result> servicingOptionItemSequences, OptionalFieldGroup servicingOptionGroup, int servicingOptionId, OptionalField servicingOption)
 {
     OptionalFieldItemSequences = servicingOptionItemSequences;
     OptionalFieldGroup         = servicingOptionGroup;
     OptionalField   = servicingOption;
     OptionalFieldId = servicingOptionId;
 }
Exemple #8
0
        //Delete From DB
        public void Delete(OptionalField optionalField)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            db.spDesktopDataAdmin_DeleteOptionalField_v1(
                optionalField.OptionalFieldId,
                adminUserGuid,
                optionalField.VersionNumber
                );
        }
Exemple #9
0
 public static void Main()
 {
     QuickStart.Go();
     UsingNonSerializedFields.Go();
     OptionalField.Go();
     ISerializableVersioning.Go();
     SerializingSingletons.Go();
     SerializationSurrogates.Go();
     SerializationBinderDemo.Go();
 }
        public ActionResult Edit(OptionalFieldVM optionalFieldVM)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            OptionalField optionalField = new OptionalField();

            optionalField = optionalFieldRepository.GetItem(optionalFieldVM.OptionalField.OptionalFieldId);

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

            //Update Model from Form
            try
            {
                UpdateModel(optionalFieldVM);
            }
            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"));
            }

            //Database Update
            try
            {
                optionalFieldRepository.Update(optionalFieldVM);
            }
            catch (SqlException ex)
            {
                LogRepository logRepository = new LogRepository();
                logRepository.LogError(ex.Message);

                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"));
        }
        // GET: Edit A Single OptionalFieldLookupValue
        public ActionResult Edit(int id)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            OptionalFieldLookupValue optionalFieldLookupValue = optionalFieldLookupValueRepository.GetItem(id);

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

            OptionalFieldLookupValueVM optionalFieldLookupValueVM = new OptionalFieldLookupValueVM();

            //Language
            OptionalFieldLookupValueLanguage optionalFieldLookupValueLanguage = new OptionalFieldLookupValueLanguage();

            optionalFieldLookupValueLanguage = optionalFieldLookupValueLanguageRepository.GetItem(optionalFieldLookupValue.OptionalFieldLookupValueId);
            if (optionalFieldLookupValueLanguage != null)
            {
                optionalFieldLookupValueVM.OptionalFieldLookupValueLanguage = optionalFieldLookupValueLanguage;
            }

            //Get the Languages
            LanguageRepository languageRepository = new LanguageRepository();

            optionalFieldLookupValueVM.OptionalFieldLookupValueLanguages = new SelectList(
                languageRepository.GetAllLanguages().ToList(),
                "LanguageCode",
                "LanguageName",
                optionalFieldLookupValueLanguage.LanguageCode
                );

            //Need the name for breadcrumbs
            OptionalFieldRepository optionalFieldRespository = new OptionalFieldRepository();
            OptionalField           optionalField            = optionalFieldRespository.GetItem(optionalFieldLookupValue.OptionalFieldId);

            if (optionalField != null)
            {
                ViewData["OptionalFieldName"] = optionalField.OptionalFieldName;
            }

            optionalFieldLookupValueVM.OptionalFieldLookupValue = optionalFieldLookupValue;

            return(View(optionalFieldLookupValueVM));
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            OptionalField optionalField = new OptionalField();

            optionalField = optionalFieldRepository.GetItem(id);

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

            //Delete Item
            try
            {
                optionalField.VersionNumber = Int32.Parse(collection["OptionalField.VersionNumber"]);
                optionalFieldRepository.Delete(optionalField);
            }
            catch (SqlException ex)
            {
                //Versioning Error - go to standard versionError page
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/OptionalField.mvc/Delete/" + optionalField.OptionalFieldId.ToString();
                    return(View("VersionError"));
                }
                //Restraint Error - go to standard DeleteError page
                if (ex.Message == "SQLDeleteError")
                {
                    ViewData["ReturnURL"] = "/OptionalField.mvc/Delete/" + optionalField.OptionalFieldId.ToString();
                    return(View("DeleteError"));
                }
                //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"));
        }
Exemple #13
0
        public void DefineTest()
        {
            MemoryBufferAddressSpace dataSource = new MemoryBufferAddressSpace(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 });
            LayoutManager            a          = new LayoutManager().AddPrimitives().AddTStructTypes(new string[] { "A" });
            Reader        readerA = new Reader(dataSource, a);
            OptionalField fA      = readerA.Read <OptionalField>(0);

            Assert.Equal(0x08070605, fA.Y);
            Assert.Equal(0x0c0b0a09, fA.Z);

            Reader        readerB = new Reader(dataSource);
            OptionalField fB      = readerB.Read <OptionalField>(0);

            Assert.Equal(0x0, fB.Y);
            Assert.Equal(0x08070605, fB.Z);
        }
        //GET: A list of OptionalFieldLanguages
        public ActionResult List(int id, string filter, int?page, string sortField, int?sortOrder)
        {
            //Check Access Rights to Domain
            ViewData["Access"] = "";
            if (hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Access"] = "WriteAccess";
            }

            //SortField + SortOrder settings
            if (sortField != "OptionalFieldLabel")
            {
                sortField = "LanguageName";
            }
            ViewData["CurrentSortField"] = sortField;

            if (sortOrder == 1)
            {
                ViewData["NewSortOrder"]     = 0;
                ViewData["CurrentSortOrder"] = 1;
            }
            else
            {
                ViewData["NewSortOrder"]     = 1;
                ViewData["CurrentSortOrder"] = 0;
            }

            OptionalField           optionalField            = new OptionalField();
            OptionalFieldRepository optionalFieldRespository = new OptionalFieldRepository();

            optionalField = optionalFieldRespository.GetItem(id);

            if (optionalField != null)
            {
                ViewData["OptionalFieldId"]   = optionalField.OptionalFieldId;
                ViewData["OptionalFieldName"] = optionalField.OptionalFieldName;
            }

            var items = optionalFieldLanguageRepository.PageOptionalFieldLanguages(id, filter ?? "", page ?? 1, sortField, sortOrder ?? 0);

            return(View(items));
        }
        // GET: View A Single OptionalField
        public ActionResult View(int id)
        {
            OptionalField optionalField = optionalFieldRepository.GetItem(id);

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

            OptionalFieldVM optionalFieldVM = new OptionalFieldVM();

            //Get the Optional Field Style
            OptionalFieldStyleRepository optionalFieldStyleRepository = new OptionalFieldStyleRepository();

            optionalField.OptionalFieldStyle = optionalFieldStyleRepository.GetStyle(optionalField.OptionalFieldStyleId);

            optionalFieldVM.OptionalField = optionalField;

            return(View(optionalFieldVM));
        }
        // GET: Create A Single OptionalField
        public ActionResult Create()
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            OptionalFieldVM optionalFieldVM = new OptionalFieldVM();
            OptionalField   optionalField   = new OptionalField();

            OptionalFieldStyle optionalFieldStyle = new OptionalFieldStyle();

            optionalField.OptionalFieldStyle = optionalFieldStyle;
            optionalFieldVM.OptionalField    = optionalField;

            OptionalFieldStyleRepository optionalFieldStyleRepository = new OptionalFieldStyleRepository();

            optionalFieldVM.OptionalFieldStyles = optionalFieldStyleRepository.GetAllOptionalFieldStyles().ToList();

            return(View(optionalFieldVM));
        }
 public OptionalFieldVM(OptionalField optionalField)
 {
     OptionalField = optionalField;
 }