protected void OnButtonCommand(object sender, CommandEventArgs e)
    {
        //Event handler for command button clicked
        try {
            //Change view to Viewer and reset to clear existing data
            Master.Viewer.Reset();

            //Get parameters for the query
            string _start  = DateTime.Parse(this.txtStart.Text).ToString("yyyy-MM-dd");
            string _end    = DateTime.Parse(this.txtEnd.Text).ToString("yyyy-MM-dd");
            string _client = this.ddlClient.SelectedValue;

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = REPORT_NAME;
            report.EnableExternalImages = true;
            EnterpriseService enterprise = new EnterpriseService();
            DataSet           ds         = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { _client, null, _start, _end });
            if (ds.Tables[TBL_REPORT].Rows.Count >= 0)
            {
                switch (e.CommandName)
                {
                case "Run":
                    //Set local report and data source
                    System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC);
                    report.LoadReportDefinition(stream);
                    report.DataSources.Clear();
                    report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT]));
                    DataSet _ds = enterprise.FillDataset("uspRptClientRead", "NewTable", new object[] { _client });
                    report.DataSources.Add(new ReportDataSource("DataSet2", _ds.Tables["NewTable"]));

                    //Set the report parameters for the report
                    ReportParameter number = new ReportParameter("ClientNumber", _client);
                    ReportParameter div    = new ReportParameter("ClientDivision");
                    ReportParameter start  = new ReportParameter("StartDate", _start);
                    ReportParameter end    = new ReportParameter("EndDate", _end);
                    report.SetParameters(new ReportParameter[] { number, div, start, end });

                    //Update report rendering with new data
                    report.Refresh();

                    if (!Master.Viewer.Enabled)
                    {
                        Master.Viewer.CurrentPage = 1;
                    }
                    break;
                }
            }
            else
            {
                Master.ShowMessageBox("There were no records found.");
            }
        }
        catch (Exception ex) { Master.ReportError(ex, 4); }
    }
Esempio n. 2
0
    protected void OnButtonCommand(object sender, CommandEventArgs e)
    {
        //Event handler for command button clicked
        try {
            //Change view to Viewer and reset to clear existing data
            Master.Viewer.Reset();

            //Get parameters for the query
            string _clientName = this.ddlClient.SelectedItem.Text;
            string _pickupID = "", _termCode = "";

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = REPORT_NAME;
            report.EnableExternalImages = true;
            EnterpriseService enterprise = new EnterpriseService();
            DataSet           ds         = new DataSet(REPORT_DS);
            foreach (GridViewRow row in SelectedRows)
            {
                DataKey dataKey = (DataKey)this.grdPickups.DataKeys[row.RowIndex];
                _pickupID = dataKey["PickupID"].ToString();
                _termCode = dataKey["TerminalCode"].ToString();
                DataSet _ds = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { _termCode, _pickupID });
                ds.Merge(_ds);
            }
            if (ds.Tables[TBL_REPORT].Rows.Count >= 0)
            {
                switch (e.CommandName)
                {
                case "Run":
                    //Set local report and data source
                    System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC);
                    report.LoadReportDefinition(stream);
                    report.DataSources.Clear();
                    report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT]));

                    //Set the report parameters for the report
                    ReportParameter puID       = new ReportParameter("PickupID", "0");
                    ReportParameter clientName = new ReportParameter("ClientName", _clientName);
                    ReportParameter termCode   = new ReportParameter("TerminalCode", "0");
                    report.SetParameters(new ReportParameter[] { puID, clientName, termCode });

                    //Update report rendering with new data
                    report.Refresh();

                    if (!Master.Viewer.Enabled)
                    {
                        Master.Viewer.CurrentPage = 1;
                    }
                    break;
                }
            }
            else
            {
                Master.ShowMessageBox("There were no records found.");
            }
        }
        catch (Exception ex) { Master.ReportError(ex, 4); }
    }
