private void btnShowFront_Click(object sender, EventArgs e) { try { SqlConnection con = new SqlConnection(Community.DBLayer.con_String); con.Open(); ReportDocument cryRpt = new ReportDocument(); Reports.Staff_NIC.rptNICStaff_Front rpt = new MCKJ.Reports.Staff_NIC.rptNICStaff_Front(); this.WindowState = FormWindowState.Maximized; rpt.SetDatabaseLogon("sa", "sql_pwd_SA", "MCKJ-SERVER", "Community"); this.crvStaffNIC.ReportSource = rpt; rpt.SetParameterValue("Id", Id); rpt.SetParameterValue("IdToPrint", GetFormatId(Id.ToString())); //rpt.SetParameterValue("TransactionNo", dgBillSummary.Rows[dgBillSummary.CurrentCell.RowIndex].Cells["TransactionNo"].Value.ToString()); this.Refresh(); this.Show(); con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "Staff", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnViewAll_Click(object sender, EventArgs e) { if (btnViewAll.Text == "Print") { try { if (this.dgvStaffMembers.SelectedRows.Count > 0) { SqlConnection con = new SqlConnection(Community.DBLayer.con_String); con.Open(); ReportDocument cryRpt = new ReportDocument(); Reports.Staff_NIC.frmStaffNIC frm = new MCKJ.Reports.Staff_NIC.frmStaffNIC(); frm.ID = Convert.ToInt32(dgvStaffMembers.Rows[dgvStaffMembers.CurrentCell.RowIndex].Cells["Id"].Value.ToString()); Reports.Staff_NIC.rptNICStaff_Front rpt = new MCKJ.Reports.Staff_NIC.rptNICStaff_Front(); frm.WindowState = FormWindowState.Maximized; rpt.SetDatabaseLogon("sa", "sql_pwd_SA", "MCKJ-SERVER", "Community"); frm.crvStaffNIC.ReportSource = rpt; rpt.SetParameterValue("Id", dgvStaffMembers.Rows[dgvStaffMembers.CurrentCell.RowIndex].Cells["Id"].Value.ToString()); rpt.SetParameterValue("IdToPrint", GetFormatId(dgvStaffMembers.Rows[dgvStaffMembers.CurrentCell.RowIndex].Cells["Id"].Value.ToString())); //rpt.SetParameterValue("TransactionNo", dgBillSummary.Rows[dgBillSummary.CurrentCell.RowIndex].Cells["TransactionNo"].Value.ToString()); frm.Refresh(); frm.Show(); con.Close(); } } catch (Exception ex) { } } else { frmNICStaff_Load(null, null); } }