Beispiel #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (!IsPrint)
            {
                dynamic d = GridPrint.DataContext;
                if (!string.IsNullOrEmpty(d.CardPwd))
                {
                    DeskCardCashWindow ncw = new DeskCardCashWindow(uow, d.Id);
                    if (ncw.ShowDialog().GetValueOrDefault())
                    {
                        txtCount.Text = Convert.ToString(d.Count);
                        this.IsCancel = false;
                    }
                    else
                    {
                        this.IsCancel = true;
                        this.Close();
                    }
                }
                DeskNoMemberCashWindow ncw1 = new DeskNoMemberCashWindow(d.Amount);
                if (ncw1.ShowDialog().GetValueOrDefault())
                {
                    decimal dCash = 0;
                    try
                    {
                        if (!string.IsNullOrEmpty(ncw1.txtCash.Text))
                        {
                            dCash = Convert.ToDecimal(ncw1.txtCash.Text);
                        }
                        else
                        {
                            dCash = d.Amount;
                        }
                    }
                    catch
                    {
                        throw new ArgumentException("金额请输入数字");
                    }

                    if (dCash < d.Amount)
                    {
                        throw new ArgumentException("收的钱应不小于消费金额");
                    }

                    decimal dChange = 0;
                    dChange        = dCash - d.Amount;
                    txtCash.Text   = dCash.ToString();
                    txtChange.Text = dChange.ToString();
                    txtCount.Text  = Convert.ToString(d.Count);
                    this.IsCancel  = false;
                }
                else
                {
                    this.IsCancel = true;
                    this.Close();
                }
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (!IsPrint)
            {
                dynamic d = GridPrint.DataContext;

                DeskCardCashWindow ncw = new DeskCardCashWindow(uow, d.Id);
                if (ncw.ShowDialog().GetValueOrDefault())
                {
                    txtCount.Text = Convert.ToString(d.Count);
                    this.IsCancel = false;
                }
                else
                {
                    this.IsCancel = true;
                    this.Close();
                }
            }
        }