C2018-033 added enum lists for the date/time formats to use for a PDF prefix or suffix
C2018-033 added logic to save selected prefix and suffix date/time format to the config
This commit is contained in:
		| @@ -89,6 +89,74 @@ namespace VEPROMS.CSLA.Library | ||||
| 			[Description("Quad Column")] | ||||
| 			FourColumns | ||||
| 		} | ||||
| 	// C2018-033 PDF file date/time Prefix formats | ||||
| 	/// <summary> | ||||
| 	///          The description is used in the drop down list | ||||
| 	///					 The enum is the date/time format that is used as a parameter for dts.ToString() to generate the desired format | ||||
| 	///           A "__" will be replaced with a space, a "_" will be replaced with a dash before giving it to ToString(). | ||||
| 	///					 This is used in DlgPrintProcedure.cs BuildPDFFileName() | ||||
| 	///           date/time formating: | ||||
| 	///						yyyy will give a four digit year | ||||
| 	///						MM will give a two digit month | ||||
| 	///						dd will give a two digit day | ||||
| 	///						HH will give a two digit hour (military time) | ||||
| 	///						mm will give a two digit minutes | ||||
| 	///					  ss will give a two digit sections (but it was decided seconds was not needed so we are not using this) | ||||
| 	/// </summary> | ||||
| 		[TypeConverter(typeof(EnumDescConverter))] | ||||
| 		public enum PDFDTPrefix : int | ||||
| 		{ | ||||
| 			[Description("Use Text Instead")] | ||||
| 			None = 0, | ||||
| 			[Description("Yr-Mt-Dy")] | ||||
| 			yyyy_MM_dd, | ||||
| 			[Description("Dy-Mt-Yr")] | ||||
| 			dd_MM_yyyy, | ||||
| 			[Description("Yr-Mt-Dy HrMn")] | ||||
| 			yyyy_MM_dd__HHmm, | ||||
| 			[Description("Dy-Mt-Yr HrMn")] | ||||
| 			dd_MM_yyyy__HHmm, | ||||
| 			[Description("Mt-Dy-Yr HrMn")] | ||||
| 			MM_dd_yyyy__HHmm, | ||||
| 			[Description("HrMn")] | ||||
| 			HHmm, | ||||
| 			[Description("HrMn Yr-Mt-Dy")] | ||||
| 			HHmm__yyyy_MM_dd | ||||
| 			} | ||||
| 	// C2018-033 PDF file date/time Suffix formats | ||||
| 		/// <summary> | ||||
| 		///          The description is used in the drop down list | ||||
| 		///					 The enum is the date/time format that is used as a parameter for dts.ToString() to generate the desired format | ||||
| 		///           A "__" will be replaced with a space, a "_" will be replaced with a dash before giving it to ToString(). | ||||
| 		///					 This is used in DlgPrintProcedure.cs BuildPDFFileName() | ||||
| 		///           date/time formating: | ||||
| 		///						yyyy will give a four digit year | ||||
| 		///						MM will give a two digit month | ||||
| 		///						dd will give a two digit day | ||||
| 		///						HH will give a two digit hour (military time) | ||||
| 		///						mm will give a two digit minutes | ||||
| 		///					  ss will give a two digit sections (but it was decided seconds was not needed so we are not using this) | ||||
| 		/// </summary> | ||||
| 		[TypeConverter(typeof(EnumDescConverter))] | ||||
| 		public enum PDFDTSuffix : int | ||||
| 		{ | ||||
| 			[Description("Use Text Instead")] | ||||
| 			None = 0, | ||||
| 			[Description("Yr-Mt-Dy")] | ||||
| 			yyyy_MM_dd, | ||||
| 			[Description("Dy-Mt-Yr")] | ||||
| 			dd_MM_yyyy, | ||||
| 			[Description("Yr-Mt-Dy HrMn")] | ||||
| 			yyyy_MM_dd__HHmm, | ||||
| 			[Description("Dy-Mt-Yr HrMn")] | ||||
| 			dd_MM_yyyy__HHmm, | ||||
| 			[Description("Mt-Dy-Yr HrMn")] | ||||
| 			MM_dd_yyyy__HHmm, | ||||
| 			[Description("HrMn")] | ||||
| 			HHmm, | ||||
| 			[Description("HrMn Yr-Mt-Dy")] | ||||
| 			HHmm__yyyy_MM_dd | ||||
| 		} | ||||
| 		// | ||||
| 	//} | ||||
| } | ||||
|   | ||||
| @@ -935,6 +935,84 @@ namespace VEPROMS.CSLA.Library | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		// C2018-033 the Prefix date/time format is in the config | ||||
| 		[Category("Print Settings")] | ||||
| 		[DisplayName("PDFdtFilePrefix")] | ||||
| 		[RefreshProperties(RefreshProperties.All)] | ||||
| 		[Description("PDF File Date Time Prefix")] | ||||
| 		public PDFDTPrefix Print_PDFdtFilePrefix | ||||
| 		{ | ||||
| 			get | ||||
| 			{ | ||||
| 				string s = _Xp["PrintSettings", "PDFdtFilePrefix"]; | ||||
|  | ||||
| 				//If there is no value to get, then get the parent value (a.k.a. default value). | ||||
| 				if (s == string.Empty) | ||||
| 					s = _Xp.ParentValue("PrintSettings", "PDFdtFilePrefix"); // get the parent value | ||||
| 				// If there is no parent value, then use the volian default | ||||
| 				if (s == string.Empty) | ||||
| 					return PDFDTPrefix.None;// default to volian default | ||||
|  | ||||
| 				return (PDFDTPrefix)int.Parse(s); | ||||
| 			} | ||||
| 			set | ||||
| 			{ | ||||
| 				// if value being saved is same as the parent value, then clear the value (save blank).  This will | ||||
| 				// reset the data to use the parent value. | ||||
|  | ||||
| 				string parval = _Xp.ParentValue("PrintSettings", "PDFdtFilePrefix"); // get the parent value | ||||
|  | ||||
| 				if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default | ||||
| 					parval = ((int)(PDFDTPrefix.None)).ToString(); | ||||
|  | ||||
| 				if (parval.Equals(((int)value).ToString())) | ||||
| 					_Xp["PrintSettings", "PDFdtFilePrefix"] = string.Empty; // reset to parent value | ||||
| 				else | ||||
| 					_Xp["PrintSettings", "PDFdtFilePrefix"] = ((int)value).ToString(); // save selected value | ||||
|  | ||||
| 				OnPropertyChanged("Print_PDFdtFilePrefix"); | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		// C2018-033 the Suffix date/time format is in the config | ||||
| 		[Category("Print Settings")] | ||||
| 		[DisplayName("PDFdtFileSuffix")] | ||||
| 		[RefreshProperties(RefreshProperties.All)] | ||||
| 		[Description("PDF File Date Time Suffix")] | ||||
| 		public PDFDTSuffix Print_PDFdtFileSuffix | ||||
| 		{ | ||||
| 			get | ||||
| 			{ | ||||
| 				string s = _Xp["PrintSettings", "PDFdtFileSuffix"]; | ||||
|  | ||||
| 				//If there is no value to get, then get the parent value (a.k.a. default value). | ||||
| 				if (s == string.Empty) | ||||
| 					s = _Xp.ParentValue("PrintSettings", "PDFdtFileSuffix"); // get the parent value | ||||
| 				// If there is no parent value, then use the volian default | ||||
| 				if (s == string.Empty) | ||||
| 					return PDFDTSuffix.None;// default to volian default | ||||
|  | ||||
| 				return (PDFDTSuffix)int.Parse(s); | ||||
| 			} | ||||
| 			set | ||||
| 			{ | ||||
| 				// if value being saved is same as the parent value, then clear the value (save blank).  This will | ||||
| 				// reset the data to use the parent value. | ||||
|  | ||||
| 				string parval = _Xp.ParentValue("PrintSettings", "PDFdtFileSuffix"); // get the parent value | ||||
|  | ||||
| 				if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default | ||||
| 					parval = ((int)(PDFDTSuffix.None)).ToString(); | ||||
|  | ||||
| 				if (parval.Equals(((int)value).ToString())) | ||||
| 					_Xp["PrintSettings", "PDFdtFileSuffix"] = string.Empty; // reset to parent value | ||||
| 				else | ||||
| 					_Xp["PrintSettings", "PDFdtFileSuffix"] = ((int)value).ToString(); // save selected value | ||||
|  | ||||
| 				OnPropertyChanged("Print_PDFdtFileSuffix"); | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		[Category("Print Settings")] | ||||
| 		[DisplayName("AlwaysOverwritePDF")] | ||||
| 		[RefreshProperties(RefreshProperties.All)] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user