private ReportTreeNode CopyReport(Serialization.Node src, int businessUnitId)
        {
            ReportTreeNode dst = null;

            if (IsAuthorized(src, businessUnitId))
            {
                ReportHandle handle = new ReportHandle();

                CopyFields(handle, src);

                Serialization.ReportReference reference = (Serialization.ReportReference)src.Content.Items[0];

                if (reference.ComingSoon)
                {
                    handle.ComingSoon = true;
                }
                else
                {
                    handle.Report = FindReport(reference.Value, true);
                }

                dst = handle;
            }

            return(dst);
        }
Beispiel #2
0
        public void SetupTest(CultureInfo culture)
        {
            Thread.CurrentThread.CurrentCulture   = culture;
            Thread.CurrentThread.CurrentUICulture = culture;

            treeViewCSSP = new TreeView();
            richTextBoxTreeViewSelectedStatus = new RichTextBox();
            reportTreeNodeRoot = new ReportTreeNode();

            reportBaseService = new ReportBaseService((culture.TwoLetterISOLanguageName == "fr" ? LanguageEnum.fr : LanguageEnum.en), treeViewCSSP);
            baseEnumService   = new BaseEnumService((culture.TwoLetterISOLanguageName == "fr" ? LanguageEnum.fr : LanguageEnum.en));
            reportBase        = new ReportBase();
        }