Esempio n. 3
0
    protected void OnButtonCommand(object sender, CommandEventArgs e)
    {
        //Event handler for command button clicked
        try {
            //Change view to Viewer and reset to clear existing data
            Master.Viewer.Reset();

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = REPORT_NAME;
            report.EnableExternalImages = true;
            report.EnableHyperlinks     = true;
            EnterpriseService enterprise = new EnterpriseService();
            DataSet           ds         = new DataSet(REPORT_DS);
            foreach (GridViewRow row in SelectedRows)
            {
                DataKey dataKey = (DataKey)this.grdPickups.DataKeys[row.RowIndex];
                DataSet _ds     = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { dataKey["PickupID"].ToString() });
                ds.Merge(_ds);
            }
            if (ds.Tables[TBL_REPORT] == null)
            {
                ds.Tables.Add(TBL_REPORT);
            }
            switch (e.CommandName)
            {
            case "Run":
                //Set local report and data source
                System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC);
                report.LoadReportDefinition(stream);
                report.DataSources.Clear();
                report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT]));
                report.SetParameters(new ReportParameter[] { new ReportParameter("PickupID", "0") });
                report.Refresh();
                if (!Master.Viewer.Enabled)
                {
                    Master.Viewer.CurrentPage = 1;
                }
                break;
            }
        }
        catch (Exception ex) { Master.ReportError(ex, 4); }
    }
    protected void OnButtonCommand(object sender, CommandEventArgs e)
    {
        //Event handler for command button clicked
        try {
            //Change view to Viewer and reset to clear existing data
            Master.Viewer.Reset();

            //Get parameters for the query
            string _ofddate = DateTime.Parse(this.txtDate.Text).ToString("yyyy-MM-dd");

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = REPORT_NAME;
            report.EnableExternalImages = true;
            EnterpriseService enterprise = new EnterpriseService();
            DataSet           ds         = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { _ofddate });
            if (ds.Tables[TBL_REPORT].Rows.Count >= 0)
            {
                switch (e.CommandName)
                {
                case "Run":
                    //Set local report and data source
                    System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC);
                    report.LoadReportDefinition(stream);
                    report.DataSources.Clear();
                    report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT]));

                    //Set the report parameters for the report
                    ReportParameter rdddate = new ReportParameter("RequestedDeliveryDate", _ofddate);
                    report.SetParameters(new ReportParameter[] { rdddate });

                    //Update report rendering with new data
                    report.Refresh();
                    break;
                }
            }
            else
            {
                Master.ShowMessageBox("There were no records found.");
            }
        }
        catch (Exception ex) { Master.ReportError(ex, 3); }
    }
