void Fill(Theme theme)
        {
            foreach (Language language in theme.Languages)
            {
                listLang.Items.Add(language);
                BitArray ba = new BitArray(ColumnsHelper.GetColumns().Count(), false);

                foreach (IColumn column in language.VisibleColumns)
                {
                    ba[column.Index] = true;
                }

                columns.Add(language, ba);
            }

            int y = 47;

            foreach (IColumn column in theme.Languages.First().Columns)
            {
                KryptonCheckBox check = new KryptonCheckBox();
                check.Text            = column.Name;
                check.Location        = new Point(145, y);
                check.CheckedChanged += ColumnCheckedChanged;
                check.Tag             = column;
                check.Enabled         = false;
                Controls.Add(check);
                y += 22;
            }

            if (listLang.Items.Count > 0)
            {
                listLang.SelectedIndex = 0;
            }
        }
Exemple #2
0
        public FormattedPlanSheetBuilder(string sheetName, ExportPlanRequest exportPlanRequest)
            : base(sheetName)
        {
            _exportPlanRequest = exportPlanRequest;
            _viewMode          = exportPlanRequest.ViewMode;

            _chartData = JsonConvert.DeserializeObject <ChartData>(exportPlanRequest.Chart.Version.JsonData,
                                                                   new JsonSerializerSettings
            {
                StringEscapeHandling =
                    StringEscapeHandling.EscapeHtml,
                NullValueHandling     = NullValueHandling.Ignore,
                MissingMemberHandling =
                    MissingMemberHandling.Ignore
            });

            if (_chartData.Columns == null)
            {
                throw new ApplicationException("Please re-save plan before export");
            }

            _columnsHelper = new ColumnsHelper(_viewMode, _chartData.Columns);

            _planRows = new Dictionary <int, RowDefinition>();
        }
Exemple #3
0
        private byte[] GenareteDanfe(Rectangle format)
        {
            using (var memoryStream = new MemoryStream())
            {
                using (var pdfDocument = new BuilderDocument().Create(format).Standard())
                {
                    var pdfWriter = new BuilderPdfWriter().Create(pdfDocument, memoryStream);
                    var obj       = (TNfeProc)Helper.LoadXmltoStr(_xml.ReadToEnd(), VersaoNFe.v310, "TNfeProc");
                    var header    = new DanfeHeader(obj, _isHomolog);
                    pdfWriter.PageEvent = header;

                    pdfDocument.Open();

                    var relativeWidths = ColumnsHelper.GetRelativeColumnsForProducts(format);
                    var pdfTable       = new BuilderTable().Create(relativeWidths).Standard();

                    GetProducts(pdfTable, obj.NFe.infNFe.det);

                    pdfDocument.Add(pdfTable);

                    const float footerSize = 78f;
                    const float headerSize = 444f;
                    const float pageBorder = 40f;

                    var usedTotalSize            = (header.GetTotalPages() * headerSize) + pdfTable.TotalHeight + (header.GetTotalPages() * pageBorder);
                    var availableTotalSize       = PageSize.A4.Height * header.GetTotalPages();
                    var freeSpaceToEmptyProducts = (int)(availableTotalSize - (usedTotalSize + footerSize));

                    var pdfEmptyTable = new BuilderTable().Create(1).Standard();
                    pdfEmptyTable.AddCell(new BuilderCell().Create("").HorizontalCenter().VerticalCenter().FixedHeight(freeSpaceToEmptyProducts).BorderBuilder(true, true, true, true).Standard());

                    pdfDocument.Add(pdfEmptyTable);
                    header.SetLastPage();
                }

                var reportResult = new byte[memoryStream.Position];
                memoryStream.Position = 0;
                memoryStream.Read(reportResult, 0, reportResult.Length);
                return(reportResult);
            }
        }
        public bool ShowDialog(IWin32Window owner, int themeId)
        {
            using (ISession session = DataHelper.OpenSession())
            {
                using (ITransaction transaction = session.BeginTransaction())
                {
                    Theme theme = session.Get <Theme>(themeId);
                    Fill(theme);
                    if (ShowDialog(owner) == DialogResult.OK)
                    {
                        try
                        {
                            Repository <Language> repo = new Repository <Language>(session);
                            foreach (Language language in theme.Languages)
                            {
                                foreach (IColumn c in language.Columns)
                                {
                                    ColumnsHelper.SetVisible(language, c.Index, columns[language][c.Index]);
                                }

                                repo.Update(language);
                            }

                            transaction.Commit();
                        }
                        catch (ADOException ex)
                        {
                            transaction.Rollback();
                            Trace.TraceError(ErrorHelper.Message(ex));
                            ErrorHelper.ShowDbError(this, ex);
                        }

                        return(true);
                    }
                }
            }

            return(false);
        }
