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 = null; try { 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" }); } } } finally { dataStructureManager.Dispose(); } } } }