Example #1
0
        private void addButton_Click(object sender, EventArgs e)
        {
            DataTable table = new DataTable();
            getDatabase().fillWithLatestStockQuotes(table);
            NewCycleForm n = new NewCycleForm();
            Database.StockCycleInfo info = new Database.StockCycleInfo();
            info.quotes = table;
            n.info = info;

            if (n.ShowDialog() == DialogResult.OK)
            {
                getDatabase().newCycle(n.info);
                cycleList.Retrieve();
            }
        }
        void Retrieve()
        {
            if (getDatabase() == null)
                return;

            DataTable table = new DataTable();
            now = getDatabase().now();
            getDatabase().fillWithCycleInfoAndQuotes(1, table);
            info = new Database.StockCycleInfo();

            foreach (DataRow row in table.Rows)
            {
                info.start = Convert.ToDateTime(row["START_TIME"]);
                info.border1 = Convert.ToDateTime(row["BORDER1_TIME"]);
                info.border2 = Convert.ToDateTime(row["BORDER2_TIME"]);
                info.finish = Convert.ToDateTime(row["FINISH_TIME"]);
            }

            untilBorder1 = info.border1 - now;
            untilBorder2 = info.border2 - now;
            untilFinish = info.finish - now;
        }
Example #3
0
        private void editButton_Click(object sender, EventArgs e)
        {
            UInt64 cycleId = cycleList.getCurrentCycleId();
            if (cycleId == 0)
            {
                MessageBox.Show("Нечего редактировать");
                return;
            }

            DataTable table = new DataTable();
            getDatabase().fillWithQuotesForCycle(cycleId, table);

            Database.StockCycleInfo info = new Database.StockCycleInfo();
            info.quotes = table;
            info.id = cycleId;
            info.start = Convert.ToDateTime(cycleList.SelectedRows[0].Cells["START_TIME"].Value);
            info.border1 = Convert.ToDateTime(cycleList.SelectedRows[0].Cells["BORDER1_TIME"].Value);
            info.border2 = Convert.ToDateTime(cycleList.SelectedRows[0].Cells["BORDER2_TIME"].Value);
            info.finish = Convert.ToDateTime(cycleList.SelectedRows[0].Cells["FINISH_TIME"].Value);

            NewCycleForm n = new NewCycleForm();
            n.info = info;

            if (n.ShowDialog() == DialogResult.OK)
            {
                getDatabase().editCycle(info);
                cycleList.Retrieve();
            }
        }