private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Columns[e.ColumnIndex].Name == "Operate1") { projectgroupId = Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString()); frmSelectTimePeriodAdd fm = frmSelectTimePeriodAdd.GetInstance(projectgroupId); fm.Exec(projectgroupId); fm.ShowDialog(); } else if (dataGridView1.Columns[e.ColumnIndex].Name == "Operate2") { projectgroupId = Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString()); frmSelectTimePeriodEdit fm = frmSelectTimePeriodEdit.GetInstance(projectgroupId); fm.Exec(projectgroupId); fm.ShowDialog(); } else if (dataGridView1.Columns[e.ColumnIndex].Name == "Operate3") { projectgroupId = Convert.ToInt32(this.dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString()); desc = this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString() + " - " + this.dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() + " " + this.dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString(); frmSelectTimePeriodDetails fm = frmSelectTimePeriodDetails.GetInstance(projectgroupId, desc); fm.Exec(projectgroupId, desc); fm.ShowDialog(); } }
public static frmSelectTimePeriodDetails GetInstance(int projectgroupId, string desc) { if (frmSelectTimePeriodDtls == null) { frmSelectTimePeriodDtls = new frmSelectTimePeriodDetails(projectgroupId, desc); } return(frmSelectTimePeriodDtls); }