示例#1
0
 protected void MainCallbackPanel_Callback(object sender, CallbackEventArgsBase e)
 {
     try
     {
         var args = SPlanetUtil.DeserializeCallbackArgs(e.Parameter);
         if (args.Count == 0)
         {
             return;
         }
         if (args[0] == "SaveEditForm")          // When click Save button in EditForm Popup Windows
         {
             BasePage.SaveEditFormChanges(args[2]);
         }
         if (args[0] == "DeleteEntry")           // When click Delete button at Toolbar menu
         {
             BasePage.DeleteEntry(args[1]);
         }
         if (args[0] == "RefreshEntry")           // When click Refresh button at Toolbar menu
         {
             BasePage.RefreshEntry();
         }
         if (args[0] == "FilterChanged")         // When click Save button in Filter Popup Windows
         {
             FilterBag.FilterControlExpression = args[1];
             UpdateFilterControlExpression();
             //MainCallbackPanel.JSProperties["cpSelectedFilterNavBarItemName"] = FilterBag.GetActiveFilterName();
             BasePage.OnFilterChanged();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    public static XtraReport CreateReport(string queryString)
    {
        var args = SPlanetUtil.DeserializeCallbackArgs(queryString);

        if (args.Count == 0)
        {
            return(null);
        }
        ReportType rType;

        if (!Enum.TryParse(args[0], out rType))
        {
            return(null);
        }
        //var itemID = !string.IsNullOrEmpty(args[1]) ? long.Parse(args[1]) : DataListUtil.emptyEntryID;
        return(CreateReport(rType, args));
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            XtraReport mainReport;
            var        query = Request.QueryString[LoadReportArgsKey];

            ArrayList paymentIds = new ArrayList();

            //  If sale order
            if (query.Contains("Sale_Order_Product"))
            {
                var     args = SPlanetUtil.DeserializeCallbackArgs(query);
                DataSet dsSaleOrderData;
                using (SqlConnection conn = new SqlConnection(SPlanetUtil.GetConnectionString()))
                {
                    //Create array of Parameters
                    List <SqlParameter> arrParm = new List <SqlParameter>
                    {
                        new SqlParameter("@sale_order_no", SqlDbType.VarChar, 20)
                        {
                            Value = args[1].ToString()
                        },
                    };
                    conn.Open();
                    dsSaleOrderData = SqlHelper.ExecuteDataset(conn, "sp_sale_order_list_data_by_no", arrParm.ToArray());
                    conn.Close();
                }
                if (dsSaleOrderData.Tables.Count > 0)
                {
                    #region SaleOrder Payment
                    // Quotation Notification
                    foreach (var row in dsSaleOrderData.Tables[3].AsEnumerable())
                    {
                        paymentIds.Add(Convert.IsDBNull(row["id"]) ? 0 : Convert.ToInt32(row["id"]));
                    }
                    #endregion SaleOrder Payment

                    if (paymentIds.Count == 0)
                    {
                        paymentIds.Add(0);
                    }
                }

                mainReport = new XtraReport();

                for (int i = 0; i < paymentIds.Count; i++)
                {
                    var report = HicomReportUtil.CreateReport(query + "|" + paymentIds[i] + "|" + (i + 1));
                    if (report != null)
                    {
                        //DocumentViewerControl.Report = report;
                        report.CreateDocument();

                        mainReport.Pages.AddRange(report.Pages);
                    }
                }
            }
            else
            {
                mainReport = HicomReportUtil.CreateReport(query);
            }

            DocumentViewerControl.Report = mainReport;

            var isTableLayout = true;
            if (query.Contains("Stock_Card") ||
                query.Contains("Stock_Inventory_Products")
                )
            {
                isTableLayout = false;
            }
            DocumentViewerControl.SettingsReportViewer.TableLayout = isTableLayout;

            DocumentViewerControl.Report.RequestParameters = false;
            //DocumentViewerControl.Report.par
            //DocumentViewerControl.Report.Parameters.
        }