Пример #1
0
        public void Save()
        {
            switch (MetaDataTypeEnum)
            {
            case MetaDataTypeEnum.SubjectCategories:
                var sub = MemoryCache.GetSubjectCategory(SubjectId.Value);
                if (!SortMetaDataObject.GetSortMetaDatas(SortMainId, MetaDataTypeEnum).Exists(n => n.Data.Equals(sub.FullSubject, StringComparison.InvariantCultureIgnoreCase)))
                {
                    SortMetaDataObject.AddNew(MetaDataTypeEnum, SortMainId, sub.FullSubject);
                }
                break;

            case MetaDataTypeEnum.SponsoringOrgs:
                if (!SortMetaDataObject.GetSortMetaDatas(SortMainId, MetaDataTypeEnum).Exists(n => n.Data.Equals(Sponsor, StringComparison.InvariantCultureIgnoreCase)))
                {
                    SortMetaDataObject.AddNew(MetaDataTypeEnum, SortMainId, Sponsor);
                }
                break;

            case MetaDataTypeEnum.Keywords:
                if (!SortMetaDataObject.GetSortMetaDatas(SortMainId, MetaDataTypeEnum).Exists(n => n.Data.Equals(Keyword.Trim(), StringComparison.InvariantCultureIgnoreCase)))
                {
                    SortMetaDataObject.AddNew(MetaDataTypeEnum, SortMainId, Keyword.Trim());
                }
                break;

            case MetaDataTypeEnum.CoreCapabilities:
                var core = MemoryCache.GetCoreCapability(CoreCapabilityId.Value);
                if (!SortMetaDataObject.GetSortMetaDatas(SortMainId, MetaDataTypeEnum).Exists(n => n.Data.Equals(core.Name, StringComparison.InvariantCultureIgnoreCase)))
                {
                    SortMetaDataObject.AddNew(MetaDataTypeEnum, SortMainId, core.Name);
                }
                break;
            }
        }
Пример #2
0
        [HttpPost]/*, ValidateAntiForgeryToken]*/
        public ActionResult AddCoreCapabilities(MetadataModel model)
        {
            if (ModelState.IsValid && SortMainObject.CheckUserHasWriteAccess(model.SortMainId))
            {
                model.Save();

                return(PartialView("Partials/_coreCapabilitiesList", SortMetaDataObject.GetSortMetaDatas(model.SortMainId, MetaDataTypeEnum.CoreCapabilities)));
            }

            return(null);
        }
Пример #3
0
        [HttpPost]/*, ValidateAntiForgeryToken]*/
        public ActionResult AddSponsor(MetadataModel model)
        {
            if (ModelState.IsValid && SortMainObject.CheckUserHasWriteAccess(model.SortMainId))
            {
                model.Save();

                return(PartialView("Partials/_sponsorOrgList", SortMetaDataObject.GetSortMetaDatas(model.SortMainId, MetaDataTypeEnum.SponsoringOrgs)));
            }

            Response.StatusCode = (int)HttpStatusCode.BadRequest;
            return(null);
        }
Пример #4
0
        public ActionResult RemoveSponsor(int?id)
        {
            int sid = 0;

            if (id.HasValue)
            {
                var meta = SortMetaDataObject.GetSortMetaData(id.Value);
                if (meta != null)
                {
                    sid = meta.SortMainId;
                    if (SortMainObject.CheckUserHasWriteAccess(sid))
                    {
                        meta.Delete();
                    }
                }
            }

            return(PartialView("Partials/_sponsorOrgList", SortMetaDataObject.GetSortMetaDatas(sid, MetaDataTypeEnum.SponsoringOrgs)));
        }
Пример #5
0
        public ActionResult RemoveCoreCapabilities(int?id)
        {
            int mid = 0;

            if (id.HasValue)
            {
                var meta = SortMetaDataObject.GetSortMetaData(id.Value);
                if (meta != null)
                {
                    mid = meta.SortMainId;
                    if (SortMainObject.CheckUserHasWriteAccess(mid))
                    {
                        meta.Delete();
                    }
                }
            }

            return(PartialView("Partials/_coreCapabilitiesList", SortMetaDataObject.GetSortMetaDatas(mid, MetaDataTypeEnum.CoreCapabilities)));
        }
Пример #6
0
 public MetadataModel(int mainId, MetaDataTypeEnum dataType)
 {
     SortMainId   = mainId;
     MetaDataType = dataType.ToString();
     Metadata     = SortMetaDataObject.GetSortMetaDatas(SortMainId, MetaDataTypeEnum);
 }