internal void Handle(RebuildInstallPackages request) { var resp = new SwlResponse(); resp.swlr = SwlResult.GENERAL_FAIL; using (var dbConn = DatabaseManager.DbConn()) { var ii = dbConn.ExecuteBpl(new InstallGetById(request.InstallId)); if (ii == null) { resp.swlr = SwlResult.NOT_FOUND; Reply(resp); return; } if (ii.Status != InstallStatus.Ready) { resp.swlr = SwlResult.NOT_READY; Reply(resp); return; } var pi = dbConn.ExecuteBpl(new PlatformGetById(ii.PlatformId)); if (pi == null) { resp.swlr = SwlResult.INVALID_PLATFORM; Reply(resp); return; } if (pi.Lock != PlatformLockType.NoLock) { Log.Error("Platform with Id {0} locked {1}.", pi.PlatformId.LocalId.ToString(), pi.Lock.ToString()); resp.swlr = SwlResult.BUSY; Reply(resp); return; } dbConn.ExecuteBpl(new PlatformSetLock(pi.PlatformId, PlatformLockType.ByClient, request.ClientId)); Log.Trace("Platform with Id {0} successfully locked to rebuild packages.", pi.PlatformId.LocalId.ToString()); resp.swlr = SwlResult.OK; Reply(resp); Log.Trace("Install Id: {0} ==> Build packages started", ii.InstallId); var swlr = LogisticsHelpers.InstallCreatePackages(dbConn, ii.InstallId); if (swlr == SwlResult.OK) { Log.Trace("Install Id: {0} ==> Build packages finished successfully", ii.InstallId); } else { Log.Error("Install Id: {0} ==> Build packages finished with error {1}", ii.InstallId, swlr); } dbConn.ExecuteBpl(new PlatformSetLock(pi.PlatformId, PlatformLockType.NoLock, BplIdentity.Empty)); } }
private void _btnVersionRebuildPackagesOnClick(object sender, EventArgs e) { if (_selectedInstall == null) { MessageBox.Show("Select installation first", "Installation not selected", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } var req = new RebuildInstallPackages(); req.InstallId = _selectedInstall.InstallId; SendRequest(req); /* if (DB.DatabaseManager.ImageCreatePackages(_selectedImage.ImageId)) { MessageBox.Show("Packages were successfully rebuilt.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Failed to rebuild packages", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); }*/ }