/// <summary> ///Create info based on real SuperCollection. /// </summary> public SuperCollectionInfo(SuperCollection coll) { Id = coll.Id; Title = coll.Title; User = coll.User; CollectionsCount = coll.Collections.Count; }
protected static Uri UrlForCollection(SuperCollection superCollection, Collection collection) { if (superCollection == null || collection == null || string.IsNullOrEmpty(superCollection.Title) || string.IsNullOrEmpty(collection.Title)) return null; string path = _hostPath.Value + "/" + FriendlyUrl.FriendlyUrlEncode(superCollection.Title) + "/"; if (string.CompareOrdinal(superCollection.Title, collection.Title) != 0) { path += FriendlyUrl.FriendlyUrlEncode(collection.Title) + "/"; } return new Uri(path); }
private static void ToRunInFirstBatch() { //add locdata super collection SuperCollection loc_sc = new SuperCollection(); loc_sc.Id = Guid.NewGuid(); loc_sc.Title = "LOC Data"; loc_sc.Collections = new System.Collections.ObjectModel.Collection<Collection>(); dbInst.SuperCollections.Add(loc_sc); dbInst.SaveChanges(); my_sc = loc_sc; }
/** * Takes in the batch numbers to run and runs those batches creating flat json files and writing to the db concurrently */ static void Main(string[] args) { Console.Write("Enter the batch number to be run\n"); String batchn = Console.ReadLine(); Decimal batchnum = Decimal.Parse(batchn); Console.Write("Enter the path to the folder in which the batch data exists\n"); Console.Write("Eg - C:\\Users\\sowmya\\Desktop\\New folder - if Batch#.json exists in New folder \n"); Console.Write("Please ensure that the folder entered is not read only \n"); basebatchurl = Console.ReadLine(); InitializeDbContext(); var sc = dbInst.SuperCollections.Where(c => c.Title == "LOC Data"); foreach (SuperCollection s in sc) my_sc = s; batchurl = basebatchurl + "\\Batch" + batchnum + ".json"; try { if(my_sc == null) ToRunInFirstBatch(); WriteToDb(); } catch (Exception e) { Console.WriteLine(e); } }