StoredProcedure
ALTER PROCEDURE [dbo].[SSP_GetAllDraftPreliminaryEnquiryByOfficeIDWithPaging]
@OfficeID bigINT,
@PageIndex INT = 1,
@PageSize INT = 1
AS
BEGIN
select fi.fileid, pe.preliminaryenquiryid, pe.sourceofpe,pe.complaintreferencenumber, pe.penumber, pe.PEDate, fi.ReferenceId
from preliminaryenquiry pe
inner join fileinformation fi on fi.referenceid = pe.preliminaryenquiryid and fi.ReferenceType=195
where not exists (
select 1
from registerpreliminaryenquiry
where referenceid = pe.preliminaryenquiryid and referencetype = 195
) AND fi.OfficeID = @OfficeID order by FileID
OFFSET (@PageIndex * @PageSize)
ROWS FETCH NEXT @PageSize ROWS ONLY
select COUNT(*) as TotalRowCount
from preliminaryenquiry pe
inner join fileinformation fi on fi.referenceid = pe.preliminaryenquiryid and fi.ReferenceType=195
where not exists (
select 1
from registerpreliminaryenquiry
where referenceid = pe.preliminaryenquiryid and referencetype = 195
) AND fi.OfficeID = @OfficeID
END
-----------------------
aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
LoadDraftPreliminaryEnquiry(0, 10);
}
public void LoadDraftPreliminaryEnquiry(int pageNumber, int pageSize)
{
try
{
DataSet ds = new DataSet();
using (var client = ServiceClient<IComplaintMigrationManager>.Create(ObjectConstants.ComplaintMigrationManager))
{
ds = client.Instance.GetAllDraftPreliminaryEnquiryByOfficeIDWithPaging(CurrentUser.OfficeId, pageNumber,pageSize);
}
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
var totalRowsCount = Convert.ToInt32(ds.Tables[1].Rows[0]["TotalRowCount"]);
grdDraftPreliminaryEnquiry.VirtualItemCount = totalRowsCount;
}
}
grdDraftPreliminaryEnquiry.DataSource = ds;
grdDraftPreliminaryEnquiry.DataBind();
}
catch (Exception ex)
{
ProcessException(ex);
}
}
}
protected void grdDraftPreliminaryEnquiry_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
var pageIndex = e.NewPageIndex;
grdDraftPreliminaryEnquiry.PageIndex = pageIndex;
LoadDraftPreliminaryEnquiry(pageIndex, 10);
}
----------------------------------------
aspx
<asp:GridView runat="server" ID="grdDraftPreliminaryEnquiry" AutoGenerateColumns="false"
OnRowCommand="grdDraftPreliminaryEnquiry_RowCommand" CssClass="table table-striped" OnRowDeleting="grdDraftPreliminaryEnquiry_RowDeleting" OnRowDataBound="grdDraftPreliminaryEnquiry_RowDataBound" AllowPaging="true" OnPageIndexChanging="grdDraftPreliminaryEnquiry_PageIndexChanging" AllowCustomPaging="true" PageSize="10" >
<Columns>
<asp:BoundField DataField="fileid" HeaderText="File ID" />
<asp:BoundField DataField="preliminaryenquiryID" HeaderText="preliminary enq ID" />
<asp:BoundField DataField="sourceofpe" HeaderText="source of pe" />
<asp:BoundField DataField="complaintreferencenumber" HeaderText="Comp ref num" />
<%-- <telerik:GridBoundColumn DataField="referencefilenumber" HeaderText="Ref File No." />--%>
<asp:BoundField DataField="penumber" HeaderText="pe number" />
<asp:BoundField DataField="pedate" HeaderText="PE Date" />
<%--<telerik:GridBoundColumn DataField="referencetype" HeaderText="reference type" />--%>
<asp:BoundField DataField="referenceid" HeaderText="reference ID" />
<%--<telerik:GridBoundColumn DataField="createdby" HeaderText="created by" />--%>
<asp:TemplateField HeaderText="Select" Visible="true">
<ItemTemplate>
<asp:LinkButton ID="lnkgrdDraftPreliminaryEnquirySelect" runat="server" CssClass="btn btn-danger" ToolTip="Select" CommandName="Select" Text="Select" CausesValidation="false" CommandArgument='<%# Eval("preliminaryenquiryid") + ";"+ Eval("fileid")%>' > </asp:LinkButton>
<%--<asp:LinkButton ID="lnkgrdDraftPreliminaryEnquiryDelete" runat="server" CssClass="btn btn-danger" ToolTip="delete" CausesValidation="false" CommandName="delete" >Delete</asp:LinkButton>--%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerSettings Mode="NumericFirstLast" PageButtonCount="4" FirstPageText="First" LastPageText="Last"/>
</asp:GridView>
-
No comments:
Post a Comment