public void Save(object sender, EventArgs e) { try { dataItemskryptonDataGridView.RefreshEdit(); if (Valid()) { this.Cursor = Cursors.WaitCursor; UpdateEntity(); if (m_stocktaking.ID == 0) { r_stocktaking.Save(m_stocktaking); } else { r_stocktaking.Update(m_stocktaking); } KryptonMessageBox.Show("Transaction '" + m_stocktaking.CODE + "' Record has been saved", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); //ClearForm(); textBoxCode.Text = m_stocktaking.CODE; setEnableForm(false); setEditMode(EditMode.View); textBoxCode.Focus(); this.Cursor = Cursors.Default; } } catch (Exception x) { KryptonMessageBox.Show(x.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { this.Cursor = Cursors.Default; } }
private void Create() { m_stockTaking.AMOUNT = 500000; m_stockTaking.CURRENCY = new Currency(1); m_stockTaking.EMPLOYEE = new Employee(1); m_stockTaking.EVENT_STATUS = EventStatus.Entry; m_stockTaking.NOTES = "test insert"; m_stockTaking.NOTICE_DATE = DateTime.Today; m_stockTaking.POSTED = false; m_stockTaking.STOCK_CARD_ENTRY_TYPE = StockCardEntryType.StockTaking; m_stockTaking.STOCK_TAKING_TYPE = StockTakingType.Adjustment; m_stockTaking.TRANSACTION_DATE = DateTime.Today; m_stockTaking.WAREHOUSE = new Warehouse(1); StockTakingItems it1 = new StockTakingItems(); it1.QYTAMOUNT = 3; it1.EVENT = m_stockTaking; it1.PART = new Part(9068); it1.PRICE = 100000; it1.STOCK_CARD_ENTRY_TYPE = StockCardEntryType.StockTaking; it1.TOTAL_AMOUNT = 300000; it1.UNIT = new Unit(1); it1.WAREHOUSE = new Warehouse(1); StockTakingItems it2 = new StockTakingItems(); it2.QYTAMOUNT = 2; it2.EVENT = m_stockTaking; it2.PART = new Part(9068); it2.PRICE = 50000; it2.STOCK_CARD_ENTRY_TYPE = StockCardEntryType.StockTaking; it2.TOTAL_AMOUNT = 200000; it2.UNIT = new Unit(1); it2.WAREHOUSE = new Warehouse(1); m_stockTaking.EVENT_ITEMS.Add(it1); m_stockTaking.EVENT_ITEMS.Add(it2); m_stRep.Save(m_stockTaking); }