/
Whitfield_Payroll_ByProject.ascx.cs
69 lines (63 loc) · 2.06 KB
/
Whitfield_Payroll_ByProject.ascx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections.Specialized;
using System.Drawing;
public partial class Whitfield_Payroll_ByProject : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
public void DisplayGrid(String _userid,String FromDate, String ToDate)
{
try
{
WhitfieldPayroll _dbClass = new WhitfieldPayroll();
DataSet dsSubMats = _dbClass.GetPayRollProjectHoursForEmployee(_userid, FromDate, ToDate);
PopulateDataGrid(dsSubMats, grdEmpl);
}
catch (Exception exp)
{
Response.Write(exp.Message.ToString());
}
}
public void PopulateDataGrid(DataSet dsGridResults, DataGrid grdpl1)
{
Int32 resultCount = 0;
if (dsGridResults.Tables.Count > 0)
resultCount = dsGridResults.Tables[0].Rows.Count;
Int32 maxResultItemInPage = 0;
Int32 minResultItemInPage = 0;
try
{
if (resultCount > 0)
{
DataTable tblInstallments = dsGridResults.Tables[0];
//Display results in Grid
if (resultCount > (grdpl1.CurrentPageIndex + 1) * grdpl1.PageSize)
maxResultItemInPage = (grdpl1.CurrentPageIndex + 1) * grdpl1.PageSize;
else
maxResultItemInPage = resultCount;
if (maxResultItemInPage - (grdpl1.PageSize - 1) > 1)
minResultItemInPage = maxResultItemInPage - (grdpl1.PageSize - 1);
else
minResultItemInPage = 1;
grdpl1.Visible = true;
grdpl1.DataSource = tblInstallments;
grdpl1.DataBind();
}
else
{
grdpl1.Visible = false;
}
}
catch (Exception exp)
{
Response.Write(exp.Message.ToString());
}
}
}