2 series on my chart - asp.net-4.0

I would like to show 2 series on the same chart, however I'm not sure how to update the following code:
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="UcSalesSeries.ascx.cs" Inherits="Silverlight.ConfigEnhanced.Web.UcSalesSeries" %>
<asp:Chart ID="Chart1" runat="server" DataSourceID="LinqDataSource1"
Height="500px" Width="750px" >
<Series>
<asp:Series ChartType="Line" Name="Series1" XValueMember="EndOfMonth"
YValueMembers="Quantity" >
</asp:Series>
</Series>
<Series>
<asp:Series ChartType="Line" Name="Series2" XValueMember="EndOfMonth"
YValueMembers="Quantity" >
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</ChartAreas> <Legends>
<asp:Legend TableStyle="Auto" Docking="Top" >
</asp:Legend>
</Legends>
</asp:Chart>
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="Data.DataClasses1DataContext" EntityTypeName="" Select="new (EndOfMonth, Quantity)"
TableName="T_SalesDatas" OrderBy="EndOfMonth" Where="Model == #Model">
<WhereParameters>
<asp:Parameter DefaultValue="XXS" Name="Model" Type="String" />
</WhereParameters>
</asp:LinqDataSource>
the second serie I would like to see is the same as above, but I would be changing the parameter
<asp:Parameter DefaultValue="NEWVALUE" Name="Model" Type="String" />

The Chart does not support multiple DataSources so you will need to manually add the points from code behind to the chart when rendering the page. You create two tables from your data with the different parameters and iterate each table and adding them to the chart manually.
Read more in the section 'Manual' series population on this MSDN blog:
http://blogs.msdn.com/b/alexgor/archive/2009/02/21/data-binding-ms-chart-control.aspx

Related

Procedure has no parameters and arguments were supplied (literally no parameters)

I've been getting errors with this stored procedure so I tried simplifying it right down. For some reason I'm still getting an error saying the SP is expecting a parameter when I'm not using any parameters at all.
I should note that I'm trying to get this working via a Telerik RadDataform in ASP. Could it be that Telerik is adding a sneaky parameter here?
Here's the SP:
ALTER procedure [dbo].[NewEmployee_Update]
as
insert
NewEmployeeDetails
select top 1
NE.FormHeaderID,
NE.VersionNumber + 1,
getdate(), -- AddDate
'vibribbon',
'Bart',
'Simpson',
'El Barto',
'Rascal'
from
OnlineFormHeader H
inner join NewEmployeeDetails NE on NE.FormHeaderID = H.RecID
where
H.RecID = 3
order by
NE.VersionNumber desc
And the ASP DataSource:
<asp:SqlDataSource ID="dsEmployeeDetails" runat="server" ConnectionString="<%$ ConnectionStrings:OnlineStaffFormsConnectionString %>" InsertCommand="NewEmployee_Insert"
InsertCommandType="StoredProcedure" UpdateCommand="NewEmployee_Update" UpdateCommandType="StoredProcedure" SelectCommand="select top 1
NE.*
from
OnlineFormHeader H
inner join NewEmployeeDetails NE on NE.FormHeaderID = H.RecID
where
H.RecID = #formHeaderID
order by
NE.VersionNumber desc">
<SelectParameters>
<asp:QueryStringParameter Name="formHeaderID" QueryStringField="ID" Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:SessionParameter Name="currentUser" SessionField="currentUser" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="PreferredName" Type="String" />
<asp:Parameter Name="JobTitle" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</div>
</asp:Content>
It seems the Telerik DataForm automatically adds the unique id of the record to be updated to the parameter set.
Probably more noticeable here because I'm fudging the "update" command to insert instead.

Using ValueDataSource to show skalar value

