protected void Application_Start() { ModelBinderProviders.BinderProviders.Add(new ModelBinderProvider()); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RoutingFactory.RegisterRoutes(RouteTable.Routes); }
public ActionResult Edit([Bind(Include = "Id,Name,Description,Slug,CreatorUserId,CreateDateTime,LastModifierByUserId,LastModifyDateTime,IsActive")] EventCategory eventCategory) { if (ModelState.IsValid) { AddModificationInfo(eventCategory); Db.EventCategories.AddOrUpdate(eventCategory); Db.SaveChanges(); RoutingFactory.RegisterRoutes(RouteTable.Routes); return(RedirectToAction("Index")); } return(View(eventCategory)); }
public ActionResult Create([Bind(Include = "Id,Name,Slug,CreatorUserId,CreateDateTime,LastModifierByUserId,LastModifyDateTime,IsActive")] ContentCategory contentCategory) { if (ModelState.IsValid) { AddCreationInfo(contentCategory); Db.ContentCategories.Add(contentCategory); Db.SaveChanges(); RoutingFactory.RegisterRoutes(RouteTable.Routes); return(RedirectToAction("Index")); } return(View(contentCategory)); }
public ActionResult Edit([Bind(Include = "Id,Title,Description,Body,CategoryId,Slug,CreatorUserId,CreateDateTime,LastModifierByUserId,LastModifyDateTime,IsActive")] Models.Content content) { if (ModelState.IsValid) { AddModificationInfo(content); Db.Contents.AddOrUpdate(content); Db.SaveChanges(); RoutingFactory.RegisterRoutes(RouteTable.Routes); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(Db.ContentCategories, "Id", "Name", content.CategoryId); return(View(content)); }
public ActionResult Edit([Bind(Include = "Id,Name,ShortDescription,Description,EventDate,Location,LocationCoordinates,CategoryId,Slug,CreatorUserId,CreateDateTime,LastModifierByUserId,LastModifyDateTime,IsActive")] Event @event, string imagePath = null) { if (ModelState.IsValid) { AddModificationInfo(@event); Db.Events.AddOrUpdate(@event); Db.SaveChanges(); if (!string.IsNullOrWhiteSpace(imagePath)) { @event.ImageSave(imagePath, EntityImageFormat.Original, EntityImageFormat.Cover, EntityImageFormat.Icon); } RoutingFactory.RegisterRoutes(RouteTable.Routes); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(Db.EventCategories, "Id", "Name", @event.CategoryId); return(View(@event)); }
public void Launch(ConnectionPack input) { bool _stateful = false; bool firstOP = false; string cmd = input.Cmd; List <string> urls = input.ListUrls; List <string> downstreamUrls = input.ReplicaUrlsOutput; // in order to make a custom import for the first operator if (input.RoutingTypeToReadFromFile != null) { firstOP = true; } // split command by keywords string pattern = @"INPUT OPS|REP FACT|ROUTING|ADDRESS|OPERATOR SPEC"; string[] tokens = Regex.Split(cmd, pattern, RegexOptions.IgnoreCase).Where(s => s != String.Empty).ToArray <string>(); // splitting by 5 keywords should generate 6 tokens if (tokens.Length != 6) { System.Console.WriteLine("Something went wrong while splitting the command!!!"); } // tokens[0] -> operator name // tokens[1] -> input file or previous operator // tokens[2] -> replication factor // tokens[3] -> routing policy // tokens[4] -> list of slave's URLs // tokens[5] -> name of the transformation function (and possibly parameters) /*** create import object ***/ AbstractFactory importFactory = new ImportFactory(); Import importObj = null; // tokenize input string importPattern = @",|\s"; string[] importTokens = Regex.Split(tokens[1], importPattern).Where(s => s != String.Empty).ToArray <string>(); // list to collect possible file paths List <string> filePathsList = new List <string>(); for (int i = 0; i < importTokens.Length; i++) { if (importTokens[i].StartsWith("OP")) // input comes from operator { importObj = importFactory.GetImport(new string[] { "OpImport" }, null, 0, 0); break; // assuming only one operator } if (importTokens[i].Contains(".")) // input comes from file { filePathsList.Add(importTokens[i]); } else { Console.WriteLine("Neither operator nor input file!!!"); } } /*** create routing object ***/ AbstractFactory routingFactory = new RoutingFactory(); Route routeObj; // tokenize routing policy string[] routingTokens; string routingPattern = @"[)(\s]"; if (input.RoutingType != null) { routingTokens = Regex.Split(input.RoutingType, routingPattern).Where(s => s != String.Empty).ToArray <string>(); } else { routingTokens = Regex.Split("Output", routingPattern).Where(s => s != String.Empty).ToArray <string>(); } routeObj = routingFactory.GetRouting(routingTokens, downstreamUrls, input.Semantic.ToLower()); /*** create processing object ***/ AbstractFactory processingFactory = new ProcessingFactory(); Process processObj; // tokenize processing function string processingPattern = @",|\s"; string[] processingTokens = Regex.Split(tokens[5], processingPattern).Where(s => s != String.Empty).ToArray <string>(); // if it's a count operator or a uniq - it needs state - for exactly-once _stateful = Stateful(processingTokens[0]); processObj = processingFactory.GetProcessing(processingTokens); string[] plainUrls = urls.ToArray().Where(s => s != String.Empty).ToArray <string>(); bool wasNull = importObj == null; foreach (string url in plainUrls) { if (wasNull) { // tokenize routing policy for the first operator string[] merge = firstOP ? FileImportRouting(input.RoutingTypeToReadFromFile) : FileImportRouting(input.RoutingType); // supports both import in the beginning or in the middle if (input.RoutingType != null) { importObj = importFactory.GetImport(merge, filePathsList.ToArray(), plainUrls.ToList().IndexOf(url), plainUrls.Length); } else { importObj = importFactory.GetImport(new string[] { "FileImport", "primary" }, filePathsList.ToArray(), plainUrls.ToList().IndexOf(url), plainUrls.Length); } } System.Diagnostics.Process.Start(@"Slave.exe", SerializeObject(importObj) + " " + SerializeObject(routeObj) + " " + SerializeObject(processObj) + " " + SerializeObject(url) + " " + SerializeObject(input.PuppetMasterUrl) + " " + SerializeObject(input.IsLogFull) + " " + SerializeObject(input.Semantic.ToLower()) + " " + SerializeObject(getSiblings(plainUrls, url)) + " " + SerializeObject(_stateful)); } }