public static PayCheckFrm GetInstance() { if (singleton == null) { singleton = new PayCheckFrm(); } return(singleton); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 8) { // detail ClientDetail cd = ClientDetail.GetInstance(); cd.MdiParent = this.MdiParent; cd.Show(); cd.SetData(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); } else if (e.ColumnIndex == 9) { // payroll string accNum = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); string sql = "select * from ClientPayroll where AccNum='" + accNum + "'"; if (DBOperator.QuerySql(sql).Rows.Count == 0) { MessageBox.Show("This client doesn't have Payroll"); return; } ClientPayroll ci = ClientPayroll.GetInstance(); ci.MdiParent = this.MdiParent; ci.Show(); ci.SetData(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); } else if (e.ColumnIndex == 10) { string accNum = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); string sql = "select * from ClientPayroll where AccNum='" + accNum + "' and PayFreq<>'Quarterly'"; if (DBOperator.QuerySql(sql).Rows.Count == 0) { MessageBox.Show("This client doesn't need Paycheck"); return; } // paycheck PayCheckFrm pcf = PayCheckFrm.GetInstance(); pcf.MdiParent = this.MdiParent; pcf.Show(); pcf.SetAccNum(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); } }
private void PayCheckFrm_FormClosed(object sender, FormClosedEventArgs e) { singleton = null; }