I want to show a skalar values by using a label. The following example shows the sum of customer order amounts.
https://doc.cuba-platform.com/manual-6.8/value_datasources.html
<dsContext>
<valueCollectionDatasource id="salesDs">
<query>
<![CDATA[select o.customer, sum(o.amount) from demo$Order o group by o.customer]]>
</query>
<properties>
<property class="com.company.demo.entity.Customer" name="customer"/>
<property datatype="decimal" name="sum"/>
</properties>
</valueCollectionDatasource>
here I want to bind the loaded data to the label:
<label datasource="salesDs"
property="name"/>
but nothing is shown.
Why is the label value empty? (salesDs is correctly loaded, I can step through with intelliJ...)
I also tried to get the loaded data from the datasource, but I can't find the correct way.
salesDs.getItem() //returns null
salesDs.getItems() //retruns a collection of KeyValueEntries
But, what is the correct way to get my data from a KeyValueEntry?
It would work if you selected an item in the collection datasource (no matter ValueCollectionDatasource or a normal one). It can be done programmatically via setItem() or by some visual component also connected to the same datasource.
For example, in the below screen the label shows the name of the customer currently selected in the table:
<dsContext>
<valueCollectionDatasource id="customersDs">
<query>
<![CDATA[select e.name, e.email
from sales$Customer e]]>
</query>
<properties>
<property datatype="string"
name="name"/>
<property datatype="string"
name="email"/>
</properties>
</valueCollectionDatasource>
</dsContext>
<layout expand="customersTable" spacing="true">
<table id="customersTable" width="100%">
<columns>
<column id="name"/>
<column id="email"/>
</columns>
<rows datasource="customersDs"/>
</table>
<groupBox caption="Label">
<label id="nameLab"
datasource="customersDs"
property="name"/>
</groupBox>
</layout>

How can I highlight syntax in Microsoft OneNote 2013?

I want to highlight syntax for my programming language of choice (proprietary) in Microsoft OneNote 2013 with a macro or script. I found a free Macro creator for MS OneNote '13 that allows creation of custom macros called "OneTastic". I created a macro that is given two arrays with lists of predefined words associated with different colors to give each list (ex: List 1 words = blue, list 2 words = orange, etc.)
API: https://www.omeratay.com/onetastic/docs/
Problem: The search logic is finding words inside of bigger words, like "IN" inside of the word "domain" (domaIN). My code is below:
<?xml version="1.0" encoding="utf-16"?>
<Macro name="CCL TEST 3" category="Color" description="" version="10">
<ModifyVar name="KEYWORDS1" op="set">
<Function name="String_Split">
<Param name="string" value="drop create program go %i declare call set end END execute else elseif protect constant curqual of subroutine to noconstant record free range in is protect define macro endmacro" />
<Param name="delimiter" value=" " />
</Function>
</ModifyVar>
<ModifyVar name="counter" op="set" value="0" />
<WhileVar name="counter" op="lt">
<Function name="Array_Length">
<Param name="array" var="KEYWORDS1" />
</Function>
<IsRootOp />
<ModifyVar name="keyword" op="set" var="KEYWORDS1">
<RightIndex var="counter" />
</ModifyVar>
<For each="Text">
<That hasProp="value" op="eq" var="keyword" />
<ModifyProp name="fontColor" op="set" value="blue" />
</For>
<ModifyVar name="counter" op="add" value="1" />
</WhileVar>
<ModifyVar name="KEYWORDS2" op="set">
<Function name="String_Split">
<Param name="string" value="datetimefind datetimediff cnvtdatetime cnvtalias format build concat findfile error alterlist alter initrec cnvtdate esmError echo max min avg sum count uar_get_code_meaning mod substring size trim hour day isnumeric expand locateval cnvtstring fillstring btestfindstring logical uar_get_code_display uar_get_meaning_by_codeset UAR_GET_CODE_BY sqltype cnvtreal echorecord cnvtupper cnvtlower cnvtdatetimeutc abs datetimediff year julian btest decode evaluate findstring asis replace validate nullterm parser value uar_timer_create uar_CreatePropList uar_SetPropString uar_CloseHandle uar_Timer_Destroy uar_Timer_Stop build2 patstring piece cnvtalphanum timestampdiff" />
<Param name="delimiter" value=" " />
</Function>
</ModifyVar>
<ModifyVar name="counter2" op="set" value="0" />
<WhileVar name="counter2" op="lt">
<Function name="Array_Length">
<Param name="array" var="KEYWORDS2" />
</Function>
<IsRootOp />
<ModifyVar name="keyword" op="set" var="KEYWORDS2">
<RightIndex var="counter2" />
</ModifyVar>
<For each="Text">
<That hasProp="value" op="eq" var="keyword" />
<ModifyProp name="fontColor" op="set" value="orange" />
</For>
<ModifyVar name="counter2" op="add" value="1" />
</WhileVar>
</Macro>
There is no such inbuilt feature available in OneNote but you can do it.
Use Visual Studio Code, it's free. Turn on right text copy/pasting. Write your code in in VS code. Copy it. It'll paste exactly as you see. Colors and all.
While this does not use VBA, I use and love the add-in NoteHightlight2016
If you don't find a language you can go through and add your own. I've added the Excel Formula keywords to the languages supported and I believe it is a bit easier than creating in OneTastic, which I also use and love.

