예제 #1
0
        public PopupPaymentEdit(DTO_Payment payment)
        {
            InitializeComponent();
            ID = payment.PaymentID;
            DataTable tb = bus.findPaymentbyID(payment.PaymentID);

            foreach (DataRow row in tb.Rows)
            {
                tbMoney.Text        = row["TotalAmount"].ToString();
                tbTime.Text         = row["Time"].ToString();
                tbEmployeeName.Text = row["EmployeeName"].ToString();
                tbDescription.Text  = row["Description"].ToString();
            }
        }
        public PopupPaymentDetail(DTO_Payment dto)
        {
            InitializeComponent();
            bus = new BUS_Payment();
            DataTable tb = bus.findPaymentbyID(dto.PaymentID);

            foreach (DataRow row in tb.Rows)
            {
                tbAmount.Text       = row["TotalAmount"].ToString();
                tbTime.Text         = row["Time"].ToString();
                tbPaymentID.Text    = row["PaymentID"].ToString();
                tbEmployeeName.Text = row["EmployeeName"].ToString();
                tbDescription.Text  = row["Description"].ToString();
            }
        }
예제 #3
0
        void findPayment()
        {
            DateTime timestart = new DateTime(01 / 01 / 2021);

            if (dpDateStart.SelectedDate != null)
            {
                timestart = (DateTime)dpDateStart.SelectedDate;
            }
            DateTime timeend = DateTime.Now;

            if (dpDateEnd.SelectedDate != null)
            {
                timeend = (DateTime)dpDateEnd.SelectedDate;
            }
            var       list      = new ObservableCollection <DTO_Payment>();
            DataTable temp      = bus.findPaymentbyID(tbNameFind.Text);
            int       rowNumber = Int32.Parse(tbNumPage.Text);
            int       count     = 1;

            foreach (DataRow row in temp.Rows)
            {
                string   id           = row["PaymentID"].ToString();
                float    money        = float.Parse(row["TotalAmount"].ToString());
                string   employeename = row["EmployeeName"].ToString();
                string   time         = row["Time"].ToString();
                DateTime timefind     = DateTime.ParseExact(time, "dd/MM/yyyy", null);
                if (count >= (rowNumber - 1) * limitRow + 1 && count <= rowNumber * limitRow)
                {
                    if (DateTime.Compare(timefind, timeend) <= 0 && DateTime.Compare(timefind, timestart) >= 0)
                    {
                        list.Add(new DTO_Payment()
                        {
                            PaymentID = id, Time = time, EmployeeID = employeename, TotalAmount = money
                        });
                        count++;
                    }
                }
                else
                {
                    count++;
                }
            }
            dgPayment.ItemsSource = list;
            find   = true;
            numRow = temp.Rows.Count;
            setNumPage();
        }