Пример #1
0
        private void SetupGrids()
        {
            var fontBold     = new Font(Font, FontStyle.Bold);
            var dataSpeciman = new AccountShared(new Account(), true);

            // счета
            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.AccountId), "#")
            {
                SortOrder   = FastColumnSort.Ascending,
                ColumnWidth = 60
            });
            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.IsOwnAccount), Localizer.GetString("TitleOwner"))
            {
                ColumnMinWidth = 60,
                formatter      = value => (bool)value ? Localizer.GetString("TitleYes") : ""
            });
            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.SharePercent), Localizer.GetString("TitlePercent"))
            {
                ColumnMinWidth = 75,
                formatter      = value =>
                {
                    var percent = ((decimal)value);
                    return(percent == 100 ? "100 %" : percent.ToString("f5") + "%");
                }
            });
            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.ShareMoneyWallet), Localizer.GetString("TitleSum"))
            {
                ColumnMinWidth = 75,
                formatter      = value => ((decimal)value).ToStringUniformMoneyFormat()
            });

            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.IsOwnAccount), Localizer.GetString("TitleChart"))
            {
                Tag                    = ColumnTagChart,
                ColumnMinWidth         = 60,
                ImageList              = imageListGridChart,
                IsHyperlinkStyleColumn = true,
                HyperlinkActiveCursor  = Cursors.Hand,
            });

            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.IsOwnAccount), Localizer.GetString("TitleDeposit"))
            {
                Tag                      = ColumnTagDeposit,
                SortOrder                = FastColumnSort.Ascending,
                ColumnWidth              = 70,
                IsHyperlinkStyleColumn   = true,
                HyperlinkActiveCursor    = Cursors.Hand,
                ColorHyperlinkTextActive = Color.Blue,
                HyperlinkFontActive      = fontBold,
                formatter                = valueObject => Localizer.GetString("TitleDeposit")
            });
            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.IsOwnAccount), Localizer.GetString("TitleWithdraw"))
            {
                Tag                      = ColumnTagWithdraw,
                SortOrder                = FastColumnSort.Ascending,
                ColumnWidth              = 63,
                IsHyperlinkStyleColumn   = true,
                HyperlinkActiveCursor    = Cursors.Hand,
                ColorHyperlinkTextActive = Color.Blue,
                HyperlinkFontActive      = fontBold,
                formatter                = valueObject => Localizer.GetString("TitleWithdraw")
            });
            gridAccount.UserHitCell += GridAccountOnUserHitCell;
            gridAccount.CheckSize();

            // подписки
            var blank = new Contract.Entity.Subscription();

            gridSubscription.Columns.Add(new FastColumn(blank.Property(p => p.PaidService), Localizer.GetString("TitleService"))
            {
                Tag                      = PaidServiceType.Signals,
                SortOrder                = FastColumnSort.Ascending,
                ColumnMinWidth           = 65,
                IsHyperlinkStyleColumn   = true,
                HyperlinkActiveCursor    = Cursors.Hand,
                ColorHyperlinkTextActive = Color.Blue,
                HyperlinkFontActive      = fontBold,
                formatter                = valueObject =>
                {
                    var srv = (PaidService)valueObject;
                    return(EnumFriendlyName <PaidServiceType> .GetString(srv.ServiceType) +
                           (string.IsNullOrEmpty(srv.Comment) ? "" : " (" + srv.Comment + ")"));
                }
            });
            gridSubscription.Columns.Add(new FastColumn(blank.Property(p => p.TimeStarted), Localizer.GetString("TitleBeginning"))
            {
                ColumnMinWidth = 75
            });
            gridSubscription.Columns.Add(new FastColumn(blank.Property(p => p.TimeEnd), Localizer.GetString("TitleEnd"))
            {
                ColumnMinWidth = 75
            });
            gridSubscription.Columns.Add(new FastColumn(blank.Property(p => p.PaidService), Localizer.GetString("TitleCost"))
            {
                ColumnMinWidth = 70,
                formatter      = valueObject =>
                {
                    var srv = (PaidService)valueObject;
                    if (srv.ServiceType == PaidServiceType.Signals)
                    {
                        return(srv.FixedPrice == 0
                                   ? "-"
                                   : srv.FixedPrice.ToStringUniformMoneyFormat(true) + " / " +
                               PaidService.GetMonthFeeFromDailyFee(srv.FixedPrice) + " " +
                               srv.Currency);
                    }
                    if (srv.ServiceType == PaidServiceType.PAMM)
                    {
                        if (srv.serviceRates.Count == 0)
                        {
                            return("-");
                        }
                        if (srv.serviceRates.Count == 1)
                        {
                            return(srv.serviceRates[0].Amount.ToStringUniformMoneyFormat(true) + "%");
                        }
                        return
                        (srv.serviceRates[srv.serviceRates.IndexOfMin(r =>
                                                                      r.Amount)].Amount.ToStringUniformMoneyFormat(true) + "% ... " +
                         srv.serviceRates[srv.serviceRates.IndexOfMin(r =>
                                                                      - r.Amount)].Amount.ToStringUniformMoneyFormat(true) + "%");
                    }
                    return("");
                }
            });
            gridSubscription.Columns.Add(new FastColumn(blank.Property(p => p.RenewAuto), Localizer.GetString("TitleProlong"))
            {
                ColumnWidth            = 61,
                formatter              = v => (bool)v ? Localizer.GetString("TitleProlong") : Localizer.GetString("TitleNo"),
                IsHyperlinkStyleColumn = true,
                HyperlinkActiveCursor  = Cursors.Hand,
                HyperlinkFontActive    = fontBold,
                Tag = true
            });
            gridSubscription.Columns.Add(new FastColumn(blank.Property(p => p.RenewAuto), Localizer.GetString("TitleTurnOff"))
            {
                ColumnWidth            = 57,
                ImageList              = imageListGrid,
                IsHyperlinkStyleColumn = true,
                HyperlinkActiveCursor  = Cursors.Hand
            });
            gridSubscription.UserHitCell += GridSubscriptionOnUserHitCell;
            gridSubscription.CheckSize();

            summaryTransfersFastGrid.Columns.Add(new FastColumn("a", " "));
            summaryTransfersFastGrid.Columns.Add(new FastColumn("b", Localizer.GetString("TitleTransactions")));
            summaryTransfersFastGrid.Columns.Add(new FastColumn("c", Localizer.GetString("TitleSum")));
        }