Esempio n. 5
0
    protected void OnButtonCommand(object sender, CommandEventArgs e)
    {
        //Event handler for command button clicked
        try {
            //Change view to Viewer and reset to clear existing data
            Master.Viewer.Reset();
            Session["PacSunDS"] = null;

            //Get parameters for the query
            string _start = this.ddpSetup.FromDate.ToString("yyyy-MM-dd");
            string _end   = this.ddpSetup.ToDate.ToString("yyyy-MM-dd");
            string _flag  = this.cboFilter.SelectedValue;

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = REPORT_NAME;
            report.EnableExternalImages = true;
            EnterpriseService enterprise = new EnterpriseService();
            DataSet           ds         = enterprise.FillDataset((_flag == "0"?USP_REPORT:USP_REPORT_OSD), TBL_REPORT, new object[] { _start, _end });
            Session["PacSunDS"] = ds;
            if (ds.Tables[TBL_REPORT].Rows.Count >= 0)
            {
                switch (e.CommandName)
                {
                case "Run":
                    //Set local report and data source
                    System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC);
                    report.LoadReportDefinition(stream);
                    report.DataSources.Clear();
                    report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT]));

                    //Set the report parameters for the report
                    ReportParameter start = new ReportParameter("FromDate", _start);
                    ReportParameter end   = new ReportParameter("ToDate", _end);
                    report.SetParameters(new ReportParameter[] { start, end });

                    //Update report rendering with new data
                    report.Refresh();

                    if (!Master.Viewer.Enabled)
                    {
                        Master.Viewer.CurrentPage = 1;
                    }
                    break;

                case "Data":
                    //Set local export report and data source
                    report.LoadReportDefinition(Master.CreateExportRdl(ds, REPORT_DS, "RGXVMSQLR.TSORT"));
                    report.DataSources.Clear();
                    report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT]));
                    report.Refresh(); break;

                case "Excel":
                    //Create Excel mime-type page
                    Response.ClearHeaders();
                    Response.Clear();
                    Response.Charset = "";
                    Response.AddHeader("Content-Disposition", "inline; filename=PacSunDelivery.xls");
                    Response.ContentType = "application/vnd.ms-excel";      //application/octet-stream";
                    System.IO.StringWriter       sw = new System.IO.StringWriter();
                    System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
                    DataGrid dg = new DataGrid();
                    dg.DataSource = ds.Tables[TBL_REPORT];
                    dg.DataBind();
                    dg.RenderControl(hw);
                    Response.Write(sw.ToString());
                    Response.End();
                    break;
                }
            }
            else
            {
                Master.Status = "There were no records found.";
            }
        }
        catch (Exception ex) { Master.ReportError(ex, 4); }
    }
    protected void OnButtonCommand(object sender, CommandEventArgs e)
    {
        //Event handler for command button clicked
        //Change view to Viewer and reset to clear existing data
        Master.Viewer.Reset();

        //Get parameters for the query
        string _client      = Master.ClientNumber;
        string _division    = Master.Division;
        string _agent       = Master.AgentNumber;
        string _region      = Master.Region;
        string _district    = Master.District;
        string _store       = Master.StoreNumber;
        int    _isException = this.chkExceptionsOnly.Checked ? 1 : 0;
        string _start       = Master.StartDate;
        string _end         = Master.EndDate;

        //Initialize control values
        LocalReport report = Master.Viewer.LocalReport;

        report.DisplayName          = REPORT_NAME;
        report.EnableExternalImages = true;
        EnterpriseService enterprise = new EnterpriseService();
        DataSet           ds         = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { _client, _division, _agent, _region, _district, _store, _start, _end, _isException });

        if (ds.Tables[TBL_REPORT].Rows.Count >= 0)
        {
            switch (e.CommandName)
            {
            case "Run":
                //Set local report and data source
                System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC);
                report.LoadReportDefinition(stream);
                report.DataSources.Clear();
                report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT]));

                //Set the report parameters for the report
                ReportParameter clientName = new ReportParameter("ClientName", Master.ClientName);
                ReportParameter client     = new ReportParameter("ClientNumber", _client);
                ReportParameter division   = new ReportParameter("Division", _division);
                ReportParameter agent      = new ReportParameter("AgentNumber"); if (_agent != null)
                {
                    agent.Values.Add(_agent);
                }
                ReportParameter region = new ReportParameter("Region"); if (_region != null)
                {
                    region.Values.Add(_region);
                }
                ReportParameter district = new ReportParameter("District"); if (_district != null)
                {
                    district.Values.Add(_district);
                }
                ReportParameter store = new ReportParameter("StoreNumber"); if (_store != null)
                {
                    store.Values.Add(_store);
                }
                ReportParameter start       = new ReportParameter("StartDate", _start);
                ReportParameter end         = new ReportParameter("EndDate", _end);
                ReportParameter isException = new ReportParameter("IsExceptionOnly", _isException.ToString());
                report.SetParameters(new ReportParameter[] { client, division, agent, region, district, store, start, end, isException, clientName });

                //Update report rendering with new data
                report.Refresh();
                if (!Master.Viewer.Enabled)
                {
                    Master.Viewer.CurrentPage = 1;
                }
                break;

            case "Data":
                //Set local export report and data source
                report.LoadReportDefinition(Master.CreateExportRdl(ds, REPORT_DS, "RGXSQLR.TSORT"));
                report.DataSources.Clear();
                report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT]));
                report.Refresh(); break;

            case "Excel":
                //Create Excel mime-type page
                Response.ClearHeaders();
                Response.Clear();
                Response.Charset = "";
                Response.AddHeader("Content-Disposition", "inline; filename=ScanningDetailByStore.xls");
                Response.ContentType = "application/vnd.ms-excel";      //application/octet-stream";
                System.IO.StringWriter       sw = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
                DataGrid dg = new DataGrid();
                dg.DataSource = ds.Tables[TBL_REPORT];
                dg.DataBind();
                dg.RenderControl(hw);
                Response.Write(sw.ToString());
                Response.End();
                break;
            }
        }
        else
        {
            Master.Status = "There were no records found.";
        }
    }
    protected void OnButtonCommand(object sender, CommandEventArgs e)
    {
        //Event handler for command button clicked
        try {
            //Change view to Viewer and reset to clear existing data
            Master.Viewer.Reset();

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = this.mTitle;
            report.EnableExternalImages = true;
            report.EnableHyperlinks     = true;
            EnterpriseService enterprise = new EnterpriseService();
            DataSet           ds         = new DataSet(this.mDSName);
            foreach (GridViewRow row in SelectedRows)
            {
                DataKey dataKey = (DataKey)this.grdPickups.DataKeys[row.RowIndex];
                DataSet _ds     = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { dataKey["PickupID"].ToString() });
                ds.Merge(_ds);
            }
            if (ds.Tables[mTBLName] == null)
            {
                ds.Tables.Add(mTBLName);
            }
            switch (e.CommandName)
            {
            case "Run":
                //Set local report and data source
                System.IO.Stream stream = Master.GetReportDefinition(this.mSource);
                report.LoadReportDefinition(stream);
                report.DataSources.Clear();
                report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName]));
                report.SetParameters(new ReportParameter[] { new ReportParameter("PickupID", "0") });
                report.Refresh();
                if (!Master.Viewer.Enabled)
                {
                    Master.Viewer.CurrentPage = 1;
                }
                break;

            case "Data":
                //Set local export report and data source
                report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName, "RGXVMSQLR.TSORT"));
                report.DataSources.Clear();
                report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName]));
                report.Refresh();
                break;

            case "Excel":
                //Create Excel mime-type page
                Response.ClearHeaders();
                Response.Clear();
                Response.Charset = "";
                Response.AddHeader("Content-Disposition", "inline; filename=LOccitaneCartonInfo.xls");
                Response.ContentType = "application/vnd.ms-excel";      //application/octet-stream";
                System.IO.StringWriter       sw = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
                DataGrid dg = new DataGrid();
                dg.DataSource = ds.Tables[mTBLName];
                dg.DataBind();
                dg.RenderControl(hw);
                Response.Write(sw.ToString());
                Response.End();
                break;
            }
        }
        catch (Exception ex) { Master.ReportError(ex, 4); }
    }
