private void buttonEditBan_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { string accDir = (string)dataGridView1.SelectedRows[0].Cells[accDirDataGridViewTextBoxColumn.Index].Value; DamDataSet.BanListRow banRecord = dataSet.BanList.FindByAccDir(accDir); if (banRecord != null) { new CreateBanWindow(appServices, banRecord.AccDir, banRecord.AccID, dataSet, banRecord).ShowDialog(this); dataGridView1_SelectionChanged(null, null); } } }
public CreateBanWindow(AppServiceInterface appServices, string accDir, string accID, DamDataSet dataSet, DamDataSet.BanListRow banRecord) { this.appServices = appServices; this.accDir = accDir; this.accID = accID; this.dataSet = dataSet; this.banRecord = banRecord; InitializeComponent(); if (banRecord != null) { richTextBox1.Text = banRecord.BanReason; dateTimePickerStartDate.Value = banRecord.BanStart.ToUniversalTime(); numericUpDownDuration.Value = (decimal)(banRecord.BanEnd - banRecord.BanEnd).TotalDays; } else { dateTimePickerStartDate.Value = DateTime.Now; numericUpDownDuration.Value = 0; } }