public WeeeGds(WebViewPage <TModel> webViewPage) { HtmlHelper = webViewPage.Html; UrlHelper = webViewPage.Url; gdsHelper = new Gds <TModel>(webViewPage.Html); }
private void Create_Model_And_Attributes(XmlNodeList xmlNodeList) { // for each model foreach (XmlNode node in xmlNodeList) { // create the model with its name and the type of model entity = Gds.Create(node.Attributes["name"].Value, node.Attributes["prefSuiteItem"].Value); // for each attribute foreach (XmlAttribute atr in node.Attributes) { // get the name of the attribute and its value string key = atr.Name; string value = atr.Value; // if the attribute is the name and prefSuiteItem we skip them since they were previously stored if (key.Equals("name") || key.Equals("prefSuiteItem")) // || value.Length == 0) { continue; } // store the attribute entity.AddAttribute(key, value); Assert.Equal(entity.Attributes[key], value); } } }
public void Model_Order_Children_By_Attribute_Order_LINQ() { entity = Create_Exahustive_ModelGDS(); Console.WriteLine(Gds.GetKeyEntity()); Console.WriteLine("Childs order by the attribute order - LINQ: "); // time start Stopwatch stopWatch = new(); stopWatch.Start(); for (int i = 0; i < 1000; i++) { var result = from atom in entity.Children orderby atom.Attributes["Order"] select atom; result.ToList(); } stopWatch.Stop(); Console.WriteLine("RunTime Query: " + stopWatch.Elapsed.TotalMilliseconds); // Print(result); }
public GdsDateHelperTests() { var viewDataContainer = new FakeViewDataContainer(); var viewContext = new ViewContext(); viewContext.HttpContext = new FakeHttpContext(); viewDataContainer.ViewData.Model = new TestViewModel() { JanFirst2016 = new DateTime(2016, 1, 1), MarchThirtyFirst2016 = new DateTime(2016, 3, 31), MarchThirtyFirst2017 = new DateTime(2017, 3, 31) }; gds = new Gds <TestViewModel>(new HtmlHelper <TestViewModel>(viewContext, viewDataContainer)); }
public static MvcHtmlString LabelForOverridden <TModel, TValue>(this Gds <TModel> gds, Expression <Func <TModel, TValue> > expression, Type type) { var baseType = typeof(TModel); if (type.BaseType != baseType) { throw new ArgumentException($"The Gds model type ({baseType}) must be the base type of the provided type ({type})"); } var labelFor = gds.LabelFor(expression, false); var propertyName = ExpressionHelper.GetExpressionText(expression); return(ReplaceDisplayString(labelFor, type, propertyName)); }
/// <summary> /// Json Object sent back from API. /// </summary> /// <returns>JsonObject</returns> public override JObject ToJsonObject() { return(JObjectFilter(new JObject { { REFERENCE, Reference }, { DESCRIPTION, Description }, { AMOUNT, Amount?.ToJsonObject() }, { ALLOW_PARTIAL, AllowPartial }, { SHIPPING, Shipping?.ToJsonObject() }, { ITEMS, ItemsToJArray() }, { RECURRING, Recurring?.ToJsonObject() }, { SUBSCRIBE, Subscribe }, { FIELDS, this.FieldsToJArray <Payment>() }, { AGREEMENT, Agreement }, { AGREEMENT_TYPE, AgreementType }, { GDS, Gds?.ToJsonObject() }, })); }
public GdsExtensionsTests() { gds = A.Fake <Gds <TestViewModelBase> >(); }
public new static string GetPropertyName <TProperty>(HtmlHelper htmlHelper, Expression <Func <TModel, TProperty> > expression) { return(Gds <TModel> .GetPropertyName(htmlHelper, expression)); }