public BrowserExtendedNavigatingEventArgs(object automation, Uri url, string frame, UrlContext navigationContext) { this._Url = url; this._Frame = frame; this.navigationContext = navigationContext; this._pDisp = automation; }
public ActionResult SaveItem(PurchaseOrderLineItemViewModel input) { var vendor = _repository.Find <Vendor>(input.RootId); var currentUser = _sessionContext.GetCurrentUser(); var purchaseOrder = input.ParentId > 0 ? vendor.GetPurchaseOrderInProcess().FirstOrDefault(x => x.EntityId == input.ParentId) : new PurchaseOrder { Vendor = vendor, Status = TemporalStatus.Pending.ToString() }; var baseProduct = _repository.Find <BaseProduct>(input.PurchaseOrderLineItem.Product.EntityId); var newPo = purchaseOrder.EntityId == 0; var purchaseOrderLineItem = new PurchaseOrderLineItem { Product = baseProduct, PurchaseOrder = purchaseOrder }; mapItem(purchaseOrderLineItem, input.PurchaseOrderLineItem); purchaseOrder.AddLineItem(purchaseOrderLineItem); if (purchaseOrder.EntityId == 0) { vendor.AddPurchaseOrder(purchaseOrder); } var crudManager = _saveEntityService.ProcessSave(purchaseOrder); var notification = crudManager.Finish(); notification.Data = new { poId = purchaseOrder.EntityId }; if (newPo) { notification.Redirect = true; notification.RedirectUrl = UrlContext.GetUrlForAction <PurchaseOrderController>(x => x.AddEdit(null)) + "/" + vendor.EntityId + "?ParentId=" + purchaseOrder.EntityId; } return(Json(notification, JsonRequestBehavior.AllowGet)); }
public UrlInfo ShortenUrl(string originalUrl) { using (var ctx = new UrlContext()) { UrlInfo url; url = ctx.UrlInfos.Where(u => u.OriginalUrl == originalUrl).FirstOrDefault(); if (url != null) { return(url); } var abreviation = this.NewAbreviation(); if (string.IsNullOrEmpty(abreviation)) { throw new ArgumentException("Could not find a abreviation"); } url = new UrlInfo() { Added = DateTime.Now, OriginalUrl = originalUrl, Abreviation = abreviation }; ctx.UrlInfos.Add(url); ctx.SaveChanges(); return(url); } }
private string NewAbreviation() { ///As time passes and abreviations are used the urls will become longer, ///we could use a more complex algorithm to avoid trying shorter lenghts ///once they are used, but unless we have a large userbase I don't see the ///need. using (var ctx = new UrlContext()) { var maxAbreviationLength = 8; for (int length = 3; length < maxAbreviationLength; length++) { int i = 0; while (true) { string abreviation = Guid.NewGuid().ToString().Substring(0, length); if (!ctx.UrlInfos.Where(u => u.Abreviation == abreviation).Any()) { return(abreviation); } if (i > 15) { break; } i++; } } return(string.Empty); } }
public async Task <IActionResult> Index() { using (var context = new UrlContext()) { return(View(await context.Urls.Include(s => s.Statistics).ToListAsync())); } }
public ImageButtonColumn <ENTITY> ForAction <CONTROLLER>(Expression <Func <CONTROLLER, object> > expression) where CONTROLLER : Controller { var actionUrl = UrlContext.GetUrlForAction(expression); _actionUrl = actionUrl; return(this); }
public override string ToString() { var fullUrl = UrlContext.Combine(_baseUrl, _imageSrcUrl).ToFullUrl(); var html = @"<img src=""{0}""{1}/>".ToFormat(fullUrl, GetHtmlAttributesString()); return(html); }
public string ShortUrl(string Url) { if (Url.Trim() != "") { string shortUrl = GetRandomUrl(); using (UrlContext dbContext = new UrlContext()) { try { while (dbContext.Urls.Any(ur => ur.Surl == shortUrl)) { shortUrl = GetRandomUrl(); } UrlModel data = new UrlModel(); data.Surl = shortUrl; data.Url = Url; dbContext.Urls.Add(data); dbContext.SaveChanges(); } catch { } return(shortUrl); } } return(""); }
public LinkColumn <ENTITY> ForAction <CONTROLLER>(Expression <Func <CONTROLLER, object> > expression) where CONTROLLER : Controller { var urlForAction = UrlContext.GetUrlForAction(expression); _actionUrl = urlForAction; return(this); }
public void SetUp() { UrlContext.Reset(); var registry = new FubuRegistry(); registry.Actions.IncludeType <OneController>(); registry.Actions.IncludeType <TwoController>(); registry.Actions.ExcludeMethods(x => x.Method.Name.Contains("Ignore")); registry.Routes .IgnoreControllerFolderName() .IgnoreNamespaceForUrlFrom <UrlRegistryIntegrationTester>() .IgnoreClassSuffix("Controller"); registry.ResolveTypes(x => x.AddStrategy <UrlModelForwarder>()); // need to do forwards graph = registry.BuildGraph(); var resolver = graph.Services.DefaultServiceFor <ITypeResolver>().Value; urls = new UrlRegistry(new ChainResolver((ITypeResolver)resolver, graph), new JQueryUrlTemplate()); }
public LinkColumn <ENTITY> ForAction(string controllerName, string actionName) { var urlForAction = UrlContext.GetUrlForAction(controllerName, actionName); _actionUrl = urlForAction; return(this); }
public Task <Statistic> Click(string shortUrl, string referer, string ip) { return(Task.Run(() => { using (var context = new UrlContext()) { var url = context.Urls.Include(r => r.Statistics).Where(o => o.ShortUrl.Equals(shortUrl)).FirstOrDefault(); if (url == null) { throw new Exception("Short Not Found"); } url.ClicksCount += 1; Statistic stat = new Statistic { ClickDate = DateTime.Now, Ip = ip, Referer = referer, Url = url }; url.Statistics.Add(stat); context.Urls.Update(url); context.Statistics.Add(stat); context.SaveChanges(); return stat; } })); }
public void SetUp() { UrlContext.Reset(); graph = new FubuRegistry(x => x.Actions.IncludeClassesSuffixedWithController()).BuildGraph(); registry = new UrlRegistry(new ChainResolver(new TypeResolver(), graph), new JQueryUrlTemplate()); }
protected void Application_Start(object sender, EventArgs e) { ObjectFactory.Initialize(InitializeStructureMap); UrlContext.Reset(); Bootstrap(); _signalRRegistry.Configure(); }
//used for getting controller from a field value like "InstantiatingType" public LinkColumn <ENTITY> ForAction(Expression <Func <ENTITY, object> > expression, string actionName) { var controllerName = ReflectionHelper.GetAccessor(expression).FieldName + "Controller"; var urlForAction = UrlContext.GetUrlForAction(controllerName, actionName); _actionUrl = urlForAction; return(this); }
/// <summary> /// Creates a new instance of WebBrowserExtendedNavigatingEventArgs /// </summary> /// <param name="automation">Pointer to the automation object of the browser</param> /// <param name="url">The URL to go to</param> /// <param name="frame">The name of the frame</param> /// <param name="navigationContext">The new window flags</param> public BrowserExtendedNavigatingEventArgs(object automation, Uri url, string frame, UrlContext navigationContext) { Url = url; Frame = frame; NavigationContext = navigationContext; AutomationObject = automation; }
public override void OnAuthorization(AuthorizationContext filterContext) { base.OnAuthorization(filterContext); if (filterContext.Result is HttpUnauthorizedResult) { filterContext.Result = new AjaxAwareRedirectResult(UrlContext.GetUrlForAction <LoginController>(x => x.Login(null))); } }
public void SetUp() { family = new MapFromWebPathFamily(); webAppFolder = "MapFromWebPathFamilyTester"; UrlContext.Stub(webAppFolder); expandProp = ReflectionHelper.GetProperty <TestSettings>(t => t.DefaultPath); noExpandProp = ReflectionHelper.GetProperty <TestSettings>(t => t.DoNotExpand); }
public UrlService( UrlContext context, IKeyConverter keyConverter, ILogger <UrlService> logger) { _context = context; _keyConverter = keyConverter; _logger = logger; }
public CalculatorViewModel GetViewModel() { return(new SandCalcViewModel { CalculatorDisplayName = WebLocalizationKeys.SAND.ToString(), CalculatorName = WebLocalizationKeys.SAND.ToString(), CalculateUrl = UrlContext.GetUrlForAction <CalculatorController>(x => x.Calculate(null)), SaveJSSuccssCallback = "kyt.calculator.controller.sandSuccess" }); }
public ActionResult Display(ViewModel input) { var fertilizer = _repository.Find <Fertilizer>(input.EntityId); var model = new FertilizerViewModel { Fertilizer = fertilizer, AddEditUrl = UrlContext.GetUrlForAction <FertilizerController>(x => x.AddEdit(null)) + "/" + fertilizer.EntityId }; return(PartialView("FertilizerView", model)); }
public ActionResult PurchaseOrderList() { var url = UrlContext.GetUrlForAction <PurchaseOrderListController>(x => x.PurchaseOrders(null)); ListViewModel model = new ListViewModel() { AddEditUrl = UrlContext.GetUrlForAction <PurchaseOrderController>(x => x.AddEdit(null)), ListDefinition = _purchaseOrderListGrid.GetGridDefinition(url, WebLocalizationKeys.PURCHASE_ORDERS), }; return(View(model)); }
public ActionResult Display(ViewModel input) { var vendorContact = _repository.Find <VendorContact>(input.EntityId); var model = new VendorContactViewModel { VendorContact = vendorContact, AddEditUrl = UrlContext.GetUrlForAction <VendorContactController>(x => x.AddEdit(null)) + "/" + vendorContact.EntityId }; return(PartialView("VendorContactView", model)); }
public ActionResult Display(ViewModel input) { var purchaseOrderLineItem = _repository.Find <PurchaseOrderLineItem>(input.EntityId); var model = new PurchaseOrderLineItemViewModel { PurchaseOrderLineItem = purchaseOrderLineItem, AddEditUrl = UrlContext.GetUrlForAction <PurchaseOrderLineItemController>(x => x.AddEdit(null)) + "/" + purchaseOrderLineItem.EntityId }; return(PartialView("PurchaseOrderLineItemView", model)); }
public ActionResult Display(ViewModel input) { var employee = _repository.Find <Employee>(input.EntityId); var model = new EmployeeViewModel { Employee = employee, AddEditUrl = UrlContext.GetUrlForAction <EmployeeController>(x => x.AddEdit(null)) + "/" + employee.EntityId }; return(PartialView("EmployeeView", model)); }
public ActionResult Display(ViewModel input) { var equipment = _repository.Find <Equipment>(input.EntityId); var model = new EquipmentViewModel { Equipment = equipment, AddEditUrl = UrlContext.GetUrlForAction <EquipmentController>(x => x.AddEdit(null)) + "/" + equipment.EntityId }; return(PartialView("EquipmentView", model)); }
public void SetUp() { UrlContext.Stub(""); graph = new FubuRegistry(x => { x.Actions.IncludeTypesNamed(n => n.StartsWith("UrlCategory")); }).BuildGraph(); registry = new UrlRegistry(new ChainResolver(new TypeResolver(), graph), new JQueryUrlTemplate()); }
public override string ToString() { if (_baseUrl.IsNotEmpty()) { _href = UrlContext.Combine(_baseUrl, _href); } this.Attr("href", _href.ToFullUrl()); return(@"<link{0}/>".ToFormat(GetHtmlAttributesString())); }
public ActionResult Display(ViewModel input) { var document = _repository.Find <Document>(input.EntityId); var model = new DocumentViewModel { Document = document, AddEditUrl = UrlContext.GetUrlForAction <DocumentController>(x => x.AddUpdate(null)) + "/" + document.EntityId }; return(View(model)); }
public ActionResult Display(ViewModel input) { var material = _repository.Find <Material>(input.EntityId); var model = new MaterialViewModel { Material = material, AddEditUrl = UrlContext.GetUrlForAction <MaterialController>(x => x.AddEdit(null)) + "/" + material.EntityId }; return(PartialView("MaterialView", model)); }
public UrlContext url() { UrlContext _localctx = new UrlContext(Context, State); EnterRule(_localctx, 170, RULE_url); int _la; try { EnterOuterAlt(_localctx, 1); { State = 1783; k_url(); State = 1788; ErrorHandler.Sync(this); _la = TokenStream.La(1); while (_la==SCOL) { { { State = 1784; Match(SCOL); State = 1785; other_param(); } } State = 1790; ErrorHandler.Sync(this); _la = TokenStream.La(1); } State = 1791; Match(COL); State = 1792; uri(); State = 1793; Match(CRLF); } } catch (RecognitionException re) { _localctx.exception = re; ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { ExitRule(); } return _localctx; }