Пример #2
0
        private void SetupGrid()
        {
            var fontBold = new Font(Font, FontStyle.Bold);

            grid.Columns.Add(new FastColumn(emptySubs.Property(s => s.Title), Localizer.GetString("TitleSignal"))
            {
                ColumnMinWidth           = 150,
                SortOrder                = FastColumnSort.Descending,
                IsHyperlinkStyleColumn   = true,
                HyperlinkActiveCursor    = Cursors.Hand,
                ColorHyperlinkTextActive = Color.Blue,
                HyperlinkFontActive      = fontBold,
            });
            grid.Columns.Add(new FastColumn(emptySubs.Property(s => s.RenewAuto), Localizer.GetString("TitleProlong"))
            {
                ColumnWidth = 80,
                formatter   =
                    v => (bool)v ? Localizer.GetString("TitleAutomatically") : Localizer.GetString("TitleManually"),
                IsHyperlinkStyleColumn   = true,
                HyperlinkActiveCursor    = Cursors.Hand,
                ColorHyperlinkTextActive = Color.Blue,
                HyperlinkFontActive      = fontBold,
                SortOrder  = FastColumnSort.None,
                IsEditable = true
            });
            grid.Columns.Add(new FastColumn(emptySubs.Property(s => s.TradeAuto), Localizer.GetString("TitleTradeVerb"))
            {
                ColumnWidth = 100,
                formatter   =
                    v => (bool)v ? Localizer.GetString("TitleAutomatically") : Localizer.GetString("TitleManually"),
                colorColumnFormatter = (object value, out Color? color, out Color? fontColor) =>
                {
                    color     = null;
                    fontColor = ((bool)value) ? Color.Navy : Color.Black;
                },
                IsHyperlinkStyleColumn = true,
                SortOrder                = FastColumnSort.None,
                HyperlinkActiveCursor    = Cursors.Hand,
                ColorHyperlinkTextActive = Color.Blue,
                HyperlinkFontActive      = fontBold
            });
            grid.Columns.Add(new FastColumn(emptySubs.Property(s => s.TradeAuto), Localizer.GetString("TitleConfigure"))
            {
                Tag                    = contextMenu,
                ColumnWidth            = 70,
                IsHyperlinkStyleColumn = true,
                HyperlinkActiveCursor  = Cursors.Hand,
                ImageList              = imageListGlyph
            });
            grid.colorFormatter += (object value, out Color? color, out Color? fontColor) =>
            {
                color     = null;
                fontColor = null;
                var cat = (Contract.Entity.Subscription)value;
                // !
                //if (!cat.IsSubscriber && !cat.IsSignalMaker)
                {
                    // новодобавленная категория (не сохранена в БД)
                    //fontColor = Color.Maroon;
                }
            };

            grid.ColorAltCellBackground = Color.White;
            grid.UserHitCell           += GridUserHitCell;
            grid.CalcSetTableMinWidth();
        }
