public SubRiskForm(DataGridViewCell _dgvCell, string _connectionString, MainRiskForm _form, bool readOnly) { this.readOnly = readOnly; try { dgvCell = _dgvCell; form = _form; connectionString = _connectionString; InitializeComponent(); if (readOnly) { saveToolStripMenuItem.Enabled = false; } init(); Dates dates = new Dates(form); this.lblFromDate.Text = dates.FromDate.ToShortDateString(); lblToDate.Text = dates.ToDate.ToShortDateString(); dtp.Value = dates.EvalDate; } catch (Exception) { return; } }
private void dgvRisks_MouseDoubleClick(object sender, MouseEventArgs e) { MainRiskForm mainRisk = new MainRiskForm(dgvRisks.CurrentCell, connectionString, dtp.Value.Date, readOnly); try { mainRisk.Show(); } catch (Exception) { } }
public ChooseSubRisk(string _connectionString, MainRiskForm _form) { connectionString = _connectionString; form = _form; InitializeComponent(); string SQL = "Select " + "* " + "FROM " + "[Documents].[SubRisk] " + "WHERE 1=1" + "AND [ToDate] > @EvalDate " + "AND [FromDate] <= @EvalDate"; using (var dt = RiskTextForm.SQLQuery(SQL, connectionString, new Dates(form), true)) { foreach (DataRow row in dt.Rows) { int rowIndex = dgvSubrisks.Rows.Add(); dgvSubrisks.Rows[rowIndex].Cells["SubRiskID"].Value = row["SubRiskID"].ToString(); dgvSubrisks.Rows[rowIndex].Cells["SubRiskIK"].Value = row["SubRiskIK"].ToString(); dgvSubrisks.Rows[rowIndex].Cells["SubRiskType"].Value = row["SubRiskType"].ToString(); } } }
public Dates(MainRiskForm form) { EvalDate = form.dtp.Value.Date; FromDate = DateTime.Parse(form.lblFromDate.Text); ToDate = DateTime.Parse(form.lblToDate.Text); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { MainRiskForm mainRisk = new MainRiskForm(dgvRisks.CurrentCell, connectionString, dtp.Value.Date, readOnly); mainRisk.Show(); }