protected override void ImportProcess(PackProcessEventArgs args) { base.ImportProcess(args); args.Pack.IsMasterData = false; args.Pack.IsUpgrade = false; ImportEntities(args); }
private void ImportEntities(PackProcessEventArgs e) { var packInfo = (ExportEntitiesPackInfo)e.PackInfo; using (var ent = BusinessContext.CreateTemporaryModelManager(this)) { packInfo.ImportTables(ent); ent.SaveChanges(); } }
protected override void ImportProcess(PackProcessEventArgs args) { base.ImportProcess(args); var packInfo = (ExportEntitiesPackInfo)args.PackInfo; using (var ent = new ConfigurationModelManager()) { packInfo.MergeTables(ent); ent.SaveChanges(); } }
private void ImportEntities(PackProcessEventArgs e) { var packInfo = (ExportEntitiesPackInfo)e.PackInfo; using (var ent = BusinessContext.CreateTemporaryModelManager(this)) { ent.MetadataWorkspace.LoadFromAssembly(typeof(DataModelManager).Module.Assembly); e.Pack.Result = packInfo.MergeTables(ent); ent.SaveChanges(); } }
private void a_Imported(object sender, PackProcessEventArgs e) { Trace.WriteIf(ZeroCommonClasses.Environment.Config.LogLevel.TraceInfo, string.Format("Import Finished: Status = {3}, ConnID = {0}, DB Pack = {1}, Pack Module = {2}", e.ConnectionID, e.Pack.Code, e.PackInfo != null ? e.PackInfo.ModuleCode : -1, (PackManager.PackStatus)e.Pack.PackStatusCode), "Information"); if (e.Pack.PackStatusCode == (int)PackManager.PackStatus.Imported) { if ((e.Pack.IsMasterData.GetValueOrDefault()) || (e.Pack.IsUpgrade.GetValueOrDefault())) { using (var packEnt = new CommonEntitiesManager()) { using (var ent = new ConfigurationModelManager()) { foreach (var item in ent.Terminals.Where(t => t.Code != e.PackInfo.TerminalCode)) { Trace.WriteIf(ZeroCommonClasses.Environment.Config.LogLevel.TraceVerbose, string.Format("Saved to Pendings of Terminal {0}", item.Code), "Verbose"); PackPending pp = PackPending.CreatePackPending(e.Pack.Code, item.Code); pp.Stamp = DateTime.Now; packEnt.PackPendings.AddObject(pp); } } packEnt.SaveChanges(); } } else { if (e.PackInfo != null && e.PackInfo.TerminalToCodes.Count > 0) { using (var packEnt = new CommonEntitiesManager()) { using (var ent = new ConfigurationModelManager()) { foreach (int terminal in e.PackInfo.TerminalToCodes.Where(c => c != e.PackInfo.TerminalCode)) { if (ent.Terminals.FirstOrDefault(t => t.Code == terminal) != null) { Trace.WriteIf(ZeroCommonClasses.Environment.Config.LogLevel.TraceVerbose, string.Format("Saved to Pendings of Terminal {0}", terminal), "Verbose"); PackPending pp = PackPending.CreatePackPending(e.Pack.Code, terminal); pp.Stamp = DateTime.Now; packEnt.PackPendings.AddObject(pp); } } } packEnt.SaveChanges(); } } } } }
protected override void ExportProcess(PackProcessEventArgs args) { var info = ((ExportEntitiesPackInfo)args.PackInfo); if (info.HasRowsToProcess) { info.ExportTables(); modelManager.SaveChanges(); } else { args.Cancel = true; } }
protected override void ImportProcess(PackProcessEventArgs args) { base.ImportProcess(args); args.Pack.IsUpgrade = true; string[] filesToProcess = Directory.GetFiles(args.PackInfo.WorkingDirectory, "*" + Resources.ScripFileExtention); if (filesToProcess.Length > 0) { ProcessScripts(filesToProcess, args.Pack.Code, args.PackInfo.TerminalCode); args.Pack.Result = "SQL\n" + outMessage; } if (args.PackInfo != null && !Config.IsOnServer) { string dir = Path.Combine(args.PackInfo.WorkingDirectory, "App"); if (Directory.Exists(dir)) { ProcessUpgrade(dir, args.Pack.Code); } } }
private void OnImporting(PackProcessEventArgs e) { if (Importing != null) Importing(this, e); }
private void OnImported(PackProcessEventArgs e) { if (Imported != null) Imported(this, e); }
private void OnExporting(PackProcessEventArgs e) { if (Exporting != null) Exporting(this, e); }
private void OnExported(PackProcessEventArgs e) { if (Exported != null) Exported(this, e); }
private void InternalImport() { Entities.Pack aPack = null; CommonEntitiesManager dbent = null; var args = new PackProcessEventArgs(); try { dbent = new CommonEntitiesManager(); aPack = InsertPackInDb(workingPackPath, dbent); string workingDirectory = Path.Combine(Path.GetDirectoryName(workingPackPath), Path.GetFileNameWithoutExtension(workingPackPath)); ; UpdatePackStatus(aPack, dbent, PackStatus.Starting, null); args.Pack = aPack; ExtractZip(workingPackPath, workingDirectory); DeserializePackInfo(workingDirectory); PackInfo.TerminalToCodes = new List<int>(GetTerminalDestinationList(args.Pack)); args.PackInfo = PackInfo; aPack.IsMasterData = aPack.IsMasterData.GetValueOrDefault(false); aPack.IsUpgrade = aPack.IsUpgrade.GetValueOrDefault(false); UpdatePackStatus(aPack, dbent, PackStatus.InProgress, null); ImportProcess(args); UpdatePackStatus(aPack, dbent, PackStatus.Imported, null); OnImported(args); } catch (Exception ex) { if (dbent != null && aPack != null) UpdatePackStatus(aPack, dbent, PackStatus.Error, ex.ToString()); throw; } finally { if (dbent != null) { dbent.Dispose(); } } }
private void InternalExport() { var args = new PackProcessEventArgs {PackInfo = PackInfo}; ExportProcess(args); if (!args.Cancel) { SerializePackInfo(); CreateZip(); OnExported(args); } }
protected virtual void ImportProcess(PackProcessEventArgs args) { OnExporting(args); }
protected override void ExportProcess(PackProcessEventArgs args) { base.ExportProcess(args); ((ExportEntitiesPackInfo) args.PackInfo).ExportTables(); }
private void PackReceived_Imported(object sender, PackProcessEventArgs e) { Terminal.Instance.Client.Notifier.Log(TraceLevel.Info, string.Format( "Import Finished: Status = {3}, ConnID = {0}, DB Pack = {1}, Pack Module = {2}", e.ConnectionID, e.Pack.Code, e.PackInfo != null ? e.PackInfo.ModuleCode : -1, e.Pack.PackStatusCode)); }