Esempio n. 1
0
        public Form2()
        {
            InitializeComponent();

            DataGridViewRow[] rows = new DataGridViewRow[5];

            for (int i = 0; i < rows.Count(); i++)
            {
                DataGridViewButtonCell but = new DataGridViewButtonCell();
                but.Value = "取消";
                int comm         = 9900 + i * 50;
                int callPos      = 1 + i;
                int putPos       = 1 + i;
                int callDeal     = 50 + i * 10;
                int putDeal      = 100 - i * 10;
                int priThru      = 3;
                int stopLossBase = 10;
                int stopLossTurn = 3;
                int stopLossOut  = 9;

                rows[i] = new DataGridViewRow();
                rows[i].CreateCells(this.ezDataGridView1, comm, callPos, putPos, callDeal, putDeal,
                                    stopLossBase, stopLossTurn, stopLossOut, priThru, but.Value);
            }

            this.ezDataGridView1.Rows.AddRange(rows);
        }
Esempio n. 2
0
        private void btnDel_Click(object sender, System.EventArgs e)
        {
            var row  = dtgUsers.SelectedRows[0];
            var user = row.Tag as User;

            DataGridViewRow[] rows = new DataGridViewRow[dtgUsers.RowCount];
            dtgUsers.Rows.CopyTo(rows, 0);

            if (user.IsDefaultUser == 0 && rows.Count(x => (x.Tag as User).IsDefaultUser == 0) == 1)
            {
                MetroMessageBox.Show(this, $"Невозможно удалить последнего администратора", "Сообщение");
                return;
            }

            TennisSettings.TennisContext.Users.Remove(user);
            TennisSettings.TennisContext.SaveChanges();
            dtgUsers.Rows.Remove(row);
        }
Esempio n. 3
0
        public Form1()
        {
            InitializeComponent();

            DataGridViewRow[] rows = new DataGridViewRow[20];

            for (int i = 0; i < rows.Count(); i++)
            {
                DataGridViewButtonCell but = new DataGridViewButtonCell();
                but.Value = 10200 - i * 50;
                int deal       = 0 + i * 50;
                int call_price = 660 - i * 32;
                int put_price  = 3 + i * 34;
                rows[i] = new DataGridViewRow();
                rows[i].CreateCells(this.ezDataGridView1, deal, call_price, but.Value, put_price, deal);
            }

            this.ezDataGridView1.Rows.AddRange(rows);
        }