Updating XML Tags Attributes Values in .NET

I have an xml string like that
<root>
Am trying <br id="9"/>to reorder the <br id="5"/>break
lines <br id="10"/> attributes value
</root>
Any Way to change attribute value of XML BR tag ID attribute to be in sequence
like this
<root>
Am trying <br id="1"/>to reorder the <br id="2"/>break
lines <br id="3"/> attributes value
</root>
Here is one example using LINQ TO XML
Dim doc as XElement = <root>
Am trying <br id="9"/>to reorder the <br id="5"/>break
lines <br id="10"/> attributes value
</root>
Dim index as Integer = 0
For Each br In doc.<br>
index += 1
br.#id = index
Next
This results in the following output
<root>
Am trying <br id="1" />to reorder the <br id="2" />break
lines <br id="3" /> attributes value
</root>
Also, here's an example using a LAMBDA expression.
doc.<br>.ToList().ForEach(Sub(br)
index += 1
br.#id = index
End Sub)

delete from gridview using stored procedure

Hi i have a gridview, linked to a sqldatasource. I have added a stored procedure to delete from multiple tables, and then enabled deleting on the gridviews smart tag.
When i click the delete button i get an error message, "Object must implement IConvertible". I read that it is a problem passing the parameter to the stored procedure, possibly the wrong datatype being passed. Im not sure if i am passing the parameter to the stored procedure at all. The parameter should be the gridviews datakeyname, in this case it is "UserId".
The stored procedure works i fine in management studio, so i think it is just the parameter being passed (or possibly not being passed)
Do i have to code the parameter in the code behind to be passed to the stored procedure?
<asp:SqlDataSource ID="selectUsers" runat="server" ConnectionString="<%$ ConnectionStrings:CASSFConnectionString %>"
SelectCommand="SELECT aspnet_Membership.UserId, aspnet_Membership.IsLockedOut, aspnet_Membership.Email, aspnet_Membership.CreateDate, aspnet_Membership.LastLoginDate, aspnet_Membership.LastPasswordChangedDate, aspnet_Profile.PropertyValuesString, aspnet_Users.UserName, aspnet_Membership.IsApproved FROM aspnet_Membership INNER JOIN aspnet_Profile ON aspnet_Membership.UserId = aspnet_Profile.UserId INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId AND aspnet_Profile.UserId = aspnet_Users.UserId WHERE (CONVERT (nvarchar(256), aspnet_Profile.PropertyValuesString) = #district)"
DeleteCommand="DeleteUsers" DeleteCommandType="StoredProcedure" UpdateCommand="UPDATE [aspnet_Membership] SET [IsApproved] = #IsApproved, [Email] = #email, [IsLockedOut] = #IsLockedOut WHERE [aspnet_Membership].[UserId] = #UserID">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="district" PropertyName="SelectedValue" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="UserId" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="IsApproved" />
<asp:Parameter Name="email" />
<asp:Parameter Name="IsLockedOut" />
<asp:Parameter Name="UserID" />
</UpdateParameters>
</asp:SqlDataSource>
Found the answer, i had just to remove Type="String" from the delete parameter.