GetStatusString() public static method

public static GetStatusString ( MappingStatus s ) : string
s MappingStatus
return string
コード例 #1
0
        private void RenderTableMappings(Zetbox.App.SchemaMigration.StagingDatabase s)
        {
            var p = Section.AddParagraph(s.Description);
            var t = NewTable();

            t.AddColumn("1cm");
            t.AddColumn("4.5cm");
            t.AddColumn("4.5cm");
            t.AddColumn("4.5cm");
            t.AddColumn("1.5cm");

            var r = t.AddRow();

            r.Cells[0].AddParagraph("Stat.").Style       = styleTableHeader;
            r.Cells[1].AddParagraph("Src Table").Style   = styleTableHeader;
            r.Cells[2].AddParagraph("Dest Class").Style  = styleTableHeader;
            r.Cells[3].AddParagraph("Description").Style = styleTableHeader;
            r.Cells[4].AddParagraph("%").Style           = styleTableHeader;

            foreach (var c in s.SourceTables.OrderBy(i => i.Name))
            {
                r = t.AddRow();
                r.Cells[0].AddParagraph(ReportHelper.GetStatusString(c.Status));
                r.Cells[1].AddParagraph(c.Name ?? string.Empty);
                r.Cells[2].AddParagraph(c.DestinationObjectClass != null ? c.DestinationObjectClass.Name : string.Empty);
                r.Cells[3].AddParagraph(c.Description ?? string.Empty);

                if (c.Status != MappingStatus.Ignored)
                {
                    var cols_ok = c.SourceColumn.Count(i => i.Status.HasValue && i.Status.In(MappingStatus.Mapped, MappingStatus.CustomSource, MappingStatus.Ignored));
                    r.Cells[4].AddParagraph((c.SourceColumn.Count > 0 ? (100 * cols_ok / c.SourceColumn.Count) : 0).ToString() + " %")
                    .Format.Alignment = ParagraphAlignment.Right;
                }
                else
                {
                    r.Cells[4].AddParagraph("-");
                }
            }

            p = Section.AddParagraph();
            p.Format.SpaceAfter = "1cm";
        }
コード例 #2
0
        private void RenderColumnMappings()
        {
            NewHeading2("Summary");
            var t = NewTable();

            t.AddColumn("1cm");
            t.AddColumn("4cm");
            t.AddColumn("4cm");
            t.AddColumn("7cm");

            var r = t.AddRow();

            r.Cells[0].AddParagraph("Stat.").Style       = styleTableHeader;
            r.Cells[1].AddParagraph("Src Name").Style    = styleTableHeader;
            r.Cells[2].AddParagraph("Dest Name").Style   = styleTableHeader;
            r.Cells[3].AddParagraph("Description").Style = styleTableHeader;

            foreach (var c in _obj.SourceColumn.OrderBy(i => i.Name))
            {
                r = t.AddRow();
                r.Cells[0].AddParagraph(ReportHelper.GetStatusString(c.Status));
                r.Cells[1].AddParagraph(c.Name ?? string.Empty);
                r.Cells[2].AddParagraph(c.DestinationProperty.Count > 0 ? c.DestinationProperty.Last().Name : string.Empty);
                r.Cells[3].AddParagraph(c.Description ?? string.Empty);
            }

            foreach (var c in _obj.SourceColumn.Where(i => i.Status != MappingStatus.Ignored).OrderBy(i => i.Name))
            {
                NewHeading2(string.Format("{1}Column {0}", c.Name, c.Status == MappingStatus.Questions ? "** " : string.Empty));
                if (!string.IsNullOrEmpty(c.Description))
                {
                    Section.AddParagraph(c.Description).Format.SpaceAfter = "0.5cm";
                }
                t = NewTable();

                t.AddColumn("6cm");
                t.AddColumn("10cm");

                r = t.AddRow();
                r.Cells[0].AddParagraph("Status");
                r.Cells[1].AddParagraph(c.Status.HasValue ? c.Status.Value.ToString() : string.Empty);

                r = t.AddRow();
                r.Cells[0].AddParagraph("Source Name");
                r.Cells[1].AddParagraph(c.Name ?? string.Empty);

                r = t.AddRow();
                r.Cells[0].AddParagraph("Dest Name");
                r.Cells[1].AddParagraph(c.DestinationProperty.Count > 0 ? c.DestinationProperty.Last().Name : string.Empty);

                r = t.AddRow();
                r.Cells[0].AddParagraph("Source Type");
                r.Cells[1].AddParagraph(c.DbType.ToString());

                r = t.AddRow();
                r.Cells[0].AddParagraph("Dest Type");
                r.Cells[1].AddParagraph(c.DestinationProperty.Count > 0 ? c.DestinationProperty.Last().GetPropertyTypeString() : string.Empty);

                r = t.AddRow();
                r.Cells[0].AddParagraph("IsNullable");
                r.Cells[1].AddParagraph((c.IsNullable ?? true).ToString());

                r = t.AddRow();
                r.Cells[0].AddParagraph("Size");
                r.Cells[1].AddParagraph(c.Size.ToString());

                if (!string.IsNullOrEmpty(c.Comment))
                {
                    Section.AddParagraph(c.Comment).Format.SpaceBefore = "0.5cm";
                }

                if (c.EnumEntries.Count > 0)
                {
                    var p = Section.AddParagraph("Enum Mapping");
                    p.Format.Font.Italic = true;
                    p.Format.SpaceBefore = "0.5cm";
                    p.Format.SpaceAfter  = "0.5cm";
                    t = NewTable();

                    t.AddColumn("6cm");
                    t.AddColumn("10cm");

                    r = t.AddRow();
                    r.Cells[0].AddParagraph("Src. Value").Style  = styleTableHeader;
                    r.Cells[1].AddParagraph("Dest. Value").Style = styleTableHeader;

                    foreach (var e in c.EnumEntries)
                    {
                        r = t.AddRow();
                        r.Cells[0].AddParagraph(e.SourceValue);
                        r.Cells[1].AddParagraph(e.DestinationValue.Name + (string.IsNullOrEmpty(e.DestinationValue.Description) ? ", " + e.DestinationValue.Description : string.Empty));
                    }
                }
            }
        }