Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 6 of 6

Thread: Highlight MaxMind On Splash Page

  1. #1
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Question Highlight MaxMind On Splash Page

    We want to change the colour of the MaxMind decimal depending on its value on the admin home page.

    I can see the section of code that binds the values (splash.aspx.cs)
    C#/VB.NET Code:
    using (DataTable dt = new DataTable())
    {
     
    using (IDataReader rs DB.GetRS(summarySQLcon))
    {
    dt.Load(rs);
    }
    gOrders.DataSource dt;
    gOrders.DataBind();

    and I can see how it is used (splash.aspx)
    C#/VB.NET Code:
    <asp:TemplateField HeaderText="MaxMind">
    <
    ItemTemplate
    <%
    #AspDotNetStorefrontCore.Localization.DecimalStringForDB((decimal)DataBinder.Eval(Container.DataItem, "MaxMindFraudScore")) %>
    </ItemTemplate>
    <
    ItemStyle CssClass="normalData" HorizontalAlign="Right"  width="50px" />
    <
    HeaderStyle HorizontalAlign="Right" />
    </
    asp:TemplateField
    What I would love to do is change the MaxMind so if it is over say 5.5 it shows up bold in red. If it is over 4.5 it shows up in red and if it is over 2.7 make it show up in orange. Otherwise just leave it as it is.

    The only problem is I can't use an aspx if statment and I am not sure if I can code the if statement before the data is bound as the aspx page is looking to parse a decimal.

    Anyone have any ideas how I could do what I am looking to do?
    I could even settle for it being applied to the whole row, just nice to bring our attention to orders we should check.

    Thanks in advance!
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience

  2. #2
    BFG 9000 is offline Senior Member
    Join Date
    Oct 2006
    Location
    South UK
    Posts
    882

    Default

    I'm fairly sure you could do exactly what you want with jquery.

    However - have you considered setting up a custom report to pull 'suspicious' orders?

    Here's what I use :-

    C#/VB.NET Code:
    SELECT TOP 25 OrderNumber AS 'Order'CONVERT(VARCHAR(8), OrderDate3) AS DateEmailLastIPAddressBillingZip AS BillingShippingZip AS ShippingOrderTotal AS 'Order Total'AVSResult AS AVSLast4MaxMindFraudScore AS FraudScoresubstring(MaxMindDetails, (charindex('<riskScore>'MaxMindDetails)+11), charindex('<'substring(MaxMindDetails, (charindex('<riskScore>'MaxMindDetails)+11), 6))-1) AS RiskScore FROM Orders WHERE (OrderTotal 200 AND (BillingZip != ShippingZip OR AVSResult 'I' OR AVSResult 'N') AND MaxMindFraudScore 0) OR MaxMindFraudScore 3.5 Order by OrderNumber Desc 
    I check this multiple times a day - but that's only because our warehouse are constantly working - sometimes shipping within an hour of the order.
    You can obviously change the parameters to fit - but this works for me - it hasn't failed to catch a fraudulent order yet - although it does get a few false positives.


    TTFN

    BFG

  3. #3
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Default

    A report did come to mind but few employees will use it in the long run. We list all orders that have not been shipped on the home page, so it pretty much the centre point for all of the sales team.

    I was thinking jQuery but how would I target jQuery to look at the MaxMind field?
    The only unique part of the MaxMind field is
    C#/VB.NET Code:
    </td><td class="normalData" align="right" style="width:50px;"
    0.11
    </td
    The fact it has a style of width 50%.
    There is already a class in use for styling. I guess I could copy that class and make it unique to MaxMind.

    With that I could have jQuery scan that class, each time it would run a basic switch statement on the value inside the td and assign a new class if required.

    Unless there is an easier method than what I have in mind.
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience

  4. #4
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Default

    The jQuery is driving me mad, your idea is best BFG.

    Modded the report a little to fit us.
    C#/VB.NET Code:
    INSERT INTO CustomReport (NameDescriptionSQLCommand)
    VALUES ('Fraud Orders''Shows Unshipped Orders That May Be Fraudulent.''SELECT OrderNumber AS ''Order'', CONVERT(VARCHAR(8), OrderDate, 3) AS Date, Email, LastIPAddress, BillingZip AS Billing, ShippingZip AS Shipping, OrderTotal AS ''Order Total'', AVSResult AS AVS, Last4, PaymentGateway, CardType, MaxMindFraudScore AS FraudScore, substring(MaxMindDetails, (charindex(''<riskScore>'', MaxMindDetails)+11), charindex(''<'', substring(MaxMindDetails, (charindex(''<riskScore>'', MaxMindDetails)+11), 6))-1) AS RiskScore FROM Orders WHERE (OrderTotal > 200 AND (BillingZip != ShippingZip OR AVSResult = ''I'' OR AVSResult = ''N'') AND MaxMindFraudScore > 0) OR MaxMindFraudScore > 2.8 AND (ShippedOn = '''' AND TransactionState != ''VOIDED'' AND TransactionState != ''FORCE VOIDED'' AND TransactionState != ''REFUNDED'' AND IsNew = 0)  Order by OrderNumber Desc'
    Cheers!

    Just changed it a little again so it rarely returns anything,.
    C#/VB.NET Code:
    SELECT 
    OrderNumber 
    AS 'Order'
    CONVERT(VARCHAR(8), OrderDate3) AS Date
    Email
    LastIPAddress
    BillingZip AS Billing
    ShippingZip AS Shipping
    OrderTotal AS 'Order Total'
    AVSResult AS AVS
    Last4
    PaymentGateway
    CardType
    MaxMindFraudScore AS FraudScore
    substring(MaxMindDetails
    (
    charindex('<riskScore>'MaxMindDetails)+11), charindex('<'substring(MaxMindDetails, (charindex('<riskScore>'MaxMindDetails)+11), 6))-1) AS RiskScore 
    FROM Orders 
    WHERE 
    OrderTotal 
    100 
    AND AVSResult != 'ALL MATCH' 
    AND (BillingZip != ShippingZip 
    OR MaxMindFraudScore 2.8
    AND 
    IsNew 1
    AND TransactionState != 'VOIDED' 
    AND TransactionState != 'FORCE VOIDED' 
    AND TransactionState != 'REFUNDED' 
    Order by OrderNumber Desc 
    Last edited by DotNetDevelopments; 01-26-2011 at 06:41 AM.
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience

  5. #5
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    I did something similar (not with MaxMind, but the OrderDate) by altering the summarySQL string. Ours now reads:

    Code:
    String summarySQL = "SELECT OrderNumber, CASE WHEN History < 7 THEN '<font color=green>' + CONVERT(NVARCHAR(100),OrderDate, 20) + '</font>' WHEN History > 6 AND History < 31 THEN '<font color=orange>' + CONVERT(NVARCHAR(100),OrderDate, 20) + '</font>' ELSE '<font color=red>' + CONVERT(NVARCHAR(100),OrderDate,20) + '</font>' END AS OrderDate
    ...
    to give red, green and orange dates. You could do the same for MaxMind, thus injecting old-style HTML
    http://www.esedirect.co.uk
    --------------------------------------------------------------------------
    Using MS 9.2.0.0 with the following customisations:

    Lightbox/Fancybox enlarged images;
    Auto-suggest searchbox;
    Extra product information shown only to our IP Address (such as supplier info, costs, etc.);
    Failed transactions emailed via trigger;
    Custom app to show basket contents when customer online;
    Orders pushed through to accounting systems.

    All the above without source!

  6. #6
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Default

    Hm that is a pretty good idea, might do that. Thank guys (I'll buy you a pint in Vegas!)
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience