<WebService([Namespace]:=“http://tempuri.org/”)> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public Class schedulerConnector
Inherits dhtmlxRequestHandler
Public Overloads Overrides Function CreateConnector(ByVal context As HttpContext) As IdhtmlxConnector
Return New dhtmlxSchedulerConnector("Events", "EventID",
dhtmlxDatabaseAdapterType.SqlServer2005, ConfigurationManager.ConnectionStrings(“Samplesdatabase”).ConnectionString,
“FromDate”, “ToDate”,“Subject as text, Details as details, Tags”)
End Function
Hello,
1)i dunno how to load & save current user ID to SQL(**all sample is using asp MVC,but i design with asp.net with VB).
Do you have column for user id in your Events table?
if so, you need to add it to connector configuration, eg
“Subject as text, Details as details, Tags, UserID”
Also you’ll have to attach BeforeProcessing event handler, to add current user id to newly added event
If you need to load different subsets of event for different users, you may attach appropriate rule to data request
connector.Request.Rules.Add(new FieldRule((TableField)“UserID”, Operator.Equals, currUserId))
in VB it will look like following, i think
connector.Request.Rules.Add(New FieldRule(DirectCast(“UserID”, TableField), [Operator].Equals, currUserId))
Where
“UserID” - column for events user,
currUserId - id of the logged in user
very thanks for helps, but i think i not very understand with ur explanation. i will try my best.
Yes…My table got userid column, just dunno how to save it n handle the save button
[code]Public Overrides Function CreateConnector(context As HttpContext) As IdhtmlxConnector
Dim UserID As Integer = 0
'somehow get user id- from query string, cookies, membership or some other way
If context.Request.QueryString("UserID") IsNot Nothing Then
UserID = Convert.ToInt32(context.Request.QueryString("UserID"))
End If
Dim connector As New dhtmlxSchedulerConnector( "Events", _
"EventID", _
dhtmlxDatabaseAdapterType.SqlServer2005, _
ConfigurationManager.ConnectionStrings("Samplesdatabase").ConnectionString, _
"FromDate", "ToDate", _
"Subject as text, Details as details, Tags, UserID")'added user id to configuration
'attach handler
connector.Request.Rules.Add(New FieldRule(CType("UserID", TableField), [Operator].Equals, UserID))
'get by UserID
connector.BeforeDataActionProcessing += New EventHandler(Of DataActionProcessingEventArgs)(AddressOf connector_BeforeDataActionProcessing)
Return connector
End Function
Private Sub connector_BeforeDataActionProcessing(sender As Object, e As DataActionProcessingEventArgs)
If (e.DataAction.ActionType = ActionType.Inserted OrElse e.DataAction.ActionType = ActionType.Updated) AndAlso Not e.DataAction.Data.ContainsKey(CType(“UserID”, TableField)) Then
Dim UserID As Integer = 0
If HttpContext.Current.Request.QueryString(“UserID”) IsNot Nothing Then
UserID = Convert.ToInt32(HttpContext.Current.Request.QueryString(“UserID”))
End If
'add UserID to new or updated field
e.DataAction.Data.Add(CType(“UserID”, TableField), UserID.ToString())
End If
End Sub[/code]
Hi,
looks like instead of
connector.BeforeDataActionProcessing += New EventHandler(Of DataActionProcessingEventArgs)(AddressOf connector_BeforeDataActionProcessing)
there should be
AddHandler connector.BeforeProcessing, AddressOf connector_BeforeDataActionProcessing