(%@ Register TagPrefix="igtbl" Namespace="Infragistics.WebUI.UltraWebGrid" Assembly="Infragistics.WebUI.UltraWebGrid.v6.3, Version=6.3.20063.53, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %)
(%@ Page language="c#" Codebehind="testpage.aspx.cs" AutoEventWireup="false" Inherits="bms.testpage" %)
(!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" )
(HTML)
(HEAD)
(title)testpage(/title)
(meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR")
(meta content="C#" name="CODE_LANGUAGE")
(meta content="JavaScript" name="vs_defaultClientScript")
(meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema")
(LINK href="/ig_common/20063/Styles/Office2007Silver/ig_WebGrid.css " type="text/css"
rel="Stylesheet")
(/HEAD)
(body XMLNS:igtbl="http://schemas.infragistics.com/ASPNET/WebControls/UltraWebGrid" MS_POSITIONING="GridLayout")
(form id="Form1" method="post" runat="server")
(table border="1" width="50%")
(tr)
(td)(igtbl:ultrawebgrid id="UltraWebGrid1" runat="server" ImageDirectory="/ig_common/Images/")
(DisplayLayout AllowDeleteDefault="Yes" ColWidthDefault="100%" RowSizingDefault="Free" StationaryMargins="Header"
StationaryMarginsOutlookGroupBy="True" AllowSortingDefault="OnClient" RowHeightDefault="20px"
Version="2.00" ViewType="OutlookGroupBy" SelectTypeRowDefault="Extended" AllowColumnMovingDefault="OnServer"
HeaderClickActionDefault="SortMulti" BorderCollapseDefault="Separate" AllowColSizingDefault="Free"
RowSelectorsDefault="No" Name="UltraWebGrid1" TableLayout="Fixed" AllowUpdateDefault="Yes")
(AddNewBox Hidden="False")
(Style BorderWidth="1px" BorderColor="InactiveCaption" BorderStyle="Solid" BackColor="Window")
(BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White")
(/BorderDetails)
(/Style)
(/AddNewBox)
(Pager MinimumPagesForDisplay="2")
(Style BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray")
(BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White")
(/BorderDetails)
(/Style)
(/Pager)
(HeaderStyleDefault BorderStyle="Solid" HorizontalAlign="Left" BackColor="LightGray")
(BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White")(/BorderDetails)
(/HeaderStyleDefault)
(GroupByRowStyleDefault BorderColor="Window" BackColor="Control")(/GroupByRowStyleDefault)
(FrameStyle BorderWidth="1px" Font-Size="8.25pt" Font-Names="Microsoft Sans Serif" BorderColor="InactiveCaption"
BorderStyle="Solid" BackColor="Window")(/FrameStyle)
(FilterOptionsDefault)
(FilterHighlightRowStyle ForeColor="White" BackColor="#151C55")(/FilterHighlightRowStyle)
(FilterDropDownStyle BorderWidth="1px" Font-Size="11px" Font-Names="Verdana,Arial,Helvetica,sans-serif"
BorderColor="Silver" BorderStyle="Solid" BackColor="White" Height="300px" CustomRules="overflow:auto;")
(Padding Left="2px")(/Padding)
(/FilterDropDownStyle)
(/FilterOptionsDefault)
(FooterStyleDefault BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray")
(BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White")(/BorderDetails)
(/FooterStyleDefault)
(GroupByBox)
(Style BorderColor="Window" BackColor="ActiveBorder")(/Style)
(/GroupByBox)
(Images /)
(EditCellStyleDefault BorderWidth="0px" BorderStyle="None")(/EditCellStyleDefault)
(RowStyleDefault BorderWidth="1px" BorderColor="Silver" BorderStyle="Solid" BackColor="Window")
(Padding Left="3px")(/Padding)
(BorderDetails ColorTop="Window" ColorLeft="Window")(/BorderDetails)
(/RowStyleDefault)
(/DisplayLayout)
(Bands)
(igtbl:UltraGridBand Key="Level0" CellClickAction="RowSelect" Expandable="Yes")
(Columns)
(igtbl:UltraGridColumn HeaderText="Emp Name" Format="")
(Footer Key="")(/Footer)
(Header Key="" Caption="Emp Name")(/Header)
(/igtbl:UltraGridColumn)
(/Columns)
(/igtbl:UltraGridBand)
(igtbl:UltraGridBand Key="Level1" Expandable="Yes")
(Columns)
(igtbl:UltraGridColumn HeaderText="Active" Width="80%" Type="CheckBox" Format="" AllowResize="Free" Hidden="True")
(Footer Key="")(/Footer)
(Header Key="" Caption="Active")(/Header)
(/igtbl:UltraGridColumn)
(igtbl:UltraGridColumn HeaderText="Role Name" Width="94%" Format="" AllowResize="Free")
(Footer Key="")
(RowLayoutColumnInfo OriginX="1")(/RowLayoutColumnInfo)
(/Footer)
(Header Key="" Caption="Role Name")
(RowLayoutColumnInfo OriginX="1")(/RowLayoutColumnInfo)
(/Header)
(/igtbl:UltraGridColumn)
(/Columns)
(/igtbl:UltraGridBand)
(igtbl:UltraGridBand Key="Level2")
(Columns)
(igtbl:UltraGridColumn HeaderText="Role Desc" Width="50%" Format="" AllowResize="Free")
(Footer Key="")(/Footer)
(Header Key="" Caption="Role Desc")(/Header)
(/igtbl:UltraGridColumn)
(igtbl:UltraGridColumn HeaderText="Is Primary" Width="50%" Type="CheckBox" Format="" AllowResize="Free")
(Footer Key="")
(RowLayoutColumnInfo OriginX="1")(/RowLayoutColumnInfo)
(/Footer)
(Header Key="" Caption="Is Primary")
(RowLayoutColumnInfo OriginX="1")(/RowLayoutColumnInfo)
(/Header)
(/igtbl:UltraGridColumn)
(/Columns)
(/igtbl:UltraGridBand)
(/Bands)
(/igtbl:ultrawebgrid)
(/td)
(/tr)
(tr)
(td)(asp:button id="Button1" runat="server" Text="Get value")(/asp:button)
(asp:button id="Button2" runat="server" Text="Load")(/asp:button)(/td)
(/tr)
(/table)
(/form)
(/body)
(/HTML)
#region using
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using BMSQBInterface;
using bmsFramework.MyAccount;
using Infragistics.WebUI.UltraWebGrid;
#endregion
namespace bms
{
///
/// Summary description for testpage.
///
public class testpage : System.Web.UI.Page
{
protected BMSQBServer bmsQBServer = null;
protected DBConnection dbc;
protected cmaDBInterface odb;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected Infragistics.WebUI.UltraWebGrid.UltraWebGrid UltraWebGrid1;
protected System.Data.SqlClient.SqlConnection myConn;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
UltraWebGrid1.Width = Unit.Empty;
UltraWebGrid1.Height = Unit.Empty;
UltraWebGrid1.DisplayLayout.FrameStyle.CustomRules = "table-layout:auto";
UltraWebGrid1.Bands[1].Expandable = Infragistics.WebUI.UltraWebGrid.Expandable.Yes;
odb.LoadEMPGD(UltraWebGrid1);
odb.LoadRolesGD(UltraWebGrid1);
odb.LoadRoledetailsGD(UltraWebGrid1);
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Unload += new System.EventHandler(this.Services_Unload);
this.Load += new System.EventHandler(this.Page_Load);
this.Init += new System.EventHandler(this.Services_Init);
}
#endregion
private void Services_Init(object sender, System.EventArgs e)
{
string strConnInfo = Application.Contents["ConnectionInfo"].ToString();
odb = new cmaDBInterface();
odb.OpenStagingDatabase(strConnInfo);
}
private void Services_Unload(object sender, System.EventArgs e)
{
odb.CloseStagingDatabase();
}
}
}
cmadbinterface methods..
public void LoadEMPGD(Infragistics.WebUI.UltraWebGrid.UltraWebGrid argGrid)
{
int nID = -9999;
string sqlQuery = "Select Employee_ID, First_Name + ' ' + Last_Name as 'Name' FROM employees";
argGrid.Rows.Clear();
System.Data.SqlClient.SqlDataReader myReader = null;
try
{
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand(sqlQuery, myConn);
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
Infragistics.WebUI.UltraWebGrid.UltraGridRow myRow = new Infragistics.WebUI.UltraWebGrid.UltraGridRow(true);
nID = myReader.GetInt32(0);
string Service_Desc = (myReader.IsDBNull(1) ? "" : myReader.GetString(1));
Infragistics.WebUI.UltraWebGrid.UltraGridCell Cell0 = new Infragistics.WebUI.UltraWebGrid.UltraGridCell(Service_Desc);
myRow.Key = nID.ToString();
myRow.Cells.Add(Cell0);
argGrid.Rows.Add(myRow);
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Source);
System.Diagnostics.Debug.WriteLine(e.Message);
}
finally
{
myReader.Close();
}
}
public void LoadRolesGD(Infragistics.WebUI.UltraWebGrid.UltraWebGrid argGrid)
{
int Role_ID = -1;
string strQuery = "select R.Role_ID,R.Role_name from Employees E INNER JOIN Employee_Roles ER ON E.Employee_id = ER.Employee_id INNER JOIN Role R ON ER.Role_ID = R.Role_ID AND E.Employee_id = @Employee_ID";
try
{
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand(strQuery, myConn);
myCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Employee_ID", System.Data.SqlDbType.Int, 4));
foreach (Infragistics.WebUI.UltraWebGrid.UltraGridRow eventrow in argGrid.Rows)
{
eventrow.Rows.Clear();
myCommand.Parameters["@Employee_ID"].Value = Int32.Parse(eventrow.Key);
System.Data.SqlClient.SqlDataReader myReader = null;
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
Infragistics.WebUI.UltraWebGrid.UltraGridRow myRow = new Infragistics.WebUI.UltraWebGrid.UltraGridRow(true);
Role_ID = myReader.GetInt32(0);
bool Active = true;
string Role_Name = (myReader.IsDBNull(1) ? "" : myReader.GetString(1));
Infragistics.WebUI.UltraWebGrid.UltraGridCell Cell1 = new Infragistics.WebUI.UltraWebGrid.UltraGridCell(Active.ToString());
Infragistics.WebUI.UltraWebGrid.UltraGridCell Cell2 = new Infragistics.WebUI.UltraWebGrid.UltraGridCell(Role_Name);
myRow.Key = Role_ID.ToString();
// myRow.Key = (nServiceID * 1000 + eventrow.Rows.Count + 1).ToString();
myRow.Cells.Add(Cell1);
myRow.Cells.Add(Cell2);
eventrow.Rows.Add(myRow);
}
myReader.Close();
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Source);
System.Diagnostics.Debug.WriteLine(e.Message);
}
// finally
// {
// myReader.Close();
// }
}
public void LoadRoledetailsGD(Infragistics.WebUI.UltraWebGrid.UltraWebGrid argGrid)
{
int Role_Id = -1;
int RolerowPID = -1;
string strQuery = "Select Role_ID,Role_Name, PrimaryRole FROM Role where Role_Id=@Role_Id";
try
{
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand(strQuery, myConn);
myCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Role_Id", System.Data.SqlDbType.Int, 4));
foreach (Infragistics.WebUI.UltraWebGrid.UltraGridRow Empployeesrows in argGrid.Rows)
{
foreach (Infragistics.WebUI.UltraWebGrid.UltraGridRow Rolerow in Empployeesrows.Rows)
{
Role_Id = Convert.ToInt32(Rolerow.Key);
myCommand.Parameters["@Role_Id"].Value = Role_Id;
Rolerow.Rows.Clear();
System.Data.SqlClient.SqlDataReader myReader = null;
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
Infragistics.WebUI.UltraWebGrid.UltraGridRow myRow = new Infragistics.WebUI.UltraWebGrid.UltraGridRow(true);
RolerowPID = myReader.GetInt32(0);
myRow.Key = RolerowPID.ToString();
string RoleDesc = (myReader.IsDBNull(1) ? "" : myReader.GetString(1));
bool isPrimary = (myReader.IsDBNull(2) ? false : Convert.ToBoolean(myReader.GetByte(2)));
Infragistics.WebUI.UltraWebGrid.UltraGridCell Cell0 = new Infragistics.WebUI.UltraWebGrid.UltraGridCell();
Cell0.Value = RoleDesc;
Infragistics.WebUI.UltraWebGrid.UltraGridCell Cell1 = new Infragistics.WebUI.UltraWebGrid.UltraGridCell(Convert.ToInt32(isPrimary));
myRow.Cells.Add(Cell0);
myRow.Cells.Add(Cell1);
Rolerow.Rows.Add(myRow);
}
myReader.Close();
}
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Source);
System.Diagnostics.Debug.WriteLine(e.Message);
}
// finally
// {
//
// myReader.Close();
// }
}
No comments:
Post a Comment