分布式框架开发代码片段一

2016-12-30 09:55:28来源:oschina作者:深圳大道人点击

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserExt.aspx.cs" Inherits="DistributedWeb.Sql.User.UserExt" %>










<%if (mmodel != null)
{
Response.Write(mmodel.ID + "
");
Response.Write(mmodel.UserName + "
");
}
if (emodel != null)
{
Response.Write(emodel.CityId + "
");
Response.Write(emodel.GetCity() + "
");
Response.Write(emodel.GetNation() + "
");
Response.Write(emodel.AddTime + "
");
}
%>



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using DistributedModel.User;
using DistributedBLL.User;
namespace DistributedWeb.Sql.User
{
public partial class UserExt : System.Web.UI.Page
{
public DistributedModel.User.LoginUserInfo mmodel = null;
public DistributedModel.User.UserInfo emodel = null;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
protected void BindData()
{
LoginUserBLL bll = new LoginUserBLL();
//根据条件获取主数据
int totalCount = 0;
List mainList = bll.FindListPage("id='1001'", 1, 1,
out totalCount);
mmodel = mainList[0];
//获取某信息的扩展数据泛型集合(可能多个扩展信息类)
emodel = mmodel.GetExData("UserInfo");
/*
string userId = "1001";
DistributedBLL.User.LoginUserBLL bll = new DistributedBLL.User.LoginUserBLL();
//根据条件获取主数据
mmodel = bll.FindById(userId);
//获取某信息的扩展数据泛型集合(可能多个扩展信息类)
DistributedBLL.User.UserBLL bll1 = new DistributedBLL.User.UserBLL();
emodel = bll1.FindById(userId);
*/
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AspNetPagerList.aspx.cs" Inherits="DistributedWeb.AspNetPagerList" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>




分页例子

















FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" NumericButtonTextFormatString="{0}"
OnPageChanged="AspNetPager1_PageChanged" PageSize="3" PagingButtonSpacing="8px"
PrevPageText="上一页" ShowCustomInfoSection="Left" LayoutType="Table" CssClass="pages"
AlwaysShow="true" CurrentPageButtonClass="cpb" NumericButtonCount="5" CustomInfoHTML="第%CurrentPageIndex%页/共%PageCount%页 每页显示%PageSize%条">





using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DistributedBLL.User;
using DistributedModel.User;
using DistributedUtil.Helper;
using DistributedBLL;
using DistributedWeb.BasePage;
namespace DistributedWeb
{
public partial class AspNetPagerList : System.Web.UI.Page
{
LoginUserBLL loginbll = new LoginUserBLL();
UserBLL userbll = new UserBLL();
public List ulist = null;
protected void Page_Load(object sender, EventArgs e)
{
LoginUser.IsLogin();
if (!IsPostBack)
{
GetData();
}
}
public void GetData()
{
int RecordCount = 0;
string strWhere = GetWhereString();
ulist = loginbll.FindListPage(strWhere, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out RecordCount);
AspNetPager1.RecordCount = RecordCount;
GridView1.DataSource = ulist;
GridView1.DataBind();
}
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
GetData();
}

protected void btnsearch_Click(object sender, EventArgs e)
{
GetData();
}
protected string GetWhereString()
{
//拼接查询语句
string strWhere = "1=1 ";
return strWhere;
}
}
}

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台