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 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; }
private bool SaveSectionSettings() { if (sectionPositionSpinEdit.ReadOnly == false) { UpdateSectionPosition(m_CurrentLotCodeSection.SectionPosition, Convert.ToInt32(sectionPositionSpinEdit.Value)); m_CurrentLotCodeSection.SectionPosition = Convert.ToInt32(sectionPositionSpinEdit.Value); } m_CurrentLotCodeSection.SectionName = sectionNameTextEdit.Text; m_CurrentLotCodeSection.SectionType = (LotCodeSectionType)sectionTypeImageComboBoxEdit.EditValue; m_CurrentLotCodeSection.SectionLength = Convert.ToInt32(sectionLengthSpinEdit.Value); m_CurrentLotCodeSection.Save(); foreach (LotCodeSectionSettings setting in m_CurrentLotCodeSection.SectionSettings) { setting.Delete(); } if (lettersToSkipTextEdit.ReadOnly == false && lettersToSkipTextEdit.Enabled == true) { m_CurrentLotCodeSectionSettings = new LotCodeSectionSettings(m_LotCodeSession) { LotCodeSection = m_CurrentLotCodeSection, SettingName = "LettersToSkip", SettingValue = (lettersToSkipTextEdit.EditValue == null ? null : Convert.ToString(lettersToSkipTextEdit.EditValue)) }; m_CurrentLotCodeSectionSettings.Save(); } if (lettersToReplaceTextEdit.ReadOnly == false && lettersToReplaceTextEdit.Enabled == true) { m_CurrentLotCodeSectionSettings = new LotCodeSectionSettings(m_LotCodeSession) { LotCodeSection = m_CurrentLotCodeSection, SettingName = "LettersToReplace", SettingValue = (lettersToReplaceTextEdit.EditValue == null ? null : Convert.ToString(lettersToReplaceTextEdit.EditValue)) }; m_CurrentLotCodeSectionSettings.Save(); } if (replacementLettersTextEdit.ReadOnly == false && replacementLettersTextEdit.Enabled == true) { m_CurrentLotCodeSectionSettings = new LotCodeSectionSettings(m_LotCodeSession) { LotCodeSection = m_CurrentLotCodeSection, SettingName = "ReplacementLetters", SettingValue = (replacementLettersTextEdit.EditValue == null ? null : Convert.ToString(replacementLettersTextEdit.EditValue)) }; m_CurrentLotCodeSectionSettings.Save(); } if (firstMonthComboBoxEdit.ReadOnly == false && firstMonthComboBoxEdit.Enabled == true) { m_CurrentLotCodeSectionSettings = new LotCodeSectionSettings(m_LotCodeSession) { LotCodeSection = m_CurrentLotCodeSection, SettingName = "FirstMonth", SettingValue = (firstMonthComboBoxEdit.EditValue == null ? null : Convert.ToString(firstMonthComboBoxEdit.EditValue)) }; m_CurrentLotCodeSectionSettings.Save(); } if (firstYearTextEdit.ReadOnly == false && firstYearTextEdit.Enabled == true) { m_CurrentLotCodeSectionSettings = new LotCodeSectionSettings(m_LotCodeSession) { LotCodeSection = m_CurrentLotCodeSection, SettingName = "FirstYear", SettingValue = (firstYearTextEdit.EditValue == null ? null : Convert.ToString(firstYearTextEdit.EditValue)) }; m_CurrentLotCodeSectionSettings.Save(); } if (firstWeekOfYearImageComboBoxEdit.ReadOnly == false && firstWeekOfYearImageComboBoxEdit.Enabled == true) { m_CurrentLotCodeSectionSettings = new LotCodeSectionSettings(m_LotCodeSession) { LotCodeSection = m_CurrentLotCodeSection, SettingName = "FirstWeekOfYear", SettingValue = (firstWeekOfYearImageComboBoxEdit.EditValue == null ? null : Convert.ToString(firstWeekOfYearImageComboBoxEdit.EditValue)) }; m_CurrentLotCodeSectionSettings.Save(); } if (firstDayOfWeekImageComboBoxEdit.ReadOnly == false && firstDayOfWeekImageComboBoxEdit.Enabled == true) { m_CurrentLotCodeSectionSettings = new LotCodeSectionSettings(m_LotCodeSession) { LotCodeSection = m_CurrentLotCodeSection, SettingName = "FirstDayOfWeek", SettingValue = (firstDayOfWeekImageComboBoxEdit.EditValue == null ? null : Convert.ToString(firstDayOfWeekImageComboBoxEdit.EditValue)) }; m_CurrentLotCodeSectionSettings.Save(); } if (restartsOnTextEdit.ReadOnly == false && restartsOnTextEdit.Enabled == true) { m_CurrentLotCodeSectionSettings = new LotCodeSectionSettings(m_LotCodeSession) { LotCodeSection = m_CurrentLotCodeSection, SettingName = "RestartsOnThe", SettingValue = (restartsOnTextEdit.EditValue == null ? null : Convert.ToString(restartsOnTextEdit.EditValue)) }; m_CurrentLotCodeSectionSettings.Save(); } if (fromSpinEdit.ReadOnly == false && fromSpinEdit.Enabled == true) { m_CurrentLotCodeSectionSettings = new LotCodeSectionSettings(m_LotCodeSession) { LotCodeSection = m_CurrentLotCodeSection, SettingName = "NumberRangeFrom", SettingValue = (fromSpinEdit.EditValue == null ? null : Convert.ToString(fromSpinEdit.EditValue)) }; m_CurrentLotCodeSectionSettings.Save(); } if (toSpinEdit.ReadOnly == false && toSpinEdit.Enabled == true) { m_CurrentLotCodeSectionSettings = new LotCodeSectionSettings(m_LotCodeSession) { LotCodeSection = m_CurrentLotCodeSection, SettingName = "NumberRangeTo", SettingValue = (toSpinEdit.EditValue == null ? null : Convert.ToString(toSpinEdit.EditValue)) }; m_CurrentLotCodeSectionSettings.Save(); } return(true); }