private void BindLocationControls(int locationID) { m_LocationSession.DropIdentityMap(); Locations location = m_LocationSession.GetObjectByKey <Locations>(locationID, true); m_CurrentLocation = location; oidTextEdit.EditValue = m_CurrentLocation.Oid; codeTextEdit.EditValue = m_CurrentLocation.LocationCode; codeTextEdit.Enabled = false; nameTextEdit.EditValue = m_CurrentLocation.LocationName; addressTextEdit.EditValue = m_CurrentLocation.LocationAddress; cityTextEdit.EditValue = m_CurrentLocation.LocationCity; stateTextEdit.EditValue = m_CurrentLocation.LocationState; zipCodeTextEdit.EditValue = m_CurrentLocation.LocationZipCode; phoneTextEdit.EditValue = m_CurrentLocation.LocationPhone; faxTextEdit.EditValue = m_CurrentLocation.LocationFax; receivingCheckEdit.EditValue = m_CurrentLocation.CanReceive; shippingCheckEdit.EditValue = m_CurrentLocation.CanShip; productionCheckEdit.EditValue = m_CurrentLocation.CanProduce; warehousingCheckEdit.EditValue = m_CurrentLocation.CanWarehouse; inventoryAvailableCheckEdit.EditValue = m_CurrentLocation.InventoryAvailable; defaultWarehouseCheckEdit.EditValue = LocationsBLL.IsDefaultLocation(m_CurrentLocation); BindLocationGridControls(locationID); transfersToGroupControl.Text = "Location Transfers To " + m_CurrentLocation.LocationCode; transfersFromGroupControl.Text = "Location Transfers From " + m_CurrentLocation.LocationCode; }
private void deleteBarButtonItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (MessageBox.Show("Are you sure you want to delete this location.", "Delete Location", MessageBoxButtons.YesNo, MessageBoxIcon.Hand) == DialogResult.No) { return; } if (LocationsBLL.DeleteLocation(m_CurrentLocation.Oid, m_LocationSession) != true) { MessageBox.Show("The location was not deleted.", "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { BindLocationSearch(); } }
private bool SaveChanges() { int selectedId = 0; if (m_CurrentLocation.Oid != -1) { selectedId = locationSearchGridView.FocusedRowHandle; } if (LocationsBLL.ValidateRecord(codeTextEdit.Text)) { m_CurrentLocation.LocationCode = codeTextEdit.Text; m_CurrentLocation.LocationName = nameTextEdit.Text; m_CurrentLocation.LocationAddress = addressTextEdit.Text; m_CurrentLocation.LocationCity = cityTextEdit.Text; m_CurrentLocation.LocationState = stateTextEdit.Text; m_CurrentLocation.LocationZipCode = zipCodeTextEdit.Text; m_CurrentLocation.LocationPhone = phoneTextEdit.Text; m_CurrentLocation.LocationFax = faxTextEdit.Text; m_CurrentLocation.CanReceive = receivingCheckEdit.Checked; m_CurrentLocation.CanShip = shippingCheckEdit.Checked; m_CurrentLocation.CanProduce = productionCheckEdit.Checked; m_CurrentLocation.CanWarehouse = warehousingCheckEdit.Checked; m_CurrentLocation.InventoryAvailable = inventoryAvailableCheckEdit.Checked; } else { MessageBox.Show("You must provide a location code before saving the record."); return(false); } try { m_CurrentLocation.Save(); } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } BindLocationSearch(); BindLocationControls(m_CurrentLocation.Oid); locationSearchGridView.FocusedRowHandle = selectedId; return(true); }