Acme.Northwind.Install.nHydrateSetting.LoadHistory C# (CSharp) Method

LoadHistory() public method

public LoadHistory ( string text ) : void
text string
return void
		public void LoadHistory(string text)
		{
			this.History.Clear();
			if (!string.IsNullOrEmpty(text))
			{
				foreach (string dataRow in text.Split('^'))
				{
					string[] data = dataRow.Split('|');
					if (data.Length == 2)
					{
						try
						{
							this.History.Add(new HistoryItem() { PublishDate = DateTime.ParseExact(data[0], "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture), Version = data[1] });
						}
						catch { }
					}
				}
			}
		}

Usage Example

Exemplo n.º 1
0
		internal static void UpdateDatabaseMetaProperty(string connectionString, string propertyName, string propertyValue)
		{
			System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
			try
			{
				var settings = new nHydrateSetting();
				settings.Load(connectionString);
				switch (propertyName)
				{
					case "dbVersion":
						settings.dbVersion = propertyValue;
						break;
					case "LastUpdate":
						settings.LastUpdate = DateTime.Parse(propertyValue);
						break;
					case "ModelKey":
						settings.ModelKey = new Guid(propertyValue);
						break;
					case "History":
						settings.LoadHistory(propertyValue);
						break;
					default:
						throw new Exception("No property found!");
				}
				settings.Save(connectionString);
			}
			catch (Exception ex)
			{
				throw;
			}
			finally
			{
				if (conn != null)
					conn.Close();
			}

			//We no longer use extended properties
			if (CanUseExtendedProperty(connectionString))
			{
				if (ExtendedPropertyExists(connectionString, propertyName, string.Empty, string.Empty, string.Empty))
				{
					//UpdateExtendedProperty(connectionString, propertyName, propertyValue, string.Empty, string.Empty, string.Empty);
					DeleteExtendedProperty(connectionString, propertyName);
				}
				else
				{
					//InsertExtendedPropery(connectionString, propertyName, propertyValue, string.Empty, string.Empty, string.Empty);
				}
			}

		}
All Usage Examples Of Acme.Northwind.Install.nHydrateSetting::LoadHistory