Пример #1
0
        protected void lbView_Click(object sender, EventArgs e)
        {
            if (ddlArea.SelectedIndex > 0)
            {
                this.rvWorkSchedule.ProcessingMode = ProcessingMode.Local;

                ISSA.Pages.Reports.DataSet1 DS_Report = new ISSA.Pages.Reports.DataSet1();
                DS_Report.EnforceConstraints = false;

                ISSA.Pages.Reports.DataSet1TableAdapters.TA_RPT_WorkScheduleTableAdapter Rpt_TableAdapter = new ISSA.Pages.Reports.DataSet1TableAdapters.TA_RPT_WorkScheduleTableAdapter();
                Rpt_TableAdapter.Fill(DS_Report.TA_RPT_WorkSchedule, ddlYear.SelectedValue, ddlMonth.SelectedValue, Convert.ToByte(ddlArea.SelectedValue), ddlShift.SelectedValue);

                if (DS_Report.TA_RPT_WorkSchedule.Rows.Count > 0)
                {
                    ISSA.Pages.Reports.DataSet1.dtParametersDataTable dtParam = new ISSA.Pages.Reports.DataSet1.dtParametersDataTable();

                    DataRow dr = dtParam.NewRow();
                    dr["ParamOne"] = ddlMonth.SelectedItem.Text + ", " + ddlYear.SelectedValue;
                    dr["ParamTwo"] = ddlArea.SelectedItem.Text;
                    if (ddlShift.SelectedIndex == 0)
                    {
                        dr["ParamThree"] = "All";
                    }
                    else
                    {
                        dr["ParamThree"] = ddlShift.SelectedItem.Text;
                    }
                    dr["User"] = MISC.getUserName().ToUpper();;
                    dr["Date"] = DateTime.Now;
                    dtParam.Rows.Add(dr);

                    Microsoft.Reporting.WebForms.ReportDataSource RpDs1          = new Microsoft.Reporting.WebForms.ReportDataSource();
                    Microsoft.Reporting.WebForms.ReportDataSource RpDsParameters = new Microsoft.Reporting.WebForms.ReportDataSource();

                    RpDs1.Name           = "TA_RPT_WorkSchedule";
                    RpDs1.Value          = DS_Report.TA_RPT_WorkSchedule;
                    RpDsParameters.Name  = "dtParameters";
                    RpDsParameters.Value = dtParam;

                    rvWorkSchedule.LocalReport.ReportPath = "Pages/Reports/rpt_WorkSchedule.rdlc";
                    rvWorkSchedule.LocalReport.DataSources.Clear();
                    rvWorkSchedule.LocalReport.DataSources.Add(RpDs1);
                    rvWorkSchedule.LocalReport.DataSources.Add(RpDsParameters);
                    rvWorkSchedule.LocalReport.Refresh();
                    rvWorkSchedule.Visible        = true;
                    rvWorkSchedule.ShowReportBody = true;
                    mpeViewWorkSchedule.Show();
                }
                else
                {
                    ShowMessage("No record found for selected parameters. Schedule may not have been created.", MessageType.Info);
                    mpeViewWorkSchedule.Hide();
                }
            }
            else
            {
                ShowMessage("Area is required", MessageType.Warning);
                //mpeViewWorkSchedule.Hide();
            }
        }
        protected void generateWorkSchedule()
        {
            this.rvWorkSchedule.ProcessingMode = ProcessingMode.Local;

            ISSA.Pages.Reports.DataSet1 DS_Report = new ISSA.Pages.Reports.DataSet1();
            DS_Report.EnforceConstraints = false;

            ISSA.Pages.Reports.DataSet1TableAdapters.TA_RPT_WorkScheduleTableAdapter Rpt_TableAdapter = new ISSA.Pages.Reports.DataSet1TableAdapters.TA_RPT_WorkScheduleTableAdapter();
            Rpt_TableAdapter.Fill(DS_Report.TA_RPT_WorkSchedule, ddlYear.SelectedValue, ddlMonth.SelectedValue, Convert.ToByte(ddlArea.SelectedValue), ddlShift.SelectedValue);

            ISSA.Pages.Reports.DataSet1.dtParametersDataTable dtParam = new ISSA.Pages.Reports.DataSet1.dtParametersDataTable();

            DataRow dr = dtParam.NewRow();

            dr["ParamOne"] = ddlMonth.SelectedItem.Text + ", " + ddlYear.SelectedValue;
            dr["ParamTwo"] = ddlArea.SelectedItem.Text;
            if (ddlShift.SelectedIndex == 0)
            {
                dr["ParamThree"] = "All";
            }
            else
            {
                dr["ParamThree"] = ddlShift.SelectedItem.Text;
            }
            dr["User"] = loggedInUser;
            dr["Date"] = DateTime.Now;
            dtParam.Rows.Add(dr);

            Microsoft.Reporting.WebForms.ReportDataSource RpDs1          = new Microsoft.Reporting.WebForms.ReportDataSource();
            Microsoft.Reporting.WebForms.ReportDataSource RpDsParameters = new Microsoft.Reporting.WebForms.ReportDataSource();

            RpDs1.Name           = "TA_RPT_WorkSchedule";
            RpDs1.Value          = DS_Report.TA_RPT_WorkSchedule;
            RpDsParameters.Name  = "dtParameters";
            RpDsParameters.Value = dtParam;

            this.rvWorkSchedule.LocalReport.ReportPath = "Pages/Reports/rpt_WorkSchedule.rdlc";
            this.rvWorkSchedule.LocalReport.DataSources.Clear();
            this.rvWorkSchedule.LocalReport.DataSources.Add(RpDs1);
            this.rvWorkSchedule.LocalReport.DataSources.Add(RpDsParameters);
            this.rvWorkSchedule.LocalReport.Refresh();
            this.rvWorkSchedule.Visible        = true;
            this.rvWorkSchedule.ShowReportBody = true;
        }