普通列表页面指的是上一章那种有层次感列表以外的正常列表页面,由于上一章已讲解了正常添加页面的相关操作了,所以部分相关的操作本章节就不再罗嗦重复一次了。大家可以试试先用本章内容中的一些简单介绍,自己使用上一章下载的解决方案来实现一下,做做练习。
首先还是打开数据字典,创建广告内容表
在这里要说明一下的是,大家在对数据字典进行操作后(增、改、删),一定要在数据字典中的“版本”工作表中添加更新历史,以方便后面的维护人员查看(一定要养成一种良好的开发习惯),如下图
然后还是使用ExcelToSQLString2.91_sql.exe工具生成SQL语句,并在数据库中创建数据表,下面是生成好的SQL语句,请在数据库查询分析表中执行
/****** Object: Table [dbo].[Advertisement] Script Date: 2014/7/9 17:07:11 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Advertisement]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Advertisement]
GO /****** Object: Table [dbo].[Advertisement] Script Date: 2014/7/9 17:07:11 ******/
CREATE TABLE [dbo].[Advertisement] (
[Id] [int] IDENTITY (1, 1) NOT NULL,
[Name] [nvarchar] (50) NOT NULL,
[Content] [nvarchar] (100) NOT NULL,
[Url] [nvarchar] (200) NOT NULL,
[Keyword] [nvarchar] (50) NOT NULL,
[AdvertisingPosition_Id] [int] NOT NULL,
[AdvertisingPosition_Name] [nvarchar] (20) NOT NULL,
[AdImg] [nvarchar] (250) NOT NULL,
[ShowRate] [int] NOT NULL,
[StartTime] [datetime] NOT NULL,
[EndTime] [datetime] NOT NULL,
[IsDisplay] [tinyint] NOT NULL,
[HitCount] [int] NOT NULL,
[Sort] [int] NOT NULL,
[Manager_Id] [int] NOT NULL,
[Manager_CName] [nvarchar] (20) NOT NULL,
[UpdateDate] [datetime] NOT NULL
) ON [PRIMARY]
GO ALTER TABLE [dbo].[Advertisement] WITH NOCHECK ADD
CONSTRAINT [PK_Advertisement] PRIMARY KEY CLUSTERED
(
[Id]
) ON [PRIMARY]
GO ALTER TABLE [dbo].[Advertisement] ADD
CONSTRAINT [DF_Advertisement_Name] DEFAULT ('') FOR [Name],
CONSTRAINT [DF_Advertisement_Content] DEFAULT ('') FOR [Content],
CONSTRAINT [DF_Advertisement_Url] DEFAULT ('') FOR [Url],
CONSTRAINT [DF_Advertisement_Keyword] DEFAULT ('') FOR [Keyword],
CONSTRAINT [DF_Advertisement_AdvertisingPosition_Id] DEFAULT (0) FOR [AdvertisingPosition_Id],
CONSTRAINT [DF_Advertisement_AdvertisingPosition_Name] DEFAULT ('') FOR [AdvertisingPosition_Name],
CONSTRAINT [DF_Advertisement_AdImg] DEFAULT ('') FOR [AdImg],
CONSTRAINT [DF_Advertisement_ShowRate] DEFAULT (0) FOR [ShowRate],
CONSTRAINT [DF_Advertisement_StartTime] DEFAULT (getdate()) FOR [StartTime],
CONSTRAINT [DF_Advertisement_EndTime] DEFAULT (getdate()) FOR [EndTime],
CONSTRAINT [DF_Advertisement_IsDisplay] DEFAULT (0) FOR [IsDisplay],
CONSTRAINT [DF_Advertisement_HitCount] DEFAULT (0) FOR [HitCount],
CONSTRAINT [DF_Advertisement_Sort] DEFAULT (0) FOR [Sort],
CONSTRAINT [DF_Advertisement_Manager_Id] DEFAULT (0) FOR [Manager_Id],
CONSTRAINT [DF_Advertisement_Manager_CName] DEFAULT ('') FOR [Manager_CName],
CONSTRAINT [DF_Advertisement_UpdateDate] DEFAULT (getdate()) FOR [UpdateDate]
GO CREATE INDEX [IX_Advertisement__Name] ON [dbo].[Advertisement]([Name]) ON [PRIMARY]
GO CREATE INDEX [IX_Advertisement__Keyword] ON [dbo].[Advertisement]([Keyword]) ON [PRIMARY]
GO CREATE INDEX [IX_Advertisement__AdvertisingPosition_Id] ON [dbo].[Advertisement]([AdvertisingPosition_Id]) ON [PRIMARY]
GO CREATE INDEX [IX_Advertisement__StartTime] ON [dbo].[Advertisement]([StartTime]) ON [PRIMARY]
GO CREATE INDEX [IX_Advertisement__EndTime] ON [dbo].[Advertisement]([EndTime]) ON [PRIMARY]
GO CREATE INDEX [IX_Advertisement__IsDisplay] ON [dbo].[Advertisement]([IsDisplay]) ON [PRIMARY]
GO CREATE INDEX [IX_Advertisement__Sort] ON [dbo].[Advertisement]([Sort]) ON [PRIMARY]
GO exec sp_addextendedproperty N'MS_Description', N'主键Id', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Id'
GO exec sp_addextendedproperty N'MS_Description', N'标题', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Name'
GO exec sp_addextendedproperty N'MS_Description', N'备注', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Content'
GO exec sp_addextendedproperty N'MS_Description', N'链接Url', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Url'
GO exec sp_addextendedproperty N'MS_Description', N'关键字,只能由字母数字组成,主要用于模板标签 {%ad-InfoKey%}', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Keyword'
GO exec sp_addextendedproperty N'MS_Description', N'广告位置Id', N'user', N'dbo', N'table', N'Advertisement', N'column', N'AdvertisingPosition_Id'
GO exec sp_addextendedproperty N'MS_Description', N'广告位置名称', N'user', N'dbo', N'table', N'Advertisement', N'column', N'AdvertisingPosition_Name'
GO exec sp_addextendedproperty N'MS_Description', N'图片', N'user', N'dbo', N'table', N'Advertisement', N'column', N'AdImg'
GO exec sp_addextendedproperty N'MS_Description', N'显示频率(同一个位置有多个广告时,这里用来计算它随机出现的频率)', N'user', N'dbo', N'table', N'Advertisement', N'column', N'ShowRate'
GO exec sp_addextendedproperty N'MS_Description', N'开始时间', N'user', N'dbo', N'table', N'Advertisement', N'column', N'StartTime'
GO exec sp_addextendedproperty N'MS_Description', N'结束时间', N'user', N'dbo', N'table', N'Advertisement', N'column', N'EndTime'
GO exec sp_addextendedproperty N'MS_Description', N'审核, 0=False,1=True,', N'user', N'dbo', N'table', N'Advertisement', N'column', N'IsDisplay'
GO exec sp_addextendedproperty N'MS_Description', N'点击数', N'user', N'dbo', N'table', N'Advertisement', N'column', N'HitCount'
GO exec sp_addextendedproperty N'MS_Description', N'排序', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Sort'
GO exec sp_addextendedproperty N'MS_Description', N'修改人员id', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Manager_Id'
GO exec sp_addextendedproperty N'MS_Description', N'修改人员姓名', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Manager_CName'
GO exec sp_addextendedproperty N'MS_Description', N'修改时间', N'user', N'dbo', N'table', N'Advertisement', N'column', N'UpdateDate'
GO
跟着打开VS,找到数据层与逻辑层的SubSonic文件夹,选择模板并点击右键,找到“运行自定义工具”,点击重新运行生成相关的模板类
打开Informations文件夹,将InformationList.aspx与InformationEdit.aspx复制到Advertisements(上一章广告文件夹命名错了,我将AdvertisingPositions重新修改为Advertisements)文件夹中
将它们修改名称为AdvertisementList.aspx与AdvertisementEdit.aspx
然后将页面中的“Information”替换成“Advertisement”,“信息”替换为“广告”。
下面是改好的AdvertisementList.aspx页面代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AdvertisementList.aspx.cs" Inherits="Solution.Web.Managers.WebManage.Advertisements.AdvertisementList" %>
<%@ Import Namespace="DotNet.Utilities" %> <!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 id="Head1" runat="server">
<title>广告列表</title>
</head>
<body>
<form id="form1" runat="server">
<f:pagemanager id="PageManager1" runat="server" />
<f:panel id="Panel1" runat="server" title="广告列表" enableframe="false" bodypadding="10px"
enablecollapse="True">
<toolbars>
<f:Toolbar ID="toolBar" runat="server">
<Items>
<f:Button ID="ButtonRefresh" runat="server" Text="刷新" Icon="ArrowRefresh" OnClick="ButtonRefresh_Click" CssClass="inline"></f:Button>
<f:Button ID="ButtonSearch" runat="server" Text="查询" Icon="Magnifier" OnClick="ButtonSearch_Click"></f:Button>
<f:Button ID="ButtonAdd" runat="server" Text="添加" Icon="Add" OnClick="ButtonAdd_Click"></f:Button>
<f:Button ID="ButtonSaveAutoSort" runat="server" Text="自动排序" Icon="ArrowJoin" OnClick="ButtonSaveAutoSort_Click" ConfirmTitle="自动排序提示" ConfirmText="是否对所有数据进行自动排序?"></f:Button>
<f:Button ID="ButtonSaveSort" runat="server" Text="保存排序" Icon="Disk" OnClick="ButtonSaveSort_Click"></f:Button>
<f:Button ID="ButtonDelete" runat="server" Text="删除" Icon="Delete" OnClick="ButtonDelete_Click" ConfirmTitle="删除提示" ConfirmText="是否删除记录?"
OnClientClick="if (!F('Panel1_Grid1').getSelectionModel().hasSelection() ) { F.alert('请选择你想要删除的记录!'); return false; } ">
</f:Button>
</Items>
</f:Toolbar>
</toolbars>
<items>
<f:Form ID="Form6" ShowBorder="True" BodyPadding="5px" ShowHeader="False" runat="server">
<Rows>
<f:FormRow ID="FormRow1" runat="server">
<Items>
<f:TextBox runat="server" ID="txtName" Label="广告名称" Width="260px" Text="" MaxLength="" />
<f:TextBox runat="server" ID="txtKeyword" Label="Key" Width="260px" Text="" MaxLength="" />
<f:DropDownList CompareType="String" Label="广告位置" EnableSimulateTree="true" runat="server" ID="dllAdvertisingPosition" Width="260px" />
</Items>
</f:FormRow>
<f:FormRow ID="FormRow3" runat="server">
<Items>
<f:DatePicker runat="server" Label="查询日期" ID="dpStart" DateFormatString="yyyy-M-d HH:mm:ss" Width="260px" EmptyText="查询指定日期广告" />
<f:DropDownList CompareType="String" Label="审批状态"
runat="server" ID="ddlIsDisplay" Width="260px" >
<f:ListItem Text="==全部==" Value="" />
<f:ListItem Text="已审批" Value="" />
<f:ListItem Text="未审批" Value="" />
</f:DropDownList>
<f:Label runat="server"></f:Label>
</Items>
</f:FormRow>
</Rows>
</f:Form>
<f:Grid ID="Grid1" Title="广告列表" EnableFrame="false" EnableCollapse="true" AllowSorting="true" IsDatabasePaging="True"
PageSize="" ShowBorder="true" ShowHeader="False" AllowPaging="true" runat="server" EnableCheckBoxSelect="True" DataKeyNames="Id" EnableColumnLines="true"
OnPageIndexChange="Grid1_PageIndexChange" OnPreRowDataBound="Grid1_PreRowDataBound" OnRowCommand="Grid1_RowCommand" OnSort="Grid1_Sort">
<Columns>
<f:TemplateField RenderAsRowExpander="true">
<ItemTemplate>
<div class="expander">
<table width="800px">
<tr>
<td rowspan="" style="width: 200px;">
<%# Eval("AdImg").ToString().Length > ? "<a href='" + Eval("AdImg") + "' target=\"_blank\"><img src='" + DirFileHelper.GetFilePathPostfix(Eval("AdImg").ToString(), "s") + "'></a>" : ""%>
</td>
</tr>
<tr>
<td style="width: 200px;padding-top: 10px;">
<strong>修改人员:</strong><%# Eval("Manager_CName")%>
</td>
<td style="padding-top: 10px;">
<strong>修改时间:</strong><%# Eval("UpdateDate")%>
</td>
</tr>
<tr>
<td colspan="" style="padding-top: 10px;">
<strong>链接URL:</strong><a href="<%# Eval("Url")%>" target="_blank"><%# Eval("Url")%></a>
</td>
</tr>
<tr>
<td colspan="" style="padding-top: 10px;">
<strong>备注:</strong><%# Eval("Content")%>
</td>
</tr>
</table>
</div>
</ItemTemplate>
</f:TemplateField>
<f:BoundField DataField="Id" SortField="Id" HeaderText="Id" Width="50px" />
<f:BoundField DataField="Name" SortField="[Name]" HeaderText="广告标题" Width="150px" />
<f:BoundField DataField="AdvertisingPosition_Name" SortField="AdvertisingPosition_Id" HeaderText="广告位置" Width="150px" />
<f:BoundField DataField="Keyword" SortField="Keyword" HeaderText="广告Key" Width="100px" />
<f:BoundField DataField="ShowRate" SortField="ShowRate" HeaderText="显示频率" Width="80px" />
<f:BoundField DataField="HitCount" SortField="HitCount" HeaderText="点击数" Width="60px" />
<f:BoundField DataField="StartTime" SortField="StartTime" HeaderText="开始时间" Width="130px" />
<f:BoundField DataField="EndTime" SortField="EndTime" HeaderText="结束时间" Width="130px" />
<f:TemplateField HeaderText="排序" Width="100px">
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Width="50px" Text='<%# Eval("Sort") %>' AutoPostBack="false"></asp:TextBox>
</ItemTemplate>
</f:TemplateField>
<f:LinkButtonField ColumnID="IsDisplay" SortField="IsDisplay" HeaderText="审核" TextAlign="Center" CommandName="IsDisplay" Width="40px" />
<f:LinkButtonField Width="100px" HeaderText="操作" TextAlign="Center" ToolTip="点击修改当前记录" ColumnID="ButtonEdit" CommandName="ButtonEdit" />
</Columns>
</f:Grid>
<f:Label runat="server" ID="lblSpendingTime" Text=""></f:Label>
<f:HiddenField runat="server" ID="SortColumn" Text="Id"></f:HiddenField>
</items>
</f:panel>
<f:window id="Window1" width="680px" height="350px" icon="TagBlue" title="编辑" hidden="True"
enablemaximize="True" closeaction="HidePostBack" onclose="Window1_Close" enablecollapse="true"
runat="server" enableresize="true" bodypadding="5px" enableframe="True" iframeurl="about:blank"
enableiframe="true" enableclose="true" plain="false" ismodal="True" enableconfirmonclose="True">
</f:window>
</form>
</body>
</html>
我们可以看到,AdvertisementList.aspx页面代码主要分为三个部分
<toolbars>标签中存放的是页面顶部按钮
放在这里时,<f:Toolbar ID="toolBar" runat="server">这个标签的Id一定要命名为toolBar,不然程序就不会对这些按钮权限自动进行判断了
这是一个按钮标签:<f:Button ID="ButtonExportReport" runat="server" Text="导出报表" Icon="Add" OnClick="ButtonExportReport_Click"></f:Button>
在进行权限绑定时,程序绑定的是ButtonExportReport这个字符串,当我们添加的新按钮名称页面控件权限管理那里不存在,则需要开发人员手动进行添加,添加的中文名称用于显示,而英文名称则用于绑定按钮ID。
比如将上面“导出报表”添加到工具栏中,显示的效果如下图(当前管理员帐号未赋“导出报表”按钮权限,所以为禁用状态,不能点击):
当然cs代码中要添加
/// <summary>
/// 报表导出按钮点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ButtonExportReport_Click(object sender, EventArgs e)
{ }
页面中<f:Form>标签内存放的是列表条件查询控件
这里大家根据需要进行添加即可
而<f:Grid>标签中存放的则是数据库中查询出来的列表内容了
在这里讲解一下常用的Grid标签属性
属性名称 | 说明 |
ID | 控件Id,默认为Grid1 |
Title | 列表标题 |
ShowHeader | 是否显示标题 |
ShowBorder | 是否显示表格外边框 |
EnableFrame | 表格外边框是否加粗 |
AllowSorting | 是否允许排序 |
IsDatabasePaging | 是否使用数据库分页(否的话不分页查询出来) |
PageSize | 每页显示记录数量 |
AllowPaging | 是否允许分页 |
EnableCheckBoxSelect | 每行记录前是否显示选择框 |
DataKeyNames | 主键字段名称,这里可以设置多个字段,提交后会将这些字段的所有值都传到程序中,提供给程序调用 |
EnableColumnLines | 为每一列绘制线条 |
OnPageIndexChange | 列表翻页点击事件 |
OnPreRowDataBound | 列表加载绑定事件 |
OnRowCommand | 列表记录点击事件 |
OnSort | 列表排序点击事件(点击列表顶部名称时进行排序) |
列表内,最常见的行标签就是<f:BoundField DataField="Id" SortField="Id" HeaderText="Id列" Width="50px" />
DataField是用来绑定数据表字段的,将字段内容显示出来;SortField绑定排序字段;HeaderText是列表顶部显示的标题;Width是列宽。这几个是最常见的属性。如果用你的字段为关键字时,可以这样处理<f:BoundField DataField="[key]" SortField="[key]" HeaderText="Id列" Width="50px" />,为字段加上中括号。
另外还有两个隐藏标签
<f:Label runat="server" ID="lblSpendingTime" Text=""></f:Label>
<f:HiddenField runat="server" ID="SortColumn" Text="Id"></f:HiddenField>
前者用来显示列表数据查询时所使用的时间
后者是用在多个分页时,点击编辑修改某条记录后,关闭窗口会刷新列表页面,而这时如果没有这个隐藏控件保存排序字段的话,那么刷新列表后所显示的内容排序可能就会同编辑之前的内容排序不一样,而导致相关管理人员在手动编辑大量数据时需要花费多余时间查找未编辑的记录,而不能顺着列表记录逐个进行。
下面是改好的AdvertisementList.aspx.cs页面代码
using System;
using System.Collections.Generic;
using DotNet.Utilities;
using FineUI;
using Solution.DataAccess.DataModel;
using Solution.DataAccess.DbHelper;
using Solution.Logic.Managers;
using Solution.Web.Managers.WebManage.Application;
/***********************************************************************
* 作 者:AllEmpty(陈焕)-- 1654937@qq.com
* 博 客:http://www.cnblogs.com/EmptyFS/
* 技 术 群:327360708
*
* 创建日期:2014-07-09
* 文件名称:AdvertisementList.aspx.cs
* 描 述:广告列表管理
*
* 修 改 人:
* 修改日期:
* 修改原因:
***********************************************************************/
using SubSonic.Query; namespace Solution.Web.Managers.WebManage.Advertisements
{
public partial class AdvertisementList : PageBase
{
#region Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//绑定下拉列表
AdvertisingPositionBll.GetInstence().BandDropDownListShowAll(this, dllAdvertisingPosition); LoadData();
}
}
#endregion #region 接口函数,用于UI页面初始化,给逻辑层对象、列表等对象赋值
public override void Init()
{
//逻辑对象赋值
bll = AdvertisementBll.GetInstence();
//表格对象赋值
grid = Grid1;
}
#endregion #region 加载数据
/// <summary>读取数据</summary>
public override void LoadData()
{
//设置排序
if (sortList == null)
{
Sort(null);
} //绑定Grid表格
bll.BindGrid(Grid1, Grid1.PageIndex + , Grid1.PageSize, InquiryCondition(), sortList);
} /// <summary>
/// 查询条件
/// </summary>
/// <returns></returns>
private List<ConditionHelper.SqlqueryCondition> InquiryCondition()
{
var wheres = new List<ConditionHelper.SqlqueryCondition>(); //起始时间
if (!string.IsNullOrEmpty(dpStart.Text.Trim()))
{
wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, AdvertisementTable.StartTime, Comparison.LessOrEquals, StringHelper.FilterSql(dpStart.Text)));
wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, AdvertisementTable.EndTime, Comparison.GreaterOrEquals, StringHelper.FilterSql(dpStart.Text)));
}
//广告位置
if (dllAdvertisingPosition.SelectedValue != "")
{
wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, AdvertisementTable.AdvertisingPosition_Id, Comparison.Equals,
StringHelper.FilterSql(dllAdvertisingPosition.SelectedValue)));
}
//是否审批
if (ddlIsDisplay.SelectedValue != "")
{
wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, AdvertisementTable.IsDisplay, Comparison.Equals,
StringHelper.FilterSql(ddlIsDisplay.SelectedValue)));
}
//广告名称
if (!string.IsNullOrEmpty(txtName.Text.Trim()))
{
wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, AdvertisementTable.Name,
Comparison.Like, "%" + StringHelper.FilterSql(txtName.Text) + "%"));
}
//Keyword
if (!string.IsNullOrEmpty(txtKeyword.Text.Trim()))
{
wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, AdvertisementTable.Keyword, Comparison.Like,
"%" + StringHelper.FilterSql(txtKeyword.Text) + "%"));
} return wheres;
}
#endregion #region 列表属性绑定 #region 列表按键绑定——修改列表控件属性
/// <summary>
/// 列表按键绑定——修改列表控件属性
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PreRowDataBound(object sender, FineUI.GridPreRowEventArgs e)
{
//绑定是否显示
GridRow gr = Grid1.Rows[e.RowIndex];
//判断当前行IsDisplay字段值是否为0
if (((System.Data.DataRowView)(gr.DataItem)).Row.Table.Rows[e.RowIndex][AdvertisementTable.IsDisplay].ToString() == "")
{
//查找名称为IsDisplay的列
var lbf = Grid1.FindColumn("IsDisplay") as LinkButtonField;
//修改图标
lbf.Icon = Icon.BulletCross;
//设置参数值
lbf.CommandArgument = "";
}
else
{
var lbf = Grid1.FindColumn("IsDisplay") as LinkButtonField;
lbf.Icon = Icon.BulletTick;
lbf.CommandArgument = "";
} //绑定是否编辑列
var lbfEdit = Grid1.FindColumn("ButtonEdit") as LinkButtonField;
lbfEdit.Text = "编辑";
lbfEdit.Enabled = MenuInfoBll.GetInstence().CheckControlPower(this, "ButtonEdit");
}
#endregion #region Grid点击事件
/// <summary>
/// Grid点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e)
{
GridRow gr = Grid1.Rows[e.RowIndex];
//获取当前点击列的主键ID
object id = gr.DataKeys[]; switch (e.CommandName)
{
case "IsDisplay":
//更新状态
AdvertisementBll.GetInstence().UpdateIsDisplay(this, ConvertHelper.Cint0(id), ConvertHelper.Cint0(e.CommandArgument));
//重新加载
LoadData(); break; case "ButtonEdit":
//打开编辑窗口
Window1.IFrameUrl = "AdvertisementEdit.aspx?Id=" + id + "&" + MenuInfoBll.GetInstence().PageUrlEncryptStringNoKey(id + "");
Window1.Hidden = false; break;
}
}
#endregion #region 保存自动排序
/// <summary>
/// 保存自动排序
/// </summary>
public override void SaveAutoSort()
{
if (bll.UpdateAutoSort(this))
{
Alert.ShowInParent("保存成功", "保存自动排序成功", "window.location.reload();");
}
else
{
Alert.ShowInParent("保存失败", "保存自动排序失败");
}
}
#endregion #endregion #region 添加新记录
/// <summary>
/// 添加新记录
/// </summary>
public override void Add()
{
Window1.IFrameUrl = "AdvertisementEdit.aspx?" + MenuInfoBll.GetInstence().PageUrlEncryptString();
Window1.Hidden = false;
}
#endregion #region 删除记录
/// <summary>
/// 删除记录
/// </summary>
/// <returns></returns>
public override string Delete()
{
//获取要删除的Id组
var id = GridViewHelper.GetSelectedKeyArray(Grid1); //如果没有选择记录,则直接退出
if (id == null)
{
return "请选择要删除的记录。";
} try
{
//逐个删除对应图片
foreach (var i in id)
{
//删除广告图片
AdvertisementBll.GetInstence().DelAdImg(this, i);
} //删除记录
bll.Delete(this, id); return "删除编号Id为[" + string.Join(",", id) + "]的数据记录成功。";
}
catch (Exception e)
{
string result = "尝试删除编号ID为[" + string.Join(",", id) +"]的数据记录失败!"; //出现异常,保存出错日志广告
CommonBll.WriteLog(result, e); return result;
}
}
#endregion }
}
在cs页面代码的加载数据函数中,绑定Grid表格用的是bll.BindGrid(Grid1, Grid1.PageIndex + 1, Grid1.PageSize, InquiryCondition(), sortList)这个函数。我们在模板中生成的绑定表格函数共有两种类型,一种是有层次感列表绑定,一种是普通列表绑定。当前这种普通列表绑定,需要传递表格控件名称、当前页码、每页显示记录数量、查询条件和排序这几个参数,而对于查询条件如果添加使用,前面章节已有比较详细的说明,大家也可以参考一下上面的cs代码来使用。
刚刚发现InformationList.aspx.cs页面忘了加查询条件了,就做为作业,大家自己尝试去添加一下吧。
在列表属性绑定时,由于广告表有排序字段,但没有父Id存在,即它不是多级别分类记录,所以在实现自动排序时,使用父类默认的自动排序函数是不行的,我们需要重写该函数,具体如下:UpdateAutoSort()函数有很多参数,但大部分都有默认值,按照默认值,我们只需要传当前页面针指进去就可以了,具体实现大家请自己查看该函数。
#region 保存自动排序
/// <summary>
/// 保存自动排序
/// </summary>
public override void SaveAutoSort()
{
if (bll.UpdateAutoSort(this))
{
Alert.ShowInParent("保存成功", "保存自动排序成功", "window.location.reload();");
}
else
{
Alert.ShowInParent("保存失败", "保存自动排序失败");
}
}
#endregion
由于广告管理会上传广告图片,所以执行删除时需要先将运行图片删除函数(AdvertisementBll.GetInstence().DelAdImg(this, i)),再删除广告记录。
其他的cs页面代码同上一章差不多,所以不再详细说明。
我们本章已添加了广告页面,所以上一章注释的删除判断与更新广告位置名称时,同步更新广告表对应名称的功能要启用。
AdvertisingPositionList.aspx.cs页面
删除前判断当前广告位置记录是否已给广告记录使用了,是的话必须删除相关广告后才能删除广告位置记录。
AdvertisingPositionEdit.aspx.cs页面
广告位置记录编辑时,如果广告位置名称有修改,这里就会同步执行修改广告表里对应的广告位置名称。这里所调用的函数也是模板生成好的函数。
AdvertisementEdit.aspx页面代码
<%@ Page Language="C#" ValidateRequest="false" AutoEventWireup="true" CodeBehind="AdvertisementEdit.aspx.cs"
Inherits="Solution.Web.Managers.WebManage.Advertisements.AdvertisementEdit" %> <!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 id="Head1" runat="server">
<title>广告编辑</title>
</head>
<body>
<form id="form1" runat="server">
<f:HiddenField runat="server" ID="hidId" Text="">
</f:HiddenField>
<f:PageManager ID="PageManager1" runat="server" />
<f:Panel ID="Panel1" runat="server" EnableFrame="false" BodyPadding="10px" EnableCollapse="True"
ShowHeader="False">
<Toolbars>
<f:Toolbar ID="toolBar" runat="server">
<Items>
<f:Button ID="ButtonSave" runat="server" Text="保存" Icon="Disk" OnClick="ButtonSave_Click">
</f:Button>
<f:Button ID="ButtonDeleteImage" runat="server" Text="删除图片" Icon="Delete" OnClick="ButtonDeleteImage_Click"
ConfirmTitle="删除提示" ConfirmText="是否删除图片?" />
</Items>
</f:Toolbar>
</Toolbars>
<Items>
<f:Panel ID="Panel2" runat="server" EnableFrame="false" BodyPadding="5px" EnableCollapse="True"
ShowHeader="False" ShowBorder="False">
<Items>
<f:Form ID="extForm1" ShowBorder="false" ShowHeader="false" BodyPadding="5px" runat="server">
<Rows>
<f:FormRow ID="FormRow1" runat="server">
<Items>
<f:TextBox runat="server" ID="txtName" Label="广告名称" Width="300px" Text="" ShowRedStar="true"
MaxLength="" />
<f:TextBox runat="server" ID="txtKeyword" Label="Key(非中文)" Width="300px" Text=""
MaxLength="" Readonly="True" />
</Items>
</f:FormRow>
<f:FormRow ID="FormRow2" runat="server">
<Items>
<f:DropDownList Label="广告位置" AutoPostBack="true" CompareType="String" EnableSimulateTree="true"
runat="server" ID="ddlAdvertisingPosition" Width="300px" ShowRedStar="true" OnSelectedIndexChanged="ddlAdvertisingPosition_SelectedIndexChanged">
</f:DropDownList>
<f:RadioButtonList ID="rblIsDisplay" Label="是否审核" ColumnNumber="" runat="server"
Width="300px">
<f:RadioItem Text="显示" Value="" Selected="true" />
<f:RadioItem Text="不显示" Value="" />
</f:RadioButtonList>
</Items>
</f:FormRow>
<f:FormRow ID="FormRow4" runat="server">
<Items>
<f:DatePicker ID="dpStartTime" Label="开始时间" Width="300px" Required="true" runat="server"
ShowRedStar="true" />
<f:DatePicker ID="dpEndTime" Label="结束时间" Width="300px" Required="true" runat="server"
ShowRedStar="true" />
</Items>
</f:FormRow>
<f:FormRow ID="FormRow11" runat="server">
<Items>
<f:TextBox runat="server" ID="txtUrl" Label="广告链接地址" Width="610px" Text="" MaxLength="" />
</Items>
</f:FormRow>
<f:FormRow ID="FormRow3" runat="server">
<Items>
<f:TextArea runat="server" Label="说明" ID="txtContent" Width="610px" MaxLength=""
Height="50px">
</f:TextArea>
</Items>
</f:FormRow>
<f:FormRow ID="FormRow10" runat="server">
<Items>
<f:FileUpload runat="server" ID="filePhoto" Label="广告图片" Width="300px" />
<f:TextBox runat="server" ID="txtSort" Label="排序" Width="300px" Text="" />
</Items>
</f:FormRow>
<f:FormRow ID="ShowImage" runat="server">
<Items>
<f:ContentPanel ID="ContentPanel3" runat="server" Width="90%" ShowBorder="false"
ShowHeader="false">
<%=(p_Img != null && p_Img.Length > ) ? "<a href='" + p_Img + "' target=\"_blank\"><img src='" + p_Img + "'></a>" : ""%>
</f:ContentPanel>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</Items>
</f:Panel>
</Items>
</f:Panel>
</form>
</body>
</html>
AdvertisementEdit.aspx页面主要分为两个部分,一个是工具栏,同列表页面差不多;另一个是内容编辑控件,具体怎么排版大家自己根据需要来设置,大家看看标签属性的英文就知道是什么功能了,当然也可以进入FineUI官网查看在线示例,里面有很多排版介绍与调用的源代码例子。
AdvertisementEdit.aspx.cs页面代码
using System;
using DotNet.Utilities;
using Solution.DataAccess.DataModel;
using Solution.Logic.Managers;
using Solution.Web.Managers.WebManage.Application; /***********************************************************************
* 作 者:AllEmpty(陈焕)-- 1654937@qq.com
* 博 客:http://www.cnblogs.com/EmptyFS/
* 技 术 群:327360708
*
* 创建日期:2014-07-10
* 文件名称:AdvertisementEdit.aspx.cs
* 描 述:广告编辑页面
*
* 修 改 人:
* 修改日期:
* 修改原因:
***********************************************************************/
namespace Solution.Web.Managers.WebManage.Advertisements
{
public partial class AdvertisementEdit : PageBase
{
protected string RndKey = RandomHelper.GetRndKey();
protected string p_Img = ""; #region Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//获取ID值
hidId.Text = RequestHelper.GetInt0("Id") + "";
//广告位置下拉框
AdvertisingPositionBll.GetInstence().BandDropDownListShowAll(this, ddlAdvertisingPosition); //加载数据
LoadData();
}
}
#endregion #region 接口函数,用于UI页面初始化,给逻辑层对象、列表等对象赋值
public override void Init()
{ }
#endregion #region 加载数据
/// <summary>读取数据</summary>
public override void LoadData()
{
//读取当前编辑的广告Id
int id = ConvertHelper.Cint0(hidId.Text); if (id != )
{
//获取指定Id的广告记录实体
var model = AdvertisementBll.GetInstence().GetModelForCache(x => x.Id == id);
if (model == null)
return; //对页面窗体进行赋值
//广告名称
txtName.Text = model.Name;
//Key是不能修改的,同一个广告位置的Key值一样
txtKeyword.Text = model.Keyword;
txtKeyword.Readonly = true;
//广告链接
txtUrl.Text = model.Url;
//广告说明
txtContent.Text = model.Content;
//开始时间与结束时间
dpStartTime.SelectedDate = model.StartTime;
dpEndTime.SelectedDate = model.EndTime;
//广告位置下拉框绑定
ddlAdvertisingPosition.SelectedValue = model.AdvertisingPosition_Id + "";
//是否显示
rblIsDisplay.SelectedValue = model.IsDisplay + "";
//排序值
txtSort.Text = model.Sort + ""; //是否存在广告图片
if (!String.IsNullOrEmpty(model.AdImg))
{
//为页面的广告图片控件赋值
p_Img = model.AdImg;
//判断当前管理人员是否有“删除图片”这个按钮的操作权限
ButtonDeleteImage.Enabled = MenuInfoBll.GetInstence().CheckControlPower(this, "ButtonDeleteImage");
}
else
{
//不存在广告图片则隐藏删除图片按钮
ButtonDeleteImage.Visible = false;
}
}
else
{
//新增广告记录时隐藏删除图片按钮
ButtonDeleteImage.Visible = false;
}
} #endregion #region 页面控件绑定功能 #region 下拉列表改变事件
/// <summary>下拉列表改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlAdvertisingPosition_SelectedIndexChanged(object sender, EventArgs e)
{
//获取广告位置下拉列表选择项的值
int id = ConvertHelper.Cint0(ddlAdvertisingPosition.SelectedValue);
if (id == ) return; //读取广告位置记录实体
var model = AdvertisingPositionBll.GetInstence().GetModelForCache(id);
if (model != null)
{
//修改当前广告的Key为广告位置Key
txtKeyword.Text = model.Keyword;
}
}
#endregion #region 删除图片
/// <summary>删除图片</summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void ButtonDeleteImage_Click(object sender, EventArgs e)
{
//读取当前编辑的广告Id
int id = ConvertHelper.Cint0(hidId.Text);
if (id > )
{
//执行广告图片删除函数
AdvertisementBll.GetInstence().DelAdImg(this, id);
//刷新页面
FineUI.PageContext.RegisterStartupScript("window.location.reload()");
}
} #endregion #endregion #region 保存
/// <summary>
/// 数据保存
/// </summary>
/// <returns></returns>
public override string Save()
{
string result = string.Empty;
//读取当前编辑的广告Id
int id = ConvertHelper.Cint0(hidId.Text); try
{
#region 数据验证 if (string.IsNullOrEmpty(txtName.Text.Trim()))
{
return txtName.Label + "不能为空!";
}
//判断是否重复
var sName = StringHelper.Left(txtName.Text, );
if (AdvertisementBll.GetInstence().Exist(x => x.Name == sName && x.Id != id))
{
return txtName.Label + "已存在!请重新输入!";
}
if (ddlAdvertisingPosition.SelectedValue == "")
{
return ddlAdvertisingPosition.Label + "为必选项,请选择!";
} if (dpStartTime.SelectedDate == null || TimeHelper.IsDateTime(dpStartTime.SelectedDate) == false)
{
return "请选择" + dpStartTime.Label;
}
if (dpEndTime.SelectedDate == null || TimeHelper.IsDateTime(dpEndTime.SelectedDate) == false)
{
return "请选择" + dpEndTime.Label;
}
if (dpStartTime.SelectedDate > dpEndTime.SelectedDate)
{
return dpStartTime.Label + "不能大于" + dpEndTime.Label;
} #endregion #region 赋值 //获取实体
var model = new Advertisement(x => x.Id == id); //------------------------------------------
//设置名称
model.Name = sName;
model.Keyword = StringHelper.Left(txtKeyword.Text, );
model.Url = StringHelper.Left(txtUrl.Text, , true, false);
//说明
model.Content = StringHelper.Left(txtContent.Text, );
//取得位置
model.AdvertisingPosition_Id = ConvertHelper.Cint0(ddlAdvertisingPosition.SelectedValue);
model.AdvertisingPosition_Name = StringHelper.Left(ddlAdvertisingPosition.SelectedText, ); //开始时间与结束时间
model.StartTime = dpStartTime.SelectedDate ?? DateTime.Now;
model.EndTime = dpEndTime.SelectedDate ?? DateTime.Now.AddDays(); //设定当前项是否显示
model.IsDisplay = ConvertHelper.StringToByte(rblIsDisplay.SelectedValue); model.Sort = ConvertHelper.Cint0(txtSort.Text); ; //修改时间与用户
model.UpdateDate = DateTime.Now;
model.Manager_Id = OnlineUsersBll.GetInstence().GetManagerId();
model.Manager_CName = OnlineUsersBll.GetInstence().GetManagerCName(); #endregion //------------------------------------------ #region 上传图片 if (this.filePhoto.HasFile && this.filePhoto.FileName.Length > )
{
int vid = ; //7 广告
//---------------------------------------------------
var upload = new UploadFile();
result = new UploadFileBll().Upload_AspNet(this.filePhoto.PostedFile, vid, RndKey,
OnlineUsersBll.GetInstence().GetManagerId(), OnlineUsersBll.GetInstence().GetManagerCName(),
upload);
this.filePhoto.Dispose();
//---------------------------------------------------
if (result.Length == ) //上传成功
{
model.AdImg = upload.Path;
}
else
{
CommonBll.WriteLog("上传出错:" + result); //收集异常信息
return "上传出错!" + result;
}
}
//如果是修改,检查用户是否重新上传过封面图片,如果是删除旧的图片
if (model.Id > )
{
UploadFileBll.GetInstence()
.Upload_DiffFile(AdvertisementTable.Id, AdvertisementTable.AdImg, AdvertisementTable.TableName,
model.Id, model.AdImg); //同步UploadFile上传表
UploadFileBll.GetInstence().Upload_UpdateRs(RndKey, AdvertisementTable.TableName, model.Id);
} #endregion //----------------------------------------------------------
//存储到数据库
AdvertisementBll.GetInstence().Save(this, model); //这里放置清空前端页面缓存的代码(如果前端使用了页面缓存的话,必须进行清除操作) }
catch (Exception e)
{
result = "保存失败!"; //出现异常,保存出错日志广告
CommonBll.WriteLog(result, e);
} return result;
}
#endregion
}
}
cs页面代码与上一章的差不多,同时也加了很详细的注释,所以也不再详细描述,大家自己尝试修改后与上面代码比较一下。
下面再附上相关SQL更新代码,直接在数据库查询分析器中执行就可以了
--更新上传配置表
TRUNCATE TABLE UploadConfig
GO
set IDENTITY_INSERT UploadConfig on
GO
INSERT INTO UploadConfig (Id, Name, JoinName, UserType, UploadType_Id, UploadType_Name, UploadType_TypeKey, PicSize, FileSize, SaveDir, IsPost, IsSwf, IsChkSrcPost, IsFixPic, CutType, PicWidth, PicHeight, PicQuality, IsEditor, IsBigPic, BigWidth, BigHeight, BigQuality, IsMidPic, MidWidth, MidHeight, MidQuality, IsMinPic, MinWidth, MinHeight, MinQuality, IsHotPic, HotWidth, HotHeight, HotQuality, IsWaterPic, Manager_Id, Manager_CName, UpdateDate) VALUES (, '管理员头像', 'Manager', , , '图片文件', 'image', , , 'Manager', , , , , , , , , , , , , , , , , , , , , , , , , , , , 'admin', '2014-06-26 17:03:32')
GO
INSERT INTO UploadConfig (Id, Name, JoinName, UserType, UploadType_Id, UploadType_Name, UploadType_TypeKey, PicSize, FileSize, SaveDir, IsPost, IsSwf, IsChkSrcPost, IsFixPic, CutType, PicWidth, PicHeight, PicQuality, IsEditor, IsBigPic, BigWidth, BigHeight, BigQuality, IsMidPic, MidWidth, MidHeight, MidQuality, IsMinPic, MinWidth, MinHeight, MinQuality, IsHotPic, HotWidth, HotHeight, HotQuality, IsWaterPic, Manager_Id, Manager_CName, UpdateDate) VALUES (, '信息(新闻)分类图', 'InformationClass', , , '图片文件', 'image', , , 'ic', , , , , , , , , , , , , , , , , , , , , , , , , , , , 'admin', '2014-06-26 17:04:53')
GO
INSERT INTO UploadConfig (Id, Name, JoinName, UserType, UploadType_Id, UploadType_Name, UploadType_TypeKey, PicSize, FileSize, SaveDir, IsPost, IsSwf, IsChkSrcPost, IsFixPic, CutType, PicWidth, PicHeight, PicQuality, IsEditor, IsBigPic, BigWidth, BigHeight, BigQuality, IsMidPic, MidWidth, MidHeight, MidQuality, IsMinPic, MinWidth, MinHeight, MinQuality, IsHotPic, HotWidth, HotHeight, HotQuality, IsWaterPic, Manager_Id, Manager_CName, UpdateDate) VALUES (, '文章封面', 'Information', , , '图片文件', 'image', , , 'i', , , , , , , , , , , , , , , , , , , , , , , , , , , , 'admin', '2014-06-26 17:06:44')
GO
INSERT INTO UploadConfig (Id, Name, JoinName, UserType, UploadType_Id, UploadType_Name, UploadType_TypeKey, PicSize, FileSize, SaveDir, IsPost, IsSwf, IsChkSrcPost, IsFixPic, CutType, PicWidth, PicHeight, PicQuality, IsEditor, IsBigPic, BigWidth, BigHeight, BigQuality, IsMidPic, MidWidth, MidHeight, MidQuality, IsMinPic, MinWidth, MinHeight, MinQuality, IsHotPic, HotWidth, HotHeight, HotQuality, IsWaterPic, Manager_Id, Manager_CName, UpdateDate) VALUES (, '文章内容(编辑器)', 'Information', , , '编辑器', 'editor', , , 'i', , , , , , , , , , , , , , , , , , , , , , , , , , , , 'admin', '2014-06-26 17:06:38')
GO
INSERT INTO UploadConfig (Id, Name, JoinName, UserType, UploadType_Id, UploadType_Name, UploadType_TypeKey, PicSize, FileSize, SaveDir, IsPost, IsSwf, IsChkSrcPost, IsFixPic, CutType, PicWidth, PicHeight, PicQuality, IsEditor, IsBigPic, BigWidth, BigHeight, BigQuality, IsMidPic, MidWidth, MidHeight, MidQuality, IsMinPic, MinWidth, MinHeight, MinQuality, IsHotPic, HotWidth, HotHeight, HotQuality, IsWaterPic, Manager_Id, Manager_CName, UpdateDate) VALUES (, '广告位置', 'AdvertisingPosition', , , '广告图片', 'ad', , , 'a', , , , , , , , , , , , , , , , , , , , , , , , , , , , '管理员', '2014-07-08 17:40:27.217')
GO
INSERT INTO UploadConfig (Id, Name, JoinName, UserType, UploadType_Id, UploadType_Name, UploadType_TypeKey, PicSize, FileSize, SaveDir, IsPost, IsSwf, IsChkSrcPost, IsFixPic, CutType, PicWidth, PicHeight, PicQuality, IsEditor, IsBigPic, BigWidth, BigHeight, BigQuality, IsMidPic, MidWidth, MidHeight, MidQuality, IsMinPic, MinWidth, MinHeight, MinQuality, IsHotPic, HotWidth, HotHeight, HotQuality, IsWaterPic, Manager_Id, Manager_CName, UpdateDate) VALUES (, '默认广告', 'AdvertisingPosition', , , '广告图片', 'ad', , , 'a', , , , , , , , , , , , , , , , , , , , , , , , , , , , '管理员', '2014-07-08 17:41:55.033')
GO
INSERT INTO UploadConfig (Id, Name, JoinName, UserType, UploadType_Id, UploadType_Name, UploadType_TypeKey, PicSize, FileSize, SaveDir, IsPost, IsSwf, IsChkSrcPost, IsFixPic, CutType, PicWidth, PicHeight, PicQuality, IsEditor, IsBigPic, BigWidth, BigHeight, BigQuality, IsMidPic, MidWidth, MidHeight, MidQuality, IsMinPic, MinWidth, MinHeight, MinQuality, IsHotPic, HotWidth, HotHeight, HotQuality, IsWaterPic, Manager_Id, Manager_CName, UpdateDate) VALUES (, '默认广告', 'Advertisement', , , '广告图片', 'a', , , 'a', , , , , , , , , , , , , , , , , , , , , , , , , , , , '管理员', '2014-07-08 17:41:55')
GO
set IDENTITY_INSERT UploadConfig off
GO --更新菜单表
TRUNCATE TABLE MenuInfo
GO
set IDENTITY_INSERT MenuInfo on
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '系统管理', '/WebManage/Systems/', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '基本设置', '/WebManage/Systems/Set/', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '权限管理', '/WebManage/Systems/Powers/', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '安全管理', '/WebManage/Systems/Security/', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '网站参数设置', '/WebManage/Systems/Set/WebConfigSet.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '菜单管理', '/WebManage/Systems/Powers/MenuInfoList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '菜单编辑', '/WebManage/Systems/Powers/MenuInfoEdit.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '公共页面权限设置', '/WebManage/Systems/Powers/PagePowerSignPublicList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '公共页面权限编辑', '/WebManage/Systems/Powers/PagePowerSignPublicEdit.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '页面权限设置', '/WebManage/Systems/Powers/PagePowerSignList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '部门管理', '/WebManage/Systems/Powers/BranchList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '部门编辑', '/WebManage/Systems/Powers/BranchEdit.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '职位管理', '/WebManage/Systems/Powers/PositionList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '职位编辑', '/WebManage/Systems/Powers/PositionEdit.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '在线用户', '/WebManage/Systems/Security/OnlineUsersList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '登陆日志', '/WebManage/Systems/Security/LoginLogList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '操作日志', '/WebManage/Systems/Security/UseLogList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '错误日志', '/WebManage/Systems/Security/ErrorLogList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '上传类型设置', '/WebManage/Systems/Set/UploadTypeList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '上传类型编辑', '/WebManage/Systems/Set/UploadTypeEdit.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '上传配置管理', '/WebManage/Systems/Set/UploadConfigList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '上传配置编辑', '/WebManage/Systems/Set/UploadConfigEdit.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '已上传文件管理', '/WebManage/Systems/Set/UploadFileList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '员工管理', '/WebManage/Employees/', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '在职员工管理', '/WebManage/Employees/ManagerList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '员工编辑', '/WebManage/Employees/ManagerEdit.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '离职员工管理', '/WebManage/Employees/StaffTurnoverList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '信息管理', '/WebManage/Informations/', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '信息分类列表', '/WebManage/Informations/InformationClassList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '信息分类编辑', '/WebManage/Informations/InformationClassEdit.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '信息列表', '/WebManage/Informations/InformationList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '信息编辑', '/WebManage/Informations/InformationEdit.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '授权电话管理', '/WebManage/Systems/Powers/EmpowerPhoneList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '授权电话编辑', '/WebManage/Systems/Powers/EmpowerPhoneEdit.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '授权Ip列表', '/WebManage/Systems/Powers/EmpowerIpList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '广告管理', '/WebManage/Advertisements/', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '广告位置管理', '/WebManage/Advertisements/AdvertisingPositionList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '广告位置编辑', '/WebManage/Advertisements/AdvertisingPositionEdit.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '广告内容管理', '/WebManage/Advertisements/AdvertisementList.aspx', , , , , )
GO
INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (, '广告内容编辑', '/WebManage/Advertisements/AdvertisementEdit.aspx', , , , , )
GO
set IDENTITY_INSERT MenuInfo off --更新页面控件权限标识管理表
TRUNCATE TABLE PagePowerSign
GO
set IDENTITY_INSERT PagePowerSign on
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存', 'ButtonSave', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '添加', 'ButtonAdd', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '编辑', 'ButtonEdit', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除', 'ButtonDelete', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '自动排序', 'ButtonSaveAutoSort', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存排序', 'ButtonSaveSort', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存', 'ButtonSave', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '添加', 'ButtonAdd', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '编辑', 'ButtonEdit', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除', 'ButtonDelete', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存', 'ButtonSave', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '添加', 'ButtonAdd', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '编辑', 'ButtonEdit', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除', 'ButtonDelete', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '自动排序', 'ButtonSaveAutoSort', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存排序', 'ButtonSaveSort', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存', 'ButtonSave', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '添加', 'ButtonAdd', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '编辑', 'ButtonEdit', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除', 'ButtonDelete', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存', 'ButtonSave', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '踢除用户', 'ButtonGetOut', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '添加', 'ButtonAdd', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '编辑', 'ButtonEdit', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除', 'ButtonDelete', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存', 'ButtonSave', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '添加', 'ButtonAdd', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '编辑', 'ButtonEdit', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除', 'ButtonDelete', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存', 'ButtonSave', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '图片全部重新生成', 'ButtonImageRegenerate', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除', 'ButtonDelete', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '添加', 'ButtonAdd', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '编辑', 'ButtonEdit', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除', 'ButtonDelete', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '自动排序', 'ButtonSaveAutoSort', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存排序', 'ButtonSaveSort', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存', 'ButtonSave', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除图片', 'ButtonDeleteImage', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '添加', 'ButtonAdd', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '编辑', 'ButtonEdit', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除', 'ButtonDelete', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '自动排序', 'ButtonSaveAutoSort', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存排序', 'ButtonSaveSort', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存', 'ButtonSave', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除图片', 'ButtonDeleteImage', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '添加', 'ButtonAdd', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '编辑', 'ButtonEdit', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '离职', 'ButtonStaffTurnover', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存', 'ButtonSave', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '编辑', 'ButtonEdit', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除', 'ButtonDelete', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '复职', 'ButtonRecovery', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '添加', 'ButtonAdd', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '编辑', 'ButtonEdit', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除', 'ButtonDelete', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '自动排序', 'ButtonSaveAutoSort', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存排序', 'ButtonSaveSort', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存', 'ButtonSave', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '添加', 'ButtonAdd', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '编辑', 'ButtonEdit', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '删除', 'ButtonDelete', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '自动排序', 'ButtonSaveAutoSort', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存排序', 'ButtonSaveSort', )
GO
INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (, , '保存', 'ButtonSave', )
GO set IDENTITY_INSERT PagePowerSign off
本次代码还更新了DotNet.Utilities.ConfigHelper类、DotNet.Utilities.GridViewHelper类
前者修改配置文件读取转换出错的问题,后者修改了获取Grid表格选择行数据的相关函数,以及修改后所引起的UI层相关页面函数的引用。
还有自定义OnlineUsersBll.cs类也修改了个小Bug
除了上面添加了上面代码外,还新增三个日志删除的存储过程
大家如果将项目放在正式环境上时,可以在SQL Server代理中创建作业来运行,设置每个月自动执行一次就可以了
由于框架不是非常成熟,很多朋友不是用来学习而是直接用到项目中,但不熟悉框架引起不少小问题,所以停止提供下载,有需要学习的可以到群共享里下,不便之处敬请谅解。
版权声明:
本文由AllEmpty原创并发布于博客园,欢迎转载,未经本人同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利。如有问题,可以通过1654937@qq.com 联系我,非常感谢。
发表本编内容,只要主为了和大家共同学习共同进步,有兴趣的朋友可以加加Q群:327360708 ,大家一起探讨。
更多内容,敬请观注博客:http://www.cnblogs.com/EmptyFS/