示例#1
0
        private bool SaveSateOld(Dictionary <string, string> state)
        {
            if (_daoDb != null)
            {
                _daoDb.Execute("DELETE * FROM " + TableName);

                const string stringSql = "SELECT " + FieldPropName + ", " + FieldPropValue + " FROM " + TableName + ";";
                using (var rs = new RecDao(_daoDb, stringSql))
                {
                    foreach (var key in state.Keys)
                    {
                        if (key != null)
                        {
                            rs.AddNew();
                            rs.Put(FieldPropName, key);
                            rs.Put(FieldPropValue, state[key]);
                        }
                    }
                }

                return(true);
            }

            return(false);
        }
示例#2
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (GroupCode.Text.IsEmpty())
            {
                Different.MessageError("Не заполнено имя группы");
                return;
            }
            ChangeReportsRow();
            using (var db = new DaoDb(General.ReporterFile))
            {
                //Сохранение в ReporterData
                using (var rec = new RecDao(db, "SELECT * FROM GroupReports WHERE GroupId=" + _groupId))
                {
                    rec.Put("GroupCode", GroupCode.Text);
                    rec.Put("GroupName", GroupName.Text);
                    ((FormGroupReports)GeneralRep.CommonBook.Forms[ReporterCommand.GroupReports]).EditItem(rec, _groupId);
                }

                db.Execute("DELETE * FROM ReportsForGroup WHERE GroupId=" + _groupId);
                using (var rec = new RecDao(db, "ReportsForGroup"))
                    foreach (DataGridViewRow row in Reports.Rows)
                    {
                        if (!row.IsNewRow)
                        {
                            rec.AddNew();
                            rec.Put("GroupId", _groupId);
                            rec.PutFromDataGrid("Report", row);
                            rec.PutFromDataGrid("ReportName", row);
                            rec.PutFromDataGrid("ReportFile", row);
                            rec.PutFromDataGrid("ReportTag", row);
                        }
                    }
            }
            Close();
        }
示例#3
0
        //Запись мгновенного значения в ячейку
        private void WriteValue(Moment mom, RecDao rec, string field)
        {
            if (mom == null)
            {
                return;
            }
            switch (mom.DataType)
            {
            case DataType.Real:
                rec.Put(field, mom.Real);
                break;

            case DataType.Integer:
            case DataType.Boolean:
                rec.Put(field, mom.Integer);
                break;

            case DataType.String:
                rec.Put(field, mom.String);
                break;

            case DataType.Time:
                rec.Put(field, mom.Date);
                break;
            }
        }
示例#4
0
 //Запись в таблицы Params и SubParams, columns - список колонок таблицы Params
 public void ToParamsTables(RecDao recParams, RecDao recSub, IEnumerable <VedColumn> columns)
 {
     recParams.AddNew();
     foreach (var col in columns)
     {
         if (col.SourceType == ColumnSourceType.ResultValue && SubParams.ContainsKey(col.Code))
         {
             var m = SubParams[col.Code].LastMoment;
             if (m.DataType != DataType.Value)
             {
                 WriteValue(m, recParams, col.Code);
             }
         }
         else if (col.SourceType == ColumnSourceType.ParamChar || col.SourceType == ColumnSourceType.SignalChar)
         {
             WriteProp(col, recParams);
         }
     }
     _id = recParams.GetInt("IdParam");
     recParams.Update();
     foreach (var sub in SubParams.Keys)
     {
         recSub.AddNew();
         recSub.Put("IdParam", _id);
         recSub.Put("CodeSubParam", sub);
     }
 }