Exemple #5
0
        //bool EnabledRender = true;

        //protected override bool ShouldRender()
        //{
        //    return EnabledRender;
        //}

        protected override Task OnParametersSetAsync()
        {
            //BlazorWindowHelper.BlazorTimeAnalyzer.LogAllAdd = true;

            bvgGrid = new BvgGrid
            {
                IsReady        = true,
                Name           = TableName,
                RowsTotalCount = SourceList.Count(),
                bvgSettings    = bvgSettings,
                AllProps       = typeof(TItem).GetProperties(BindingFlags.Public | BindingFlags.Instance),
                SortState      = Tuple.Create(false, new BvgColumn()),
            };


            bvgGrid.ColumnsOrderedList          = ColumnsHelper.GetColumnsOrderedList(bvgGrid);
            bvgGrid.ColumnsOrderedListFrozen    = bvgGrid.ColumnsOrderedList.Where(x => x.IsFrozen).ToArray();
            bvgGrid.ColumnsOrderedListNonFrozen = bvgGrid.ColumnsOrderedList.Where(x => x.IsFrozen == false).ToArray();


            ColProp[] c = bvgGrid.ColumnsOrderedList.Where(x => x.IsFrozen == false).ToArray();

            bvgGrid.NonFrozenColwidthSumsByElement = new int[c.Count()];
            int j = 0;

            for (int i = 0; i < c.Count(); i++)
            {
                j += c[i].ColWidth;
                bvgGrid.NonFrozenColwidthSumsByElement[i] = j;
            }

            c = null;


            SortedRowsList = SourceList.ToArray();

            return(base.OnParametersSetAsync());
        }
        public FileListViewModel(IWindowManager windowManager, IEventAggregator events, ISidebarViewModel sidebar = null)
        {
            Events = events;
            var entryHelper = new EntriesHelper <IEntryViewModel>(loadEntriesTask)
            {
                ClearBeforeLoad = false
            };

            ProcessedEntries = new EntriesProcessor <IEntryViewModel>(entryHelper, evm => evm.EntryModel);
            Columns          = new ColumnsHelper(ProcessedEntries,
                                                 (col, direction) =>
                                                 new EntryViewModelComparer(
                                                     col.Comparer != null ? col.Comparer : CurrentDirectory.Profile.GetComparer(col),
                                                     direction)
                                                 );
            Selection  = new ListSelector <IEntryViewModel, IEntryModel>(entryHelper);
            DropHelper = new FileListDropHelper(this);
            DragHelper = new FileListDragHelper(this);

            Selection.SelectionChanged += (o, e) =>
            { events.PublishOnUIThread(new SelectionChangedEvent(this, Selection.SelectedItems)); };

            if (events != null)
            {
                events.Subscribe(this);
            }

            Sidebar = sidebar ?? new SidebarViewModel(events);
            Sidebar.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "IsVisible")
                {
                    NotifyOfPropertyChange(() => ShowSidebar);
                }
            };
            Commands = new FileListCommandManager(this, windowManager, events, Selection, Sidebar.Commands);
        }
