Ejemplo n.º 1
0
 //Сохранение спписка ошибок
 public void CloseErrorsList()
 {
     if (GridErrorsCount != GridErrors.Count)
     {
         ErrorsRec.Dispose();
         HistoryDb.Execute("DELETE * FROM ErrorsList");
         ErrorsRec = new RecDao(HistoryDb, "SELECT * FROM ErrorsList ORDER BY Id");
         foreach (var ge in GridErrors)
         {
             ge.ToRecordset(ErrorsRec);
         }
         ErrorsRec.MoveLast();
     }
     State = State.Stopped;
 }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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("Ошибка создания потока");
     }
 }