Ejemplo n.º 1
0
        private bool DeleteFromDB(int id)
        {
            try
            {
                IFileService                   _fileService          = new SCA.BusinessLib.Utility.FileService();
                ILogRecorder                   logger                = null;
                DBFileVersionManager           dbFileVersionManager  = new DBFileVersionManager(TheController.Project.SavePath, logger, _fileService);
                IDBFileVersionService          _dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(DBFileVersionManager.CurrentDBFileVersion);
                ILinkageConfigGeneralDBService generalDBService      = new SCA.DatabaseAccess.DBContext.LinkageConfigGeneralDBService(_dbFileVersionService);


                if (generalDBService.DeleteGeneralLinkageConfigInfo(id))
                {
                    if (BusinessLib.ProjectManager.GetInstance.MaxIDForGeneralLinkageConfig == id) //如果最大ID等于被删除的ID,则重新赋值
                    {
                        LinkageConfigGeneralService generalService = new LinkageConfigGeneralService(TheController);
                        BusinessLib.ProjectManager.GetInstance.MaxIDForGeneralLinkageConfig = generalService.GetMaxID();
                    }
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
 public bool SaveToDB()
 {
     try
     {
         ILogRecorder                    logger                = null;
         IFileService                    fileService           = new SCA.BusinessLib.Utility.FileService();
         DBFileVersionManager            dbFileVersionManager  = new DBFileVersionManager(TheController.Project.SavePath, logger, fileService);
         IDBFileVersionService           _dbFileVersionService = dbFileVersionManager.GetDBFileVersionServiceByVersionID(SCA.BusinessLogic.DBFileVersionManager.CurrentDBFileVersion);
         ILinkageConfigStandardDBService dbMixedService        = new LinkageConfigStandardDBService(_dbFileVersionService);
         dbMixedService.AddStandardLinkageConfigInfo(TheController.StandardConfig);
     }
     catch
     {
         return(false);
     }
     return(true);
 }