or
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
objDS = GetDataSet();
SetupResources();
RadScheduler.DataSource = objDS.Tables[0];
RadScheduler.DataBind();
}
}
private
void
SetupResources()
{
ResourceType resType =
new
ResourceType();
resType.ForeignKeyField =
"AssignedTo"
;
resType.DataSource = objDS.Tables[
"table2"
];
resType.KeyField =
"id"
;
resType.Name =
"User"
;
resType.TextField =
"UserName"
;
RadScheduler.ResourceTypes.Add(resType);
ResourceStyleMapping rsm =
new
ResourceStyleMapping();
rsm.ApplyCssClass =
"rsCategoryPink"
;
rsm.Text =
"Dasha"
;
rsm.Type =
"User"
;
RadScheduler.ResourceStyles.Add(rsm);
rsm =
new
ResourceStyleMapping();
rsm.ApplyCssClass =
"rsCategoryGreen"
;
rsm.Text =
"Joe"
;
rsm.Type =
"User"
;
RadScheduler.ResourceStyles.Add(rsm);
rsm =
new
ResourceStyleMapping();
rsm.ApplyCssClass =
"rsCategoryOrange"
;
rsm.Text =
"Adam"
;
rsm.Type =
"User"
;
RadScheduler.ResourceStyles.Add(rsm);
}
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
dataSet
>
<
table1
>
<
id
>1</
id
>
<
Title
>Task1</
Title
>
<
Date
>08/07/2010</
Date
>
<
End
>08/17/2010</
End
>
<
AssignedTo
>Dasha</
AssignedTo
>
<
Status
>Completed</
Status
>
<
Room
>Library</
Room
>
</
table1
>
<
table1
>
<
id
>2</
id
>
<
Title
>Task 2</
Title
>
<
Date
></
Date
>
<
End
>08/07/2010</
End
>
<
AssignedTo
>Dasha</
AssignedTo
>
<
Status
>Completed</
Status
>
<
Room
>Office</
Room
>
</
table1
>
<
table1
>
<
id
>3</
id
>
<
Title
>Task 3</
Title
>
<
Date
>08/18/2010</
Date
>
<
End
>08/18/2010</
End
>
<
AssignedTo
>Adam</
AssignedTo
>
<
Status
>Completed</
Status
>
<
Room
>Library</
Room
>
</
table1
>
<
table1
>
<
id
>4</
id
>
<
Title
>Task 4</
Title
>
<
Date
></
Date
>
<
End
>08/08/2010</
End
>
<
AssignedTo
>Joe</
AssignedTo
>
<
Status
>Completed</
Status
>
<
Room
>Library</
Room
>
</
table1
>
<
table2
>
<
id
>1</
id
>
<
UserName
>Dasha</
UserName
>
<
UserAge
>28</
UserAge
>
<
UserOccupation
>Plumber</
UserOccupation
>
</
table2
>
<
table2
>
<
id
>2</
id
>
<
UserName
>Joe</
UserName
>
<
UserAge
>30</
UserAge
>
<
UserOccupation
>IT Professional</
UserOccupation
>
</
table2
>
<
table2
>
<
id
>3</
id
>
<
UserName
>Adam</
UserName
>
<
UserAge
>33</
UserAge
>
<
UserOccupation
>Manager</
UserOccupation
>
</
table2
>
<
table2
>
<
id
>4</
id
>
<
UserName
>Michael</
UserName
>
<
UserAge
>30</
UserAge
>
<
UserOccupation
>Developer</
UserOccupation
>
</
table2
>
</
dataSet
>
pvtCMStoG2.DataBind()
Private Sub pvtCMStoG2_NeedDataSource(sender As Object, e As PivotGridNeedDataSourceEventArgs) Handles pvtCMStoG2.NeedDataSource
'Get an assign the data source.
pvtCMStoG2.DataSource = GetPivotGridData()
End Sub
Public Function GetPivotGridData() As DataTable
'Decalre local variables.
Dim myDataTable As New DataTable()
'Check to see if there is anything in Session for this.
If Session("ReconciliationTime") IsNot Nothing Then
'Retrieve from session.
myDataTable = CType(Session("ReconciliationTime"), DataTable)
Else
'Set up the connection.
Dim m_strConnectionString As [String] = ConfigurationManager.ConnectionStrings("SOREOConnection").ConnectionString
Dim m_objConnection As New SqlConnection(m_strConnectionString)
Dim m_objSQLCommand As New SqlCommand
Dim m_cmdParameter As SqlParameter
'Set the command properties.
With m_objSQLCommand
.Connection = m_objConnection
'Set the command timeout value to wait indefinitely.
.CommandTimeout = 0
'Set the core properties.
.CommandText = "[reconciliation].[cspCMStoG2TimesheetValidation]"
.CommandType = CommandType.StoredProcedure
End With
'Create and set the parameter values.
m_cmdParameter = New SqlParameter 'With {.ParameterName = "BeginDate", .SqlDbType = SqlDbType.DateTime}
With m_cmdParameter
.ParameterName = "@BeginDate"
.SqlDbType = SqlDbType.DateTime
'Set the value.
.Value = ctlBillingPeriodPicker.StartDate
End With
'Add the parameter to the commands.
m_objSQLCommand.Parameters.Add(m_cmdParameter)
'Create and set the parameter values.
m_cmdParameter = New SqlParameter
With m_cmdParameter
.ParameterName = "@EndDate"
.SqlDbType = SqlDbType.DateTime
'Set the value.
.Value = ctlBillingPeriodPicker.EndDate
End With
'Add the parameter to the commands.
m_objSQLCommand.Parameters.Add(m_cmdParameter)
'Create and set the parameter values.
m_cmdParameter = New SqlParameter
With m_cmdParameter
.ParameterName = "@EmployeeID"
.SqlDbType = SqlDbType.UniqueIdentifier
'Set the value.
If String.IsNullOrEmpty(ctlEmployeePicker.SelectedEmployeeID) Then
.Value = System.DBNull.Value
Else
.Value = ctlEmployeePicker.SelectedEmployeeID
End If
End With
'Add the parameter to the commands.
m_objSQLCommand.Parameters.Add(m_cmdParameter)
'Create and set the parameter values.
m_cmdParameter = New SqlParameter
With m_cmdParameter
.ParameterName = "@CustomerID"
.SqlDbType = SqlDbType.UniqueIdentifier
'Set the value.
If String.IsNullOrEmpty(ctlCustomerPicker.SelectedCustomerID) Then
.Value = System.DBNull.Value
Else
.Value = ctlCustomerPicker.SelectedCustomerID
End If
End With
'Add the parameter to the commands.
m_objSQLCommand.Parameters.Add(m_cmdParameter)
'Create and set the parameter values.
m_cmdParameter = New SqlParameter
With m_cmdParameter
.ParameterName = "@FundingAgency"
.SqlDbType = SqlDbType.VarChar
'Set the value.
If String.IsNullOrEmpty(ctlFundingOrganization.SelectedFundingOrganizationName) Then
.Value = System.DBNull.Value
Else
.Value = ctlFundingOrganization.SelectedFundingOrganizationName
End If
End With
'Add the parameter to the commands.
m_objSQLCommand.Parameters.Add(m_cmdParameter)
'Create and set the parameter values.
m_cmdParameter = New SqlParameter
With m_cmdParameter
.ParameterName = "@TimesheetID"
.SqlDbType = SqlDbType.Int
'Assign the value
If chkSingleTimesheetID.Checked = True Then
.Value = radTimesheetID.Value
Else
.Value = System.DBNull.Value
End If
End With
'Add the parameter to the commands.
m_objSQLCommand.Parameters.Add(m_cmdParameter)
'Create and set the parameter values.
m_cmdParameter = New SqlParameter
With m_cmdParameter
.ParameterName = "@IncludeLastImport"
.SqlDbType = SqlDbType.Bit
'Assign the value
.Value = chkIncludeLastImport.Checked
End With
'Add the parameter to the commands.
m_objSQLCommand.Parameters.Add(m_cmdParameter)
'Create and set the parameter values.
m_cmdParameter = New SqlParameter
With m_cmdParameter
.ParameterName = "@ErrorsOnly"
.SqlDbType = SqlDbType.Bit
'Assign the value
.Value = chkErrorsOnly.Checked
End With
'Add the parameter to the commands.
m_objSQLCommand.Parameters.Add(m_cmdParameter)
'Set up the DataAdapter
Dim DataAdapter As SqlDataAdapter = New SqlDataAdapter
DataAdapter.SelectCommand = m_objSQLCommand
Try
'Open the connection.
m_objConnection.Open()
'Fill the data adapter.
DataAdapter.Fill(myDataTable)
Finally
'Close the connection.
m_objConnection.Close()
End Try
'Add it to the session.
Session("ReconciliationTime") = myDataTable
End If
'Return the final dataset.
Return myDataTable
End Function
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
ScriptMode
=
"Release"
></
telerik:RadScriptManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"LoadingPanel1"
runat
=
"server"
Skin
=
"Default"
></
telerik:RadAjaxLoadingPanel
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"panel1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"panel1"
LoadingPanelID
=
"LoadingPanel1"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"grid1"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"panel2"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadWindow
ID
=
"RadWindow1"
runat
=
"server"
Title
=
"Settings"
Width
=
"500px"
Height
=
"350px"
OnClientClose
=
"refreshGrid"
>
<
ContentTemplate
>
<
asp:Panel
ID
=
"panel1"
runat
=
"server"
>
<
telerik:RadAsyncUpload
ID
=
"AttachFiles"
runat
=
"server"
InputSize
=
"40"
OnClientFileUploading
=
"OnClientFileUploading"
MultipleFileSelection="Automatic" OnClientValidationFailed="OnClientValidationFailed"
MaxFileSize="73400320" AllowedFileExtensions=".jpeg,.jpg,.png,.docx,.doc,.xlsx,.xls,.pdf">
</
telerik:RadAsyncUpload
>
</
asp:Panel
>
</
ContentTemplate
>
</
telerik:RadWindow
>