当前位置:网站首页>ERP部门的添加(十一)
ERP部门的添加(十一)
2022-08-06 00:34:00 【51CTO】
功能需求:
1.有部门管理权限的人员进行添加部门基本信息。
2.有部门权限管理的人员查询部门基本信息。
3.有部门权限管理的人员进行修改部门基本信息。
4.在一个页面中实现,使用弹出对话框方式
存储过程:
-- =============================================
ALTER PROCEDURE [dbo].[Department_Add]
@DepartmentName nvarchar(50),
@Tel1 nvarchar(20),
@Tel2 nvarchar(20),
@ReMark nvarchar(200)
AS
BEGIN
INSERT INTO Department
(
DepartmentName,
Tel1,
Tel2,
ReMark
)
VALUES
(
@DepartmentName,
@Tel1,
@Tel2,
@ReMark
)
--修改部门显示顺序
DECLARE @id int
SET @[email protected]@IDENTITY
UPDATE Department
SET
Displayorder [email protected]
WHERE [email protected]
END
- 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.
修改:
------------------------------------
ALTER PROCEDURE [dbo].[Department_Update]
@DepartmentId int,
@DepartmentName nvarchar(50),
@Tel1 nvarchar(20),
@Tel2 nvarchar(20),
@Displayorder int,
@ReMark nvarchar(200)
AS
UPDATE [Department] SET
[DepartmentName] = @DepartmentName,[Tel1] = @Tel1,[Tel2] = @Tel2,[Displayorder] = @Displayorder,[ReMark] = @ReMark
WHERE [email protected]
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
前台的页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DepartMentManager.aspx.cs" Inherits="BioErpWeb.HRSystem.DepartMentManager" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
<link href="../Styles/AspNetPagerStyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel id="up_all" runat="server">
<contenttemplate>
<asp:ImageButton ID="imgEditBtn" Width="1" Height="1" runat="server" />
<cc1:ModalPopupExtender ID="Modal_Add" TargetControlID="btnNew" PopupControlID="Panel_Add" runat="server">
</cc1:ModalPopupExtender>
<cc1:ModalPopupExtender ID="Modal_Update" TargetControlID="imgEditBtn" PopupControlID="Panel_Update" runat="server">
</cc1:ModalPopupExtender>
<div>
<asp:Panel ID="Panel_Add" runat="server" CssClass="pLogo">
<table class="tb_mess">
<thead class="name"><caption>部门信息添加</caption></thead>
<tr>
<td>部门名</td><td>
<asp:TextBox ID="txtDepartMent0" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>电话号码1</td><td>
<asp:TextBox ID="txtTel10" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>电话号码2</td><td>
<asp:TextBox ID="txtTel20" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>备注</td><td>
<asp:TextBox ID="txtReMark" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" class="bottomtd">
<asp:Button ID="btnAdd" runat="server" Text="提交" onclick="btnAdd_Click"/>
<asp:Button ID="Button1" runat="server" Text="关闭" />
</td>
</tr>
</table>
</asp:Panel>
</div>
<div>
<asp:Panel ID="Panel_Update" runat="server" CssClass="pLogo">
<table class="tb_mess">
<thead class="name"><caption>部门信息编辑</caption></thead>
<tr>
<td>部门名</td><td>
<asp:TextBox ID="txtDepartMent1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>电话号码1</td><td>
<asp:TextBox ID="txtTel11" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>电话号码2</td><td>
<asp:TextBox ID="txtTel21" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>显示顺序</td><td>
<asp:TextBox ID="txtDisplayOrder1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>备注</td><td>
<asp:TextBox ID="txtReMark1" runat="server"></asp:TextBox>
</td>
</tr>
</tr>
<td colspan="2" class="bottomtd">
<asp:Button ID="btnUpdate" runat="server" Text="提交" onclick="btnUpdate_Click" />
<asp:Button ID="btnClose1" CausesValidation="false" runat="server" Text="关闭"
onclick="btnClose1_Click" /></td>
</table>
</asp:Panel>
</div>
<table class="maintable">
<tr>
<td class="titlebar">
部门信息管理系统
</td>
</tr>
<tr>
<td style=" text-align:right; padding-right:10px; ">
<asp:Button ID="btnNew" runat="server" Text="添加" BackColor="#CDEAFB" Width="80px" Height="30px" />
</td>
</tr>
<tr>
<td>
<asp:GridView ID="GridView1" Width="100%" AutoGenerateColumns="False"
runat="server" onrowcommand="GridView1_RowCommand" DataKeyNames="DepartmentId">
<Columns>
<asp:TemplateField HeaderText="编号">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("DepartmentId") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="部门名称">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("DepartmentName") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="电话号码1">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("Tel1") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="电话号码2">
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Eval("Tel2") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="显示顺序">
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Eval("Displayorder") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="说明">
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# Eval("ReMark") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="操作">
<ItemTemplate>
<asp:ImageButton ID="imgEditBtn" Width="50" Height="20" CommandName="imgEdit" CommandArgument='<%#Eval("DepartmentId") %>' CausesValidation="false" ImageUrl="~/Web/images/Edit.gif" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td>
<webdiyer:AspNetPager ID="AspNetPager1" CssClass="paginator"
CurrentPageButtonClass="cpb" runat="server"
onpagechanged="AspNetPager1_PageChanged">
</webdiyer:AspNetPager>
</td>
</tr>
</table>
</contenttemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
- 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.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
- 122.
- 123.
- 124.
- 125.
- 126.
- 127.
- 128.
- 129.
- 130.
- 131.
- 132.
- 133.
- 134.
- 135.
- 136.
- 137.
- 138.
- 139.
- 140.
- 141.
- 142.
- 143.
- 144.
- 145.
- 146.
- 147.
- 148.
- 149.
- 150.
- 151.
- 152.
- 153.
- 154.
- 155.
- 156.
- 157.
- 158.
- 159.
- 160.
- 161.
- 162.
- 163.
- 164.
- 165.
- 166.
- 167.
- 168.
- 169.
- 170.
- 171.
- 172.
- 173.
- 174.
- 175.
- 176.
- 177.
- 178.
- 179.
- 180.
- 181.
- 182.
- 183.
- 184.
- 185.
- 186.
- 187.
BLL层:
public class DepartMentBLL
{
/// <summary>
/// 添加
/// </summary>
/// <param name="de"></param>
/// <returns></returns>
public int DepartMentAdd(DepartMent de)
{
SqlParameter[] parameters = {
new SqlParameter("@DepartmentName", SqlDbType.NVarChar,50),
new SqlParameter("@Tel1", SqlDbType.NVarChar,20),
new SqlParameter("@Tel2", SqlDbType.NVarChar,20),
new SqlParameter("@ReMark", SqlDbType.NVarChar,200)};
parameters[0].Value = de.DepartmentName;
parameters[1].Value = de.Tel1;
parameters[2].Value = de.Tel2;
parameters[3].Value = de.ReMark;
return DataBaseHelper.ExcuteSqlReturnInt("Department_ADD", CommandType.StoredProcedure, parameters);
}
/// <summary>
/// 修改
/// </summary>
/// <param name="de"></param>
/// <returns></returns>
public int DepartMentUpdate(DepartMent de)
{
SqlParameter[] parameters = {
new SqlParameter("@DepartmentId", SqlDbType.Int,4),
new SqlParameter("@DepartmentName", SqlDbType.NVarChar,50),
new SqlParameter("@Tel1", SqlDbType.NVarChar,20),
new SqlParameter("@Tel2", SqlDbType.NVarChar,20),
new SqlParameter("@Displayorder", SqlDbType.Int,4),
new SqlParameter("@ReMark", SqlDbType.NVarChar,200)};
parameters[0].Value = de.DepartmentId;
parameters[1].Value = de.DepartmentName;
parameters[2].Value = de.Tel1;
parameters[3].Value = de.Tel2;
parameters[4].Value = de.Displayorder;
parameters[5].Value = de.ReMark;
return DataBaseHelper.ExcuteSqlReturnInt("Department_Update", CommandType.StoredProcedure, parameters);
}
/// <summary>
/// 根据ID获取编号
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public DepartMent getDepartMentById(string ID)
{
DepartMent d = new DepartMent();
return null;
}
}
- 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.
界面层:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
pagebind();
}
}
public static int pageindex = 0;
public static int pagesize = 10;
public static string condition = "";
protected void pagebind()
{
this.AspNetPager1.RecordCount = SqlComm.getDataCountByCondition("Department", condition);
this.AspNetPager1.PageSize = pagesize;
this.GridView1.DataSource = SqlComm.getDataByPageIndex("Department", "*", "DepartmentId", condition, pageindex, pagesize);
this.GridView1.DataBind();
}
DepartMentBLL debll = new DepartMentBLL();
protected void btnAdd_Click(object sender, EventArgs e)
{
DepartMent de = new DepartMent();
de.DepartmentName = this.txtDepartMent0.Text;
de.ReMark = this.txtReMark.Text;
de.Tel1 = this.txtTel10.Text;
de.Tel2 = this.txtTel20.Text;
if (debll.DepartMentAdd(de) != 0)
{
pagebind();
}
this.Modal_Add.Hide();
}
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
pageindex = this.AspNetPager1.CurrentPageIndex - 1;
pagebind();
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "imgEdit")
{
this.Modal_Update.Show();
}
}
protected void btnClose1_Click(object sender, EventArgs e)
{
this.Modal_Update.Hide();
}
- 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.
修改BLL:
/// <summary>
/// 根据ID获取编号
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public DepartMent getDepartMentById(string ID)
{
DepartMent d = new DepartMent();
SqlDataReader reader= SqlComm.GetDataReaderByCondition("Department", "*", " DepartmentId= " + ID);
while (reader.Read())
{
d.DepartmentId=int.Parse(reader["DepartmentId"].ToString());
d.DepartmentName = reader["DepartmentName"].ToString();
d.Displayorder = int.Parse(reader["Displayorder"].ToString());
d.ReMark = reader["ReMark"].ToString();
d.Tel1 = reader["Tel1"].ToString();
d.Tel2 = reader["Tel2"].ToString();
}
reader.Close();
return d;
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
UI代码:
protected void btnUpdate_Click(object sender, EventArgs e)
{
de.DepartmentName = this.txtDepartMent1.Text;
de.ReMark = this.txtReMark1.Text;
de.Tel1 = this.txtTel11.Text;
de.Tel2 = this.txtTel21.Text;
de.Displayorder = int.Parse(this.txtDisplayOrder1.Text.Trim()) ;
if (debll.DepartMentUpdate(de) != 0)
{
pagebind();
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('修改失败')", true);
}
this.Modal_Update.Hide();
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
角色的管理:
公用层:
BLL层:
public class RoseBLL
{
/// <summary>
/// 添加一个角色信息
/// </summary>
/// <param name="rose"></param>
/// <returns></returns>
public int Rose_Add(tbRose rose)
{
SqlParameter[] parameters = {
new SqlParameter("@RoseName", SqlDbType.NVarChar,50)};
parameters[0].Value = rose.RoseName;
return DataBaseHelper.ExcuteSqlReturnInt("tbRose_ADD", CommandType.StoredProcedure, parameters);
}
/// <summary>
/// 修改一个角色对象
/// </summary>
/// <param name="rose"></param>
/// <returns></returns>
public int Rose_Update(tbRose rose)
{
SqlParameter[] parameters = {
new SqlParameter("@RoseID", SqlDbType.Int,4),
new SqlParameter("@RoseName", SqlDbType.NVarChar,50)};
parameters[0].Value = rose.RoseID;
parameters[1].Value = rose.RoseName;
return DataBaseHelper.ExcuteSqlReturnInt("tbRose_Update", CommandType.StoredProcedure, parameters);
}
/// <summary>
/// 根据ID获取Rose对象
/// </summary>
/// <param name="id">id</param>
/// <returns>tbRose</returns>
public tbRose getRoseById(string id)
{
tbRose r = new tbRose();
SqlDataReader reader = SqlComm.GetDataReaderByCondition("tbRose", "*", " RoseID=" + id);
if (reader != null)
{
while (reader.Read())
{
r.RoseID = int.Parse(reader["RoseID"].ToString());
r.RoseName = reader["RoseName"].ToString();
}
reader.Close();
}
return r;
}
}
- 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.
页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RoseManager.aspx.cs" Inherits="BioErpWeb.HRSystem.RoseManager" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
<link href="../Styles/AspNetPagerStyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel id="up_all" runat="server">
<contenttemplate>
<asp:ImageButton ID="imgEditBtn" Width="1" Height="1" runat="server" />
<cc1:ModalPopupExtender ID="Modal_Add" TargetControlID="btnNew" PopupControlID="Panel_Add" runat="server">
</cc1:ModalPopupExtender>
<cc1:ModalPopupExtender ID="Modal_Update" TargetControlID="imgEditBtn" PopupControlID="Panel_Update" runat="server">
</cc1:ModalPopupExtender>
<div>
<asp:Panel ID="Panel_Add" runat="server" CssClass="pLogo">
<table class="tb_mess">
<thead class="name"><caption>角色添加</caption></thead>
<tr>
<td>角色名</td><td>
<asp:TextBox ID="txtRose0" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" class="bottomtd">
<asp:Button ID="btnAdd" runat="server" Text="提交" onclick="btnAdd_Click"/>
<asp:Button ID="Button1" runat="server" Text="关闭" />
</td>
</tr>
</table>
</asp:Panel>
</div>
<div>
<asp:Panel ID="Panel_Update" runat="server" CssClass="pLogo">
<table class="tb_mess">
<thead class="name"><caption>角色编辑</caption></thead>
<tr>
<td>角色名</td><td>
<asp:TextBox ID="txtRose1" runat="server"></asp:TextBox>
</td>
</tr>
</tr>
<td colspan="2" class="bottomtd">
<asp:Button ID="btnUpdate" runat="server" Text="提交" onclick="btnUpdate_Click" />
<asp:Button ID="btnClose1" CausesValidation="false" runat="server" Text="关闭"
onclick="btnClose1_Click" /></td>
</table>
</asp:Panel>
</div>
<table class="maintable">
<tr>
<td class="titlebar">
企业角色管理系统
</td>
</tr>
<tr>
<td style=" text-align:right; padding-right:10px; ">
<asp:Button ID="btnNew" runat="server" Text="添加" BackColor="#CDEAFB" Width="80px" Height="30px" />
</td>
</tr>
<tr>
<td>
<asp:GridView ID="GridView1" Width="100%" AutoGenerateColumns="False"
runat="server" onrowcommand="GridView1_RowCommand" DataKeyNames="RoseID">
<Columns>
<asp:TemplateField HeaderText="编号">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("RoseID") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="角色名称">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("RoseName") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="操作">
<ItemTemplate>
<asp:ImageButton ID="imgEditBtn" Width="50" Height="20" CommandName="imgEdit" CommandArgument='<%#Eval("RoseID") %>' ImageUrl="~/Web/images/Edit.gif" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td>
<webdiyer:AspNetPager ID="AspNetPager1" CssClass="paginator"
CurrentPageButtonClass="cpb" runat="server"
onpagechanged="AspNetPager1_PageChanged">
</webdiyer:AspNetPager>
</td>
</tr>
</table>
</contenttemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
- 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.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
后端:
public partial class RoseManager : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
pagebind();
}
}
public static int pageindex = 0;
public static int pagesize = 10;
public static string condition = "";
protected void pagebind()
{
this.AspNetPager1.RecordCount = SqlComm.getDataCountByCondition("tbRose", condition);
this.AspNetPager1.PageSize = pagesize;
this.GridView1.DataSource = SqlComm.getDataByPageIndex("tbRose", "RoseID,RoseName", "RoseID", condition, pageindex, pagesize);
this.GridView1.DataBind();
}
static tbRose r=new tbRose();
RoseBLL rosebll = new RoseBLL();
protected void btnAdd_Click(object sender, EventArgs e)
{
if (this.txtRose0.Text == "" || this.txtRose0.Text.Trim().Length == 0)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('请填写角色名称');", true);
return;
}
r.RoseName = this.txtRose0.Text;
if (rosebll.Rose_Add(r) != 0)
{
pagebind();
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('提交失败');", true);
}
this.Modal_Add.Hide();
}
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
pageindex = this.AspNetPager1.CurrentPageIndex - 1;
pagebind();
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
if (this.txtRose1.Text == "" || this.txtRose1.Text.Trim().Length == 0)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('请填写角色名称');", true);
return;
}
r.RoseName = this.txtRose1.Text;
if (rosebll.Rose_Update(r) != 0)
{
pagebind();
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('编辑失败');", true);
}
this.Modal_Update.Hide();
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "imgEdit")
{
string roseid = e.CommandArgument.ToString();
r = rosebll.getRoseById(roseid);
this.txtRose1.Text = r.RoseName;
this.Modal_Update.Show();
}
}
protected void btnClose1_Click(object sender, EventArgs e)
{
this.Modal_Update.Hide();
}
}
- 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.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
边栏推荐
- 2022第四届山东国际大健康产业博览会,中国大健康产业展览会
- 在国信证券股票开户怎么样?安全吗?
- ERP仓库管理系统查询(十)
- Code Casual Recording Notes_Dynamic Programming_494 Objectives and
- openstack架构中给虚拟机提供存储资源的组件是什么
- Uniapp H5 public authorization number
- Less than two months after the launch, Ascend AI boosted the "China Computing Network" to add a new node
- Teach you the object-src of the CSP series
- 子页面监听父页面点击事件
- MySQL: storage engine
猜你喜欢
随机推荐
我明明加了唯一索引,数据库怎么还是产生重复数据?
Find My资讯|新系统苹果Find My不再显示AirTag电池电量
关于时间格式和获取指定时间的方法
代码随想录笔记_动态规划_494目标和
无线数字平板探测器维修Mars1717XU-VSI故障分析
Flutter tabbar set text background, do not delay
为啥强烈禁止使用Calendar?
Oracle学习笔记(九)
从零开始用C#做产品:私人日记(14)Sqlite封装
STM32 - USMART Debugging Component Experiment-M4
横向联邦学习-梯度安全聚合
[kali-vulnerability exploitation] (3.2) Metasploit basics (middle): Armitage tool exploitation process
子页面监听父页面点击事件
Idea如何查看代码注释 修改者?
[mysql]--remember a delete delete statement using an alias pit
17、学习MySQL 事务
Kubernetes 实现灰度和蓝绿发布
What are the core problems in the database application system
Chrome Google Chrome, how to install the appropriate browser driver?
Kubernetes 调度器优化