Beispiel #1
0
        protected void btnViewReport_Click(object sender, EventArgs e)
        {
            try
            {
                String DeliveryNoteNo   = txtDeliveryNoteNo.Text;
                String FromDateReturned = txtFromDateReturned.Text;
                String ToDateReturned   = txtToDateReturned.Text;

                this.ltlMessage.Text         = string.Empty;
                ReportViewer1.Visible        = true;
                ReportViewer1.ProcessingMode = ProcessingMode.Remote;
                IReportServerCredentials irsc = new ReportServerNetworkCredentials();
                ReportViewer1.ServerReport.ReportServerCredentials = irsc;
                ReportViewer1.ServerReport.ReportServerUrl         = new Uri((string)ViewState["ReportServerUrl"]);
                ReportViewer1.ServerReport.ReportPath = "/Delivery/DeliveryReturn";
                ReportViewer1.ShowParameterPrompts    = true;

                string            nullValue = null;
                ReportParameter[] myParam   =
                {
                    new ReportParameter("DeliveryNoteNo", DeliveryNoteNo == string.Empty ? nullValue : DeliveryNoteNo)
                    ,                                     new ReportParameter("FromDateReturned", FromDateReturned == string.Empty ? nullValue : FromDateReturned)
                    ,                                     new ReportParameter("ToDateReturned", ToDateReturned == string.Empty ? nullValue : ToDateReturned)
                };

                ReportViewer1.ServerReport.SetParameters(myParam);
                ReportViewer1.ServerReport.Refresh();
            }
            catch (Exception ex)
            {
                this.ltlMessage.Text  = ex.Message.ToString().ToErrorMessageFormat();
                ReportViewer1.Visible = false;
                lblMessage.Visible    = true;
            }
        }
Beispiel #2
0
        protected void ReportViewer_Load(object sender, EventArgs e)
        {
            ReportViewer1.ProcessingMode = ProcessingMode.Remote;
            IReportServerCredentials irsc = new ReportServerNetworkCredentials();

            ReportViewer1.ServerReport.ReportServerCredentials = irsc;
            ReportViewer1.ServerReport.ReportServerUrl         = new Uri((string)ViewState["ReportServerUrl"]);
            ReportViewer1.ServerReport.ReportPath = "/Delivery/LabelCheckerResults";
            ReportViewer1.ShowParameterPrompts    = true;
            ReportViewer1.ServerReport.SetParameters(ReportViewer1.GetCurrentParameters());
            ReportViewer1.ServerReport.Refresh();
        }
Beispiel #3
0
        protected void btnDownloadTemplate_Click(object sender, EventArgs e)
        {
            try
            {
                QuotationFile quotationFile = new QuotationFile();
                quotationFile.CustomerCode = txtCustomerCode.Text;
                quotationFile.ForecastDate = DateTime.ParseExact(txtPeriod.Text.Insert(3, "01/"), formats, CultureInfo.InvariantCulture, DateTimeStyles.None);
                quotationFile.SysCreator   = HttpContext.Current.User.Identity.Name;
                quotationFile.Export();

                this.ltlMessage.Text         = string.Empty;
                ReportViewer1.ProcessingMode = ProcessingMode.Remote;
                IReportServerCredentials irsc = new ReportServerNetworkCredentials();
                ReportViewer1.ServerReport.ReportServerCredentials = irsc;
                ReportViewer1.ServerReport.ReportServerUrl         = new Uri((string)ViewState["ReportServerUrl"]);
                ReportViewer1.ServerReport.ReportPath = "/Forecast/ForecastTemplate";

                ReportParameter[] myParam =
                {
                    new ReportParameter("CustomerCode", quotationFile.CustomerCode)
                    ,                                   new ReportParameter("ForecastDate",string.Format("{0:MM/dd/yyyy}", quotationFile.ForecastDate))
                    ,                                   new ReportParameter("SysCreator", quotationFile.SysCreator)
                };

                ReportViewer1.ServerReport.SetParameters(myParam);
                ReportViewer1.ServerReport.Refresh();

                string    mimeType;
                string    encoding;
                string    extension;
                string[]  streams;
                Warning[] warnings;
                byte[]    bytes = ReportViewer1.ServerReport.Render("Excel", string.Empty, out mimeType, out encoding, out extension, out streams, out warnings);

                Response.Clear();
                Response.ContentType = "application/excel";
                Response.AddHeader("Content-disposition", string.Format("filename={0:yyyyMM}_{1}_Forecast.xls", quotationFile.ForecastDate, quotationFile.CustomerCode));
                Response.AddHeader("Content-Length", bytes.Length.ToString());
                Response.OutputStream.Write(bytes, 0, bytes.Length);
                Response.OutputStream.Flush();
                Response.OutputStream.Close();
                Response.Flush();
                Response.Close();
            }
            catch (Exception ex)
            {
                ltlMessage.Text = ex.Message.ToString().ToErrorMessageFormat();
            }
        }
