Пример #1
0
        public void TextObjectDeleteTest()
        {
            const string source     = "abc=123; def=789";
            var          textObject = new TextObject(source);

            Assert.IsTrue(textObject.Delete("(abc=123; )"));
            Assert.AreEqual("def=789", textObject.Serialize());
        }
Пример #2
0
        public static void ProcessReportDocumentDetail(CustomReportDisplayMode pViewMode, string resourceString, string groupField, string groupCondition, string groupTitle, string filter, string filterHumanReadable, bool grouped)
        {
            try
            {
                //Move This to CustomReport SubClasses ex Filename, Params, DataSources etc

                string       reportFile   = GetReportFilePath("ReportDocumentFinanceDetailList.frx");
                CustomReport customReport = new CustomReport(reportFile, 1);

                // Add PostFix to Report Title
                Tuple <string, string> tuppleResourceString = GetResourceString(resourceString);
                string reportTitleString        = tuppleResourceString.Item1;
                string reportTitleStringPostfix = tuppleResourceString.Item2;

                //Report Parameters
                customReport.SetParameterValue("Report Title", String.Format("{0}{1}", reportTitleString, reportTitleStringPostfix));
                if (!string.IsNullOrEmpty(filterHumanReadable))
                {
                    customReport.SetParameterValue("Report Filter", filterHumanReadable);
                }

                // Get Objects
                GroupHeaderBand groupHeaderBand     = (GroupHeaderBand)customReport.FindObject("GroupHeader1");
                TextObject      groupHeaderBandText = (TextObject)customReport.FindObject("TextGroupHeader1");
                if (groupHeaderBand != null && groupHeaderBandText != null)
                {
                    groupHeaderBand.Condition = groupCondition;
                    groupHeaderBandText.Text  = groupTitle;
                }
                else
                {
                    _log.Error("Error cant find Report Objects");
                }

                //Prepare and Declare FRBOGenericCollections for non grouped and gouped reports
                if (!grouped)
                {
                    // Using view_documentfinance
                    FRBOGenericCollection <FRBODocumentFinanceMasterDetailView> gcDocumentFinanceMasterDetail = new FRBOGenericCollection <FRBODocumentFinanceMasterDetailView>(filter);
                    //Prepare and Enable DataSources
                    customReport.RegisterData(gcDocumentFinanceMasterDetail, "DocumentFinanceDetail");
                }
                else
                {
                    // Using view_documentfinancesellgroup
                    FRBOGenericCollection <FRBODocumentFinanceMasterDetailGroupView> gcDocumentFinanceMasterDetail = new FRBOGenericCollection <FRBODocumentFinanceMasterDetailGroupView>(filter, groupField, string.Empty);
                    //Prepare and Enable DataSources
                    customReport.RegisterData(gcDocumentFinanceMasterDetail, "DocumentFinanceDetail");

                    DataBand   dataBandData3               = (DataBand)customReport.FindObject("Data3");
                    TextObject textColumnDateHeader        = (TextObject)customReport.FindObject("TextColumnDateHeader");
                    TextObject textColumnDateData          = (TextObject)customReport.FindObject("TextColumnDateData");
                    TextObject textColumnCodeHeader        = (TextObject)customReport.FindObject("TextColumnCodeHeader");
                    TextObject textColumnCodeData          = (TextObject)customReport.FindObject("TextColumnCodeData");
                    TextObject textColumnDesignationHeader = (TextObject)customReport.FindObject("TextColumnDesignationHeader");
                    TextObject textColumnDesignationData   = (TextObject)customReport.FindObject("textColumnDesignationData");
                    // Change Objects
                    if (dataBandData3 != null && groupHeaderBandText != null && textColumnDateData != null && textColumnCodeHeader != null && textColumnCodeData != null && textColumnDesignationHeader != null && textColumnDesignationData != null)
                    {
                        // Remove [DocumentFinanceDetail.Date] and use sencon Sort has Priority
                        dataBandData3.Sort[0].Expression = dataBandData3.Sort[1].Expression;
                        dataBandData3.Sort[1].Expression = string.Empty;
                        // Date : Disable non exitence fields [DocumentFinanceDetail.Date] in sort and firts colum data
                        textColumnDateHeader.Delete();
                        textColumnDateData.Delete();
                        // Code
                        textColumnCodeHeader.Left         = 0;
                        textColumnCodeData.Left           = 0;
                        textColumnDesignationHeader.Left  = 56.7F;
                        textColumnDesignationData.Left    = 56.7F;
                        textColumnDesignationHeader.Width = 292.95F;
                        textColumnDesignationData.Width   = 292.95F;
                    }
                    else
                    {
                        _log.Error("Error cant find Report Objects");
                    }
                }

                if (customReport.GetDataSource("DocumentFinanceDetail") != null)
                {
                    customReport.GetDataSource("DocumentFinanceDetail").Enabled = true;
                }

                //customReport.ReportInfo.Name = FILL THIS WITH REPORT NAME;
                customReport.Process(pViewMode);
                customReport.Dispose();
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }