예제 #1
0
        private static void SetupDataDynamicMergeReport(ReportRuntime runtime, string PdmRequestRegisterID, string requestContent)
        {
            // referenceId , blockId, rowValueId
            // truncate 18000,5834,6bb03992-e5ff-4b01-a41b-438ca9a7e560

            int?mainBlockId = DDSetup.GetPdmRequestMainBlockId(PdmRequestRegisterID);

            if (mainBlockId.HasValue)
            {
                string dataFieldString = requestContent.Substring(requestContent.IndexOf(':') + 1);

                // column1: ReferenceID, Column2: BlockId, column3: RowValueGuid
                DataTable result = DDSetup.ReadCSVContentDataTable(dataFieldString, 3, "|", ",");

                if (result.Rows.Count > 0)
                {
                    string productReferenceId = result.Rows[0][0].ToString();

                    if (runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs] != null)
                    {
                        runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs].CurrentValue = productReferenceId;
                        // runtime.Parameters[DDSetup.ReportParameterMutipleProductReferenceIDs].Hidden
                    }
                    else                    // try to set ReportParameterProductReferenceID
                    {
                        runtime.Parameters[DDSetup.ReportParameterProductReferenceID].CurrentValue = productReferenceId;
                    }


                    Dictionary <string, List <DataRow> > dictBlockIdDataRowList = result.AsEnumerable().GroupBy(o => o["2"]).ToDictionary(o => o.Key.ToString(), o => o.ToList());


                    // only one block it is mainblock
                    if (dictBlockIdDataRowList.Count == 1)
                    {
                        var firstKeyList = dictBlockIdDataRowList.First();

                        var rowValueConcString = firstKeyList.Value.Select(o => o["3"].ToString()).Aggregate((current, next) => current + ", " + next);

                        // it is main block  (first block
                        //GetMergeBlockPrintGrid 3879, 5834, '6BB03992-E5FF-4B01-A41B-438CA9A7E560', -1, '2B963DC6-3D85-46C9-B100-2F19ADECA94B', 18000

                        if (firstKeyList.Key.ToString() == mainBlockId.ToString())
                        {
                            if (runtime.Parameters[DDSetup.ReportParameterBlock1RwValueFilter] != null)
                            {
                                runtime.Parameters[DDSetup.ReportParameterBlock1RwValueFilter].CurrentValue = rowValueConcString;
                            }

                            // need to set seond as   System.Guid.NewGuid() to leav empty row
                            if (runtime.Parameters[DDSetup.ReportParameterBlock2RwValueFilter] != null)
                            {
                                runtime.Parameters[DDSetup.ReportParameterBlock2RwValueFilter].CurrentValue = System.Guid.NewGuid().ToString();
                            }
                        }
                        else                         // it is not main block, it is second block
                        {
                            // need to set first as   System.Guid.NewGuid() to leav empty row
                            if (runtime.Parameters[DDSetup.ReportParameterBlock1RwValueFilter] != null)
                            {
                                runtime.Parameters[DDSetup.ReportParameterBlock1RwValueFilter].CurrentValue = System.Guid.NewGuid().ToString();
                            }


                            if (runtime.Parameters[DDSetup.ReportParameterBlock2RwValueFilter] != null)
                            {
                                runtime.Parameters[DDSetup.ReportParameterBlock2RwValueFilter].CurrentValue = rowValueConcString;
                            }
                        }
                    }
                    else                     // two blockId
                    {
                        foreach (string blockIdkey in dictBlockIdDataRowList.Keys)
                        {
                            var rowValueConcString = dictBlockIdDataRowList[blockIdkey].Select(o => o["3"].ToString()).Aggregate((current, next) => current + ", " + next);


                            // it is first block
                            if (blockIdkey == mainBlockId.ToString())
                            {
                                //MainBlockId


                                if (runtime.Parameters[DDSetup.ReportParameterBlock1RwValueFilter] != null)
                                {
                                    runtime.Parameters[DDSetup.ReportParameterBlock1RwValueFilter].CurrentValue = rowValueConcString;
                                }
                            }
                            else                             // it is second block
                            {
                                if (runtime.Parameters[DDSetup.ReportParameterBlock2RwValueFilter] != null)
                                {
                                    runtime.Parameters[DDSetup.ReportParameterBlock2RwValueFilter].CurrentValue = rowValueConcString;
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        private static void SetupReportRequestParameter(ReportDocument crystalReportDocument, string PdmRequestRegisterID, string requestContent)
        {
            //referenceId , blockId, rowValueId
            // truncate 18000,5834,6bb03992-e5ff-4b01-a41b-438ca9a7e560
            //paraNameValue: classId: 1,2,3 |colorId: 2,3 |productReferenceId: 1,2,3 |
            int?mainBlockId = DDSetup.GetPdmRequestMainBlockId(PdmRequestRegisterID);

            if (mainBlockId.HasValue)
            {
                string dataFieldString = requestContent.Substring(requestContent.IndexOf(':') + 1);

                // column1: ReferenceID, Column2: BlockId, column3: RowValueGuid
                DataTable result = DDSetup.ReadCSVContentDataTable(dataFieldString, 3, "|", ",");

                if (result.Rows.Count > 0)
                {
                    string productReferenceId = result.Rows[0][0].ToString();



                    if (IsExistParaName(crystalReportDocument, DDSetup.ReportParameterProductReferenceID))
                    {
                        SetupReportParameter(crystalReportDocument, DDSetup.ReportParameterProductReferenceID, productReferenceId);
                    }
                    else                    // try to setup _MutipleProductReferenceIDs
                    {
                        SetupReportParameter(crystalReportDocument, DDSetup.ReportParameterMutipleProductReferenceIDs, productReferenceId);
                    }



                    Dictionary <string, List <DataRow> > dictBlockIdDataRowList = result.AsEnumerable().GroupBy(o => o["2"]).ToDictionary(o => o.Key.ToString(), o => o.ToList());


                    // only one block it is mainblock
                    if (dictBlockIdDataRowList.Count == 1)
                    {
                        var firstKeyList = dictBlockIdDataRowList.First();

                        var rowValueConcString = firstKeyList.Value.Select(o => o["3"].ToString()).Aggregate((current, next) => current + ", " + next);

                        // it is main block  (first block
                        //GetMergeBlockPrintGrid 3879, 5834, '6BB03992-E5FF-4B01-A41B-438CA9A7E560', -1, '2B963DC6-3D85-46C9-B100-2F19ADECA94B', 18000

                        if (firstKeyList.Key.ToString() == mainBlockId.ToString())
                        {
                            SetupReportParameter(crystalReportDocument, DDSetup.ReportParameterBlock1RwValueFilter, rowValueConcString);


                            SetupReportParameter(crystalReportDocument, DDSetup.ReportParameterBlock2RwValueFilter, System.Guid.NewGuid().ToString());
                        }
                        else                         // it is not main block, it is second block
                        {
                            SetupReportParameter(crystalReportDocument, DDSetup.ReportParameterBlock1RwValueFilter, System.Guid.NewGuid().ToString());

                            SetupReportParameter(crystalReportDocument, DDSetup.ReportParameterBlock2RwValueFilter, rowValueConcString);
                        }
                    }
                    else                     // two blockId
                    {
                        foreach (string blockIdkey in dictBlockIdDataRowList.Keys)
                        {
                            var rowValueConcString = dictBlockIdDataRowList[blockIdkey].Select(o => o["3"].ToString()).Aggregate((current, next) => current + ", " + next);


                            // it is first block
                            if (blockIdkey == mainBlockId.ToString())
                            {
                                SetupReportParameter(crystalReportDocument, DDSetup.ReportParameterBlock1RwValueFilter, rowValueConcString);
                            }
                            else                             // it is second block
                            {
                                SetupReportParameter(crystalReportDocument, DDSetup.ReportParameterBlock2RwValueFilter, rowValueConcString);
                            }
                        }
                    }
                }
            }
        }