private string GetPrefixText(PrefixSuffixType PrefixMode, string custom) { switch (PrefixMode) { case PrefixSuffixType.ApplicationYear: return(currentYear.ToString()); case PrefixSuffixType.ApplicationYearShort: return(currentYear.ToString().Substring(2)); case PrefixSuffixType.Custom: return(custom); } return(""); }
private string GetPrefixSuffixValue(PrefixSuffixType type, int year, string suffix) { switch (type) { case PrefixSuffixType.ApplicationYear: return(year != 0 ? year.ToString() : DateTime.Today.Year.ToString()); case PrefixSuffixType.ApplicationYearShort: return(year != 0 ? year.ToString().Substring(2) : DateTime.Today.Year.ToString().Substring(2)); default: return(suffix); } }
private void DisableControl() { bool hasPrefix = ckbPreEnable.Checked; bool isPrefixRO = ckbPreReadonly.Checked; PrefixSuffixType PrefixType = (PrefixSuffixType)cbbPreInit.SelectedIndex; cbbPreInit.Enabled = hasPrefix; ckbPreReadonly.Enabled = hasPrefix; txtPreSep.Enabled = hasPrefix; txtPreValue.Enabled = hasPrefix && PrefixType == PrefixSuffixType.Custom; bool hasSuffix = ckbSufEnable.Checked; bool isSuffixRO = ckbSufReadonly.Checked; PrefixSuffixType SuffixType = (PrefixSuffixType)cbbSufInit.SelectedIndex; cbbSufInit.Enabled = hasSuffix; ckbSufReadonly.Enabled = hasSuffix; txtSufSep.Enabled = hasSuffix; txtSufValue.Enabled = hasSuffix && SuffixType == PrefixSuffixType.Custom; }