private void CancelFormatChanges() { if (cancelFormatChangesSimpleButton.Tag.ToString() == "New Format") { if (m_CurrentLotCodeFormat.Oid > 0) { m_CurrentLotCodeFormat.Delete(); } else { m_CurrentLotCodeFormat = null; } m_CurrentLotCodeSection = null; m_CurrentLotCodeSectionSettings = null; sectionSettingsPanelControl.Enabled = false; lotCodeFormatPreviewGroupControl.Enabled = false; formatNameTextEdit.EditValue = null; formatSectionsSpinEdit.EditValue = 1; formatWarningLabelControl.Visible = false; PrepareNewLotCodeSection(null); } else { BindLotCodeFormat(m_CurrentLotCodeFormat.Oid); } }
private void BindLotCodeFormat(int FormatID) { m_LotCodeSession.DropIdentityMap(); m_CurrentLotCodeFormat = m_LotCodeSession.GetObjectByKey <LotCodeFormats>(FormatID, true); formatNameTextEdit.EditValue = m_CurrentLotCodeFormat.FormatName; formatSectionsSpinEdit.EditValue = m_CurrentLotCodeFormat.Sections; formatWarningLabelControl.Visible = m_CurrentLotCodeFormat.FormatSections.Count == m_CurrentLotCodeFormat.Sections; PrepareNewLotCodeSection(1); }
private void deleteFormatSimpleButton_Click(object sender, EventArgs e) { DialogResult continueDelete = 0; if (m_CurrentLotCodeFormat == null) { return; } if (( from customersFormat in m_LotCodeSession.Query <Customers>() where customersFormat.DefaultLotCodeFormat.Oid == m_CurrentLotCodeFormat.Oid select customersFormat.CustomerID).Any() || ( from itemsFormat in m_LotCodeSession.Query <Items>() where itemsFormat.DefaultLotCodeFormat.Oid == m_CurrentLotCodeFormat.Oid select itemsFormat.ItemID).Any()) { continueDelete = MessageBox.Show("This Lot Code Format is used as a default format, are you sure you want to delete this Lot Code Format?", "Delete Lot Code Format", MessageBoxButtons.YesNo, MessageBoxIcon.Hand); } else { continueDelete = MessageBox.Show("Are you sure you want to delete this Lot Code Format?", "Delete Lot Code Format", MessageBoxButtons.YesNo, MessageBoxIcon.Hand); } if (continueDelete == DialogResult.No) { return; } m_CurrentLotCodeFormat.Delete(); if (m_CurrentLotCodeFormat.IsDeleted) { m_CurrentLotCodeFormat = null; m_CurrentLotCodeSectionSettings = null; sectionSettingsPanelControl.Enabled = false; lotCodeFormatPreviewGroupControl.Enabled = false; formatNameTextEdit.EditValue = null; formatSectionsSpinEdit.EditValue = 1; formatWarningLabelControl.Visible = false; PrepareNewLotCodeSection(null); CheckPermissions(); lotCodeFormatSectionsXpCollection.Reload(); sectionSettingsPanelControl.Enabled = false; lotCodeFormatPreviewGroupControl.Enabled = false; cancelFormatChangesSimpleButton.Enabled = false; saveFormatSimpleButton.Enabled = false; } else { MessageBox.Show("The Lot Code Format was not deleted.", "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void newLotCodeFormatSimpleButton_Click(object sender, EventArgs e) { m_CurrentLotCodeFormat = new LotCodeFormats(m_LotCodeSession); cancelFormatChangesSimpleButton.Tag = "New Format"; m_CurrentLotCodeSection = null; m_CurrentLotCodeSectionSettings = null; sectionSettingsPanelControl.Enabled = false; lotCodeFormatPreviewGroupControl.Enabled = false; formatNameTextEdit.EditValue = null; formatSectionsSpinEdit.EditValue = 1; formatWarningLabelControl.Visible = false; formatNameTextEdit.ReadOnly = false; formatSectionsSpinEdit.ReadOnly = false; PrepareNewLotCodeSection(null); CheckPermissions(); cancelFormatChangesSimpleButton.Enabled = true; saveFormatSimpleButton.Enabled = true; editLotCodeFormatSimpleButton.Enabled = false; newLotCodeFormatSimpleButton.Enabled = false; lotCodeFormatSectionsGridControl.Enabled = false; }