Exemple #7
0
        private void WriteMetaDataInCHM()
        {
            SetStatus("Writing Columns...");
            ColumnsHelper.WriteColumns();
            backgroundWorker2.ReportProgress(5, ObjectTypes.Columns);

            SetStatus("Writing ForeignKeys...");
            ForeignKeysHelper.WriteForeignKeys();
            backgroundWorker2.ReportProgress(10, ObjectTypes.ForeignKeys);

            SetStatus("Writing IndexColumns...");
            IndexColumnsHelper.WriteIndexColumns();
            backgroundWorker2.ReportProgress(15, ObjectTypes.IndexColumns);

            SetStatus("Writing Indexes...");
            IndexesHelper.WriteIndexes();
            backgroundWorker2.ReportProgress(20, ObjectTypes.Indexes);

            SetStatus("Writing Tables...");
            TablesHelper.WriteTables();
            backgroundWorker2.ReportProgress(25, ObjectTypes.Tables);

            SetStatus("Writing ViewColumns...");
            ViewColumnsHelper.WriteViewColumns();
            backgroundWorker2.ReportProgress(30, ObjectTypes.ViewColumns);

            SetStatus("Writing Views...");
            ViewsHelper.WriteViews();
            backgroundWorker2.ReportProgress(35, ObjectTypes.Views);

            SetStatus("Writing ProcedureParameters...");
            ProcedureParametersHelper.WriteProcedureParameters();
            backgroundWorker2.ReportProgress(40, ObjectTypes.ProcedureParameters);

            SetStatus("Writing Procedures...");
            ProceduresHelper.WriteProcedures();
            backgroundWorker2.ReportProgress(45, ObjectTypes.Procedures);

            SetStatus("Writing Triggers...");
            SMOHelper.TriggersHelper.WriteTriggers();
            backgroundWorker2.ReportProgress(50, ObjectTypes.Triggers);

            SetStatus("Writing UserDefinedDataTypes...");
            SMOHelper.UserDefinedDataTypesHelper.WriteUserDefinedDataTypes();
            backgroundWorker2.ReportProgress(55, ObjectTypes.UserDefinedDataTypes);

            SetStatus("Writing InstanceInformation...");
            InstanceInformationHelper.WriteInstanceInformation();
            backgroundWorker2.ReportProgress(60, ObjectTypes.InstanceInformation);

            SetStatus("Writing DataSourceInformation...");
            DataSourceInformationHelper.WriteDataSourceInformation();
            backgroundWorker2.ReportProgress(65, ObjectTypes.DataSourceInformation);

            SetStatus("Writing DataTypes...");
            DataTypesHelper.WriteDataTypes();
            backgroundWorker2.ReportProgress(70, ObjectTypes.DataTypes);

            SetStatus("Writing Restrictions...");
            RestrictionsHelper.WriteRestrictions();
            backgroundWorker2.ReportProgress(75, ObjectTypes.Restrictions);

            SetStatus("Writing ReservedWords...");
            ReservedWordsHelper.WriteReservedWords();
            backgroundWorker2.ReportProgress(80, ObjectTypes.ReservedWords);

            SetStatus("Writing Users...");
            UsersHelper.WriteUsers();
            backgroundWorker2.ReportProgress(85, ObjectTypes.Users);
        }
Exemple #8
0
        private void GetMetaData()
        {
            SetStatus("Fetching Columns...");
            ColumnsHelper.GetColumns();
            backgroundWorker1.ReportProgress(5, ObjectTypes.Columns);

            SetStatus("Fetching ForeignKeys...");
            ForeignKeysHelper.GetForeignKeys();
            backgroundWorker1.ReportProgress(10, ObjectTypes.ForeignKeys);

            SetStatus("Fetching IndexColumns...");
            IndexColumnsHelper.GetIndexColumns();
            backgroundWorker1.ReportProgress(15, ObjectTypes.IndexColumns);

            SetStatus("Fetching Indexes...");
            IndexesHelper.GetIndexes();
            backgroundWorker1.ReportProgress(20, ObjectTypes.Indexes);

            SetStatus("Fetching Tables...");
            TablesHelper.GetTables();
            backgroundWorker1.ReportProgress(25, ObjectTypes.Tables);

            SetStatus("Fetching ViewColumns...");
            ViewColumnsHelper.GetViewColumns();
            backgroundWorker1.ReportProgress(30, ObjectTypes.ViewColumns);

            SetStatus("Fetching Views...");
            ViewsHelper.GetViews();
            backgroundWorker1.ReportProgress(35, ObjectTypes.Views);

            SetStatus("Fetching ProcedureParameters...");
            ProcedureParametersHelper.GetProcedureParameters();
            backgroundWorker1.ReportProgress(40, ObjectTypes.ProcedureParameters);

            SetStatus("Fetching Procedures...");
            ProceduresHelper.GetProcedures();
            backgroundWorker1.ReportProgress(45, ObjectTypes.Procedures);

            SetStatus("Fetching Triggers...");
            SMOHelper.TriggersHelper.GetTriggers(Utility.DatabaseName);
            backgroundWorker1.ReportProgress(50, ObjectTypes.Triggers);

            SetStatus("Fetching UserDefinedDataTypes...");
            SMOHelper.UserDefinedDataTypesHelper.GetUserDefinedDataTypes(Utility.DatabaseName);
            backgroundWorker1.ReportProgress(55, ObjectTypes.UserDefinedDataTypes);

            SetStatus("Fetching InstanceInformation...");
            InstanceInformationHelper.GetInstanceInformation();
            backgroundWorker1.ReportProgress(60, ObjectTypes.InstanceInformation);

            SetStatus("Fetching DataSourceInformation...");
            DataSourceInformationHelper.GetDataSourceInformation();
            backgroundWorker1.ReportProgress(65, ObjectTypes.DataSourceInformation);

            SetStatus("Fetching DataTypes...");
            DataTypesHelper.GetDataTypes();
            backgroundWorker1.ReportProgress(70, ObjectTypes.DataTypes);

            SetStatus("Fetching Restrictions...");
            RestrictionsHelper.GetRestrictions();
            backgroundWorker1.ReportProgress(75, ObjectTypes.Restrictions);

            SetStatus("Fetching ReservedWords...");
            ReservedWordsHelper.GetReservedWords();
            backgroundWorker1.ReportProgress(80, ObjectTypes.ReservedWords);

            SetStatus("Fetching Users...");
            UsersHelper.GetUsers();
            backgroundWorker1.ReportProgress(85, ObjectTypes.Users);
        }
