Exemplo n.º 1
0
        protected void btn_SearchNow_Click(object sender, EventArgs e)
        {
            ReportDocument rpt       = new ReportDocument();
            String         Condition = string.Empty;

            CrystalReportViewer_Employee.Enabled = true;
            string str = "StaffsReport.rpt";

            rpt.Load(Server.MapPath(str));

            if (ddl_SearchField.SelectedIndex == 0 && ddl_SearchOperator.SelectedIndex == 0)
            {
                rpt.SetDataSource(StaffMasterManagement.GetInstance.GetEmployeeList());
            }
            else
            {
                if (ddl_SearchField.SelectedIndex != 0 && ddl_SearchOperator.SelectedValue == "2")
                {
                    Condition = ddl_SearchField.SelectedValue + MicroConstants.OPERATOR_LIKE + " '%" + txt_SearchText.Text + "%'";
                }
                else if (ddl_SearchField.SelectedIndex != 0 && ddl_SearchOperator.SelectedValue == "1")
                {
                    Condition = ddl_SearchField.SelectedValue + MicroConstants.OPERATOR_LIKE + " '" + txt_SearchText.Text + "%'";
                }
                else if (ddl_SearchField.SelectedIndex != 0 && ddl_SearchOperator.SelectedValue == "3")
                {
                    Condition = ddl_SearchField.SelectedValue + MicroConstants.OPERATOR_EQUALSTO + " '" + txt_SearchText.Text + "'";
                }
                rpt.SetDataSource(StaffMasterManagement.GetInstance.GetEmployeesSearchAll(Condition));
            }
            CrystalReportViewer_Employee.ReportSource = rpt;
            CrystalReportViewer_Employee.DataBind();
            CrystalReportViewer_Employee.Visible = true;
            Employeeeport_Multi.SetActiveView(ViewReport);
        }
Exemplo n.º 2
0
        protected void btn_SearchNow_Click(object sender, EventArgs e)
        {
            ReportDocument rpt       = new ReportDocument();
            String         Condition = string.Empty;

            CrystalReportViewer_Employee.Enabled = true;
            string str = "StudentAttendanceReport.rpt";

            rpt.Load(Server.MapPath(str));

            if (ddl_SearchField.SelectedIndex == 0 && ddl_SearchOperator.SelectedIndex == 0)
            {
                //rpt.SetDataSource(StaffMasterManagement.GetInstance.GetEmployeeList());
            }
            else
            {
                if (ddl_SearchField.SelectedIndex != 0 && ddl_SearchOperator.SelectedValue == "2")
                {
                    Condition = Convert.ToDateTime(txt_SearchText.Text).ToString(MicroConstants.DateFormat);
                    rpt.SetDataSource(StudentAttendanceReportManagement.GetInstance.GetAbsentAttnsListByDate(Condition));
                }
                else if (ddl_SearchField.SelectedIndex != 0 && ddl_SearchOperator.SelectedValue == "1")
                {
                    Condition = Convert.ToDateTime(txt_SearchText.Text).ToString(MicroConstants.DateFormat);
                    rpt.SetDataSource(StudentAttendanceReportManagement.GetInstance.GetPresentAttnsListByDate(Condition));
                }
                //else if (ddl_SearchField.SelectedIndex != 0 && ddl_SearchOperator.SelectedValue == "3")
                //{
                //    Condition = ddl_SearchField.SelectedValue + MicroConstants.OPERATOR_EQUALSTO + " '" + txt_SearchText.Text + "'";
                //}
            }
            CrystalReportViewer_Employee.ReportSource = rpt;
            CrystalReportViewer_Employee.DataBind();
            CrystalReportViewer_Employee.Visible = true;

            StuAttnport_Multi.SetActiveView(ViewReport);
        }