public ActionResult CheckDupFile() { var redis = new RedisService(); var appStore = new AppStoreUIService(new FileService(), redis); var appIds = redis.GetAllActiveModelIds<App>().ToIdsWithNoPrefix<App>(); List<App> apps = new List<App>(); Dictionary<string, List<string>> batchCategory = new Dictionary<string, List<string>>(); foreach (var id in appIds) { if (redis.IsExist("App:" + id)) { var app = redis.GetModelWithCustomProperties<App, CustomProperty>(id); //if (app.CustomProperties.ContainsKey("1")) //{ // if (batchCategory.ContainsKey(app.CustomProperties["1"].ToString())) // { // batchCategory[app.CustomProperties["1"].ToString()].Add(id); // } // else // { // batchCategory[app.CustomProperties["1"].ToString()] = new List<string> { id }; // } //} // if (app.CustomProperties.ContainsValue("MTK_6255*")) //{ apps.Add(app); //} } } Dictionary<string, List<string>> dups = new Dictionary<string, List<string>>(); foreach (var app in apps) { string flag6255 = string.Empty; if (app.CustomProperties != null && app.CustomProperties.ContainsKey("1") && app.CustomProperties["1"].ToString().Equals("MTK_6255*") && app.CustomProperties.ContainsKey("2") && app.CustomProperties["2"].ToString().Equals("480x800")) { flag6255 = "<lable style=\"color:red\"> <<<<<<<<<<<< MTK_6255* & 480x800</label>"; } if (!string.IsNullOrEmpty(app.CurrentTestVersion)) { var ver = appStore.GetCurrentTestVersionForApp(app.Id); if (ver != null) { if (dups.ContainsKey(ver.FileUrl)) { dups[ver.FileUrl].Add(string.Format("<a href=\"http://inet.kk570.com/AppStoresUI/AppDetails?appProjectId={0}&appId={1}\"> click here to fix Internal Test publish App {2} </a> {3}", app.AppProjectId, app.Id, app.Name, flag6255)); } else { dups[ver.FileUrl] = new List<string> { string.Format("<a href=\"http://inet.kk570.com/AppStoresUI/AppDetails?appProjectId={0}&appId={1}\"> click here to fix Internal Test publish App {2} </a>{3}", app.AppProjectId, app.Id, app.Name, flag6255) }; } } } if (!string.IsNullOrEmpty(app.CurrentVer)) { var ver = appStore.GetCurrentVersionForApp(app.Id); if (ver != null) { if (dups.ContainsKey(ver.FileUrl)) { dups[ver.FileUrl].Add(string.Format("<a href=\"http://inet.kk570.com/AppStoresUI/AppDetails?appProjectId={0}&appId={1}\"> click here to fix Published App {2} </a>{3}", app.AppProjectId, app.Id, app.Name, flag6255)); } else { dups[ver.FileUrl] = new List<string> { string.Format("<a href=\"http://inet.kk570.com/AppStoresUI/AppDetails?appProjectId={0}&appId={1}\"> click here to fix Published App {2} </a>{3}", app.AppProjectId, app.Id, app.Name, flag6255) }; } } } } StringBuilder sb = new StringBuilder(); foreach (var kv in dups) { if (kv.Value.Count > 1) { sb.Append(string.Format("<lable style=\"color:gray\">File {0} duplicate in:</label> <br/>", kv.Key)); foreach (var v in kv.Value) { sb.Append(v + "<br/>"); } sb.Append("<br/>"); } } return Content(sb.ToString(), "text/html"); }