public ICollection<AppUpdate> CheckForUpdate(AppBrief newOne) { DateTime now = DateTime.Now; List<AppUpdate> updates = new List<AppUpdate>(); // 检查版本 if (Version != newOne.Version) { AppUpdate update = new AppUpdate() { App = Id, Time = now, NewValue = newOne.Version, OldValue = Version, Type = AppUpdateType.NewRelease, }; updates.Add(update); } // 检查价格,价格单位有变动时涉及换算问题,不计入价格变化中 if (Price != newOne.Price && Currency == newOne.Currency) { AppUpdate update = new AppUpdate() { App = Id, Time = now, NewValue = newOne.Price.ToString(), OldValue = Price.ToString(), Type = newOne.Price == 0 ? AppUpdateType.PriceFree : (newOne.Price > Price ? AppUpdateType.PriceIncrease : AppUpdateType.PriceDecrease) }; updates.Add(update); } return updates; }
public static AppBrief ToAppBrief(this IDataRecord record, string columnPrefix = "") { AppBrief brief = new AppBrief() { AverageUserRatingForCurrentVersion = record.GetNullableFloat(columnPrefix + "AverageUserRatingForCurrentVersion"), Currency = record.GetString(columnPrefix + "Currency"), Features = record.GetStringArray(columnPrefix + "Features"), FileSize = record.GetInt32(columnPrefix + "FileSize"), IconUrl = record.GetString(columnPrefix + "IconUrl"), Id = record.GetInt32(columnPrefix + "Id"), Introduction = record.GetString(columnPrefix + "Introduction"), LanguagePriority = record.GetInt32(columnPrefix + "LanguagePriority"), Name = record.GetString(columnPrefix + "Name"), Price = record.GetFloat(columnPrefix + "Price"), PrimaryCategory = Category.Get(record.GetInt32(columnPrefix + "PrimaryCategory")), ReleaseDate = record.GetDateTime(columnPrefix + "ReleaseDate"), ReleaseNotes = record.GetString(columnPrefix + "ReleaseNotes"), SupportedDevices = record.GetStringArray(columnPrefix + "SupportedDevices"), UserRatingCountForCurrentVersion = record.GetNullableInt32(columnPrefix + "UserRatingCountForCurrentVersion"), Version = record.GetString(columnPrefix + "Version"), ViewUrl = record.GetString(columnPrefix + "ViewUrl"), LastValidUpdate = new AppUpdate() { NewValue = record.GetString(columnPrefix + "LastValidUpdateNewValue"), OldValue = record.GetString(columnPrefix + "LastValidUpdateOldValue"), Time = record.GetDateTime(columnPrefix + "LastValidUpdateTime"), Type = (AppUpdateType)record.GetInt32(columnPrefix + "LastValidUpdateType") }, Developer = new Developer() { Id = record.GetInt32(columnPrefix + "DeveloperId"), Name = record.GetString(columnPrefix + "DeveloperName"), ViewUrl = record.GetString(columnPrefix + "DeveloperViewUrl") } }; brief.LastValidUpdate.App = brief.Id; return brief; }
public RevokedApp(App source) { Id = source.Id; Brief = new AppBrief() { Id = source.Id }; UpdateFrom(source); }
public TrackingApp(AppBrief app, AppTrack track) { App = app; Track = track; }
public static IHtmlString AppRatingCount(this HtmlHelper helper, AppBrief app) { string output; if (app.AverageUserRatingForCurrentVersion.HasValue) { output = app.AverageUserRatingForCurrentVersion + "(" + app.UserRatingCountForCurrentVersion + ")"; } else { output = "<span class=\"trival\">未评分</span>"; ; } return helper.Raw(output); }