//Запись значения подпараметра в SysSubTabl public void PutSubValue(string param, string subparam, string value, string tag = null) { _sub.FindFirst("(ParamName='" + param + "') And (SubParamName='" + subparam + "')"); _sub.Put("SubParamValue", value); if (tag != null) { _sub.Put("SubParamTag", tag); } _sub.Update(); }
//Запись значения параметра в SysTabl public void PutValue(string param, string value, string tag = null) { _tabl.FindFirst("ParamName", param); _tabl.Put("ParamValue", value); if (tag != null) { _tabl.Put("ParamTag", tag); } _tabl.Update(); }
//Запись Tag параметра в SysTabl public static void PutTagS(string file, string param, string tag, string value = null) { string stSql = "SELECT SysTabl.ParamValue, SysTabl.ParamTag FROM SysTabl WHERE (SysTabl.ParamName='" + param + "')"; using (var rec = new DaoRec(file, stSql)) { rec.Put("ParamTag", tag); if (value != null) { rec.Put("ParamValue", value); } rec.Update(); } }
//Запись Tag подпараметра в SysSubTabl public static void PutSubTagS(string file, string param, string subparam, string tag, string value = null) { string stSql = "SELECT SysSubTabl.SubParamValue, SysSubTabl.SubParamTag FROM SysTabl INNER JOIN SysSubTabl ON SysTabl.ParamId = SysSubTabl.ParamId " + " WHERE (SysTabl.ParamName='" + param + "') AND (SysSubTabl.SubParamName='" + subparam + "')"; using (var rec = new DaoRec(file, stSql, RecordsetTypeEnum.dbOpenDynaset)) { rec.Put("SubParamTag", tag); if (value != null) { rec.Put("SubParamValue", value); } rec.Update(); } }
public void WriteStart(LogCommand command) { LogEventTime = DateTime.Now; RunHistoryOperation(_history, () => { _history.AddNew(); if (ProgressCommand != null) { _history.Put("SuperHistoryId", _superHistoryId); } _history.Put("Command", command.Name); _history.Put("Params", command.Params); _history.Put("Status", command.Status); _history.Put("Time", command.StartTime); _history.Put("Context", command.Context, true); _historyId = _history.GetInt("HistoryId"); }); }
//То же самое, но база данных не задается public void SaveDicToTable <T>(DicS <T> dic, string tabl, string keyField = "Code", string keyField2 = "", string delField = "Del") where T : ISaveToRecDao { var old = new SetS(); var add = new SetS(); using (var rec = new DaoRec(this, tabl, RecordsetTypeEnum.dbOpenTable)) while (rec.Read()) { var code = rec.GetString(keyField); if (!keyField2.IsEmpty()) { code += "." + rec.GetString(keyField2); } if (dic.ContainsKey(code)) { old.Add(code); } else { rec.Put(delField, true); } } Execute("DELETE * FROM " + tabl + " WHERE " + delField + "=True"); foreach (var ap in dic.Keys) { if (!old.Contains(ap)) { add.Add(ap); } } using (var rec = new DaoRec(this, tabl, RecordsetTypeEnum.dbOpenTable)) { while (rec.Read()) { dic[rec.GetString(keyField) + (keyField2.IsEmpty() ? "" : ("." + rec.GetString(keyField2)))].ToRecordset(rec, false); } foreach (var p in add.Keys) { dic[p].ToRecordset(rec, true); } } }
public void WriteErrorToList(CommandError error) { RunHistoryOperation(_errorsRec, () => { _errorsRec.AddNew(); _errorsRec.Put("Status", error.Quality.ToRussian()); _errorsRec.Put("Description", error.Text); _errorsRec.Put("Params", error.ToLog()); _errorsRec.Put("Time", DateTime.Now); if (LogCommand != null) { _errorsRec.Put("Command", LogCommand.Name); _errorsRec.Put("Context", LogCommand.Context); } if (Logger.PeriodCommand != null && ProgressCommand != null) { _errorsRec.Put("PeriodBegin", Logger.PeriodBegin); _errorsRec.Put("PeriodEnd", Logger.PeriodEnd); } }); }
public void WriteEvent(string description, string pars) { RunHistoryOperation(_subHistory, () => { _subHistory.AddNew(); _subHistory.Put("Description", description); _subHistory.Put("Params", pars); _subHistory.Put("Time", DateTime.Now); _subHistory.Put("HistoryId", _historyId); _subHistory.Put("FromStart", FromEvent); LogEventTime = DateTime.Now; }); }
public void WriteStartSuper(ProgressCommand command) { RunHistoryOperation(_superHistory, () => { _superHistory.AddNew(); _superHistory.Put("Command", command.Name); _superHistory.Put("Params", command.Params); _superHistory.Put("Context", command.Context, true); if (Logger.PeriodCommand != null) { _superHistory.Put("PeriodBegin", Logger.PeriodBegin); _superHistory.Put("PeriodEnd", Logger.PeriodEnd); _superHistory.Put("PeriodMode", Logger.PeriodMode); } _superHistory.Put("Status", command.Status); _superHistory.Put("Time", command.StartTime); _superHistoryId = _superHistory.GetInt("SuperHistoryId"); }); }