Beispiel #1
0
 protected override void RegisterUIEvent()
 {
     BtnReturn.AddCallback(() =>
     {
         UIMgr.Push <LevelPanel>();
     });
 }
        private void DgvOrders_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)//select the order to returning
        {
            int id = Convert.ToInt32(DgvOrders.Rows[e.RowIndex].Cells[0].Value);

            _selectedIndex = e.RowIndex;
            _SelectedOrder = _orderService.Find(id);
            //actions done when order is not returned
            if (_SelectedOrder.Returned == false)
            {
                TxtReturningBook.Text = _SelectedOrder.Book.Title;
                if ((DateTime.Now - _SelectedOrder.OrderDate).Days < 1)
                {
                    BtnReturn.Hide();
                    BtnCancel.Show();
                }
                else if ((DateTime.Now - _SelectedOrder.MustReturnAt).Days > 0)
                {
                    decimal Payment = (_SelectedOrder.Cost + ((DateTime.Now - _SelectedOrder.MustReturnAt).Days) * (_SelectedOrder.Cost * 5 / 1000));
                    TxtPayment.Text = Payment.ToString();
                    BtnReturn.Show();
                    BtnCancel.Hide();
                }
                else
                {
                    TxtPayment.Text = _SelectedOrder.Cost.ToString();
                    BtnReturn.Show();
                    BtnCancel.Hide();
                }
                return;
            }
            MessageBox.Show("This Book Is already Returned");
            TxtPayment.Text       = string.Empty;
            TxtReturningBook.Text = string.Empty;
        }
Beispiel #3
0
 private void BtnOrder_Click(object sender, EventArgs e)
 {
     DgvAllOrders.Rows.Clear();
     FillAllOrders();
     GrpSearch.Hide();
     GrbReportRange.Show();
     BtnNewOrder.Hide();
     BtnReturn.Hide();
     PnlPaymentInfo.Hide();
 }
        private void DgvClientsSearch_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)//select client to add or return order
        {
            BtnAdd.Show();
            BtnReturn.Show();
            int index = Convert.ToInt32(DgvClientsSearch.Rows[e.RowIndex].Cells[0].Value);

            selectedClient = _clientService.Find(index);
            if (selectedClient.isActive == false)
            {
                BtnAdd.Hide();
            }
        }
        private void DgvOrders_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int id = Convert.ToInt32(DgvOrders.Rows[e.RowIndex].Cells[0].Value);

            _selectedIndex = e.RowIndex;

            _selectedOrder = _orderService.Find(id);

            if (_selectedOrder.Returned == false)
            {
                TxtReturningBook.Text = _selectedOrder.Book.Name;
                if ((DateTime.Now - _selectedOrder.OrderDate).Days < 1)
                {
                    BtnReturn.Hide();
                    BtnCancel.Show();
                }
                else if ((DateTime.Now.Day - _selectedOrder.MustBeReturned.Day) > 0)
                {
                    decimal Payment = (_selectedOrder.Cost + (DateTime.Now.Day - _selectedOrder.MustBeReturned.Day) + (_selectedOrder.Cost * 5 / 100));

                    TxtPayment.Text = Payment.ToString();

                    BtnReturn.Show();
                    BtnCancel.Hide();
                }
                else
                {
                    TxtPayment.Text = _selectedOrder.Cost.ToString();
                    BtnReturn.Show();
                    BtnCancel.Hide();
                }
                return;
            }



            //TxtPayment.Text = string.Empty;
            //TxtReturningBook.Text = string.Empty;
            Reset();
        }