Beispiel #3
0
        private ReportTreeNode GetReportTreeNodeWithText(ReportTreeNode reportTreeNode, string ReportTreeNodeText)
        {
            if (reportTreeNode.Text == ReportTreeNodeText)
            {
                return(reportTreeNode);
            }

            foreach (ReportTreeNode RTN in reportTreeNode.Nodes)
            {
                ReportTreeNode RTNRes = GetReportTreeNodeWithText(RTN, ReportTreeNodeText);
                if (RTNRes != null)
                {
                    return(RTNRes);
                }
            }

            return(null);
        }
        private ReportTreeNode CopyGroup(Serialization.Node src, int businessUnitId)
        {
            ReportGroup dst = new ReportGroup();

            CopyFields(dst, src);

            foreach (Serialization.Node node in src.Content.Items)
            {
                ReportTreeNode child = Copy(node, businessUnitId);

                if (child != null)
                {
                    dst.Children.Add(child);
                }
            }

            return(dst);
        }
        public void CreateTreeViewService_CreateReportTreeNodeItem_Area_Test()
        {
            SetupTest();
            ReportTreeNode reportTreeNodeArea = createTreeViewService.CreateReportTreeNodeItem("Area", ReportTreeNodeTypeEnum.ReportAreaType, ReportTreeNodeSubTypeEnum.TableSelectable, ReportFieldTypeEnum.Error);

            Assert.AreEqual("Area", reportTreeNodeArea.Text);
            Assert.AreEqual(ReportTreeNodeTypeEnum.ReportAreaType, reportTreeNodeArea.ReportTreeNodeType);
            Assert.AreEqual(ReportTreeNodeSubTypeEnum.TableSelectable, reportTreeNodeArea.ReportTreeNodeSubType);
            Assert.AreEqual(ReportFieldTypeEnum.Error, reportTreeNodeArea.ReportFieldType);
            Assert.AreEqual(ReportSortingEnum.Error, reportTreeNodeArea.dbSortingField.ReportSorting);
            Assert.AreEqual(0, reportTreeNodeArea.dbSortingField.Ordinal);
            Assert.AreEqual(ReportFormatingDateEnum.Error, reportTreeNodeArea.reportFormatingField.ReportFormatingDate);
            Assert.AreEqual(ReportFormatingNumberEnum.Error, reportTreeNodeArea.reportFormatingField.ReportFormatingNumber);
            Assert.AreEqual(0, reportTreeNodeArea.dbFilteringDateFieldList.Count);
            Assert.AreEqual(0, reportTreeNodeArea.dbFilteringNumberFieldList.Count);
            Assert.AreEqual(0, reportTreeNodeArea.dbFilteringTextFieldList.Count);
            Assert.AreEqual(0, reportTreeNodeArea.dbFilteringTrueFalseFieldList.Count);
            Assert.AreEqual(0, reportTreeNodeArea.reportConditionDateFieldList.Count);
            Assert.AreEqual(0, reportTreeNodeArea.reportConditionNumberFieldList.Count);
            Assert.AreEqual(0, reportTreeNodeArea.reportConditionTextFieldList.Count);
            Assert.AreEqual(0, reportTreeNodeArea.reportConditionTrueFalseFieldList.Count);
        }
 private void CopyFields(ReportTreeNode dst, Serialization.Node src)
 {
     dst.Title       = src.Title;
     dst.Description = src.Description;
     dst.NodeType    = (ReportTreeNodeType)Enum.Parse(typeof(ReportTreeNodeType), src.NodeType.ToString());
 }
        public string GenerateModel(ReportTreeNode reportTreeNode, StringBuilder sb)
        {
            foreach (ReportTreeNode RTN in reportTreeNode.Nodes)
            {
                if (RTN.ReportTreeNodeSubType == ReportTreeNodeSubTypeEnum.FieldsHolder)
                {
                    sb.AppendLine(@"    public class Report" + reportTreeNode.Text + "Model");
                    sb.AppendLine(@"    {");
                    sb.AppendLine(@"        public Report" + reportTreeNode.Text + "Model()");
                    sb.AppendLine(@"        {");
                    sb.AppendLine(@"            " + reportTreeNode.Text + @"_Error = """";");
                    sb.AppendLine(@"        }");
                    sb.AppendLine(@"    ");
                    foreach (ReportTreeNode RTNField in RTN.Nodes)
                    {
                        switch (RTNField.ReportFieldType)
                        {
                        case ReportFieldTypeEnum.DateAndTime:
                            sb.AppendLine(@"        public Nullable<DateTime> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.NumberWhole:
                            sb.AppendLine(@"        public Nullable<int> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.NumberWithDecimal:
                            sb.AppendLine(@"        public Nullable<float> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.Text:
                            sb.AppendLine(@"        public string " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.TrueOrFalse:
                            sb.AppendLine(@"        public Nullable<bool> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.FilePurpose:
                            sb.AppendLine(@"        public Nullable<FilePurposeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.FileType:
                            sb.AppendLine(@"        public Nullable<FileTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.TranslationStatus:
                            sb.AppendLine(@"        public Nullable<TranslationStatusEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.BoxModelResultType:
                            sb.AppendLine(@"        public Nullable<BoxModelResultTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.InfrastructureType:
                            sb.AppendLine(@"        public Nullable<InfrastructureTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.FacilityType:
                            sb.AppendLine(@"        public Nullable<FacilityTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.AerationType:
                            sb.AppendLine(@"        public Nullable<AerationTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.PreliminaryTreatmentType:
                            sb.AppendLine(@"        public Nullable<PreliminaryTreatmentTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.PrimaryTreatmentType:
                            sb.AppendLine(@"        public Nullable<PrimaryTreatmentTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.SecondaryTreatmentType:
                            sb.AppendLine(@"        public Nullable<SecondaryTreatmentTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.TertiaryTreatmentType:
                            sb.AppendLine(@"        public Nullable<TertiaryTreatmentTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.TreatmentType:
                            sb.AppendLine(@"        public Nullable<TreatmentTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.DisinfectionType:
                            sb.AppendLine(@"        public Nullable<DisinfectionTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.CollectionSystemType:
                            sb.AppendLine(@"        public Nullable<CollectionSystemTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.AlarmSystemType:
                            sb.AppendLine(@"        public Nullable<AlarmSystemTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.ScenarioStatus:
                            sb.AppendLine(@"        public Nullable<ScenarioStatusEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.StorageDataType:
                            sb.AppendLine(@"        public Nullable<StorageDataTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.Language:
                            sb.AppendLine(@"        public Nullable<LanguageEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.SampleType:
                            sb.AppendLine(@"        public string " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.BeaufortScale:
                            sb.AppendLine(@"        public Nullable<BeaufortScaleEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.AnalyzeMethod:
                            sb.AppendLine(@"        public Nullable<AnalyzeMethodEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.SampleMatrix:
                            sb.AppendLine(@"        public Nullable<SampleMatrixEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.Laboratory:
                            sb.AppendLine(@"        public Nullable<LaboratoryEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.SampleStatus:
                            sb.AppendLine(@"        public Nullable<SampleStatusEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.SamplingPlanType:
                            sb.AppendLine(@"        public Nullable<SamplingPlanTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.LabSheetType:
                            sb.AppendLine(@"        public Nullable<LabSheetTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.LabSheetStatus:
                            sb.AppendLine(@"        public Nullable<LabSheetStatusEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.PolSourceInactiveReason:
                            sb.AppendLine(@"        public Nullable<PolSourceInactiveReasonEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.PolSourceObsInfo:
                            sb.AppendLine(@"        public string " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.AddressType:
                            sb.AppendLine(@"        public Nullable<AddressTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.StreetType:
                            sb.AppendLine(@"        public Nullable<StreetTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.ContactTitle:
                            sb.AppendLine(@"        public Nullable<ContactTitleEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.EmailType:
                            sb.AppendLine(@"        public Nullable<EmailTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.TelType:
                            sb.AppendLine(@"        public Nullable<TelTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.TideText:
                            sb.AppendLine(@"        public Nullable<TideTextEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.TideDataType:
                            sb.AppendLine(@"        public Nullable<TideDataTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.SpecialTableType:
                            sb.AppendLine(@"        public Nullable<SpecialTableTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.MWQMSiteLatestClassification:
                            sb.AppendLine(@"        public Nullable<MWQMSiteLatestClassificationEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.PolSourceIssueRisk:
                            sb.AppendLine(@"        public Nullable<PolSourceIssueRiskEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        case ReportFieldTypeEnum.MikeScenarioSpecialResultKMLType:
                            sb.AppendLine(@"        public Nullable<MikeScenarioSpecialResultKMLTypeEnum> " + RTNField.Text + " { get; set; }");
                            break;

                        default:
                            sb.AppendLine(@"        public eeeeee " + RTNField.Text + " { get; set; }");
                            break;
                        }
                    }
                    sb.AppendLine(@"    }");
                }
            }

            return("");
        }
Beispiel #8
0
        /// <summary>
        /// Adds the checked report(s) to the Customize Report list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addCheckedReportClick(object sender, EventArgs e)
        {
            //START RALLY DE 6919 error when deleting a group
            if (customReportTreeView.Nodes.Count == 0 || customReportTreeView.SelectedNode == null)
            {
                return;
            }
            //END RALLY DE 6919

            foreach (TreeNode node in predefinedReportTreeView.Nodes)
            {
                foreach (ReportTreeNode report in node.Nodes)
                {
                    if (report.Checked)
                    {
                        ReportTypes reportType  = (ReportTypes)report.ReportInfo.TypeID;
                        bool        setFound    = false;
                        bool        reportFound = false;
                        // Starting with the selected Group Node, see if the ReportSet Node is available
                        foreach (ReportSetTreeNode setNode in customReportTreeView.SelectedNode.Nodes)
                        {
                            if (setNode.ReportType == reportType)
                            {
                                // If present, we need to add the Report node if it is not in the ReportSet node.
                                setFound = true;
                                foreach (ReportTreeNode reportNode in setNode.Nodes)
                                {
                                    if (reportNode.ReportInfo.ID == report.ReportInfo.ID)
                                    {
                                        reportFound = true;
                                        break;
                                    }
                                }

                                if (!reportFound)
                                {
                                    saveButton.Enabled = true;
                                    ReportTreeNode tempReport = new ReportTreeNode(report.ReportInfo, true);
                                    setNode.Nodes.Add(tempReport);
                                    setNode.Expand();
                                }
                                break;
                            }
                        }

                        // If ReportSet is not in group, we need to create and add it to the group node
                        //  then create and add the Report Node to the ReportSet.
                        if (!setFound)
                        {
                            saveButton.Enabled = true;
                            ReportSetTreeNode setTreeNode = CreateReportSetTreeNode(reportType);
                            setTreeNode.Nodes.Add(new ReportTreeNode(report.ReportInfo, true));
                            customReportTreeView.SelectedNode.Nodes.Add(setTreeNode);
                            setTreeNode.Expand();
                        }
                    }
                }
                customReportTreeView.SelectedNode.Expand();
            }
            // Uncheck all boxes
            foreach (TreeNode node in predefinedReportTreeView.Nodes)
            {
                if (node.Checked)
                {
                    node.Checked = false;
                }
                else
                {
                    foreach (TreeNode treeNode in node.Nodes)
                    {
                        if (treeNode.Checked)
                        {
                            treeNode.Checked = false;
                        }
                    }
                }
            }
        }