Esempio n. 8
0
    protected void OnButtonCommand(object sender, CommandEventArgs e)
    {
        //Event handler for command button clicked
        try {
            //Change view to Viewer and reset to clear existing data
            Master.Viewer.Reset();

            //Get parameters for the query
            string _client   = this.cboClient.SelectedValue != "" ? this.cboClient.SelectedValue : null;
            string _division = null;
            string _agent    = null;
            string _region   = null;
            string _district = null;
            string _store    = this.cboParam.SelectedValue == "Stores" && this.txtStore.Text.Length > 0 ? this.txtStore.Text : null;
            string _start    = this.cboDateValue.SelectedValue.Split(',')[1].Split(':')[0].Trim();
            string _end      = this.cboDateValue.SelectedValue.Split(',')[1].Split(':')[1].Trim();

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = REPORT_NAME;
            report.EnableExternalImages = true;
            EnterpriseService enterprise = new EnterpriseService();
            DataSet           ds         = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { _client, _division, _agent, _region, _district, _store, _start, _end });
            if (ds.Tables[TBL_REPORT].Rows.Count >= 0)
            {
                switch (e.CommandName)
                {
                case "Run":
                    //Set local report and data source
                    System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC);
                    report.LoadReportDefinition(stream);
                    report.DataSources.Clear();
                    report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT]));

                    //Set the report parameters for the report
                    ReportParameter clientName = new ReportParameter("ClientName", this.cboClient.SelectedItem.Text);
                    ReportParameter client     = new ReportParameter("ClientNumber", _client);
                    ReportParameter division   = new ReportParameter("Division", _division);
                    ReportParameter agent      = new ReportParameter("AgentNumber", _agent);
                    ReportParameter region     = new ReportParameter("Region", _region);
                    ReportParameter district   = new ReportParameter("District", _district);
                    ReportParameter store      = new ReportParameter("StoreNumber", _store);
                    ReportParameter start      = new ReportParameter("StartDate", _start);
                    ReportParameter end        = new ReportParameter("EndDate", _end);
                    report.SetParameters(new ReportParameter[] { client, division, agent, region, district, store, start, end, clientName });

                    //Update report rendering with new data
                    report.Refresh();
                    if (!Master.Viewer.Enabled)
                    {
                        Master.Viewer.CurrentPage = 1;
                    }
                    break;
                }
            }
            else
            {
                Master.ShowMessageBox("There were no records found.");
            }
        }
        catch (Exception ex) { Master.ReportError(ex, 4); }
    }