Exemple #9
0
        private void Reset(bool LoadColumnsFromSettings)
        {
            FirstLoad    = true;
            ActualRender = true;

            LastHorizontalSkip = -1;

            LastHorizontalScrollPosition = 0;


            if (bvgGrid != null)
            {
                bvgGridTransferableState = new BvgGridTransferableState <TItem>(bvgGrid);
            }
            else
            {
                bvgGridTransferableState = new BvgGridTransferableState <TItem>();
            }

            bvgGrid = new BvgGrid <TItem>
            {
                IsReady         = true,
                Name            = TableName,
                RowsTotalCount  = SourceList.Count(),
                bvgSettings     = bvgSettings,
                AllProps        = typeof(TItem).GetProperties(BindingFlags.Public | BindingFlags.Instance),
                HasMeasuredRect = bvgGridTransferableState.HasMeasuredRect,
                bvgSize         = bvgGridTransferableState.bvgSize,
            };

            bvgGrid.bvgModal.bvgGrid = bvgGrid;

            if (bvgGridTransferableState.ContaintState)
            {
                bvgGrid.cssHelper = bvgGridTransferableState.cssHelper;
            }

            if (bvgGridTransferableState.ContaintState && !LoadColumnsFromSettings)
            {
                bvgGrid.ColumnsOrderedList          = bvgGridTransferableState.ColumnsOrderedList;
                bvgGrid.ColumnsOrderedListFrozen    = bvgGridTransferableState.ColumnsOrderedListFrozen;
                bvgGrid.ColumnsOrderedListNonFrozen = bvgGridTransferableState.ColumnsOrderedListNonFrozen;
            }
            else
            {
                bvgGrid.ColumnsOrderedList = ColumnsHelper <TItem> .GetColumnsOrderedList(bvgGrid);

                bvgGrid.ColumnsOrderedListFrozen    = bvgGrid.ColumnsOrderedList.Where(x => x.IsFrozen).ToArray();
                bvgGrid.ColumnsOrderedListNonFrozen = bvgGrid.ColumnsOrderedList.Where(x => x.IsFrozen == false).ToArray();
            }


            bvgGrid.UpdateNonFrozenColwidthSumsByElement();

            if (bvgSettings.SortedColumn.Item1)
            {
                bvgGrid.SortState = Tuple.Create(bvgSettings.SortedColumn.Item1, bvgSettings.SortedColumn.Item2, bvgSettings.SortedColumn.Item3);


                if (bvgSettings.SortedColumn.Item3)
                {
                    SortedRowsList = GenericAdapter <TItem> .GetSortedRowsList(SourceList.AsQueryable(), bvgSettings.SortedColumn.Item2).ToArray();
                }
                else
                {
                    SortedRowsList = GenericAdapter <TItem> .GetSortedRowsList(SourceList.AsQueryable(), bvgSettings.SortedColumn.Item2 + " desc").ToArray();
                }
            }
            else
            {
                bvgGrid.SortState = Tuple.Create(false, string.Empty, false);

                SortedRowsList = SourceList.ToArray();
            }
        }