Beispiel #4
0
        private void LoadReportViewer(string ServerUrl)
        {
            //String urlReportServer = ServerUrl;
            //rvForecastOrder.ProcessingMode = ProcessingMode.Remote; // ProcessingMode will be Either Remote or Local
            //rvForecastOrder.ServerReport.ReportServerUrl = new Uri(urlReportServer); //Set the ReportServer Url
            //rvForecastOrder.ServerReport.ReportPath = "/SalesOrderReports/SOReports"; //Passing the Report Path

            String urlReportServer = ServerUrl;

            rvForecastOrder.ProcessingMode = ProcessingMode.Remote;
            IReportServerCredentials irsc = new ReportServerNetworkCredentials();

            rvForecastOrder.ServerReport.ReportServerCredentials = irsc;
            rvForecastOrder.ServerReport.ReportServerUrl         = new Uri(urlReportServer);
            rvForecastOrder.ServerReport.ReportPath = "/Forecast/ForecastOrder"; //"/SalesOrderReports/SOReports";
            rvForecastOrder.ShowParameterPrompts    = true;
            rvForecastOrder.ServerReport.SetParameters(rvForecastOrder.GetCurrentParameters());
            rvForecastOrder.ServerReport.Refresh();
        }
Beispiel #5
0
        protected void lbtnExportToExcel_Click(object sender, EventArgs e)
        {
            string FromFulfilmentDate = txtFulfilmentDate.Text.Trim();
            string ToFulfilmentDate   = txtFulfilmentDate2.Text.Trim();
            string FromOrderDate      = txtOrderDate.Text.Trim();
            string ToOrderDate        = txtOrderDate2.Text.Trim();
            string FromReceivedDate   = txtReceived_Date.Text.Trim();
            string ToReceivedDate     = txtReceived_Date2.Text.Trim();

            if (FromFulfilmentDate != string.Empty || ToFulfilmentDate != string.Empty)
            {
                if (FromFulfilmentDate == string.Empty && ToFulfilmentDate != string.Empty)
                {
                    FromFulfilmentDate = ToFulfilmentDate;
                }

                if (ToFulfilmentDate == string.Empty && FromFulfilmentDate != string.Empty)
                {
                    ToFulfilmentDate = FromFulfilmentDate;
                }
            }

            if (FromOrderDate != string.Empty || ToOrderDate != string.Empty)
            {
                if (FromOrderDate == string.Empty && ToOrderDate != string.Empty)
                {
                    FromOrderDate = ToOrderDate;
                }

                if (ToOrderDate == string.Empty && FromOrderDate != string.Empty)
                {
                    ToOrderDate = FromOrderDate;
                }
            }

            if (FromReceivedDate != string.Empty || ToReceivedDate != string.Empty)
            {
                if (FromReceivedDate == string.Empty && ToReceivedDate != string.Empty)
                {
                    FromReceivedDate = ToReceivedDate;
                }

                if (ToReceivedDate == string.Empty && FromReceivedDate != string.Empty)
                {
                    ToReceivedDate = FromReceivedDate;
                }
            }

            string Warehouse       = txtWhseCode.Text;
            string DeliveryNoteNo  = txtDeliveryNote.Text;
            string DeliveryOrderNo = txtDeliveryOrderNo.Text;
            string ManifestNo      = txtManifestNo.Text;
            string OrderNo         = txtOrderNumber.Text;
            string Debtor          = txtOrderBy.Text;
            string InvoiceToCode   = txtInvoiceTo.Text;
            string DeliveryToCode  = txtDeliveryTo.Text;
            string YourRef         = txtYourRef.Text;
            string Description     = txtDescription.Text;
            string SelectionCode   = txtSelectionCode.Text;
            string DealingType     = txtDealingType.Text;

            Business.SearchOption searchOption = rblFilter.SelectedValue.ToSearchOptionEnum();

            Int32 option;

            switch (searchOption)
            {
            case Business.SearchOption.StartsWith: option = 2; break;

            case Business.SearchOption.Contains: option = 3; break;

            case Business.SearchOption.EndsWith: option = 4; break;

            default: option = 1; break;
            }

            string nullString = null;

            this.ltlMessage.Text         = string.Empty;
            ReportViewer1.Visible        = true;
            ReportViewer1.ProcessingMode = ProcessingMode.Remote;
            IReportServerCredentials irsc = new ReportServerNetworkCredentials();

            ReportViewer1.ServerReport.ReportServerCredentials = irsc;
            ReportViewer1.ServerReport.ReportServerUrl         = new Uri((string)ViewState["ReportServerUrl"]);
            ReportViewer1.ServerReport.ReportPath = "/Delivery/DNTransmittals";
            ReportViewer1.ShowParameterPrompts    = true;


            ReportParameter[] myParam =
            {
                new ReportParameter("Debtor", Debtor == string.Empty ? nullString : Debtor)
                ,                             new ReportParameter("OrderNo",            OrderNo == string.Empty ? nullString : OrderNo)
                ,                             new ReportParameter("YourRef",            YourRef == string.Empty ? nullString : YourRef)
                ,                             new ReportParameter("DeliveryNoteNo",     DeliveryNoteNo == string.Empty ? nullString : DeliveryNoteNo)
                ,                             new ReportParameter("FromFulfilmentDate", FromFulfilmentDate == string.Empty ? nullString : FromFulfilmentDate) // string.Format("{0:MM/dd/yyyy}", DateTime.ParseExact(FromFulfilmentDate, "dd/MM/yyyy", CultureInfo.InvariantCulture)))
                ,                             new ReportParameter("ToFulfilmentDate",   ToFulfilmentDate == string.Empty ? nullString : ToFulfilmentDate)     // string.Format("{0:MM/dd/yyyy}", DateTime.ParseExact(ToFulfilmentDate, "dd/MM/yyyy", CultureInfo.InvariantCulture)))
                ,                             new ReportParameter("FromOrderDate",      FromOrderDate == string.Empty ? nullString : FromOrderDate)           // string.Format("{0:MM/dd/yyyy}", DateTime.ParseExact(FromOrderDate, "dd/MM/yyyy", CultureInfo.InvariantCulture)))
                ,                             new ReportParameter("ToOrderDate",        ToOrderDate == string.Empty ? nullString : ToOrderDate)               // string.Format("{0:MM/dd/yyyy}", DateTime.ParseExact(ToOrderDate, "dd/MM/yyyy", CultureInfo.InvariantCulture)))
                ,                             new ReportParameter("Description",        Description == string.Empty ? nullString : Description)
                ,                             new ReportParameter("InvoiceToCode",      InvoiceToCode == string.Empty ? nullString : InvoiceToCode)
                ,                             new ReportParameter("DeliveryToCode",     DeliveryToCode == string.Empty ? nullString : DeliveryToCode)
                ,                             new ReportParameter("WhseCode",           Warehouse == string.Empty ? nullString : Warehouse)
                ,                             new ReportParameter("DeliveryOrderNo",    DeliveryOrderNo == string.Empty ? nullString : DeliveryOrderNo)
                ,                             new ReportParameter("ManifestNo",         ManifestNo == string.Empty ? nullString : ManifestNo)
                ,                             new ReportParameter("DealingType",        DealingType == string.Empty ? nullString : DealingType)
                ,                             new ReportParameter("SelectionCode",      SelectionCode == string.Empty ? nullString : SelectionCode)
                ,                             new ReportParameter("FromReceivedDate",   FromReceivedDate == string.Empty ? nullString :  string.Format("{0:MM/dd/yyyy}",DateTime.ParseExact(FromReceivedDate, "dd/MM/yyyy", CultureInfo.InvariantCulture)))
                ,                             new ReportParameter("ToReceivedDate",     ToReceivedDate == string.Empty ? nullString :  string.Format("{0:MM/dd/yyyy}", DateTime.ParseExact(ToReceivedDate,   "dd/MM/yyyy", CultureInfo.InvariantCulture)))
                ,                             new ReportParameter("SearchOption",       option.ToString())
            };

            ReportViewer1.ServerReport.SetParameters(myParam);
            ReportViewer1.ServerReport.Refresh();

            string mimeType;
            string encoding;
            string extension;

            string[]  streams;
            Warning[] warnings;
            byte[]    bytes = ReportViewer1.ServerReport.Render("Excel", string.Empty, out mimeType, out encoding, out extension, out streams, out warnings);

            Response.Clear();
            Response.ContentType = "application/excel";
            Response.AddHeader("Content-disposition", "filename=DNTransmittalsReceived.xls");
            Response.OutputStream.Write(bytes, 0, bytes.Length);
            Response.OutputStream.Flush();
            Response.OutputStream.Close();
            Response.Flush();
            Response.Close();
        }