예제 #1
0
        private IEnumerable <CommandButtonViewModel <PaymentType> > CreatePaymentButtons(ForeignCurrency foreignCurrency)
        {
            var result = new List <CommandButtonViewModel <PaymentType> >();

            if (_settleCommand != null)
            {
                result.Add(new CommandButtonViewModel <PaymentType>
                {
                    Caption = Resources.Settle,
                    Command = _settleCommand,
                });
            }

            var pts = foreignCurrency == null?PaymentTypes.Where(x => x.Account == null || x.Account.ForeignCurrencyId == 0) : PaymentTypes.Where(x => x.Account != null && x.Account.ForeignCurrencyId == foreignCurrency.Id);

            result.AddRange(pts
                            .OrderBy(x => x.Order)
                            .Select(x => new CommandButtonViewModel <PaymentType>
            {
                Caption   = x.Name.Replace(" ", "\r"),
                Command   = _makePaymentCommand,
                Color     = x.ButtonColor,
                Parameter = x
            }));

            if (_closeCommand != null)
            {
                result.Add(new CommandButtonViewModel <PaymentType>
                {
                    Caption = Resources.Close,
                    Command = _closeCommand,
                    Color   = "Red"
                });
            }
            return(result);
        }
예제 #2
0
 public string GetPaymentType(int?id)
 {
     return(id == null ? "" : PaymentTypes.Where(r => r.PaymentTypeID == id).Select(r => r.Name).FirstOrDefault());
 }