public LastConnectionProtocolRow GetLastConnection(
            string machineName,
            string protocolType
            )
        {
            string clause = string.Join(" AND ", Lists.Of(
                                            DbTypeFn.AsSqlClausePair(),
                                            MachineNameFn.AsSqlClausePair()
                                            ));

            List <SQLiteParameter> parameters = Lists.Of(
                new SQLiteParameter(DbTypeFn, protocolType),
                new SQLiteParameter(MachineNameFn, machineName)
                );

            LastConnectionProtocolRow row =
                GetRows(
                    clause,
                    parameters
                    )
                .Select(RowConverter.Convert <LastConnectionProtocolRow>)
                .FirstOrDefault();

            return(row);
        }
		private void SaveLastConnection(
			long groupId,
			long templateId
		)
		{
			ConnectionType cnnType = SelectedConnectionType;

			if (cnnType != null)
			{
				string machineName = Environment.MachineName;

				LastConnectionProtocolRow lastConnectionProt = new LastConnectionProtocolRow
				{
					GroupId     = groupId,
					TemplateId  = templateId,
					MachineName = machineName,
					DbType      = cnnType.Id
				};

				long? lastConnectionId = this._storage.LastConnectionProtocolTable
					.SaveLastConnection(lastConnectionProt);

				if (lastConnectionId != null)
				{
					LastConnectionRow lastConnectionRow = new LastConnectionRow
					{
						MachineName              = machineName,
						LastConnectionProtocolId = lastConnectionId.Value
					};

					this._storage.LastConnectionTable
						.SaveLastConnection(lastConnectionRow);
				}
			}
		}
 public long? SaveLastConnection(LastConnectionProtocolRow row)
 {
     return this.InsertOrUpdateRow(row);
 }
 public long?SaveLastConnection(LastConnectionProtocolRow row)
 {
     return(this.InsertOrUpdateRow(row));
 }