Esempio n. 9
0
    protected void OnButtonCommand(object sender, CommandEventArgs e)
    {
        //Event handler for command button clicked
        //Change view to Viewer and reset to clear existing data
        Master.Viewer.Reset();

        //Get parameters for the query
        string _clientName = this.dgdClientVendor.ClientName;
        string _pickupID = "", _termCode = "";

        //Initialize control values
        LocalReport report = Master.Viewer.LocalReport;

        report.DisplayName          = REPORT_NAME;
        report.EnableExternalImages = true;
        EnterpriseService enterprise = new EnterpriseService();
        DataSet           ds         = new DataSet(REPORT_DS);

        foreach (GridViewRow row in SelectedRows)
        {
            DataKey dataKey = (DataKey)this.grdPickups.DataKeys[row.RowIndex];
            _pickupID = dataKey["PickupID"].ToString();
            _termCode = dataKey["TerminalCode"].ToString();
            DataSet _ds = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { _termCode, _pickupID });
            ds.Merge(_ds);
        }
        if (ds.Tables[TBL_REPORT].Rows.Count >= 0)
        {
            switch (e.CommandName)
            {
            case "Run":
                //Set local report and data source
                System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC);
                report.LoadReportDefinition(stream);
                report.DataSources.Clear();
                report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT]));

                //Set the report parameters for the report
                ReportParameter puID       = new ReportParameter("PickupID", "0");
                ReportParameter clientName = new ReportParameter("ClientName", _clientName);
                ReportParameter termCode   = new ReportParameter("TerminalCode", "0");
                report.SetParameters(new ReportParameter[] { puID, clientName, termCode });

                //Update report rendering with new data
                report.Refresh();

                if (!Master.Viewer.Enabled)
                {
                    Master.Viewer.CurrentPage = 1;
                }
                break;

            case "Data":
                //Set local export report and data source
                report.LoadReportDefinition(Master.CreateExportRdl(ds, REPORT_DS, "RGXSQLR.TSORT"));
                report.DataSources.Clear();
                report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT]));
                report.Refresh(); break;

            case "Excel":
                //Create Excel mime-type page
                Response.ClearHeaders();
                Response.Clear();
                Response.Charset = "";
                Response.AddHeader("Content-Disposition", "inline; filename=DeliveryInfoByPickup.xls");
                Response.ContentType = "application/vnd.ms-excel";      //application/octet-stream";
                System.IO.StringWriter       sw = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
                DataGrid dg = new DataGrid();
                dg.DataSource = ds.Tables[TBL_REPORT];
                dg.DataBind();
                dg.RenderControl(hw);
                Response.Write(sw.ToString());
                Response.End();
                break;
            }
        }
        else
        {
            Master.Status = "There were no records found.";
        }
    }