/// <param name="project">ID projektu</param> /// <param name="year">Rok prognozy</param> /// <param name="variant">Ewentualne ID wariantu</param> /// <param name="model">ID modelu – ma znaczenie dla wydawanych parametrów</param> public DBReaderBatch(BlaRequest request, RoReporter rep = null, byte?connID = null) { Reporter = rep ?? new RoReporter(); Results = new Dictionary <byte, Stream>(); try { Reporter.AddMessage(new RoReMessage { Caller = "Inicjalizacja", EvType = RoReEventType.ModuleCall, Message = "Inicjalizacja systemu" }); __conn = _.SetupConnection(connID); Reporter.AddMessage(new RoReMessage { Caller = "Inicjalizacja", Message = $"DBServer: {__conn.Server}, Database: {__conn.Database}", EvType = RoReEventType.Info }); __storage = new BlaCommonStorage(__conn, request); __storage.Reporter = Reporter; __storage.Variant = new BlaDBVariantDefinition(__conn, request); } catch (Exception e) { Reporter.AddException(e, "Inicjalizacja"); } }
public CLI_Träger(string[] args) { Reporter = new RoReporter(); Reporter.PropertyChanged += __Reporter_MessageSent; if (args.Length > 0) { XMLFile = args[0]; } if (args.Length > 1) { WrokPath = args[1]; } try { if (string.IsNullOrWhiteSpace(WrokPath)) { WrokPath = _.I.Cfg.Root; } } catch { } if (args.Length > 2) { var s = args[2]; byte y; if (byte.TryParse(s, out y)) { __connID = y; } } }
/// <summary> /// Depreciated /// </summary> /// <param name="project"></param> /// <param name="year"></param> /// <param name="variant"></param> /// <param name="model"></param> /// <param name="connection"></param> /// <param name="reporter"></param> /// <param name="workMode"></param> public void InitializeBatch(int project, decimal year, int?variant, int model, DBConnectionPool connection, RoReporter reporter, Blasewitz.Bla_WorkMode workMode) { throw new NotImplementedException("Funkcja zdeprecjonowana"); //__storage = new BlaCommonStorage(workMode) //{ // Variant = new BlaDBVariantDefinition(connection, project, variant, year, model), // Reporter = reporter //}; }
public override bool CheckPrerequisities(RoReporter reporter) { if (!_platform.PuT.Lines.SelectMany(l => l.Strecken.SelectMany(ls => ls.Profiles)).Any()) { reporter.AddMessage(new RoReMessage { EvType = RoReEventType.Warning, Message = "Nie znaleziono żadnej linii/przebiegu/profilu. Nie będzie możliwe przypisanie kursów" }); } return(true); }
protected bool _CheckIf_TSysList_Exists(RoReporter reporter) { var b = _platform.DemFoundation.TSysList != null; if (!b) { reporter.AddMessage(new RoReMessage { Message = "Najpierw należy wczytać środki transportu (TSys)", EvType = RoReEventType.Error }); } return(b); }
public override bool CheckPrerequisities(RoReporter reporter) { var b = _platform.DemFoundation.TSysList != null; if (!b) { reporter.AddMessage(new RoReMessage { Caller = "ReickModule[Mod]", Message = "Najpierw należy wczytać środki transportu (TSys)", EvType = RoReEventType.Error }); } return(b); }
public override bool CheckPrerequisities(RoReporter reporter) { var b = _platform.Attributies.HasDefinitions; if (!b) { reporter.AddMessage(new RoReMessage { Caller = __MODNAME, EvType = RoReEventType.Error, Message = "Konieczne jest wcześniejsze wczytanie definicji atrybutów" }); } return(b); }
public override bool CheckPrerequisities(RoReporter reporter) { var b = _CheckIf_TSysList_Exists(reporter); if (_platform.Graph.Nodes?.Count == 0) { reporter.AddMessage(new RoReMessage { EvType = RoReEventType.Warning, Message = "Liczba węzłów wynosi 0. Zatem niemożliwe będzie stworzenie przystanków" }); } return(b); }
/// <summary> /// Wykonuje opisane w żądaniu operacje, zwracając w nim rezultaty /// </summary> /// <returns></returns> public bool Execute(BlaRequest req, byte?connId = null) { //RoReporter rep = null; //Dictionary<byte, Stream> res = null; DBReaderBatch n = null; try { n = new DBReaderBatch(req, Reporter, connId); //rep = n.Reporter; if (Reporter.IsOK) { n.FragQuellen(req.Reicks); } foreach (var batch in req.Batches) { if (Reporter.IsOK) { n.PerformBatch(batch); } } //if (Reporter.IsOK) //{ // res = new Dictionary<byte, Stream>(); // res.Add(0, n.Log); // foreach (var t in n.Results) // { // res.Add(t.Key, t.Value); // } //} } catch (Exception e) { var q = Reporter == null; if (q) { Reporter = new RoReporter(); } Reporter.AddException(e, "Błąd krytyczny ogólny"); } //if (res == null) //{ // res = new Dictionary<byte, Stream>(); // res.Add(0, Reporter.SaveLog()); //} return(Reporter != null ? n.Reporter.IsOK : false); }
public override bool CheckPrerequisities(RoReporter reporter) { var b = true; if (_platform.DemFoundation.TSysList == null) { reporter.AddMessage(new RoReMessage { Caller = "Reick Module[AtD]", EvType = RoReEventType.Error, Message = "Systemy Transportu (TSys) muszą być przewtorzone przed uruchomieniem tego modułu" }); b = false; } return(b); }
public static void WriteStreamsToFiles(string catalog, BlaRequest request, RoReporter reporter, string caller) { if (!Directory.Exists(catalog)) { reporter.AddMessage(new RoReMessage { Caller = caller, EvType = RoReEventType.Error, Message = string.Format("Katalog {0} nie istnieje", catalog) }); return; } try { foreach (var brs in request.Batches) { if ((brs.Result == null) | string.IsNullOrWhiteSpace(brs.FileName)) { reporter.AddMessage(new RoReMessage { Caller = caller, EvType = RoReEventType.Warning, Message = string.Format("Pomijanie zapisu pliku dla podzlecenia {0}", brs.BatchId) }); continue; } var path = Path.Combine(catalog, brs.FileName); reporter.AddMessage(new RoReMessage { Caller = caller, EvType = RoReEventType.Info, Message = string.Format("Zapis pliku dla podzlecenia {0} [{1}]", brs.BatchId, path) }); if (!Directory.Exists(Path.GetDirectoryName(path))) { Directory.CreateDirectory(Path.GetDirectoryName(path)); } WriteStreamToFile(brs.Result, path); } } catch (Exception e) { reporter.AddException(e, caller); } }
public DBReader(RoReporter reporter) { Reporter = reporter; }
public override bool CheckPrerequisities(RoReporter reporter) { return(true); }
//public override bool Prepare() //{ // return base.Prepare(); // //var cmd = new SqlCommand(connection: _connection.Connection, cmdText: "select [ID7110], [LX7101], [Pom], [Name], [U], [Użytkownika], [LX7102], [NumDecPlaces], [StringDefaultValue] from mgm.V7110_VisumAttributes"); // //try // //{ // // int t = 0; // // var reader = cmd.ExecuteReader(); // // int nmUser = reader.GetOrdinal("Użytkownika"); // // while (reader.Read()) { // // if (reader.GetInt32(0) > -1) // // { // // _phs.Attributies.Definitions.Add(new GrWAtt_Definition(reader)); // // //{ EntityID = 1, AttID = reader.GetInt32(0) }; // // } // // if ((reader.GetInt32(nmUser) == 1) || (reader.GetInt32(0) == -1)) _store.Add(new PhaResultRow() { Content = reader.GetString(4), EntityID = 1, OrdNum = t++ }); // // } // //} // //catch // //{ // // return false; // //} // //return true; //} public override bool CheckPrerequisities(RoReporter reporter) { return(_phs.Attributies.Definitions != null); }
public override bool CheckPrerequisities(RoReporter reporter) { return(_CheckIf_TSysList_Exists(reporter)); }
public virtual bool CheckPrerequisities(RoReporter reporter) { return(true); }
public static IEnumerable <GrWAtt_Value> Parse(/*byte EntityID,*/ DBConnectionPool connection, IEnumerable <GrWAtt_Definition> defs, BlaDBVariantDefinition var, RoReporter reporter = null) { var attids = defs.Select(a => a.AttID).Distinct().ToArray(); if (attids.Length < 1) { return(Enumerable.Empty <GrWAtt_Value>()); } var zahada = string.Join(", ", attids); var cmd = new SqlCommand(string.Format(SQLCOMMAND_ATT, zahada), connection.Connection); var re = cmd.ExecuteReader(); reporter?.AddInfo("Odczyt definicji funkcji wydających atrybuty"); var rer = re.Cast <IDataRecord>(); var fields = rer.Select(r => new { id = r["LX7110"], proc = string.Format("[{0}].[{1}]", r["Schema"], r["NazwaFunkcji"]), procid = (int)r["LX7125"], pargtempl = (int)r["LX7121"], objectid = (string)r["ObjectID_NazwaPola"], attsrc = new GrWAtt_VSource(r) }).ToList(); rer = null; re = null; var fieldsByProcs = fields.GroupBy(q => q.procid).Select(q => { var pro = q.First(); reporter?.AddInfo($"Odczyt funkcji {pro.proc} ({pro.procid})"); return(new GruFuncOrStoredProcReader(connection, pro.procid, objIDField: pro.objectid, pargtempl: pro.pargtempl, procName: pro.proc, attsrcs: q.Select(w => w.attsrc))); }); return(fieldsByProcs.SelectMany(t => t.Ask(var))); //return Enumerable.Empty<GrWAtt_Value>(); }
public override bool CheckPrerequisities(RoReporter reporter) { return(_phs.DemFoundation.TSysList != null); }
public abstract bool CheckPrerequisities(RoReporter reporter);