private void buttonOK_Click(object sender, EventArgs e) { ContractMove c = new ContractMove(); ObjectComboBox obj2 = (ObjectComboBox)comboBoxCellFrom.SelectedItem; c.StoreCellFromId = obj2.Id; ObjectComboBox obj4 = (ObjectComboBox)comboBoxCellTo.SelectedItem; c.StoreCellToId = obj4.Id; ObjectComboBox objPr = (ObjectComboBox)comboBoxProducts.SelectedItem; c.ProductId = objPr.Id; c.Amount = Int32.Parse(textBoxAmount.Text); c.Date = dateTimePicker1.Value.Date; if (Id == -1) { query.queryAddContractMove(c); } else { c.Id = Id; query.queryUpdateContractMove(c); } instance.refreshGrid(); this.Dispose(); }
private void addDataForUpdate() { ContractMove c = query.queryFindContractMoveById(Id); if (c == null) { return; } dateTimePicker1.Value = c.Date; comboBoxStorehouseFrom.SelectedValue = c.StoreCellFromObj.StorehouseId; addStorageCells((int)comboBoxStorehouseFrom.SelectedValue, comboBoxCellFrom); comboBoxCellFrom.SelectedValue = c.StoreCellFromId; comboBoxStorehouseTo.SelectedValue = c.StoreCellToObj.StorehouseId; comboBoxCellTo.SelectedValue = c.StoreCellToId; addStorageCells((int)comboBoxStorehouseTo.SelectedValue, comboBoxCellTo); comboBoxProducts.SelectedValue = c.ProductId; textBoxAmount.Text = c.Amount + ""; }