示例#5
0
        private static int CopyProp(RecDao cfgTemplate, RecDao cfg)
        {
            bool flag = !cfg.FindFirst("ParamName", cfgTemplate.GetString("ParamName"));

            //if (!cfg.FindFirst("ParamName", cfgTemplate.GetString("ParamName")))
            if (flag)
            {
                //    MessageBox.Show("Я не нашел запись в конфиге, о чем сейчас и сообщаю");
                //else MessageBox.Show("Я нашел запись в тимплейте. А вы чем занимаетесь?");
                cfg.AddNew();
            }
            cfg.Put("ParamName", cfgTemplate.GetString("ParamName"));
            cfg.Put("ParamType", cfgTemplate.GetString("ParamType"));
            cfg.Put("ParamValue", cfgTemplate.GetString("ParamValue"));
            cfg.Put("ParamDescription", cfgTemplate.GetString("ParamDescription"));
            cfg.Put("ParamTag", cfgTemplate.GetString("ParamTag"));
            int id = cfg.GetInt("ParamId");

            //MessageBox.Show(flag + " " + cfgTemplate.GetString("ParamName"));
            try
            {
                cfg.Update();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
            return(id);
        }
示例#6
0
 //Подготовка сигналов
 public void Prepare()
 {
     try
     {
         if (CloneFile.IsEmpty())
         {
             return;
         }
         Logger.AddEvent("Установка отметок для считываемых сигналов");
         _signalsId.Clear();
         _signalsStrId.Clear();
         using (var rec = new RecDao(CloneFile, "SELECT SignalId, FullCode, Otm FROM Signals"))
             while (rec.Read())
             {
                 string code = rec.GetString("FullCode");
                 if (!ProviderSignals.ContainsKey(code))
                 {
                     rec.Put("Otm", false);
                 }
                 else
                 {
                     rec.Put("Otm", true);
                     (ProviderSignals[code].DataType.LessOrEquals(DataType.Real) ? _signalsId : _signalsStrId)
                     .Add(rec.GetInt("SignalId"), ProviderSignals[code]);
                 }
             }
     }
     catch (Exception ex)
     {
         Logger.AddError("Ошибка при подготовке сигналов", ex);
     }
 }
示例#7
0
 private void ToClone(RecDao rec)
 {
     rec.AddNew();
     rec.Put("SignalId", IdInClone);
     rec.Put("Time", _time);
     rec.Put("Value", _val);
     rec.Put("Nd", _nd);
     rec.Update();
 }
示例#8
0
 //Сохранение в рекордсет файла данных отчета
 public void ToRecordset(RecDao rec, bool isAddNew)
 {
     if (isAddNew)
     {
         rec.AddNew();
     }
     rec.Put("Project", Code);
     rec.Put("ProjectCode2", Code2);
     rec.Put("ProjectName", Name);
     rec.Put("ProjectFile", File);
 }
示例#9
0
 //Записать в таблицу характеристику параметра или сигнала
 private void WriteProp(VedColumn col, RecDao rec)
 {
     if (col.Code == "Min" || col.Code == "Max")
     {
         string s = _props[col.Code];
         double?m = s == null ? (double?)null : s.ToDouble();
         rec.Put(col.Code, m);
     }
     else
     {
         rec.Put(col.Code, _props[col.Code]);
     }
 }
示例#10
0
 //Записывет данные в таблицу Projects в ControllerData, возвращает Id
 public int ToRecordset(RecDao rec, bool addnew = false)
 {
     if (addnew)
     {
         rec.AddNew();
     }
     rec.Put("ThreadId", ThreadCalc.Id);
     rec.Put("Project", Code);
     rec.Put("ProjectFile", File);
     rec.Put("Otm", Otm);
     Id = rec.GetInt("ProjectId");
     return(Id);
 }
示例#11
0
        //Чтение списка сигналов из клона
        private void PrepareForClone(string cloneFile)
        {
            try
            {
                AddEvent("Чтение свойств клона");
                if (!DaoDb.Check(cloneFile, new[] { "Objects", "Signals", "MomentsValues" }))
                {
                    AddError("Недопустимый файл клона");
                }
                else
                {
                    using (var db = new DaoDb(cloneFile))
                    {
                        using (var sys = new SysTabl(db))
                        {
                            if (_form != null)
                            {
                                _form.CalcName.Text = sys.Value("CloneDescription");
                            }
                            _cloneInf = sys.Value("CloneInf");
                            RunSource(sys.SubValue("Source", "ProviderCode"), sys.SubValue("Source", "ProviderName"), sys.SubValue("Source", "ProviderInf"));
                        }

                        AddEvent("Чтение списка сигналов клона");
                        _source.ClearSignals();
                        int n = 0;
                        using (var rec = new RecDao(db, "SELECT SignalId, FullCode, DataType, Inf FROM Signals WHERE ConstValue Is Null"))
                            while (rec.Read())
                            {
                                _source.AddSignal(rec.GetString("Inf"), rec.GetString("FullCode"), rec.GetString("DataType").ToDataType(), rec.GetInt("SignalId"));
                                n++;
                            }
                        AddEvent("Сигналы клона прочитаны", n + " сигналов");

                        //db.Execute("DELETE * FROM MomentsValues");
                        //db.Execute("DELETE * FROM Intervals");
                        using (var rec = new RecDao(db, "Intervals"))
                        {
                            rec.AddNew();
                            rec.Put("TimeBegin", _timeBegin);
                            rec.Put("TimeEnd", _timeEnd);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AddError("Ошибка при подготовке клона", ex);
            }
        }
示例#12
0
        //Генерация по одной строке таблицы
        public override void Generate(SubRows row)
        {
            _paramsRec.AddNew();
            GenerateBase(row, _paramsRec);
            _paramsRec.Put("Task", _task.GetText(row));
            _paramsRec.Put("CalcParamType", _calcParamType.GetText(row));
            _paramsRec.Put("DefaultValue", _defaultValue.GetText(row));
            int id = _paramsRec.GetInt("CalcParamId");

            _paramsRec.Update();
            foreach (var sp in SubParams)
            {
                sp.GenerateParams(row, SubParamsRec, id);
            }
        }
示例#13
0
 public GenSubParam(RecDao rec, ParsingCondition parsingCondition, ParsingGenerator parsingGenerator)
     : base(rec, parsingCondition, parsingGenerator)
 {
     MakeCondition(rec);
     OwnerId = rec.GetInt("OwnerId");
     rec.Put("ErrMess", ErrMess);
 }
示例#14
0
        //Отметка используемых провайдеров и ручного ввода
        private void SaveUsedProviders()
        {
            try
            {
                using (var db = new DaoDb(_projectFile))
                {
                    using (var rec = new RecDao(db, "Providers"))
                        while (rec.Read())
                        {
                            switch (rec.GetString("ProviderType").ToProviderType())
                            {
                            case ProviderType.Communicator:
                                rec.Put("IsUsed", true);
                                break;

                            case ProviderType.Source:
                            case ProviderType.Receiver:
                                rec.Put("IsUsed", UsedProviders.Contains(rec.GetString("ProviderName")));
                                break;

                            case ProviderType.Archive:
                                rec.Put("IsUsed", UsedProviders.Contains("Archive"));
                                break;
                            }
                        }

                    using (var sys = new SysTabl(db))
                    {
                        sys.PutSubValue("ArchiveOptions", "IsAbsolute", IsAbsolute ? "True" : "False");
                        sys.PutSubValue("ArchiveOptions", "IsPeriodic", IsPeriodic ? "True" : "False");
                        sys.PutSubValue("ArchiveOptions", "IsMoments", IsMoments ? "True" : "False");
                        sys.PutSubValue("ArchiveOptions", "IsPrevAbs", IsPrevAbs ? "True" : "False");
                        sys.PutSubValue("ArchiveOptions", "IsLastBase", IsLastBase ? "True" : "False");
                        sys.PutSubValue("ArchiveOptions", "IsLastHour", IsLastHour ? "True" : "False");
                        sys.PutSubValue("ArchiveOptions", "IsLastDay", IsLastDay ? "True" : "False");
                        sys.PutSubValue("ArchiveOptions", "IsManyBase", IsManyBase ? "True" : "False");
                        sys.PutSubValue("ArchiveOptions", "IsManyHour", IsManyHour ? "True" : "False");
                        sys.PutSubValue("ArchiveOptions", "IsManyDay", IsManyDay ? "True" : "False");
                        sys.PutSubValue("ArchiveOptions", "IsManyMoments", IsManyMoments ? "True" : "False");
                    }
                }
            }
            catch (Exception ex)
            {
                AddError("Ошибка сохранения признаков использования провайдеров и ручного ввода", ex);
            }
        }
示例#15
0
        public bool SaveSate(Dictionary <string, object> state)
        {
            if (_daoDb != null)
            {
                _daoDb.Execute("DELETE * FROM " + SubTableName);
                _daoDb.Execute("DELETE * FROM " + MainTableName);

                string stringSql = "SELECT * FROM " + MainTableName + ";";
                using (var rsMain = new RecDao(_daoDb, stringSql))
                {
                    stringSql = "SELECT * FROM " + SubTableName + ";";
                    using (var rsSub = new RecDao(_daoDb, stringSql))
                    {
                        foreach (var propKey in state.Keys)
                        {
                            int id;
                            int num = 0;

                            foreach (var propState in (List <Dictionary <string, string> >)state[propKey])
                            {
                                rsMain.AddNew();
                                rsMain.Put(FieldPropType, propKey);
                                rsMain.Put(FieldPropName, ++num);

                                rsMain.Update();
                                rsMain.MoveLast();
                                id = rsMain.GetInt("Id");

                                foreach (var subProp in propState.Keys)
                                {
                                    rsSub.AddNew();
                                    rsSub.Put(FieldPropId, id);
                                    rsSub.Put(FieldSubPropName, subProp);
                                    rsSub.Put(FieldSubPropValue, propState[subProp]);
                                }
                            }
                        }
                    }
                }

                return(true);
            }

            return(false);
        }
示例#16
0
 //Запись мгновенного значения в DebugValues
 private static void MomToRec(Moment mv, RecDao recv, int id)
 {
     if (mv == null)
     {
         return;
     }
     recv.AddNew();
     recv.Put("DebugParamId", id);
     if (mv.DataType == DataType.Time)
     {
         recv.Put("StrValue", mv.Date.ToStringWithMs());
     }
     else
     {
         if (mv.DataType == DataType.String)
         {
             recv.Put("StrValue", mv.String);
         }
         else
         {
             recv.Put("Value", mv.Real);
         }
     }
     recv.Put("Time", mv.Time);
     recv.Put("Nd", mv.Nd);
     if (mv.Error != null)
     {
         recv.Put("ErrMess", mv.Error.ToString(), true);
     }
     recv.Update();
 }
示例#17
0
        //Формирование списка параметров для записи в архив и запись их в CalcParamsArchive
        private void SaveArchive()
        {
            try
            {
                using (var db = new DaoDb(_projectFile))
                {
                    foreach (var cp in CalcParamsId.Values)
                    {
                        if (cp.Inputs.Count == 0 && cp.CalcOn && cp.ErrMess == "")
                        {
                            new ParamArchive(cp);
                        }
                    }

                    var old = new SetS();
                    var add = new SetS();
                    using (var rec = new RecDao(db, "CalcParamsArchive", RecordsetTypeEnum.dbOpenTable))
                        while (rec.Read())
                        {
                            var code = rec.GetString("FullCode");
                            if (ArchiveParams.ContainsKey(code))
                            {
                                old.Add(code);
                            }
                            else
                            {
                                rec.Put("Del", true);
                            }
                        }
                    db.Execute("DELETE * FROM CalcParamsArchive WHERE Del=True");

                    foreach (var ap in ArchiveParams.Keys)
                    {
                        if (!old.Contains(ap))
                        {
                            add.Add(ap);
                        }
                    }
                    using (var rec = new RecDao(db, "CalcParamsArchive", RecordsetTypeEnum.dbOpenTable))
                    {
                        while (rec.Read())
                        {
                            ArchiveParams[rec.GetString("FullCode")].ToRecordset(rec, false);
                        }
                        foreach (var p in add.Keys)
                        {
                            ArchiveParams[p].ToRecordset(rec, true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AddError("Ошибка сохранения архивных параметров", ex);
            }
        }
示例#18
0
 public GenParam(RecDao rec, ParsingCondition parsingCondition, ParsingGenerator parsingGenerator)
     : base(rec, parsingCondition, parsingGenerator)
 {
     MakeCondition(rec);
     _task          = MakeField(rec, "Task");
     _calcParamType = MakeField(rec, "CalcParamType");
     _defaultValue  = MakeField(rec, "DefaultValue");
     CalcParamId    = rec.GetInt("CalcParamId");
     rec.Put("ErrMess", ErrMess);
 }
示例#19
0
        //Запись SingleValue в DebugParams и DebugValues, возвращает записываемую ошибку, adderr - для записи сообщения об ошибке в подпараметрах
        public void ValuesToRec(string realCode, string debugType, int paramId, Dictionary <string, string> variables, SingleValue sv, string adderr = "")
        {
            if (sv == null)
            {
                return;
            }
            _rec.AddNew();
            _rec.Put("ProjectProvider", _projectProvider);
            _rec.Put("Code", realCode);
            _rec.Put("ResultType", sv.DataType.ToRussian());
            _rec.Put("DebugParamType", debugType);
            _rec.Put("ParamId", paramId);
            if (variables != null)
            {
                _rec.Put("Variables", variables.ToPropertyString());
            }
            var err = sv.LastError;

            if (err.IsEmpty())
            {
                err = adderr;
            }
            else
            {
                err += "; " + adderr;
            }
            _rec.Put("ErrMess", err, true);
            _rec.Put("Value", SvToStr(sv));
            _rec.Put("MomentsCount", sv.Type == SingleType.Moment ? 1 : (sv.Moments == null ? 0 : sv.Moments.Count));
            int id = _rec.GetInt("DebugParamId");

            _rec.Update();
            if (_thread.IsSaveValues)
            {
                if (sv.Type == SingleType.Moment)
                {
                    MomToRec(sv.Moment, _recv, id);
                }
                if (sv.Type == SingleType.List && sv.Moments != null)
                {
                    foreach (var mv in sv.Moments)
                    {
                        MomToRec(mv, _recv, id);
                    }
                }
            }
        }
示例#20
0
 //Записывает в рекордсет PrevParams
 public void ToRecordset(RecDao rec, bool addnew)
 {
     if (Id != 0)
     {
         if (addnew)
         {
             rec.AddNew();
         }
         rec.Put("ArchiveParamId", Id);
         rec.Put("FullCode", Code);
         rec.Put("PrevAbs", PrevAbs);
         rec.Put("LastBase", LastBase);
         rec.Put("LastHour", LastHour);
         rec.Put("LastDay", LastDay);
         rec.Put("ManyBase", ManyBase);
         rec.Put("ManyHour", ManyHour);
         rec.Put("ManyDay", ManyDay);
         rec.Put("ManyMoments", ManyMoments);
     }
 }
示例#21
0
 //Записывает параметр в таблицу
 public void ToRecordset(RecDao rec, bool addnew)
 {
     try
     {
         if (addnew)
         {
             rec.AddNew();
         }
         rec.Put("CalcParamId", FirstParam.CalcParamId);
         bool b = FirstParam != LastParam;
         if (b)
         {
             rec.Put("CalcSubParamId", LastParam.CalcParamId);
         }
         var par = LastParam ?? FirstParam;
         rec.Put("SuperProcessType", par.SuperProcess.ToRussian());
         var dt = par.CalcType.DataType.AplySuperProcess(par.SuperProcess);
         rec.Put("DataType", dt.ToRussian());
         if (dt == DataType.Integer || dt == DataType.Real)
         {
             rec.Put("Units", par.Units.IsEmpty() ? FirstParam.Units : par.Units);
             rec.Put("Min", par.Min ?? FirstParam.Min);
             rec.Put("Max", par.Max ?? FirstParam.Max);
         }
         if (dt == DataType.Real)
         {
             rec.Put("DecPlaces", par.DecPlaces ?? FirstParam.DecPlaces);
         }
         if (FirstParam.Tablik.Prevs.ContainsKey(FullCode))
         {
             FirstParam.Tablik.Prevs[FullCode].Id = rec.GetInt("Id");
         }
         rec.Put("FullCode", FullCode);
         rec.Update();
     }
     catch {}
     //catch//Повтор архивных параметров
     //{
     //    using ( var recc = new RecDao(FirstParam.Tablik.ProjectFile, "SELECT CalcParams.ErrMess FROM CalcParams WHERE CalcParamId=" + FirstParam.CalcParamId))
     //    {
     //        if (recc.GetString("ErrMess").IsEmpty()) FirstParam.Tablik.ErrorsCount++;
     //        recc.Put("ErrMess", "По данному параметру формируется два архивных параметра с одинаковым кодом (" + FullCode + ")");
     //    }
     //}
 }
示例#22
0
 private void butAddThread_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (var rec = new RecDao(General.ControllerFile, "Threads"))
         {
             rec.AddNew();
             rec.Put("ApplicationType", ApplicationType.Controller.ToEnglish());
             rec.Put("IsPeriodic", true);
             var d = DateTime.Now.ToString();
             rec.Put("TimeAdd", d);
             rec.Put("TimeChange", d);
             rec.Update();
             rec.MoveLast();
             App.AddThread(rec);
         }
     }
     catch (Exception ex)
     {
         ex.MessageError("Ошибка создания потока");
     }
 }
示例#23
0
        //Сохранение данных после настройки
        public void SaveSetup()
        {
            try
            {
                AddEvent("Сохранение настроек");
                using (var db = new DaoDb(General.ControllerFile))
                {
                    using (var rec = new RecDao(db, "SELECT * FROM Threads WHERE ThreadId=" + Id))
                    {
                        rec.Put("Comment", Comment);
                        rec.Put("IsPeriodic", IsPeriodic);
                        rec.Put("PeriodLength", PeriodLength);
                        rec.Put("SourcesLate", SourcesLate);
                        rec.Put("RushWaitingTime", RushWaitingTime);
                        rec.Put("TimeAfterError", TimeAfterError);
                        rec.Put("TimeChange", DateTime.Now.ToString());
                        rec.Put("IsImit", IsImit);
                        rec.Put("ImitMode", ImitModeStr);
                    }

                    db.Execute("DELETE * FROM Projects WHERE ThreadId=" + Id);
                    using (var rec = new RecDao(db, "Projects"))
                        foreach (var pr in Projects.Values)
                        {
                            pr.ToRecordset(rec, true);
                        }

                    db.Execute("DELETE * FROM Providers WHERE ThreadId=" + Id);
                    using (var rec = new RecDao(db, "Providers"))
                        foreach (var p in ProvidersDic.Values)
                        {
                            p.ToRecordset(rec, true);
                        }
                }
            }
            catch (Exception ex)
            {
                AddError("Ошибка при сохранении настроек", ex);
                Different.MessageError("Ошибка при сохранении настроек");
            }
            Finish();//Setup
            StartAtom(Atom.ReadSetup, ReadSetup);
            State = State.Stopped;
        }
示例#24
0
 private void ButAdd_Click(object sender, EventArgs e)
 {
     using (var rec = new RecDao(General.ReporterFile, "GroupReports"))
     {
         rec.AddNew();
         rec.Put("GroupCode", "NewGroupReport");
         GroupReports.SelectedItems.Clear();
         var item = EditItem(rec);
         item.Selected = true;
         rec.Update();
         var f = (FormGroupReportEdit)GeneralRep.RunReporterCommand(ReporterCommand.GroupReportEdit);
         f.LoadGroup((int)item.Tag);
     }
 }
示例#25
0
        //Запись значений по параметру и подпараметрам в линейную ведомость, columns - список колонок таблицы LinVed
        public void ToLinVed(RecDao rec, DicS <VedColumn> columns)
        {
            if (_param.RunParam.CalcValue == null || _param.RunParam.CalcValue.SingleValue == null)
            {
                return;
            }
            var par  = _param.RunParam.CalcValue.SingleValue.ToMomList();
            var subs = new List <VedMomList>();

            foreach (var col in columns.Values)
            {
                if (SubParams.ContainsKey(col.Code))
                {
                    subs.Add(new VedMomList(col.Code, SubParams[col.Code]));
                }
            }
            foreach (var mom in par)
            {
                rec.AddNew();
                rec.Put("IdParam", _id);
                rec.Put("TimeValue", mom.Time);
                rec.Put("TimeString", mom.Time.ToStringWithMs());
                if (mom.DataType.LessOrEquals(DataType.Real))
                {
                    if (columns.ContainsKey("ValueReal"))
                    {
                        rec.Put("ValueReal", mom.Real);
                    }
                }
                else if (columns.ContainsKey("ValueString"))
                {
                    rec.Put("ValueString", mom.String);
                }
                if (rec.ContainsField("Nd"))
                {
                    rec.Put("Nd", mom.Nd);
                }
                if (rec.ContainsField("ErrorString"))
                {
                    rec.Put("ErrorString", mom.Error.Text);
                }
                foreach (var sub in subs)
                {
                    WriteValue(sub.ChangeMoment(mom.Time), rec, sub.Code);
                }
                //foreach (var col in _vedSaver.ColumnsParams.Values)
                //    if (col.LinVedView != VedView.None)
                //        WriteProp(col, rec);
                rec.Update();
            }
        }
示例#26
0
 public void ToRecordset(RecDao rec)
 {
     rec.AddNew();
     rec.Put("Id", Id);
     rec.Put("Description", Description);
     rec.Put("Params", Params);
     rec.Put("Time", DateTime.Parse(Time));
     rec.Put("Command", _command);
     rec.Put("Context", _context);
     if (_periodBegin != null)
     {
         rec.Put("PeriodBegin", _periodBegin);
     }
     if (_periodEnd != null)
     {
         rec.Put("PeriodEnd", _periodEnd);
     }
     rec.Update();
 }
示例#27
0
 private static void CopySubProp(int tid, DaoDb tdb, int id, DaoDb db)
 {
     using (var rec = new RecDao(tdb, "SELECT * FROM SysSubTabl WHERE ParamId=" + tid))
     {
         db.Execute("DELETE * FROM SysSubTabl WHERE ParamId=" + id);
         using (var res = new RecDao(db, "SELECT * FROM SysSubTabl WHERE ParamId=" + id))
             while (rec.Read())
             {
                 res.AddNew();
                 res.Put("ParamId", id);
                 res.Put("SubParamNum", rec.GetInt("SubParamNum"));
                 res.Put("SubParamType", rec.GetString("SubParamType"));
                 res.Put("SubParamName", rec.GetString("SubParamName"));
                 res.Put("SubParamValue", rec.GetString("SubParamValue"));
                 res.Put("SubParamDescription", rec.GetString("SubParamDescription"));
                 res.Put("SubParamTag", rec.GetString("SubParamTag"));
                 res.Put("SubParamRowSource", rec.GetString("SubParamRowSource"));
             }
     }
 }
示例#28
0
 public void ToRecordset(RecDao rec, bool addnew = false)
 {
     if (addnew)
     {
         rec.AddNew();
     }
     rec.Put("ThreadId", ThreadCalc.Id);
     rec.Put("ProviderType", Type);
     rec.Put("ProviderName", Name);
     rec.Put("ProviderCode", Code);
     rec.Put("ProviderInf", Inf);
     rec.Put("Otm", Otm);
 }
示例#29
0
 //Чтение данных из клона
 private void GetCloneValues()
 {
     if (!IsConnected && !Connect())
     {
         return;
     }
     try
     {
         using (var db = new DaoDb(DatabaseFile))
         {
             db.Execute("DELETE * FROM SignalsForRead");
             Logger.Procent = 10;
             using (var rs = new RecDao(db, "SignalsForRead"))
                 foreach (int id in _objectsId.Keys)
                 {
                     rs.AddNew();
                     rs.Put("Id", id);
                 }
         }
         Logger.Procent = 20;
         int      n   = ParamsWithCut();
         DateTime beg = n == 0 ? _begin : _begin.AddHours(-1);
         Logger.AddEvent("Получение значений", _objectsId.Count + " сигналов, " + n + " без среза, время: " + beg + " - " + _end);
         var stSql = "SELECT SignalsForRead.Id AS ID, TIMESTAMP, TIME_NSEC, F_VALUE, RAW_VALUE, STS " + "FROM PT_HF_HIST INNER JOIN SignalsForRead ON PT_HF_HIST.ID = SignalsForRead.Id "
                     + "WHERE (TIMESTAMP >= " + beg.ToAccessString() + ") AND (TIMESTAMP < " + _end.ToAccessString() + ") " + "ORDER BY TIMESTAMP, TIME_NSEC";
         using (var rec = new ReaderAdo(DatabaseFile, stSql))
         {
             Logger.Procent = 40;
             Logger.AddEvent("Распределение значений по сигналам");
             var m = ReadValuesList(rec, _objectsId.Values);
             Logger.AddEvent("Значения прочитаны", m + " значений, " + _objectsId.Count + " сигналов");
         }
     }
     catch (Exception ex)
     {
         AddError("Ошибка при чтении клона архива", ex);
         IsConnected = false;
     }
 }
示例#30
0
 //Запись в рекордсет ведомости
 public void ToRecordset(RecDao rec)
 {
     rec.AddNew();
     rec.Put("ColumnId", _id);
     rec.Put("Otm", _otm);
     rec.Put("ColumnNum", _num);
     rec.Put("DataSourceType", SourceTypeToString(SourceType));
     rec.Put("DataSourceCode", Code);
     rec.Put("Caption", _caption);
     rec.Put("DataType", DataType.ToRussian());
     rec.Put("LinVedView", VedViewToString(LinVedView));
     rec.Put("KrestVedView", VedViewToString(_krestVedView));
     rec.Put("GroupVedView", VedViewToString(GroupVedView));
     rec.Put("GraphicView", _graphicView);
     rec.Put("Format", _format);
     rec.Put("DecimalPlaces", _decimalPlaces);
     rec.Put("TextAlign", _textAlign);
     rec.Put("ColumnWidth", _columnWidth);
     rec.Put("ReportColumnWidth", _reportColumnWidth);
     rec.Put("ColumnOrder", _columnOrder);
 }