예제 #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (!IsPrint)
            {
                dynamic d = GridPrint.DataContext;

                CardConsumePwdWindow ncw = new CardConsumePwdWindow(uow, d.Id);
                if (ncw.ShowDialog().GetValueOrDefault())
                {
                    txtDeskNo.Text  = ncw.txtDeskNo.Text;
                    txtDeskNo2.Text = ncw.txtDeskNo.Text;
                    txtCount.Text   = Convert.ToString(d.Count);
                }
                else
                {
                    this.Close();
                }

                NoMemberCashWindow ncw1 = new NoMemberCashWindow(d.Amount);
                ncw1.txtDeskNo.Text = txtDeskNo.Text;
                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();
                    txtDeskNo.Text = ncw1.txtDeskNo.Text;
                }
                else
                {
                    this.Close();
                }
            }
        }
예제 #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (!IsPrint)
            {
                dynamic d = GridPrint.DataContext;

                CardConsumePwdWindow ncw = new CardConsumePwdWindow(uow, d.Id);
                if (ncw.ShowDialog().GetValueOrDefault())
                {
                    txtDeskNo.Text = ncw.txtDeskNo.Text;
                }
                else
                {
                    this.Close();
                }
            }
        }