private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         var sale = _saleService.Get(_saleID);
         sale.SaleDate = dtNewDate.Value;
         _saleService.EditAsync(_saleID, sale);
         NewDate = dtNewDate.Value;
         DateUpdated();
         this.Close();
     }
     catch (Exception ex)
     {
         MetroMessageBox.Show(this, ex.Message, "Error");
     }
 }
示例#2
0
        private async void btnUpdateSaleDetails_Click(object sender, EventArgs e)
        {
            try
            {
                if (_saleID > 0)
                {
                    if (!_isFinishedSale)
                    {
                        if (VAlidateFields())
                        {
                            var posTransaction = await _saleService.GetAsync(_saleID);

                            posTransaction.Cost       = txtCost.Text;
                            posTransaction.CustomerID = customerID;
                            posTransaction.SIDR       = txtSIDR.Text;
                            posTransaction.SaleDate   = dtSalesTransactionDate.Value;
                            await _saleService.EditAsync(_saleID, posTransaction);

                            MetroMessageBox.Show(this, "Point of Sale Details has been updated", "Update Point of Sale Details", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "You cannot update a finished Point of Sale Transaction!", "Update Point of Sale Details", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MetroMessageBox.Show(this, "No Point of Sale Transaction is loaded!", "Update Point of Sale Details", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, ex.ToString());
            }
        }