예제 #1
0
 public BrowserExtendedNavigatingEventArgs(object automation, Uri url, string frame, UrlContext navigationContext)
 {
     this._Url              = url;
     this._Frame            = frame;
     this.navigationContext = navigationContext;
     this._pDisp            = automation;
 }
예제 #2
0
        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));
        }
예제 #3
0
        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);
            }
        }
 public BrowserExtendedNavigatingEventArgs(object automation, Uri url, string frame, UrlContext navigationContext)
 {
     this._Url = url;
     this._Frame = frame;
     this.navigationContext = navigationContext;
     this._pDisp = automation;
 }
예제 #5
0
        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);
            }
        }
예제 #6
0
 public async Task <IActionResult> Index()
 {
     using (var context = new UrlContext())
     {
         return(View(await context.Urls.Include(s => s.Statistics).ToListAsync()));
     }
 }
예제 #7
0
        public ImageButtonColumn <ENTITY> ForAction <CONTROLLER>(Expression <Func <CONTROLLER, object> > expression) where CONTROLLER : Controller
        {
            var actionUrl = UrlContext.GetUrlForAction(expression);

            _actionUrl = actionUrl;
            return(this);
        }
예제 #8
0
        public override string ToString()
        {
            var fullUrl = UrlContext.Combine(_baseUrl, _imageSrcUrl).ToFullUrl();
            var html    = @"<img src=""{0}""{1}/>".ToFormat(fullUrl, GetHtmlAttributesString());

            return(html);
        }
예제 #9
0
        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("");
        }
예제 #10
0
        public LinkColumn <ENTITY> ForAction <CONTROLLER>(Expression <Func <CONTROLLER, object> > expression) where CONTROLLER : Controller
        {
            var urlForAction = UrlContext.GetUrlForAction(expression);

            _actionUrl = urlForAction;
            return(this);
        }
예제 #11
0
        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());
        }
예제 #12
0
        public LinkColumn <ENTITY> ForAction(string controllerName, string actionName)
        {
            var urlForAction = UrlContext.GetUrlForAction(controllerName, actionName);

            _actionUrl = urlForAction;
            return(this);
        }
예제 #13
0
        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;
                }
            }));
        }
예제 #14
0
        public void SetUp()
        {
            UrlContext.Reset();

            graph = new FubuRegistry(x => x.Actions.IncludeClassesSuffixedWithController()).BuildGraph();

            registry = new UrlRegistry(new ChainResolver(new TypeResolver(), graph), new JQueryUrlTemplate());
        }
예제 #15
0
        protected void Application_Start(object sender, EventArgs e)
        {
            ObjectFactory.Initialize(InitializeStructureMap);
            UrlContext.Reset();
            Bootstrap();

            _signalRRegistry.Configure();
        }
예제 #16
0
        //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);
        }
예제 #17
0
 /// <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;
 }
예제 #18
0
 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)));
     }
 }
예제 #19
0
        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);
        }
예제 #20
0
 public UrlService(
     UrlContext context,
     IKeyConverter keyConverter,
     ILogger <UrlService> logger)
 {
     _context      = context;
     _keyConverter = keyConverter;
     _logger       = logger;
 }
예제 #21
0
 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));
        }
예제 #26
0
        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));
        }
예제 #28
0
        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());
        }
예제 #29
0
        public override string ToString()
        {
            if (_baseUrl.IsNotEmpty())
            {
                _href = UrlContext.Combine(_baseUrl, _href);
            }

            this.Attr("href", _href.ToFullUrl());

            return(@"<link{0}/>".ToFormat(GetHtmlAttributesString()));
        }
예제 #30
0
        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));
        }
예제 #31
0
        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;
	}