CreateUnStructuredDataStructure() public méthode

Creates an unstructured data structure UnStructuredDataStructure and persists it in the database.
public CreateUnStructuredDataStructure ( string name, string description ) : UnStructuredDataStructure
name string The name of the data structure
description string A free text describing the purpose, usage, and/or the domain of the data structure usage.
Résultat BExIS.Dlm.Entities.DataStructure.UnStructuredDataStructure
 public MessageModel storeDataStructure(long Id, string Name, bool isStructured, string Description ="", string cssId = "", bool inUse = false)
 {
     Name = Server.UrlDecode(Name);
     Description = Server.UrlDecode(Description);
     MessageModel DataStructureValidation = MessageModel.validateDataStructureInUse(Id);
     if (DataStructureValidation.hasMessage && inUse == false)
     {
         return DataStructureValidation;
     }
     else
     {
         DataStructureValidation = MessageModel.validateDataStructureName(Id, Name, cssId);
         if (DataStructureValidation.hasMessage)
         {
             return DataStructureValidation;
         }
         else
         {
             DataStructureManager dataStructureManager = new DataStructureManager();
             DataStructure dataStructure;
             if (isStructured)
             {
                 if (Id == 0)
                 {
                     dataStructure = dataStructureManager.CreateStructuredDataStructure(Name.Trim(), Description.Trim(), null, null, DataStructureCategory.Generic);
                     LoggerFactory.LogData(dataStructure.Id.ToString(), typeof(DataStructure).Name, Vaiona.Entities.Logging.CrudState.Created);
                     return new MessageModel()
                     {
                         Message = dataStructure.Id.ToString(),
                         hasMessage = false,
                         CssId = "redirect"
                     };
                 }
                 else
                 {
                     StructuredDataStructure StructuredDataStructure = dataStructureManager.StructuredDataStructureRepo.Get(Id);
                     StructuredDataStructure.Name = Name;
                     StructuredDataStructure.Description = Description;
                     dataStructure = dataStructureManager.UpdateStructuredDataStructure(StructuredDataStructure);
                     LoggerFactory.LogData(dataStructure.Id.ToString(), typeof(DataStructure).Name, Vaiona.Entities.Logging.CrudState.Created);
                     return new MessageModel()
                     {
                         Message = Id.ToString(),
                         hasMessage = false,
                         CssId = "redirect"
                     };
                 }
             }
             else
             {
                 if (Id == 0)
                 {
                     dataStructure = dataStructureManager.CreateUnStructuredDataStructure(Name.Trim(), Description.Trim());
                     LoggerFactory.LogData(dataStructure.Id.ToString(), typeof(DataStructure).Name, Vaiona.Entities.Logging.CrudState.Created);
                     return new MessageModel()
                     {
                         Message = "refresh DataStructureResultGrid",
                         hasMessage = false,
                         CssId = "refresh"
                     };
                 }
                 else
                 {
                     UnStructuredDataStructure unStructuredDataStructure = dataStructureManager.UnStructuredDataStructureRepo.Get(Id);
                     unStructuredDataStructure.Name = Name;
                     unStructuredDataStructure.Description = Description;
                     dataStructure = dataStructureManager.UpdateUnStructuredDataStructure(unStructuredDataStructure);
                     LoggerFactory.LogData(dataStructure.Id.ToString(), typeof(DataStructure).Name, Vaiona.Entities.Logging.CrudState.Created);
                     return new MessageModel()
                     {
                         Message = "refresh DataStructureResultGrid",
                         hasMessage = false,
                         CssId = "refresh"
                     };
                 }
             }
         }
     }
 }
Exemple #2
0
        // create unstructured DataStructures
        public DataStructure CreateDataStructure(string fileType)
        {
            DataStructureManager dataStructureManager = new DataStructureManager();
            UnStructuredDataStructure dataStructure = new UnStructuredDataStructure();

            // values of DataStructure
            string name = fileType;
            string description = "old BExIS unstrctured data structure: " + fileType;

            UnStructuredDataStructure existDS = dataStructureManager.UnStructuredDataStructureRepo.Get(s => name.Equals(s.Name)).FirstOrDefault();
            if (existDS == null)
            {
                // create dataStructure
                return dataStructureManager.CreateUnStructuredDataStructure(name, description);
            }
            else
            {
                return existDS;
            }
        }