Skip to content

Commit

Permalink
Complex ads
Browse files Browse the repository at this point in the history
  • Loading branch information
ayende committed Jul 26, 2012
1 parent 6c61583 commit af3a7d4
Show file tree
Hide file tree
Showing 8 changed files with 234 additions and 36 deletions.
40 changes: 40 additions & 0 deletions MediaMind.Course/Controllers/AdController.cs
Expand Up @@ -7,6 +7,46 @@ namespace MediaMind.Course.Controllers
{
public class AdController : NHibernateController
{
public ActionResult NewAd()
{
var id = Session.Save(new Ad
{
Name = "Test Ad",
Data = new StandardBanner()
{
Size = "300x120",
SmartResource = 4
}
});

return Json(id);
}

public ActionResult ListAds()
{
var list = Session.Query<Ad>().ToList();

return Json(list.Select(x => new
{
x.Name,
x.Type,
x.Data.SmartResource
}).ToList());
}


public ActionResult ShowNewAd(long id)
{
var ad = Session.Get<Ad>(id);

return Json(new
{
ad.Name,
ad.Data.SmartResource,
((VideoStripImageAdData) ad.Data).DefaultImage
});
}

public ActionResult CreateCampaign()
{
var save = Session.Save(new Campaign
Expand Down
2 changes: 1 addition & 1 deletion MediaMind.Course/Controllers/NHibernateController.cs
Expand Up @@ -39,7 +39,7 @@ private static ISessionFactory CreateSessionFactory()
//cfg.SetNamingStrategy(new NamingConvention());
cfg.DataBaseIntegration(properties =>
{
properties.SchemaAction = SchemaAutoAction.Create;
//properties.SchemaAction = SchemaAutoAction.Validate;
properties.Dialect<NHibernate.Dialect.MsSql2008Dialect>();
properties.ConnectionStringName = Environment.MachineName;
});
Expand Down
4 changes: 4 additions & 0 deletions MediaMind.Course/MediaMind.Course.csproj
Expand Up @@ -92,6 +92,7 @@
<Compile Include="Infrastructure\Optimizations.cs" />
<Compile Include="Infrastructure\ValidatingEventListener.cs" />
<Compile Include="Models\Account.cs" />
<Compile Include="Models\Ad.cs" />
<Compile Include="Models\Campaign.cs" />
<Compile Include="Models\Contact.cs" />
<Compile Include="Models\Office.cs" />
Expand Down Expand Up @@ -135,6 +136,9 @@
<EmbeddedResource Include="Models\Placement.hbm.xml">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Models\Ad.hbm.xml">
<SubType>Designer</SubType>
</EmbeddedResource>
<Content Include="Scripts\jquery-1.5.1-vsdoc.js" />
<Content Include="Scripts\jquery-1.5.1.js" />
<Content Include="Scripts\jquery-1.5.1.min.js" />
Expand Down
18 changes: 0 additions & 18 deletions MediaMind.Course/Models/Account.hbm.xml
Expand Up @@ -57,23 +57,5 @@
</class>


<class name="Ad" abstract="true">
<id name="Id" column="Id" type="System.Int64">
<generator class="hilo"/>
</id>
<property name="Name" not-null="true"/>
<many-to-one name="Campaign"/>

<union-subclass name="NegativeAd" >
<property name="WhatThatSucks"/>
</union-subclass>

<union-subclass name="PositiveAd" >
<property name="WhyThisIsAwesome"/>
</union-subclass>

</class>



</hibernate-mapping>
38 changes: 38 additions & 0 deletions MediaMind.Course/Models/Ad.cs
@@ -0,0 +1,38 @@
namespace MediaMind.Course.Models
{
public class Ad
{
public virtual string Type
{
get
{
if (Data is VideoStripImageAdData)
return "Video Strip Image";
if (Data is StandardBanner)
return "Standard Banner";

return "no idea";
}
}
public virtual Campaign Campaign { get; set; }
public virtual long Id { get; set; }
public virtual string Name { get; set; }
public virtual SharedAdData Data { get; set; }
}

public abstract class SharedAdData
{
public virtual long Id { get; set; }
public virtual int SmartResource { get; set; }
}

public class VideoStripImageAdData : SharedAdData
{
public virtual string DefaultImage { get; set; }
}

public class StandardBanner : SharedAdData
{
public virtual string Size { get; set; }
}
}
41 changes: 41 additions & 0 deletions MediaMind.Course/Models/Ad.hbm.xml
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="MediaMind.Course.Models"
assembly="MediaMind.Course">

<class name="Ad">
<id name="Id" column="Id" type="System.Int64">
<generator class="hilo"/>
</id>
<property name="Name" not-null="true"/>
<many-to-one name="Campaign"/>

<any name="Data" id-type="System.Int64" meta-type="System.String"
cascade="save-update">

<meta-value class="StandardBanner" value="StandardBanner"/>
<meta-value class="VideoStripImageAdData" value="VideoStripImageAdData"/>

<column name="DataType"/>
<column name="DataId"/>
</any>

</class>

<class name="SharedAdData" abstract="true">
<id name="Id" column="Id" type="System.Int64">
<generator class="hilo"/>
</id>
<property name="SmartResource"/>

<union-subclass name="VideoStripImageAdData">
<property name="DefaultImage"/>
</union-subclass>

<union-subclass name="StandardBanner">
<property name="Size"/>
</union-subclass>
</class>


</hibernate-mapping>
17 changes: 0 additions & 17 deletions MediaMind.Course/Models/Campaign.cs
Expand Up @@ -17,21 +17,4 @@ public Campaign()
Contacts = new HashSet<Contact>();
}
}

public class Ad
{
public virtual Campaign Campaign { get; set; }
public virtual long Id { get; set; }
public virtual string Name { get; set; }
}

public class PositiveAd : Ad
{
public virtual string WhyThisIsAwesome { set; get; }
}

public class NegativeAd : Ad
{
public virtual string WhatThatSucks { set; get; }
}
}
110 changes: 110 additions & 0 deletions packages/NHibernateProfiler.1.0.0.940/tools/log.txt
Expand Up @@ -298,3 +298,113 @@ Exception rethrown at [0]:
2012-07-26 11:45:01,601 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 11:50:01,601 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 11:50:02,392 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 11:55:02,401 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 11:55:03,203 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:00:03,201 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:00:04,017 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:05:04,019 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:05:04,819 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:22:59,509 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:23:13,453 [16] ERROR Rhino.Licensing.AbstractLicenseValidator [(null)] - Could not re-lease subscription license
System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://uberprof.com/Subscriptions.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: The remote name could not be resolved: 'uberprof.com'
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
--- End of inner exception stack trace ---

Server stack trace:
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Rhino.Licensing.ISubscriptionLicensingService.LeaseLicense(String previousLicense)
at Rhino.Licensing.AbstractLicenseValidator.TryGettingNewLeaseSubscription()
2012-07-26 12:23:13,478 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:28:13,489 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:28:14,790 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:33:14,790 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:33:15,972 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:38:15,980 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:38:17,364 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:43:17,374 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:43:18,443 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:48:18,440 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:48:19,340 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:53:19,352 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:53:20,166 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:58:20,167 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 12:58:21,963 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:03:21,967 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:03:22,828 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:08:22,830 [30] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:08:24,021 [30] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:13:24,022 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:13:24,955 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:18:24,964 [30] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:18:26,247 [30] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:23:26,248 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:23:27,124 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:28:27,127 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:28:28,892 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:33:28,895 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:33:29,779 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:38:29,791 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:38:30,616 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:43:30,623 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:43:31,446 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:48:31,455 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:48:32,590 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:53:32,607 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:53:33,469 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:58:33,477 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 13:58:34,466 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:03:34,469 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:03:35,432 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:08:35,439 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:08:36,836 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:13:36,833 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:13:37,636 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:18:37,633 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:18:38,616 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:23:38,623 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:23:39,621 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:28:39,628 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:28:40,695 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:33:40,693 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:33:41,977 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:38:41,978 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:38:46,202 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:43:46,212 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:43:47,818 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:48:47,824 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:48:49,166 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:53:49,171 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:53:50,450 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:58:50,456 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 14:58:53,530 [6] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:03:53,534 [30] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:03:54,347 [30] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:08:54,350 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:08:55,689 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:13:55,699 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:13:58,798 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:18:58,807 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:19:00,140 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:24:00,139 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:24:01,113 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:29:01,112 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:29:01,921 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:34:01,928 [30] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:34:02,777 [30] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:39:02,776 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:39:03,563 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:44:03,563 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59
2012-07-26 15:44:04,345 [16] INFO Rhino.Licensing.AbstractLicenseValidator [(null)] - License expiration date is 12/31/9999 23:59:59

0 comments on commit af3a7d4

Please sign in to comment.