private void productQuantityBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (productQuantityBindingSource == null)
            {
                return;
            }
            if (Product == null)
            {
                return;
            }
            Validate();
            ((ProductQuantity)productQuantityBindingSource.Current).ProductId = Product.ProductId;
            productQuantityBindingSource.EndEdit();
            var iResult = ProductQuantityManager.Save((ProductQuantity)productQuantityBindingSource.Current);

            if (iResult > 0)
            {
                MessageBox.Show(@"Record was successfully saved.", @"Save", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                productQuantityDateDateTimePicker.Focus();
            }
            else
            {
                MessageBox.Show(@"Error occurred in saving.", @"Save", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
        private void DeleteProductQuantity()
        {
            if (productQuantityBindingSource == null)
            {
                return;
            }
            var dResult = MessageBox.Show(@"Delete current record?", @"Delete", MessageBoxButtons.YesNo,
                                          MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (dResult == DialogResult.Yes)
            {
                if (ProductQuantityManager.Delete(((ProductQuantity)productQuantityBindingSource.Current).ProductQuantityId))
                {
                    MessageBox.Show(@"Record was deleted successfully.", @"Delete", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                    productQuantityBindingSource.RemoveCurrent();
                }
                else
                {
                    MessageBox.Show(@"Error on delete operation.", @"Delete", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    productQuantityDateDateTimePicker.Focus();
                }
            }
        }
Beispiel #3
0
 private void LoadProductQuantityRecord()
 {
     Cursor.Current = Cursors.WaitCursor;
     productQuantityBindingSource.DataSource = ProductQuantityManager.GetAll(_product.ProductId);
     Cursor.Current = Cursors.Default;
 }