Esempio n. 1
0
        // Клиенты
        public Boolean FillClientData()
        {
            AppJournal.Write("DataManager", "Trying open client table");

            tableSettlPair         = new DSSERVERLib.Online();
            clientData             = new ObservableCollection <SettlPair>();
            tableSettlPair.AddRow += TableClientsAddRow;

            lastAddRowTime = DateTime.Now.AddDays(1);

            try
            {
                connectionType = tableSettlPair.Open(DSSERVERLib.ConnectionType.RTSONL_DYNAMIC, "SettlPair", "id, firm_name, settl_pair", "id", null, null, DSSERVERLib.Sort.RTSONL_SORT_EMPTY);
            }
            catch (Exception ex)
            {
                AppJournal.Write("DataManager", "Opening table err: " + ex.ToString());
                MessageBox.Show("Ошибка доступа к таблице Workstation!");
            }

            if (connectionType == 0)
            {
                return(false);
            }
            else
            {
                LoadTimeManagement();
                return(true);
            }
        }
Esempio n. 2
0
        void TableQuotesAddRow(int IDConnect, int IDRecord, object Fields)
        {
            IList collection = (IList)Fields;

            decimal rez;

            decimal.TryParse(collection[1].ToString(), NumberStyles.Any, new CultureInfo("en-US"), out rez);

            AppJournal.WriteServerLogs("ServerResponse", string.Format("Firm: {0}, price: {1}, lot: {2}, serverTime: {3}, curTime: {4}", collection[3].ToString(), rez.ToString(), collection[0].ToString(), collection[2].ToString(), DateTime.Now.ToString("dd.MM.yyyy hh:mm:ss:fff")));
        }
Esempio n. 3
0
 public void CheckSerial()
 {
     if (CheckConnection(0) != 0)
     {
         if (Execute("select * from robots where serial='" + App.hddSerialNumber + "'").Tables[0].Rows.Count == 0)
         {
             AppJournal.Write("DataBaseManager", "Record about SN not exist in DB");
             MessageBox.Show("Подключение не легально.\nДанного ключа программы нет в базе.", "Предупреждение правообладателя", MessageBoxButton.OK, MessageBoxImage.Warning);
             Environment.Exit(0);
         }
     }
 }
Esempio n. 4
0
        // Добавление режимов
        public void MakeModes()
        {
            AppJournal.Write("DataManager", "Make modes");

            modeData = new ObservableCollection <Mode>();

            modeData.Add(new Mode {
                type = "Конкурирующий"
            });
            modeData.Add(new Mode {
                type = "Поточный"
            });
            modeData.Add(new Mode {
                type = "Разовый"
            });
        }
Esempio n. 5
0
        protected int FirmsOpen()
        {
            AppJournal.Write("DataManager", "Trying open firm table");

            tableFirms         = new DSSERVERLib.Online();
            firmData           = new ObservableCollection <Firm>();
            tableFirms.AddRow += TableFirmsAddRows;

            try {
                connectionType = tableFirms.Open(DSSERVERLib.ConnectionType.RTSONL_DYNAMIC, "Firm", "id, name", "name", null, null, DSSERVERLib.Sort.RTSONL_FORWARD);
            } catch (Exception ex) {
                AppJournal.Write("DataManager", "Opening table err: " + ex.ToString());
                MessageBox.Show("Ошибка доступа к таблице клиентов!");
            }

            return(connectionType);
        }
Esempio n. 6
0
        public void FillQuotesData()
        {
            AppJournal.Write("Order", "Trying open quotes table");

            DSSERVERLib.Online tableQuotes;

            tableQuotes         = new DSSERVERLib.Online();
            tableQuotes.AddRow += TableQuotesAddRow;

            try
            {
                tableQuotes.Open(DSSERVERLib.ConnectionType.RTSONL_DYNAMIC, "Quote", "issue_name, price, moment, firm_name", "id", null, null, DSSERVERLib.Sort.RTSONL_SORT_EMPTY);
            }
            catch (Exception ex)
            {
                AppJournal.Write("Order", "Opening table err: " + ex.ToString());
                MessageBox.Show("Ошибка доступа к таблице котировок!");
            }
        }
Esempio n. 7
0
        public int IssuesOpen()
        {
            AppJournal.Write("DataManager", "Trying open issue table");

            tableIssues         = new DSSERVERLib.Online();
            issueData           = new ObservableCollection <Issue>();
            tableIssues.AddRow += TableIssuesAddRow;

            try
            {
                connectionType = tableIssues.Open(DSSERVERLib.ConnectionType.RTSONL_DYNAMIC, "Issue", "id, name, nominal", "id", null, null, DSSERVERLib.Sort.RTSONL_BACKWARD);
            }
            catch (Exception ex)
            {
                AppJournal.Write("DataManager", "Open table err: " + ex.ToString());
                MessageBox.Show("Ошибка доступа к таблице инструментов!");
            }

            return(connectionType);
        }
Esempio n. 8
0
        private DataSet Execute(String queryStr)
        {
            if (mySqlConn.State != ConnectionState.Open)
            {
                connectionStatus = CheckConnection(1);
            }

            if (connectionStatus != 0)
            {
                sqlAdapter.SelectCommand = new MySqlCommand(queryStr, mySqlConn);

                try {
                    sqlAdapter.Fill(dataSet);
                    return(dataSet);
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                    AppJournal.Write("DataBaseManager", "Get data from db query err: " + ex.ToString());
                }
            }
            return(null);
        }
Esempio n. 9
0
        private int CheckConnection(int trying)
        {
            mySqlConn = new MySqlConnection(connectionStr);

            try {
                mySqlConn.Open();
            } catch (Exception ex) {
                AppJournal.Write("DataBaseManager", "Connect to DB err: " + ex.ToString());
                MessageBox.Show("Нет доступа к базе", "Предупреждение правообладателя", MessageBoxButton.OK, MessageBoxImage.Warning);
                if (trying == 0)
                {
                    Environment.Exit(0);
                }
                else
                {
                    return(0);
                }
            }
            connectionStatus = 1;

            return(connectionStatus);
        }