Пример #3
0
        private void SetupGrids()
        {
            var fontBold = new Font(Font, FontStyle.Bold);
            var dataSpeciman = new AccountShared(new Account(), true);

            // счета
            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.AccountId), "#")
            {
                SortOrder = FastColumnSort.Ascending,
                ColumnWidth = 60
            });
            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.IsOwnAccount), Localizer.GetString("TitleOwner"))
            {
                ColumnMinWidth = 60,
                formatter = value => (bool) value ? Localizer.GetString("TitleYes") : ""
            });
            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.SharePercent), Localizer.GetString("TitlePercent"))
            {
                ColumnMinWidth = 75,
                formatter = value =>
                    {
                        var percent = ((decimal) value);
                        return percent == 100 ? "100 %" : percent.ToString("f5") + "%";
                    }
            });
            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.ShareMoneyWallet), Localizer.GetString("TitleSum"))
            {
                ColumnMinWidth = 75,
                formatter = value => ((decimal) value).ToStringUniformMoneyFormat()
            });

            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.IsOwnAccount), Localizer.GetString("TitleChart"))
            {
                Tag = ColumnTagChart,
                ColumnMinWidth = 60,
                ImageList = imageListGridChart,
                IsHyperlinkStyleColumn = true,
                HyperlinkActiveCursor = Cursors.Hand,
            });

            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.IsOwnAccount), Localizer.GetString("TitleDeposit"))
            {
                Tag = ColumnTagDeposit,
                SortOrder = FastColumnSort.Ascending,
                ColumnWidth = 70,
                IsHyperlinkStyleColumn = true,
                HyperlinkActiveCursor = Cursors.Hand,
                ColorHyperlinkTextActive = Color.Blue,
                HyperlinkFontActive = fontBold,
                formatter = valueObject => Localizer.GetString("TitleDeposit")
            });
            gridAccount.Columns.Add(new FastColumn(dataSpeciman.Property(s => s.IsOwnAccount), Localizer.GetString("TitleWithdraw"))
            {
                Tag = ColumnTagWithdraw,
                SortOrder = FastColumnSort.Ascending,
                ColumnWidth = 63,
                IsHyperlinkStyleColumn = true,
                HyperlinkActiveCursor = Cursors.Hand,
                ColorHyperlinkTextActive = Color.Blue,
                HyperlinkFontActive = fontBold,
                formatter = valueObject => Localizer.GetString("TitleWithdraw")
            });
            gridAccount.UserHitCell += GridAccountOnUserHitCell;
            gridAccount.CheckSize();

            // подписки
            var blank = new Contract.Entity.Subscription();
            gridSubscription.Columns.Add(new FastColumn(blank.Property(p => p.PaidService), Localizer.GetString("TitleService"))
            {
                Tag = PaidServiceType.Signals,
                SortOrder = FastColumnSort.Ascending,
                ColumnMinWidth = 65,
                IsHyperlinkStyleColumn = true,
                HyperlinkActiveCursor = Cursors.Hand,
                ColorHyperlinkTextActive = Color.Blue,
                HyperlinkFontActive = fontBold,
                formatter = valueObject =>
                {
                    var srv = (PaidService) valueObject;
                    return EnumFriendlyName<PaidServiceType>.GetString(srv.ServiceType) +
                           (string.IsNullOrEmpty(srv.Comment) ? "" : " (" + srv.Comment + ")");
                }
            });
            gridSubscription.Columns.Add(new FastColumn(blank.Property(p => p.TimeStarted), Localizer.GetString("TitleBeginning")) { ColumnMinWidth = 75 });
            gridSubscription.Columns.Add(new FastColumn(blank.Property(p => p.TimeEnd), Localizer.GetString("TitleEnd")) { ColumnMinWidth = 75 });
            gridSubscription.Columns.Add(new FastColumn(blank.Property(p => p.PaidService), Localizer.GetString("TitleCost"))
            {
                ColumnMinWidth = 70,
                formatter = valueObject =>
                {
                    var srv = (PaidService) valueObject;
                    if (srv.ServiceType == PaidServiceType.Signals)
                        return srv.FixedPrice == 0
                                   ? "-"
                                   : srv.FixedPrice.ToStringUniformMoneyFormat(true) + " / " +
                                     PaidService.GetMonthFeeFromDailyFee(srv.FixedPrice) + " " +
                                     srv.Currency;
                    if (srv.ServiceType == PaidServiceType.PAMM)
                    {
                        if (srv.serviceRates.Count == 0) return "-";
                        if (srv.serviceRates.Count == 1)
                            return srv.serviceRates[0].Amount.ToStringUniformMoneyFormat(true) + "%";
                        return
                            srv.serviceRates[srv.serviceRates.IndexOfMin(r =>
                                r.Amount)].Amount.ToStringUniformMoneyFormat(true) + "% ... " +
                            srv.serviceRates[srv.serviceRates.IndexOfMin(r =>
                                -r.Amount)].Amount.ToStringUniformMoneyFormat(true) + "%";
                    }
                    return "";
                }
            });
            gridSubscription.Columns.Add(new FastColumn(blank.Property(p => p.RenewAuto), Localizer.GetString("TitleProlong"))
            {
                ColumnWidth = 61,
                formatter = v => (bool)v ? Localizer.GetString("TitleProlong") : Localizer.GetString("TitleNo"),
                IsHyperlinkStyleColumn = true,
                HyperlinkActiveCursor = Cursors.Hand,
                HyperlinkFontActive = fontBold,
                Tag = true
            });
            gridSubscription.Columns.Add(new FastColumn(blank.Property(p => p.RenewAuto), Localizer.GetString("TitleTurnOff"))
            {
                ColumnWidth = 57,
                ImageList = imageListGrid,
                IsHyperlinkStyleColumn = true,
                HyperlinkActiveCursor = Cursors.Hand
            });
            gridSubscription.UserHitCell += GridSubscriptionOnUserHitCell;
            gridSubscription.CheckSize();

            summaryTransfersFastGrid.Columns.Add(new FastColumn("a", " "));
            summaryTransfersFastGrid.Columns.Add(new FastColumn("b", Localizer.GetString("TitleTransactions")));
            summaryTransfersFastGrid.Columns.Add(new FastColumn("c", Localizer.GetString("TitleSum")));
        }