private void cmbScholarshipPaymentID_SelectedIndexChanged(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptScholarshipPaymentReceipt rpt = new rptScholarshipPaymentReceipt(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection(cs.DBConn); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from ScholarshipPayment,Student,Scholarship where Student.ScholarNo=ScholarshipPayment.ScholarNo and Scholarship.ScholarshipID=ScholarshipPayment.ScholarshipID and ScholarshipPaymentID = '" + cmbScholarshipPaymentID.Text + "'"; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "ScholarshipPayment"); myDA.Fill(myDS, "Student"); myDA.Fill(myDS, "Scholarship"); rpt.SetDataSource(myDS); crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmEmployeeReport_Load(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptEmployee rpt = new rptEmployee(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection("Data Source=GHAFFARI\\ALIGHAFFARI;Initial Catalog=CMS;Integrated Security=True;"); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from Employee "; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "Employee"); rpt.SetDataSource(myDS); crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptOthersTransaction rpt = new rptOthersTransaction(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection("Data Source=GHAFFARI\\ALIGHAFFARI;Initial Catalog=CMS;Integrated Security=True;"); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from OtherTransaction where Date between @date1 and @date2"; MyCommand.Parameters.Add("@date1", SqlDbType.DateTime, 30, "Date").Value = DateFrom.Value.Date; MyCommand.Parameters.Add("@date2", SqlDbType.DateTime, 30, "Date").Value = DateTo.Value.Date; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "OtherTransaction"); rpt.SetDataSource(myDS); crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Print_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; frmScholarshipPaymentReceipt frm = new frmScholarshipPaymentReceipt(); rptScholarshipPaymentReceipt rpt = new rptScholarshipPaymentReceipt(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection("Data Source=GHAFFARI\\ALIGHAFFARI;Initial Catalog=CMS;Integrated Security=True;"); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from ScholarshipPayment where ScholarshipPaymentID = '" + ScholarshipPaymentID.Text + "'"; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "ScholarshipPayment"); rpt.SetDataSource(myDS); frm.crystalReportViewer1.ReportSource = rpt; frm.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button12_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptScholarshipPayment rpt = new rptScholarshipPayment(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection(cs.DBConn); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from ScholarshipPayment,Student,Scholarship where Student.ScholarNo=ScholarshipPayment.scholarNo and ScholarShipPayment.ScholarshipID=Scholarship.ScholarShipID and PaymentDate between @date1 and @date2 and DuePayment > 0 order by PaymentDate "; MyCommand.Parameters.Add("@date1", SqlDbType.DateTime, 30, "PaymentDate").Value = DateFrom.Value.Date; MyCommand.Parameters.Add("@date2", SqlDbType.DateTime, 30, "PaymentDate").Value = DateTo.Value.Date; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "ScholarshipPayment"); myDA.Fill(myDS, "Student"); myDA.Fill(myDS, "Scholarship"); rpt.SetDataSource(myDS); crystalReportViewer4.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmbStaffName_SelectedIndexChanged(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptSalaryPayment rpt = new rptSalaryPayment(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection(cs.DBConn); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from EmployeePayment,Employee where EmployeePayment.StaffID=Employee.StaffID and Staffname= '" + cmbStaffName.Text + "' order by PaymentDate"; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "EmployeePayment"); myDA.Fill(myDS, "Employee"); rpt.SetDataSource(myDS); crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnPrint_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptSalarySlip rpt = new rptSalarySlip(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. FrmSalarySlip frm = new FrmSalarySlip(); myConnection = new SqlConnection(cs.DBConn); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from EmployeePayment,Employee where Employee.StaffID=EmployeePayment.StaffID and PaymentID='" + txtPaymentID.Text + "'"; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "EmployeePayment"); myDA.Fill(myDS, "Employee"); rpt.SetDataSource(myDS); frm.crystalReportViewer1.ReportSource = rpt; frm.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void textBox1_TextChanged(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptStudentRegistration rpt = new rptStudentRegistration(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection(cs.DBConn); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from studentRegistration where Student_name like '" + txtStudentName.Text + "%' order by DateOfAdmission"; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "StudentRegistration"); rpt.SetDataSource(myDS); crystalReportViewer3.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button4_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptStudentRegistration rpt = new rptStudentRegistration(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection(cs.DBConn); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from studentRegistration where DateOfAdmission between @date1 and @date2 order by DateOfAdmission"; MyCommand.Parameters.Add("@date1", SqlDbType.DateTime, 30, " DateOfAdmission").Value = DateFrom.Value.Date; MyCommand.Parameters.Add("@date2", SqlDbType.DateTime, 30, " DateOfAdmission").Value = DateTo.Value.Date; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "StudentRegistration"); rpt.SetDataSource(myDS); crystalReportViewer2.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmFeeDetailsReport_Load(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptFeeDetails rpt = new rptFeeDetails(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection(cs.DBConn); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from FeesDetails"; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "FeesDetails"); rpt.SetDataSource(myDS); crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button5_Click(object sender, EventArgs e) { if (Course.Text == "") { MessageBox.Show("Please select course", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Course.Focus(); return; } if (Branch.Text == "") { MessageBox.Show("Please select branch", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Branch.Focus(); return; } try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptFeesPayment rpt = new rptFeesPayment(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection(cs.DBConn); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from FeePayment,Student where Student.ScholarNo=FeePayment.ScholarNo and DateOfPayment between @date1 and @date2 and Course= '" + Course.Text + "'and branch='" + Branch.Text + "' order by DateOfPayment"; MyCommand.Parameters.Add("@date1", SqlDbType.DateTime, 30, "DateOfPayment").Value = Date_from.Value.Date; MyCommand.Parameters.Add("@date2", SqlDbType.DateTime, 30, "DateOfPayment").Value = Date_to.Value.Date; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "FeePayment"); myDA.Fill(myDS, "Student"); rpt.SetDataSource(myDS); crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Button1_Click(object sender, EventArgs e) { try { if (Course.Text == "") { MessageBox.Show("Please select course", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Course.Focus(); return; } if (Branch.Text == "") { MessageBox.Show("Please select branch", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Branch.Focus(); return; } if (Session.Text == "") { MessageBox.Show("Please select session", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Session.Focus(); return; } Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptStudentRegistration rpt = new rptStudentRegistration(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection(cs.DBConn); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from studentRegistration where Course= '" + Course.Text + "'and branch='" + Branch.Text + "'and Session='" + Session.Text + "'order by DateOfAdmission"; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "StudentRegistration"); rpt.SetDataSource(myDS); crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Button1_Click(object sender, EventArgs e) { if (Course.Text == "") { MessageBox.Show("Please select course", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Course.Focus(); return; } if (Branch.Text == "") { MessageBox.Show("Please select branch", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Branch.Focus(); return; } try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptSubjectInfo rpt = new rptSubjectInfo(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection("Data Source=GHAFFARI\\ALIGHAFFARI;Initial Catalog=CMS;Integrated Security=True;"); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from subjectinfo where coursename = '" + Course.Text + "' and branch ='" + Branch.Text + "' order by Semester"; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "SubjectInfo"); rpt.SetDataSource(myDS); crystalReportViewer1.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { if (ScholarNo.Text == "") { MessageBox.Show("Please select scholar no.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); ScholarNo.Focus(); return; } try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptFeesPayment rpt = new rptFeesPayment(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection(cs.DBConn); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from FeePayment,Student where FeePayment.ScholarNo=Student.ScholarNo and FeePayment.ScholarNo= '" + ScholarNo.Text + "'order by DateOfPayment"; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "FeePayment"); myDA.Fill(myDS, "Student"); rpt.SetDataSource(myDS); crystalReportViewer2.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button4_Click(object sender, EventArgs e) { if (cmbTransactionType.Text == "") { MessageBox.Show("Please select transaction type", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbTransactionType.Focus(); return; } try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptOthersTransaction rpt = new rptOthersTransaction(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection(cs.DBConn); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from OtherTransaction where Date between @date1 and @date2 and transactiontype = '" + cmbTransactionType.Text + "'"; MyCommand.Parameters.Add("@date1", SqlDbType.DateTime, 30, "Date").Value = dateTimePicker1.Value.Date; MyCommand.Parameters.Add("@date2", SqlDbType.DateTime, 30, "Date").Value = dateTimePicker2.Value.Date; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "OtherTransaction"); rpt.SetDataSource(myDS); crystalReportViewer2.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { if (cmbCourse1.Text == "") { MessageBox.Show("Please select course", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbCourse1.Focus(); return; } if (cmbBranch1.Text == "") { MessageBox.Show("Please select branch", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbBranch1.Focus(); return; } if (cmbSemester1.Text == "") { MessageBox.Show("Please select semester", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbSemester1.Focus(); return; } if (cmbSession1.Text == "") { MessageBox.Show("Please select session", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbSession1.Focus(); return; } if (cmbSection1.Text == "") { MessageBox.Show("Please select section", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbSection1.Focus(); return; } if (cmbSubjectCode.Text == "") { MessageBox.Show("Please select subject code", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbSubjectCode.Focus(); return; } try { Cursor = Cursors.WaitCursor; timer1.Enabled = true; rptAttendance rpt = new rptAttendance(); //The report you created. SqlConnection myConnection = default(SqlConnection); SqlCommand MyCommand = new SqlCommand(); SqlDataAdapter myDA = new SqlDataAdapter(); CMS_DBDataSet myDS = new CMS_DBDataSet(); //The DataSet you created. myConnection = new SqlConnection("Data Source=GHAFFARI\\ALIGHAFFARI;Initial Catalog=CMS;Integrated Security=True;"); MyCommand.Connection = myConnection; MyCommand.CommandText = "select * from Attendance where Course= '" + cmbCourse1.Text + "' and branch='" + cmbBranch1.Text + "' and Session='" + cmbSession1.Text + "' and Semester = '" + cmbSemester1.Text + "' and Section = '" + cmbSection1.Text + "' and SubjectCode = '" + cmbSubjectCode.Text + "' and AttendanceDate between @date1 and @date2 order by Student_name "; MyCommand.Parameters.Add("@date1", SqlDbType.DateTime, 30, " AttendanceDate").Value = dateTimePicker4.Value.Date; MyCommand.Parameters.Add("@date2", SqlDbType.DateTime, 30, " AttendanceDate").Value = dateTimePicker3.Value.Date; MyCommand.CommandType = CommandType.Text; myDA.SelectCommand = MyCommand; myDA.Fill(myDS, "Attendance"); con.Open(); cmd = new SqlCommand("select Count(ScholarNo) from Attendance where Course= '" + cmbCourse1.Text + "' and branch='" + cmbBranch1.Text + "' and Session='" + cmbSession1.Text + "' and Semester = '" + cmbSemester1.Text + "' and Section = '" + cmbSection1.Text + "' and SubjectCode = '" + cmbSubjectCode.Text + "' and AttendanceDate between @date1 and @date2 group by ScholarNo", con); cmd.Parameters.Add("@date1", SqlDbType.DateTime, 30, " AttendanceDate").Value = dateTimePicker4.Value.Date; cmd.Parameters.Add("@date2", SqlDbType.DateTime, 30, " AttendanceDate").Value = dateTimePicker3.Value.Date; rdr = cmd.ExecuteReader(); if (rdr.Read()) { label20.Text = rdr.GetInt32(0).ToString(); } if ((rdr != null)) { rdr.Close(); } if (con.State == ConnectionState.Open) { con.Close(); } rpt.SetDataSource(myDS); rpt.SetParameterValue("variable", dateTimePicker4.Value); rpt.SetParameterValue("variable1", dateTimePicker3.Value); rpt.SetParameterValue("variable2", label20.Text); crystalReportViewer2.ReportSource = rpt; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }