Пример #1
0
        private void DeleteDrugType()
        {
            if (categoryBindingSource == null)
            {
                return;
            }
            var dResult = MessageBox.Show(@"Delete current record?", @"Delete", MessageBoxButtons.YesNo,
                                          MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (dResult == DialogResult.Yes)
            {
                if (DrugTypeManager.Delete(((DrugType)drugTypeBindingSource.Current).DrugTypeId))
                {
                    MessageBox.Show(@"Record was deleted successfully.", @"Delete", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                    drugTypeBindingSource.RemoveCurrent();
                }
                else
                {
                    MessageBox.Show(@"Error on delete operation.", @"Delete", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    drugTypeDataGridView.Focus();
                }
            }
        }
Пример #2
0
 private void InitRecord()
 {
     Cursor.Current = Cursors.WaitCursor;
     supplierBindingSource.DataSource = SupplierManager.GetAll();
     categoryBindingSource.DataSource = CategoryManager.GetAll();
     drugTypeBindingSource.DataSource = DrugTypeManager.GetAll();
     Cursor.Current = Cursors.Default;
 }
Пример #3
0
 private void InitRecords()
 {
     Cursor.Current = Cursors.WaitCursor;
     categoryBindingSource.DataSource   = CategoryManager.GetAll();
     unitBindingSource.DataSource       = UnitManager.GetAll();
     drugTypeBindingSource.DataSource   = DrugTypeManager.GetAll();
     packingBindingSource.DataSource    = PackingManager.GetAll();
     voidReasonBindingSource.DataSource = VoidReasonManager.GetAll();
     Cursor.Current = Cursors.Default;
 }
Пример #4
0
        private void InitRecord()
        {
            Cursor.Current = Cursors.WaitCursor;
            supplierBindingSource.DataSource = SupplierManager.GetAll();
            categoryBindingSource.DataSource = CategoryManager.GetAll();
            unitBindingSource.DataSource     = UnitManager.GetAll();
            drugTypeBindingSource.DataSource = DrugTypeManager.GetAll();
            packingBindingSource.DataSource  = PackingManager.GetAll();

            _listProducts = ProductManager.GetAll();
            productBindingSource.DataSource = _listProducts;
            Cursor.Current = Cursors.Default;
        }
Пример #5
0
        private void drugTypeDataGridView_RowLeave(object sender, DataGridViewCellEventArgs e)
        {
            if (drugTypeBindingSource == null)
            {
                return;
            }
            if (drugTypeDataGridView.Rows.Count <= 1)
            {
                return;
            }
            if (!drugTypeDataGridView.IsCurrentRowDirty)
            {
                return;
            }
            Validate();
            drugTypeBindingSource.EndEdit();
            var iResult = DrugTypeManager.Save((DrugType)drugTypeBindingSource.Current);

            toolStripStatusLabel1.Text = iResult > 0 ? @"Drug Type saved successfully." : @"Error occurred when saving Unit.";
        }