• 从零开始编写自己的C#框架(22)——添加普通列表页面


    普通列表页面指的是上一章那种有层次感列表以外的正常列表页面,由于上一章已讲解了正常添加页面的相关操作了,所以部分相关的操作本章节就不再罗嗦重复一次了。大家可以试试先用本章内容中的一些简单介绍,自己使用上一章下载的解决方案来实现一下,做做练习。

      首先还是打开数据字典,创建广告内容表

      在这里要说明一下的是,大家在对数据字典进行操作后(增、改、删),一定要在数据字典中的“版本”工作表中添加更新历史,以方便后面的维护人员查看(一定要养成一种良好的开发习惯),如下图

      然后还是使用ExcelToSQLString2.91_sql.exe工具生成SQL语句,并在数据库中创建数据表,下面是生成好的SQL语句,请在数据库查询分析表中执行

      1 /****** Object:  Table [dbo].[Advertisement]    Script Date: 2014/7/9 17:07:11  ******/
      2 if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Advertisement]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
      3 drop table [dbo].[Advertisement]
      4 GO
      5 
      6 /****** Object:  Table [dbo].[Advertisement]    Script Date: 2014/7/9 17:07:11   ******/
      7 CREATE TABLE [dbo].[Advertisement] (
      8   [Id] [int] IDENTITY (1, 1) NOT NULL,
      9   [Name] [nvarchar] (50) NOT NULL,
     10   [Content] [nvarchar] (100) NOT NULL,
     11   [Url] [nvarchar] (200) NOT NULL,
     12   [Keyword] [nvarchar] (50) NOT NULL,
     13   [AdvertisingPosition_Id] [int] NOT NULL,
     14   [AdvertisingPosition_Name] [nvarchar] (20) NOT NULL,
     15   [AdImg] [nvarchar] (250) NOT NULL,
     16   [ShowRate] [int] NOT NULL,
     17   [StartTime] [datetime] NOT NULL,
     18   [EndTime] [datetime] NOT NULL,
     19   [IsDisplay] [tinyint] NOT NULL,
     20   [HitCount] [int] NOT NULL,
     21   [Sort] [int] NOT NULL,
     22   [Manager_Id] [int] NOT NULL,
     23   [Manager_CName] [nvarchar] (20) NOT NULL,
     24   [UpdateDate] [datetime] NOT NULL
     25 ) ON [PRIMARY]
     26 GO
     27 
     28 ALTER TABLE [dbo].[Advertisement] WITH NOCHECK ADD
     29   CONSTRAINT [PK_Advertisement] PRIMARY KEY  CLUSTERED
     30 (
     31  [Id]
     32 )  ON [PRIMARY]
     33 GO
     34 
     35 ALTER TABLE [dbo].[Advertisement] ADD
     36   CONSTRAINT [DF_Advertisement_Name] DEFAULT ('') FOR [Name],
     37   CONSTRAINT [DF_Advertisement_Content] DEFAULT ('') FOR [Content],
     38   CONSTRAINT [DF_Advertisement_Url] DEFAULT ('') FOR [Url],
     39   CONSTRAINT [DF_Advertisement_Keyword] DEFAULT ('') FOR [Keyword],
     40   CONSTRAINT [DF_Advertisement_AdvertisingPosition_Id] DEFAULT (0) FOR [AdvertisingPosition_Id],
     41   CONSTRAINT [DF_Advertisement_AdvertisingPosition_Name] DEFAULT ('') FOR [AdvertisingPosition_Name],
     42   CONSTRAINT [DF_Advertisement_AdImg] DEFAULT ('') FOR [AdImg],
     43   CONSTRAINT [DF_Advertisement_ShowRate] DEFAULT (0) FOR [ShowRate],
     44   CONSTRAINT [DF_Advertisement_StartTime] DEFAULT (getdate()) FOR [StartTime],
     45   CONSTRAINT [DF_Advertisement_EndTime] DEFAULT (getdate()) FOR [EndTime],
     46   CONSTRAINT [DF_Advertisement_IsDisplay] DEFAULT (0) FOR [IsDisplay],
     47   CONSTRAINT [DF_Advertisement_HitCount] DEFAULT (0) FOR [HitCount],
     48   CONSTRAINT [DF_Advertisement_Sort] DEFAULT (0) FOR [Sort],
     49   CONSTRAINT [DF_Advertisement_Manager_Id] DEFAULT (0) FOR [Manager_Id],
     50   CONSTRAINT [DF_Advertisement_Manager_CName] DEFAULT ('') FOR [Manager_CName],
     51   CONSTRAINT [DF_Advertisement_UpdateDate] DEFAULT (getdate()) FOR [UpdateDate] 
     52 GO
     53 
     54 CREATE  INDEX [IX_Advertisement__Name] ON [dbo].[Advertisement]([Name]) ON [PRIMARY]
     55 GO
     56 
     57 CREATE  INDEX [IX_Advertisement__Keyword] ON [dbo].[Advertisement]([Keyword]) ON [PRIMARY]
     58 GO
     59 
     60 CREATE  INDEX [IX_Advertisement__AdvertisingPosition_Id] ON [dbo].[Advertisement]([AdvertisingPosition_Id]) ON [PRIMARY]
     61 GO
     62 
     63 CREATE  INDEX [IX_Advertisement__StartTime] ON [dbo].[Advertisement]([StartTime]) ON [PRIMARY]
     64 GO
     65 
     66 CREATE  INDEX [IX_Advertisement__EndTime] ON [dbo].[Advertisement]([EndTime]) ON [PRIMARY]
     67 GO
     68 
     69 CREATE  INDEX [IX_Advertisement__IsDisplay] ON [dbo].[Advertisement]([IsDisplay]) ON [PRIMARY]
     70 GO
     71 
     72 CREATE  INDEX [IX_Advertisement__Sort] ON [dbo].[Advertisement]([Sort]) ON [PRIMARY]
     73 GO
     74 
     75 exec sp_addextendedproperty N'MS_Description', N'主键Id', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Id'
     76 GO
     77 
     78 exec sp_addextendedproperty N'MS_Description', N'标题', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Name'
     79 GO
     80 
     81 exec sp_addextendedproperty N'MS_Description', N'备注', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Content'
     82 GO
     83 
     84 exec sp_addextendedproperty N'MS_Description', N'链接Url', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Url'
     85 GO
     86 
     87 exec sp_addextendedproperty N'MS_Description', N'关键字,只能由字母数字组成,主要用于模板标签 {%ad-InfoKey%}', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Keyword'
     88 GO
     89 
     90 exec sp_addextendedproperty N'MS_Description', N'广告位置Id', N'user', N'dbo', N'table', N'Advertisement', N'column', N'AdvertisingPosition_Id'
     91 GO
     92 
     93 exec sp_addextendedproperty N'MS_Description', N'广告位置名称', N'user', N'dbo', N'table', N'Advertisement', N'column', N'AdvertisingPosition_Name'
     94 GO
     95 
     96 exec sp_addextendedproperty N'MS_Description', N'图片', N'user', N'dbo', N'table', N'Advertisement', N'column', N'AdImg'
     97 GO
     98 
     99 exec sp_addextendedproperty N'MS_Description', N'显示频率(同一个位置有多个广告时,这里用来计算它随机出现的频率)', N'user', N'dbo', N'table', N'Advertisement', N'column', N'ShowRate'
    100 GO
    101 
    102 exec sp_addextendedproperty N'MS_Description', N'开始时间', N'user', N'dbo', N'table', N'Advertisement', N'column', N'StartTime'
    103 GO
    104 
    105 exec sp_addextendedproperty N'MS_Description', N'结束时间', N'user', N'dbo', N'table', N'Advertisement', N'column', N'EndTime'
    106 GO
    107 
    108 exec sp_addextendedproperty N'MS_Description', N'审核, 0=False,1=True,', N'user', N'dbo', N'table', N'Advertisement', N'column', N'IsDisplay'
    109 GO
    110 
    111 exec sp_addextendedproperty N'MS_Description', N'点击数', N'user', N'dbo', N'table', N'Advertisement', N'column', N'HitCount'
    112 GO
    113 
    114 exec sp_addextendedproperty N'MS_Description', N'排序', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Sort'
    115 GO
    116 
    117 exec sp_addextendedproperty N'MS_Description', N'修改人员id', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Manager_Id'
    118 GO
    119 
    120 exec sp_addextendedproperty N'MS_Description', N'修改人员姓名', N'user', N'dbo', N'table', N'Advertisement', N'column', N'Manager_CName'
    121 GO
    122 
    123 exec sp_addextendedproperty N'MS_Description', N'修改时间', N'user', N'dbo', N'table', N'Advertisement', N'column', N'UpdateDate'
    124 GO
    View Code

      跟着打开VS,找到数据层与逻辑层的SubSonic文件夹,选择模板并点击右键,找到“运行自定义工具”,点击重新运行生成相关的模板类

      打开Informations文件夹,将InformationList.aspx与InformationEdit.aspx复制到Advertisements(上一章广告文件夹命名错了,我将AdvertisingPositions重新修改为Advertisements)文件夹中

      将它们修改名称为AdvertisementList.aspx与AdvertisementEdit.aspx

      然后将页面中的“Information”替换成“Advertisement”,“信息”替换为“广告”。

      下面是改好的AdvertisementList.aspx页面代码

      1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AdvertisementList.aspx.cs" Inherits="Solution.Web.Managers.WebManage.Advertisements.AdvertisementList" %>
      2 <%@ Import Namespace="DotNet.Utilities" %>
      3 
      4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      5 <html xmlns="http://www.w3.org/1999/xhtml">
      6 <head id="Head1" runat="server">
      7     <title>广告列表</title>
      8 </head>
      9 <body>
     10     <form id="form1" runat="server">
     11     <f:pagemanager id="PageManager1" runat="server" />
     12     <f:panel id="Panel1" runat="server" title="广告列表" enableframe="false" bodypadding="10px"
     13         enablecollapse="True">
     14         <toolbars>
     15             <f:Toolbar ID="toolBar" runat="server">
     16                 <Items>
     17                     <f:Button ID="ButtonRefresh" runat="server" Text="刷新" Icon="ArrowRefresh" OnClick="ButtonRefresh_Click" CssClass="inline"></f:Button>
     18                     <f:Button ID="ButtonSearch" runat="server" Text="查询" Icon="Magnifier" OnClick="ButtonSearch_Click"></f:Button>
     19                     <f:Button ID="ButtonAdd" runat="server" Text="添加" Icon="Add" OnClick="ButtonAdd_Click"></f:Button>
     20                     <f:Button ID="ButtonSaveAutoSort" runat="server" Text="自动排序" Icon="ArrowJoin" OnClick="ButtonSaveAutoSort_Click" ConfirmTitle="自动排序提示" ConfirmText="是否对所有数据进行自动排序?"></f:Button>
     21                     <f:Button ID="ButtonSaveSort" runat="server" Text="保存排序" Icon="Disk" OnClick="ButtonSaveSort_Click"></f:Button>
     22                     <f:Button ID="ButtonDelete" runat="server" Text="删除" Icon="Delete" OnClick="ButtonDelete_Click" ConfirmTitle="删除提示" ConfirmText="是否删除记录?" 
     23                         OnClientClick="if (!F('Panel1_Grid1').getSelectionModel().hasSelection() ) { F.alert('请选择你想要删除的记录!'); return false; } ">
     24                     </f:Button>
     25                 </Items>
     26             </f:Toolbar>
     27         </toolbars>
     28         <items>
     29             <f:Form ID="Form6" ShowBorder="True" BodyPadding="5px" ShowHeader="False" runat="server">
     30                 <Rows>
     31                     <f:FormRow ID="FormRow1" runat="server">
     32                         <Items>
     33                             <f:TextBox runat="server" ID="txtName" Label="广告名称" Width="260px" Text="" MaxLength="20"  />
     34                             <f:TextBox runat="server" ID="txtKeyword" Label="Key" Width="260px" Text="" MaxLength="20"  />
     35                             <f:DropDownList CompareType="String" Label="广告位置" EnableSimulateTree="true" runat="server" ID="dllAdvertisingPosition" Width="260px" />
     36                         </Items>
     37                     </f:FormRow>
     38                     <f:FormRow ID="FormRow3" runat="server">
     39                         <Items>
     40                             <f:DatePicker runat="server" Label="查询日期" ID="dpStart" DateFormatString="yyyy-M-d HH:mm:ss" Width="260px" EmptyText="查询指定日期广告" />
     41                             <f:DropDownList CompareType="String" Label="审批状态"
     42                                 runat="server" ID="ddlIsDisplay" Width="260px" >
     43                                 <f:ListItem Text="==全部==" Value="" />
     44                                 <f:ListItem Text="已审批" Value="1" />
     45                                 <f:ListItem Text="未审批" Value="0" />
     46                             </f:DropDownList>
     47                             <f:Label runat="server"></f:Label>
     48                         </Items>
     49                     </f:FormRow>
     50                 </Rows>
     51             </f:Form>
     52             <f:Grid ID="Grid1" Title="广告列表" EnableFrame="false" EnableCollapse="true" AllowSorting="true" IsDatabasePaging="True"
     53             PageSize="15" ShowBorder="true" ShowHeader="False" AllowPaging="true" runat="server" EnableCheckBoxSelect="True" DataKeyNames="Id" EnableColumnLines="true"
     54             OnPageIndexChange="Grid1_PageIndexChange" OnPreRowDataBound="Grid1_PreRowDataBound" OnRowCommand="Grid1_RowCommand" OnSort="Grid1_Sort">
     55                 <Columns>
     56                     <f:TemplateField RenderAsRowExpander="true">
     57                         <ItemTemplate>
     58                             <div class="expander">
     59                                 <table width="800px">
     60                                     <tr>
     61                                         <td rowspan="4" style=" 200px;">
     62                                             <%# Eval("AdImg").ToString().Length > 5 ? "<a href='" + Eval("AdImg") + "' target="_blank"><img src='" + DirFileHelper.GetFilePathPostfix(Eval("AdImg").ToString(), "s") + "'></a>" : ""%>
     63                                         </td>
     64                                     </tr>
     65                                     <tr>
     66                                         <td style=" 200px;padding-top: 10px;">
     67                                             <strong>修改人员:</strong><%# Eval("Manager_CName")%>
     68                                         </td>
     69                                         <td style="padding-top: 10px;">
     70                                             <strong>修改时间:</strong><%# Eval("UpdateDate")%>
     71                                         </td>
     72                                     </tr>
     73                                     <tr>
     74                                         <td colspan="3" style="padding-top: 10px;">
     75                                             <strong>链接URL:</strong><a href="<%# Eval("Url")%>" target="_blank"><%# Eval("Url")%></a>
     76                                         </td>
     77                                     </tr>
     78                                     <tr>
     79                                         <td colspan="3" style="padding-top: 10px;">
     80                                             <strong>备注:</strong><%# Eval("Content")%>
     81                                         </td>
     82                                     </tr>
     83                                 </table>
     84                             </div>
     85                         </ItemTemplate>
     86                     </f:TemplateField>
     87                     <f:BoundField DataField="Id" SortField="Id" HeaderText="Id" Width="50px" />
     88                     <f:BoundField DataField="Name" SortField="[Name]" HeaderText="广告标题" Width="150px" />
     89                     <f:BoundField DataField="AdvertisingPosition_Name" SortField="AdvertisingPosition_Id" HeaderText="广告位置" Width="150px" />
     90                     <f:BoundField DataField="Keyword" SortField="Keyword" HeaderText="广告Key" Width="100px" />
     91                     <f:BoundField DataField="ShowRate" SortField="ShowRate" HeaderText="显示频率" Width="80px" />
     92                     <f:BoundField DataField="HitCount" SortField="HitCount" HeaderText="点击数" Width="60px" />
     93                     <f:BoundField DataField="StartTime" SortField="StartTime" HeaderText="开始时间" Width="130px" />
     94                     <f:BoundField DataField="EndTime" SortField="EndTime" HeaderText="结束时间" Width="130px" />
     95                     <f:TemplateField HeaderText="排序" Width="100px">
     96                         <ItemTemplate>
     97                             <asp:TextBox ID="TextBox1" runat="server" Width="50px" Text='<%# Eval("Sort") %>' AutoPostBack="false"></asp:TextBox>
     98                         </ItemTemplate>
     99                     </f:TemplateField>
    100                     <f:LinkButtonField ColumnID="IsDisplay" SortField="IsDisplay" HeaderText="审核" TextAlign="Center" CommandName="IsDisplay" Width="40px"  />
    101                     <f:LinkButtonField Width="100px" HeaderText="操作" TextAlign="Center" ToolTip="点击修改当前记录" ColumnID="ButtonEdit" CommandName="ButtonEdit" />
    102                 </Columns>
    103             </f:Grid>
    104             <f:Label runat="server" ID="lblSpendingTime" Text=""></f:Label>
    105             <f:HiddenField runat="server" ID="SortColumn" Text="Id"></f:HiddenField>
    106         </items>
    107     </f:panel>
    108     <f:window id="Window1" width="680px" height="350px" icon="TagBlue" title="编辑" hidden="True"
    109         enablemaximize="True" closeaction="HidePostBack" onclose="Window1_Close" enablecollapse="true"
    110         runat="server" enableresize="true" bodypadding="5px" enableframe="True" iframeurl="about:blank"
    111         enableiframe="true" enableclose="true" plain="false" ismodal="True" enableconfirmonclose="True">
    112     </f:window>
    113     </form>
    114 </body>
    115 </html>
    View Code

      我们可以看到,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代码中要添加

    复制代码
    1         /// <summary>
    2         /// 报表导出按钮点击事件
    3         /// </summary>
    4         /// <param name="sender"></param>
    5         /// <param name="e"></param>
    6         protected void ButtonExportReport_Click(object sender, EventArgs e)
    7         {
    8             
    9         }
    复制代码

      

      

      页面中<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页面代码

      1 using System;
      2 using System.Collections.Generic;
      3 using DotNet.Utilities;
      4 using FineUI;
      5 using Solution.DataAccess.DataModel;
      6 using Solution.DataAccess.DbHelper;
      7 using Solution.Logic.Managers;
      8 using Solution.Web.Managers.WebManage.Application;
      9 /***********************************************************************
     10  *   作    者:AllEmpty(陈焕)-- 1654937@qq.com
     11  *   博    客:http://www.cnblogs.com/EmptyFS/
     12  *   技 术 群:327360708
     13  *  
     14  *   创建日期:2014-07-09
     15  *   文件名称:AdvertisementList.aspx.cs
     16  *   描    述:广告列表管理
     17  *             
     18  *   修 改 人:
     19  *   修改日期:
     20  *   修改原因:
     21  ***********************************************************************/
     22 using SubSonic.Query;
     23 
     24 namespace Solution.Web.Managers.WebManage.Advertisements
     25 {
     26     public partial class AdvertisementList : PageBase
     27     {
     28         #region Page_Load
     29         protected void Page_Load(object sender, EventArgs e)
     30         {
     31             if (!IsPostBack)
     32             {
     33                 //绑定下拉列表
     34                 AdvertisingPositionBll.GetInstence().BandDropDownListShowAll(this, dllAdvertisingPosition);
     35 
     36                 LoadData();
     37             }
     38         }
     39         #endregion
     40 
     41         #region 接口函数,用于UI页面初始化,给逻辑层对象、列表等对象赋值
     42         public override void Init()
     43         {
     44             //逻辑对象赋值
     45             bll = AdvertisementBll.GetInstence();
     46             //表格对象赋值
     47             grid = Grid1;
     48         }
     49         #endregion
     50 
     51         #region 加载数据
     52         /// <summary>读取数据</summary>
     53         public override void LoadData()
     54         {
     55             //设置排序
     56             if (sortList == null)
     57             {
     58                 Sort(null);
     59             }
     60 
     61             //绑定Grid表格
     62             bll.BindGrid(Grid1, Grid1.PageIndex + 1, Grid1.PageSize, InquiryCondition(), sortList);
     63         }
     64 
     65         /// <summary>
     66         /// 查询条件
     67         /// </summary>
     68         /// <returns></returns>
     69         private List<ConditionHelper.SqlqueryCondition> InquiryCondition()
     70         {
     71             var wheres = new List<ConditionHelper.SqlqueryCondition>();
     72 
     73 
     74             //起始时间
     75             if (!string.IsNullOrEmpty(dpStart.Text.Trim()))
     76             {
     77                 wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, AdvertisementTable.StartTime, Comparison.LessOrEquals, StringHelper.FilterSql(dpStart.Text)));
     78                 wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, AdvertisementTable.EndTime, Comparison.GreaterOrEquals, StringHelper.FilterSql(dpStart.Text)));
     79             }
     80             //广告位置
     81             if (dllAdvertisingPosition.SelectedValue != "0")
     82             {
     83                 wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, AdvertisementTable.AdvertisingPosition_Id, Comparison.Equals,
     84                     StringHelper.FilterSql(dllAdvertisingPosition.SelectedValue)));
     85             }
     86             //是否审批
     87             if (ddlIsDisplay.SelectedValue != "")
     88             {
     89                 wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, AdvertisementTable.IsDisplay, Comparison.Equals,
     90                     StringHelper.FilterSql(ddlIsDisplay.SelectedValue)));
     91             }
     92             //广告名称
     93             if (!string.IsNullOrEmpty(txtName.Text.Trim()))
     94             {
     95                 wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, AdvertisementTable.Name,
     96                     Comparison.Like, "%" + StringHelper.FilterSql(txtName.Text) + "%"));
     97             }
     98             //Keyword
     99             if (!string.IsNullOrEmpty(txtKeyword.Text.Trim()))
    100             {
    101                 wheres.Add(new ConditionHelper.SqlqueryCondition(ConstraintType.And, AdvertisementTable.Keyword, Comparison.Like,
    102                     "%" + StringHelper.FilterSql(txtKeyword.Text) + "%"));
    103             }
    104 
    105             return wheres;
    106         }
    107         #endregion
    108         
    109         #region 列表属性绑定
    110 
    111         #region 列表按键绑定——修改列表控件属性
    112         /// <summary>
    113         /// 列表按键绑定——修改列表控件属性
    114         /// </summary>
    115         /// <param name="sender"></param>
    116         /// <param name="e"></param>
    117         protected void Grid1_PreRowDataBound(object sender, FineUI.GridPreRowEventArgs e)
    118         {
    119             //绑定是否显示
    120             GridRow gr = Grid1.Rows[e.RowIndex];
    121             //判断当前行IsDisplay字段值是否为0
    122             if (((System.Data.DataRowView)(gr.DataItem)).Row.Table.Rows[e.RowIndex][AdvertisementTable.IsDisplay].ToString() == "0")
    123             {
    124                 //查找名称为IsDisplay的列
    125                 var lbf = Grid1.FindColumn("IsDisplay") as LinkButtonField;
    126                 //修改图标
    127                 lbf.Icon = Icon.BulletCross;
    128                 //设置参数值
    129                 lbf.CommandArgument = "1";
    130             }
    131             else
    132             {
    133                 var lbf = Grid1.FindColumn("IsDisplay") as LinkButtonField;
    134                 lbf.Icon = Icon.BulletTick;
    135                 lbf.CommandArgument = "0";
    136             }
    137 
    138             //绑定是否编辑列
    139             var lbfEdit = Grid1.FindColumn("ButtonEdit") as LinkButtonField;
    140             lbfEdit.Text = "编辑";
    141             lbfEdit.Enabled = MenuInfoBll.GetInstence().CheckControlPower(this, "ButtonEdit");
    142         }
    143         #endregion
    144 
    145         #region Grid点击事件
    146         /// <summary> 
    147         /// Grid点击事件
    148         /// </summary>
    149         /// <param name="sender"></param>
    150         /// <param name="e"></param>
    151         protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e)
    152         {
    153             GridRow gr = Grid1.Rows[e.RowIndex];
    154             //获取当前点击列的主键ID
    155             object id = gr.DataKeys[0];
    156 
    157             switch (e.CommandName)
    158             {
    159                 case "IsDisplay":
    160                     //更新状态
    161                     AdvertisementBll.GetInstence().UpdateIsDisplay(this, ConvertHelper.Cint0(id), ConvertHelper.Cint0(e.CommandArgument));
    162                     //重新加载
    163                     LoadData();
    164 
    165                     break;
    166 
    167                 case "ButtonEdit":
    168                     //打开编辑窗口
    169                     Window1.IFrameUrl = "AdvertisementEdit.aspx?Id=" + id + "&" + MenuInfoBll.GetInstence().PageUrlEncryptStringNoKey(id + "");
    170                     Window1.Hidden = false;
    171 
    172                     break;
    173             }
    174         }
    175         #endregion
    176 
    177         #region 保存自动排序
    178         /// <summary>
    179         /// 保存自动排序
    180         /// </summary>
    181         public override void SaveAutoSort()
    182         {
    183             if (bll.UpdateAutoSort(this))
    184             {
    185                 Alert.ShowInParent("保存成功", "保存自动排序成功", "window.location.reload();");
    186             }
    187             else
    188             {
    189                 Alert.ShowInParent("保存失败", "保存自动排序失败");
    190             }
    191         }
    192         #endregion
    193 
    194         #endregion
    195 
    196         #region 添加新记录
    197         /// <summary>
    198         /// 添加新记录
    199         /// </summary>
    200         public override void Add()
    201         {
    202             Window1.IFrameUrl = "AdvertisementEdit.aspx?" + MenuInfoBll.GetInstence().PageUrlEncryptString();
    203             Window1.Hidden = false;
    204         }
    205         #endregion
    206 
    207         #region 删除记录
    208         /// <summary>
    209         /// 删除记录
    210         /// </summary>
    211         /// <returns></returns>
    212         public override string Delete()
    213         {
    214             //获取要删除的Id组
    215             var id = GridViewHelper.GetSelectedKeyArray(Grid1);
    216             
    217             //如果没有选择记录,则直接退出
    218             if (id == null)
    219             {
    220                 return "请选择要删除的记录。";
    221             }
    222 
    223             try
    224             {
    225                 //逐个删除对应图片
    226                 foreach (var i in id)
    227                 {
    228                     //删除广告图片
    229                     AdvertisementBll.GetInstence().DelAdImg(this, i);
    230                 }
    231 
    232                 //删除记录
    233                 bll.Delete(this, id);
    234 
    235                 return "删除编号Id为[" + string.Join(",", id) + "]的数据记录成功。";
    236             }
    237             catch (Exception e)
    238             {
    239                 string result = "尝试删除编号ID为[" + string.Join(",", id) +"]的数据记录失败!";
    240 
    241                 //出现异常,保存出错日志广告
    242                 CommonBll.WriteLog(result, e);
    243 
    244                 return result;
    245             }
    246         }
    247         #endregion
    248 
    249     }
    250 }
    View Code

      在cs页面代码的加载数据函数中,绑定Grid表格用的是bll.BindGrid(Grid1, Grid1.PageIndex + 1, Grid1.PageSize, InquiryCondition(), sortList)这个函数。我们在模板中生成的绑定表格函数共有两种类型,一种是有层次感列表绑定,一种是普通列表绑定。当前这种普通列表绑定,需要传递表格控件名称、当前页码、每页显示记录数量、查询条件和排序这几个参数,而对于查询条件如果添加使用,前面章节已有比较详细的说明,大家也可以参考一下上面的cs代码来使用。

      刚刚发现InformationList.aspx.cs页面忘了加查询条件了,就做为作业,大家自己尝试去添加一下吧。

      在列表属性绑定时,由于广告表有排序字段,但没有父Id存在,即它不是多级别分类记录,所以在实现自动排序时,使用父类默认的自动排序函数是不行的,我们需要重写该函数,具体如下:UpdateAutoSort()函数有很多参数,但大部分都有默认值,按照默认值,我们只需要传当前页面针指进去就可以了,具体实现大家请自己查看该函数。

    复制代码
     1         #region 保存自动排序
     2         /// <summary>
     3         /// 保存自动排序
     4         /// </summary>
     5         public override void SaveAutoSort()
     6         {
     7             if (bll.UpdateAutoSort(this))
     8             {
     9                 Alert.ShowInParent("保存成功", "保存自动排序成功", "window.location.reload();");
    10             }
    11             else
    12             {
    13                 Alert.ShowInParent("保存失败", "保存自动排序失败");
    14             }
    15         }
    16         #endregion
    复制代码

      由于广告管理会上传广告图片,所以执行删除时需要先将运行图片删除函数(AdvertisementBll.GetInstence().DelAdImg(this, i)),再删除广告记录。

      其他的cs页面代码同上一章差不多,所以不再详细说明。

      我们本章已添加了广告页面,所以上一章注释的删除判断与更新广告位置名称时,同步更新广告表对应名称的功能要启用。

      AdvertisingPositionList.aspx.cs页面

      

      删除前判断当前广告位置记录是否已给广告记录使用了,是的话必须删除相关广告后才能删除广告位置记录。

      AdvertisingPositionEdit.aspx.cs页面 

      广告位置记录编辑时,如果广告位置名称有修改,这里就会同步执行修改广告表里对应的广告位置名称。这里所调用的函数也是模板生成好的函数。

      

      AdvertisementEdit.aspx页面代码

     1 <%@ Page Language="C#" ValidateRequest="false" AutoEventWireup="true" CodeBehind="AdvertisementEdit.aspx.cs"
     2     Inherits="Solution.Web.Managers.WebManage.Advertisements.AdvertisementEdit" %>
     3 
     4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     5 <html xmlns="http://www.w3.org/1999/xhtml">
     6 <head id="Head1" runat="server">
     7     <title>广告编辑</title>
     8 </head>
     9 <body>
    10     <form id="form1" runat="server">
    11     <f:HiddenField runat="server" ID="hidId" Text="0">
    12     </f:HiddenField>
    13     <f:PageManager ID="PageManager1" runat="server" />
    14     <f:Panel ID="Panel1" runat="server" EnableFrame="false" BodyPadding="10px" EnableCollapse="True"
    15         ShowHeader="False">
    16         <Toolbars>
    17             <f:Toolbar ID="toolBar" runat="server">
    18                 <Items>
    19                     <f:Button ID="ButtonSave" runat="server" Text="保存" Icon="Disk" OnClick="ButtonSave_Click">
    20                     </f:Button>
    21                     <f:Button ID="ButtonDeleteImage" runat="server" Text="删除图片" Icon="Delete" OnClick="ButtonDeleteImage_Click"
    22                         ConfirmTitle="删除提示" ConfirmText="是否删除图片?" />
    23                 </Items>
    24             </f:Toolbar>
    25         </Toolbars>
    26         <Items>
    27             <f:Panel ID="Panel2" runat="server" EnableFrame="false" BodyPadding="5px" EnableCollapse="True"
    28                 ShowHeader="False" ShowBorder="False">
    29                 <Items>
    30                     <f:Form ID="extForm1" ShowBorder="false" ShowHeader="false" BodyPadding="5px" runat="server">
    31                         <Rows>
    32                             <f:FormRow ID="FormRow1" runat="server">
    33                                 <Items>
    34                                     <f:TextBox runat="server" ID="txtName" Label="广告名称" Width="300px" Text="" ShowRedStar="true"
    35                                         MaxLength="50" />
    36                                     <f:TextBox runat="server" ID="txtKeyword" Label="Key(非中文)" Width="300px" Text=""
    37                                         MaxLength="50" Readonly="True" />
    38                                 </Items>
    39                             </f:FormRow>
    40                             <f:FormRow ID="FormRow2" runat="server">
    41                                 <Items>
    42                                     <f:DropDownList Label="广告位置" AutoPostBack="true" CompareType="String" EnableSimulateTree="true"
    43                                         runat="server" ID="ddlAdvertisingPosition" Width="300px" ShowRedStar="true" OnSelectedIndexChanged="ddlAdvertisingPosition_SelectedIndexChanged">
    44                                     </f:DropDownList>
    45                                     <f:RadioButtonList ID="rblIsDisplay" Label="是否审核" ColumnNumber="2" runat="server"
    46                                         Width="300px">
    47                                         <f:RadioItem Text="显示" Value="1" Selected="true" />
    48                                         <f:RadioItem Text="不显示" Value="0" />
    49                                     </f:RadioButtonList>
    50                                 </Items>
    51                             </f:FormRow>
    52                             <f:FormRow ID="FormRow4" runat="server">
    53                                 <Items>
    54                                     <f:DatePicker ID="dpStartTime" Label="开始时间" Width="300px" Required="true" runat="server"
    55                                         ShowRedStar="true" />
    56                                     <f:DatePicker ID="dpEndTime" Label="结束时间" Width="300px" Required="true" runat="server"
    57                                         ShowRedStar="true" />
    58                                 </Items>
    59                             </f:FormRow>
    60                             <f:FormRow ID="FormRow11" runat="server">
    61                                 <Items>
    62                                     <f:TextBox runat="server" ID="txtUrl" Label="广告链接地址" Width="610px" Text="" MaxLength="200" />
    63                                 </Items>
    64                             </f:FormRow>
    65                             <f:FormRow ID="FormRow3" runat="server">
    66                                 <Items>
    67                                     <f:TextArea runat="server" Label="说明" ID="txtContent" Width="610px" MaxLength="100"
    68                                         Height="50px">
    69                                     </f:TextArea>
    70                                 </Items>
    71                             </f:FormRow>
    72                             <f:FormRow ID="FormRow10" runat="server">
    73                                 <Items>
    74                                     <f:FileUpload runat="server" ID="filePhoto" Label="广告图片" Width="300px" />
    75                                     <f:TextBox runat="server" ID="txtSort" Label="排序" Width="300px" Text="0" />
    76                                 </Items>
    77                             </f:FormRow>
    78                             <f:FormRow ID="ShowImage" runat="server">
    79                                 <Items>
    80                                     <f:ContentPanel ID="ContentPanel3" runat="server" Width="90%" ShowBorder="false"
    81                                         ShowHeader="false">
    82                                         <%=(p_Img != null && p_Img.Length > 5) ? "<a href='" + p_Img + "' target="_blank"><img src='" + p_Img + "'></a>" : ""%>
    83                                     </f:ContentPanel>
    84                                 </Items>
    85                             </f:FormRow>
    86                         </Rows>
    87                     </f:Form>
    88                 </Items>
    89             </f:Panel>
    90         </Items>
    91     </f:Panel>
    92     </form>
    93 </body>
    94 </html>
    View Code

       AdvertisementEdit.aspx页面主要分为两个部分,一个是工具栏,同列表页面差不多;另一个是内容编辑控件,具体怎么排版大家自己根据需要来设置,大家看看标签属性的英文就知道是什么功能了,当然也可以进入FineUI官网查看在线示例,里面有很多排版介绍与调用的源代码例子。

      AdvertisementEdit.aspx.cs页面代码

      1 using System;
      2 using DotNet.Utilities;
      3 using Solution.DataAccess.DataModel;
      4 using Solution.Logic.Managers;
      5 using Solution.Web.Managers.WebManage.Application;
      6 
      7 /***********************************************************************
      8  *   作    者:AllEmpty(陈焕)-- 1654937@qq.com
      9  *   博    客:http://www.cnblogs.com/EmptyFS/
     10  *   技 术 群:327360708
     11  *  
     12  *   创建日期:2014-07-10
     13  *   文件名称:AdvertisementEdit.aspx.cs
     14  *   描    述:广告编辑页面
     15  *             
     16  *   修 改 人:
     17  *   修改日期:
     18  *   修改原因:
     19  ***********************************************************************/
     20 namespace Solution.Web.Managers.WebManage.Advertisements
     21 {
     22     public partial class AdvertisementEdit : PageBase
     23     {
     24         protected string RndKey = RandomHelper.GetRndKey();
     25         protected string p_Img = "";
     26 
     27         #region Page_Load
     28         protected void Page_Load(object sender, EventArgs e)
     29         {
     30             if (!IsPostBack)
     31             {
     32                 //获取ID值
     33                 hidId.Text = RequestHelper.GetInt0("Id") + "";
     34                 //广告位置下拉框
     35                 AdvertisingPositionBll.GetInstence().BandDropDownListShowAll(this, ddlAdvertisingPosition);
     36 
     37                 //加载数据
     38                 LoadData();
     39             }
     40         }
     41         #endregion
     42 
     43         #region 接口函数,用于UI页面初始化,给逻辑层对象、列表等对象赋值
     44         public override void Init()
     45         {
     46 
     47         }
     48         #endregion
     49 
     50         #region 加载数据
     51         /// <summary>读取数据</summary>
     52         public override void LoadData()
     53         {
     54             //读取当前编辑的广告Id
     55             int id = ConvertHelper.Cint0(hidId.Text);
     56 
     57             if (id != 0)
     58             {
     59                 //获取指定Id的广告记录实体
     60                 var model = AdvertisementBll.GetInstence().GetModelForCache(x => x.Id == id);
     61                 if (model == null)
     62                     return;
     63 
     64                 //对页面窗体进行赋值
     65                 //广告名称
     66                 txtName.Text = model.Name;
     67                 //Key是不能修改的,同一个广告位置的Key值一样
     68                 txtKeyword.Text = model.Keyword;
     69                 txtKeyword.Readonly = true;
     70                 //广告链接
     71                 txtUrl.Text = model.Url;
     72                 //广告说明
     73                 txtContent.Text = model.Content;
     74                 //开始时间与结束时间
     75                 dpStartTime.SelectedDate = model.StartTime;
     76                 dpEndTime.SelectedDate = model.EndTime;
     77                 //广告位置下拉框绑定
     78                 ddlAdvertisingPosition.SelectedValue = model.AdvertisingPosition_Id + "";
     79                 //是否显示
     80                 rblIsDisplay.SelectedValue = model.IsDisplay + "";
     81                 //排序值
     82                 txtSort.Text = model.Sort + "";
     83 
     84                 //是否存在广告图片
     85                 if (!String.IsNullOrEmpty(model.AdImg))
     86                 {
     87                     //为页面的广告图片控件赋值
     88                     p_Img = model.AdImg;
     89                     //判断当前管理人员是否有“删除图片”这个按钮的操作权限
     90                     ButtonDeleteImage.Enabled = MenuInfoBll.GetInstence().CheckControlPower(this, "ButtonDeleteImage");
     91                 }
     92                 else
     93                 {
     94                     //不存在广告图片则隐藏删除图片按钮
     95                     ButtonDeleteImage.Visible = false;
     96                 }
     97             }
     98             else
     99             {
    100                 //新增广告记录时隐藏删除图片按钮
    101                 ButtonDeleteImage.Visible = false;
    102             }
    103         }
    104 
    105         #endregion
    106 
    107         #region 页面控件绑定功能
    108 
    109         #region 下拉列表改变事件
    
    110         /// <summary>下拉列表改变事件
    111         /// </summary>
    112         /// <param name="sender"></param>
    113         /// <param name="e"></param>
    114         protected void ddlAdvertisingPosition_SelectedIndexChanged(object sender, EventArgs e)
    115         {
    116             //获取广告位置下拉列表选择项的值
    117             int id = ConvertHelper.Cint0(ddlAdvertisingPosition.SelectedValue);
    118             if (id == 0) return;
    119 
    120             //读取广告位置记录实体
    121             var model = AdvertisingPositionBll.GetInstence().GetModelForCache(id);
    122             if (model != null)
    123             {
    124                 //修改当前广告的Key为广告位置Key
    125                 txtKeyword.Text = model.Keyword;
    126             }
    127         }
    128         #endregion
    129 
    130         #region 删除图片
    131         /// <summary>删除图片</summary>
    132         /// <param name="sender"></param>
    133         /// <param name="e"></param>
    134         public void ButtonDeleteImage_Click(object sender, EventArgs e)
    135         {
    136             //读取当前编辑的广告Id
    137             int id = ConvertHelper.Cint0(hidId.Text);
    138             if (id > 0)
    139             {
    140                 //执行广告图片删除函数
    141                 AdvertisementBll.GetInstence().DelAdImg(this, id);
    142                 //刷新页面
    143                 FineUI.PageContext.RegisterStartupScript("window.location.reload()");
    144             }
    145         }
    146 
    147         #endregion
    148 
    149         #endregion
    150 
    151         #region 保存
    152         /// <summary>
    153         /// 数据保存
    154         /// </summary>
    155         /// <returns></returns>
    156         public override string Save()
    157         {
    158             string result = string.Empty;
    159             //读取当前编辑的广告Id
    160             int id = ConvertHelper.Cint0(hidId.Text);
    161 
    162             try
    163             {
    164                 #region 数据验证
    165 
    166                 if (string.IsNullOrEmpty(txtName.Text.Trim()))
    167                 {
    168                     return txtName.Label + "不能为空!";
    169                 }
    170                 //判断是否重复
    171                 var sName = StringHelper.Left(txtName.Text, 50);
    172                 if (AdvertisementBll.GetInstence().Exist(x => x.Name == sName && x.Id != id))
    173                 {
    174                     return txtName.Label + "已存在!请重新输入!";
    175                 }
    176                 if (ddlAdvertisingPosition.SelectedValue == "0")
    177                 {
    178                     return ddlAdvertisingPosition.Label + "为必选项,请选择!";
    179                 }
    180 
    181                 if (dpStartTime.SelectedDate == null || TimeHelper.IsDateTime(dpStartTime.SelectedDate) == false)
    182                 {
    183                     return "请选择" + dpStartTime.Label;
    184                 }
    185                 if (dpEndTime.SelectedDate == null || TimeHelper.IsDateTime(dpEndTime.SelectedDate) == false)
    186                 {
    187                     return "请选择" + dpEndTime.Label;
    188                 }
    189                 if (dpStartTime.SelectedDate > dpEndTime.SelectedDate)
    190                 {
    191                     return dpStartTime.Label + "不能大于" + dpEndTime.Label;
    192                 }
    193 
    194                 #endregion
    195 
    196                 #region 赋值
    197 
    198                 //获取实体
    199                 var model = new Advertisement(x => x.Id == id);
    200 
    201                 //------------------------------------------
    202                 //设置名称
    203                 model.Name = sName;
    204                 model.Keyword = StringHelper.Left(txtKeyword.Text, 50);
    205                 model.Url = StringHelper.Left(txtUrl.Text, 200, true, false);
    206                 //说明
    207                 model.Content = StringHelper.Left(txtContent.Text, 100);
    208                 //取得位置
    209                 model.AdvertisingPosition_Id = ConvertHelper.Cint0(ddlAdvertisingPosition.SelectedValue);
    210                 model.AdvertisingPosition_Name = StringHelper.Left(ddlAdvertisingPosition.SelectedText, 50);
    211 
    212                 //开始时间与结束时间
    213                 model.StartTime = dpStartTime.SelectedDate ?? DateTime.Now;
    214                 model.EndTime = dpEndTime.SelectedDate ?? DateTime.Now.AddDays(1);
    215 
    216                 //设定当前项是否显示
    217                 model.IsDisplay = ConvertHelper.StringToByte(rblIsDisplay.SelectedValue);
    218 
    219                 model.Sort = ConvertHelper.Cint0(txtSort.Text); ;
    220                 
    221                 //修改时间与用户
    222                 model.UpdateDate = DateTime.Now;
    223                 model.Manager_Id = OnlineUsersBll.GetInstence().GetManagerId();
    224                 model.Manager_CName = OnlineUsersBll.GetInstence().GetManagerCName();
    225 
    226                 #endregion
    227 
    228                 //------------------------------------------
    229 
    230                 #region 上传图片
    231 
    232                 if (this.filePhoto.HasFile && this.filePhoto.FileName.Length > 3)
    233                 {
    234                     int vid = 7; //7    广告
    235                     //---------------------------------------------------
    236                     var upload = new UploadFile();
    237                     result = new UploadFileBll().Upload_AspNet(this.filePhoto.PostedFile, vid, RndKey,
    238                         OnlineUsersBll.GetInstence().GetManagerId(), OnlineUsersBll.GetInstence().GetManagerCName(),
    239                         upload);
    240                     this.filePhoto.Dispose();
    241                     //---------------------------------------------------
    242                     if (result.Length == 0) //上传成功
    243                     {
    244                         model.AdImg = upload.Path;
    245                     }
    246                     else
    247                     {
    248                         CommonBll.WriteLog("上传出错:" + result); //收集异常信息
    249                         return "上传出错!" + result;
    250                     }
    251                 }
    252                 //如果是修改,检查用户是否重新上传过封面图片,如果是删除旧的图片
    253                 if (model.Id > 0)
    254                 {
    255                     UploadFileBll.GetInstence()
    256                         .Upload_DiffFile(AdvertisementTable.Id, AdvertisementTable.AdImg, AdvertisementTable.TableName,
    257                             model.Id, model.AdImg);
    258 
    259                     //同步UploadFile上传表
    260                     UploadFileBll.GetInstence().Upload_UpdateRs(RndKey, AdvertisementTable.TableName, model.Id);
    261                 }
    262 
    263                 #endregion
    264 
    265                 //----------------------------------------------------------
    266                 //存储到数据库
    267                 AdvertisementBll.GetInstence().Save(this, model);
    268 
    269                 //这里放置清空前端页面缓存的代码(如果前端使用了页面缓存的话,必须进行清除操作)
    270 
    271 
    272             }
    273             catch (Exception e)
    274             {
    275                 result = "保存失败!";
    276 
    277                 //出现异常,保存出错日志广告
    278                 CommonBll.WriteLog(result, e);
    279             }
    280 
    281             return result;
    282         }
    283         #endregion
    284     }
    285 }
    View Code

      cs页面代码与上一章的差不多,同时也加了很详细的注释,所以也不再详细描述,大家自己尝试修改后与上面代码比较一下。

      下面再附上相关SQL更新代码,直接在数据库查询分析器中执行就可以了

      1 --更新上传配置表
      2 TRUNCATE TABLE UploadConfig 
      3 GO
      4 set IDENTITY_INSERT UploadConfig     on 
      5 GO
      6 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 (1, '管理员头像', 'Manager', 1, 1, '图片文件', 'image', 200, 20000, 'Manager', 1, 0, 0, 1, 2, 500, 500, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 100, 100, 0, 0, 0, 0, 0, 0, 1, 'admin', '2014-06-26 17:03:32')
      7 GO
      8 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 (2, '信息(新闻)分类图', 'InformationClass', 1, 1, '图片文件', 'image', 500, 20000, 'ic', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 100, 100, 0, 0, 0, 0, 0, 0, 1, 'admin', '2014-06-26 17:04:53')
      9 GO
     10 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 (3, '文章封面', 'Information', 1, 1, '图片文件', 'image', 500, 20000, 'i', 1, 0, 0, 1, 1, 200, 200, 75, 0, 1, 700, 260, 90, 1, 430, 160, 90, 1, 100, 100, 0, 0, 0, 0, 0, 0, 1, 'admin', '2014-06-26 17:06:44')
     11 GO
     12 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 (4, '文章内容(编辑器)', 'Information', 1, 6, '编辑器', 'editor', 500, 20000, 'i', 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 'admin', '2014-06-26 17:06:38')
     13 GO
     14 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 (5, '广告位置', 'AdvertisingPosition', 1, 5, '广告图片', 'ad', 512, 2048, 'a', 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 200, 100, 80, 0, 0, 0, 0, 1, 100, 50, 0, 0, 0, 0, 0, 0, 1, '管理员', '2014-07-08 17:40:27.217')
     15 GO
     16 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 (6, '默认广告', 'AdvertisingPosition', 1, 5, '广告图片', 'ad', 512, 2048, 'a', 1, 0, 1, 1, 0, 200, 100, 80, 0, 1, 200, 100, 80, 0, 0, 0, 0, 1, 100, 50, 0, 0, 0, 0, 0, 0, 1, '管理员', '2014-07-08 17:41:55.033')
     17 GO
     18 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 (7, '默认广告', 'Advertisement', 1, 5, '广告图片', 'a', 512, 2048, 'a', 1, 0, 1, 1, 0, 200, 100, 80, 0, 1, 200, 100, 80, 0, 0, 0, 0, 1, 100, 50, 0, 0, 0, 0, 0, 0, 1, '管理员', '2014-07-08 17:41:55')
     19 GO
     20 set IDENTITY_INSERT  UploadConfig     off 
     21 GO
     22 
     23 
     24 
     25 --更新菜单表
     26 TRUNCATE TABLE MenuInfo
     27 GO
     28 set IDENTITY_INSERT MenuInfo  on 
     29 GO
     30 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (1, '系统管理', '/WebManage/Systems/', 0, 99, 0, 1, 0)
     31 GO
     32 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (2, '基本设置', '/WebManage/Systems/Set/', 1, 1, 1, 1, 0)
     33 GO
     34 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (3, '权限管理', '/WebManage/Systems/Powers/', 1, 2, 1, 1, 0)
     35 GO
     36 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (4, '安全管理', '/WebManage/Systems/Security/', 1, 3, 1, 1, 0)
     37 GO
     38 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (5, '网站参数设置', '/WebManage/Systems/Set/WebConfigSet.aspx', 2, 1, 2, 1, 1)
     39 GO
     40 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (6, '菜单管理', '/WebManage/Systems/Powers/MenuInfoList.aspx', 3, 1, 2, 1, 1)
     41 GO
     42 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (7, '菜单编辑', '/WebManage/Systems/Powers/MenuInfoEdit.aspx', 3, 2, 2, 0, 1)
     43 GO
     44 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (8, '公共页面权限设置', '/WebManage/Systems/Powers/PagePowerSignPublicList.aspx', 3, 3, 2, 1, 1)
     45 GO
     46 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (9, '公共页面权限编辑', '/WebManage/Systems/Powers/PagePowerSignPublicEdit.aspx', 3, 4, 2, 0, 1)
     47 GO
     48 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (10, '页面权限设置', '/WebManage/Systems/Powers/PagePowerSignList.aspx', 3, 5, 2, 1, 1)
     49 GO
     50 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (11, '部门管理', '/WebManage/Systems/Powers/BranchList.aspx', 3, 6, 2, 1, 1)
     51 GO
     52 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (12, '部门编辑', '/WebManage/Systems/Powers/BranchEdit.aspx', 3, 7, 2, 0, 1)
     53 GO
     54 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (13, '职位管理', '/WebManage/Systems/Powers/PositionList.aspx', 3, 8, 2, 1, 1)
     55 GO
     56 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (14, '职位编辑', '/WebManage/Systems/Powers/PositionEdit.aspx', 3, 9, 2, 0, 1)
     57 GO
     58 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (15, '在线用户', '/WebManage/Systems/Security/OnlineUsersList.aspx', 4, 1, 2, 1, 1)
     59 GO
     60 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (16, '登陆日志', '/WebManage/Systems/Security/LoginLogList.aspx', 4, 2, 2, 1, 1)
     61 GO
     62 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (17, '操作日志', '/WebManage/Systems/Security/UseLogList.aspx', 4, 3, 2, 1, 1)
     63 GO
     64 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (18, '错误日志', '/WebManage/Systems/Security/ErrorLogList.aspx', 4, 4, 2, 1, 1)
     65 GO
     66 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (19, '上传类型设置', '/WebManage/Systems/Set/UploadTypeList.aspx', 2, 2, 2, 1, 1)
     67 GO
     68 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (20, '上传类型编辑', '/WebManage/Systems/Set/UploadTypeEdit.aspx', 2, 3, 2, 0, 1)
     69 GO
     70 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (21, '上传配置管理', '/WebManage/Systems/Set/UploadConfigList.aspx', 2, 4, 2, 1, 1)
     71 GO
     72 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (22, '上传配置编辑', '/WebManage/Systems/Set/UploadConfigEdit.aspx', 2, 5, 2, 0, 1)
     73 GO
     74 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (23, '已上传文件管理', '/WebManage/Systems/Set/UploadFileList.aspx', 2, 6, 2, 1, 1)
     75 GO
     76 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (24, '员工管理', '/WebManage/Employees/', 0, 90, 0, 1, 0)
     77 GO
     78 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (25, '在职员工管理', '/WebManage/Employees/ManagerList.aspx', 24, 1, 1, 1, 1)
     79 GO
     80 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (26, '员工编辑', '/WebManage/Employees/ManagerEdit.aspx', 24, 2, 1, 0, 1)
     81 GO
     82 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (27, '离职员工管理', '/WebManage/Employees/StaffTurnoverList.aspx', 24, 3, 1, 1, 1)
     83 GO
     84 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (28, '信息管理', '/WebManage/Informations/', 0, 1, 0, 1, 0)
     85 GO
     86 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (29, '信息分类列表', '/WebManage/Informations/InformationClassList.aspx', 28, 1, 1, 1, 1)
     87 GO
     88 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (30, '信息分类编辑', '/WebManage/Informations/InformationClassEdit.aspx', 28, 2, 1, 0, 1)
     89 GO
     90 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (31, '信息列表', '/WebManage/Informations/InformationList.aspx', 28, 3, 1, 1, 1)
     91 GO
     92 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (32, '信息编辑', '/WebManage/Informations/InformationEdit.aspx', 28, 4, 1, 0, 1)
     93 GO
     94 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (33, '授权电话管理', '/WebManage/Systems/Powers/EmpowerPhoneList.aspx', 3, 10, 2, 1, 1)
     95 GO
     96 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (34, '授权电话编辑', '/WebManage/Systems/Powers/EmpowerPhoneEdit.aspx', 3, 11, 2, 0, 1)
     97 GO
     98 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (35, '授权Ip列表', '/WebManage/Systems/Powers/EmpowerIpList.aspx', 3, 12, 2, 1, 1)
     99 GO
    100 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (36, '广告管理', '/WebManage/Advertisements/', 0, 2, 0, 1, 0)
    101 GO
    102 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (37, '广告位置管理', '/WebManage/Advertisements/AdvertisingPositionList.aspx', 36, 1, 1, 1, 1)
    103 GO
    104 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (38, '广告位置编辑', '/WebManage/Advertisements/AdvertisingPositionEdit.aspx', 36, 2, 1, 0, 1)
    105 GO
    106 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (39, '广告内容管理', '/WebManage/Advertisements/AdvertisementList.aspx', 36, 3, 1, 1, 1)
    107 GO
    108 INSERT INTO MenuInfo (Id, Name, Url, ParentId, Sort, Depth, IsDisplay, IsMenu) VALUES (40, '广告内容编辑', '/WebManage/Advertisements/AdvertisementEdit.aspx', 36, 4, 1, 0, 1)
    109 GO
    110 set IDENTITY_INSERT  MenuInfo  off 
    111 
    112 
    113 
    114 --更新页面控件权限标识管理表
    115 TRUNCATE TABLE PagePowerSign 
    116 GO
    117 set IDENTITY_INSERT PagePowerSign  on 
    118 GO
    119 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (1, 4, '保存', 'ButtonSave', 5)
    120 GO
    121 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (2, 1, '添加', 'ButtonAdd', 6)
    122 GO
    123 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (3, 2, '编辑', 'ButtonEdit', 6)
    124 GO
    125 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (4, 3, '删除', 'ButtonDelete', 6)
    126 GO
    127 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (5, 5, '自动排序', 'ButtonSaveAutoSort', 6)
    128 GO
    129 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (6, 6, '保存排序', 'ButtonSaveSort', 6)
    130 GO
    131 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (7, 4, '保存', 'ButtonSave', 7)
    132 GO
    133 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (8, 1, '添加', 'ButtonAdd', 8)
    134 GO
    135 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (9, 2, '编辑', 'ButtonEdit', 8)
    136 GO
    137 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (10, 3, '删除', 'ButtonDelete', 8)
    138 GO
    139 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (11, 4, '保存', 'ButtonSave', 9)
    140 GO
    141 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (12, 1, '添加', 'ButtonAdd', 11)
    142 GO
    143 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (13, 2, '编辑', 'ButtonEdit', 11)
    144 GO
    145 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (14, 3, '删除', 'ButtonDelete', 11)
    146 GO
    147 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (15, 5, '自动排序', 'ButtonSaveAutoSort', 11)
    148 GO
    149 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (16, 6, '保存排序', 'ButtonSaveSort', 11)
    150 GO
    151 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (17, 4, '保存', 'ButtonSave', 12)
    152 GO
    153 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (18, 1, '添加', 'ButtonAdd', 13)
    154 GO
    155 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (19, 2, '编辑', 'ButtonEdit', 13)
    156 GO
    157 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (20, 3, '删除', 'ButtonDelete', 13)
    158 GO
    159 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (21, 4, '保存', 'ButtonSave', 14)
    160 GO
    161 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (22, 8, '踢除用户', 'ButtonGetOut', 15)
    162 GO
    163 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (23, 1, '添加', 'ButtonAdd', 19)
    164 GO
    165 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (24, 2, '编辑', 'ButtonEdit', 19)
    166 GO
    167 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (25, 3, '删除', 'ButtonDelete', 19)
    168 GO
    169 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (26, 4, '保存', 'ButtonSave', 20)
    170 GO
    171 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (27, 1, '添加', 'ButtonAdd', 21)
    172 GO
    173 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (28, 2, '编辑', 'ButtonEdit', 21)
    174 GO
    175 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (29, 3, '删除', 'ButtonDelete', 21)
    176 GO
    177 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (30, 4, '保存', 'ButtonSave', 22)
    178 GO
    179 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (31, 9, '图片全部重新生成', 'ButtonImageRegenerate', 23)
    180 GO
    181 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (32, 3, '删除', 'ButtonDelete', 23)
    182 GO
    183 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (33, 1, '添加', 'ButtonAdd', 29)
    184 GO
    185 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (34, 2, '编辑', 'ButtonEdit', 29)
    186 GO
    187 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (35, 3, '删除', 'ButtonDelete', 29)
    188 GO
    189 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (36, 5, '自动排序', 'ButtonSaveAutoSort', 29)
    190 GO
    191 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (37, 6, '保存排序', 'ButtonSaveSort', 29)
    192 GO
    193 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (38, 4, '保存', 'ButtonSave', 30)
    194 GO
    195 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (39, 10, '删除图片', 'ButtonDeleteImage', 30)
    196 GO
    197 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (40, 1, '添加', 'ButtonAdd', 31)
    198 GO
    199 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (41, 2, '编辑', 'ButtonEdit', 31)
    200 GO
    201 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (42, 3, '删除', 'ButtonDelete', 31)
    202 GO
    203 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (43, 5, '自动排序', 'ButtonSaveAutoSort', 31)
    204 GO
    205 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (44, 6, '保存排序', 'ButtonSaveSort', 31)
    206 GO
    207 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (45, 4, '保存', 'ButtonSave', 32)
    208 GO
    209 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (46, 10, '删除图片', 'ButtonDeleteImage', 32)
    210 GO
    211 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (47, 1, '添加', 'ButtonAdd', 25)
    212 GO
    213 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (48, 2, '编辑', 'ButtonEdit', 25)
    214 GO
    215 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (49, 11, '离职', 'ButtonStaffTurnover', 25)
    216 GO
    217 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (50, 4, '保存', 'ButtonSave', 26)
    218 GO
    219 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (51, 2, '编辑', 'ButtonEdit', 27)
    220 GO
    221 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (52, 3, '删除', 'ButtonDelete', 27)
    222 GO
    223 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (53, 12, '复职', 'ButtonRecovery', 27)
    224 GO
    225 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (54, 1, '添加', 'ButtonAdd', 37)
    226 GO
    227 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (55, 2, '编辑', 'ButtonEdit', 37)
    228 GO
    229 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (56, 3, '删除', 'ButtonDelete', 37)
    230 GO
    231 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (57, 5, '自动排序', 'ButtonSaveAutoSort', 37)
    232 GO
    233 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (58, 6, '保存排序', 'ButtonSaveSort', 37)
    234 GO
    235 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (59, 4, '保存', 'ButtonSave', 38)
    236 GO
    237 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (60, 1, '添加', 'ButtonAdd', 39)
    238 GO
    239 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (61, 2, '编辑', 'ButtonEdit', 39)
    240 GO
    241 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (62, 3, '删除', 'ButtonDelete', 39)
    242 GO
    243 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (63, 5, '自动排序', 'ButtonSaveAutoSort', 39)
    244 GO
    245 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (64, 6, '保存排序', 'ButtonSaveSort', 39)
    246 GO
    247 INSERT INTO PagePowerSign (Id, PagePowerSignPublic_Id, CName, EName, MenuInfo_Id) VALUES (65, 4, '保存', 'ButtonSave', 40)
    248 GO
    249 
    250 set IDENTITY_INSERT PagePowerSign   off 
    View Code

      本次代码还更新了DotNet.Utilities.ConfigHelper类、DotNet.Utilities.GridViewHelper类

      前者修改配置文件读取转换出错的问题,后者修改了获取Grid表格选择行数据的相关函数,以及修改后所引起的UI层相关页面函数的引用。

      还有自定义OnlineUsersBll.cs类也修改了个小Bug

      除了上面添加了上面代码外,还新增三个日志删除的存储过程

      

      大家如果将项目放在正式环境上时,可以在SQL Server代理中创建作业来运行,设置每个月自动执行一次就可以了

      

      

      

      

      

      

      

    由于框架不是非常成熟,很多朋友不是用来学习而是直接用到项目中,但不熟悉框架引起不少小问题,所以停止提供下载,有需要学习的可以到群共享里下,不便之处敬请谅解。

    版权声明:
      本文由AllEmpty原创并发布于博客园,欢迎转载,未经本人同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利。如有问题,可以通过1654937@qq.com 联系我,非常感谢。

      发表本编内容,只要主为了和大家共同学习共同进步,有兴趣的朋友可以加加Q群:327360708 ,大家一起探讨。

      更多内容,敬请观注博客:http://www.cnblogs.com/EmptyFS/

    只有将自己置空,才能装进更多的东西
  • 相关阅读:
    Sql Server 存储过程删除一个表里(除ID外)完全重复的数据记录
    把一个库中的表复制到另外一个库的表中(Sql server 2005)
    ajax执行后台返回的提交表单及JS
    WinCE中使用本地数据库SQLite以及得到当前应用程序所在路径
    如何评测一个软件工程师的计算机网络知识水平与网络编程技能水平
    如何评测软件工程知识技能水平?
    深入理解TCP协议及其源代码
    Socket与系统调用深度分析
    创新产品的需求分析:未来的图书会是什么样子?
    ubuntu小问题集合
  • 原文地址:https://www.cnblogs.com/FinleyJiang/p/7600874.html
Copyright © 2020-2023  润新知