这是最近在干一个webform的cms的时候用起来的,原来虽然做过很多技术,什么remoting,wcf,webservice,可是弄来弄去,最后也没个收藏的地儿,全都放在笔记本儿上了,可是人又懒地可以,做来做去,最后它们还是扔在那里

说正题吧:最近用到的这套小型的cms,主就是用的链表了,大部分的栏目都在同一张表里,而这张表囊括了几乎所有需要用到的字段,包括图片,内容,一堆乱七八糟的东西,这样做的时候主要就是读这一张表,所以这里做的时候主要就是把配置给抽出来。封装的
作用一直都最关键在委托的使用上,从2.0开始,喜欢用委托,可是手写一个又太麻烦从4.0开发就一直用扩展方法和ACTION FUNC等委托,好 好几年未认真写,如今用来还真的是得心应手。表达思想表达地比较迅速,也容量写好。对于一个对代码有追求的人。应该

using System; using System.Collections.Generic; using System.Data.Entity; using System.IO; using System.Linq; using System.Runtime.Remoting.Contexts; using System.Web; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using JGDJWeb.Helper; using JGDJWeb.Model; namespace JGDJWeb.Extensions {     public class PageBase : System.Web.UI.Page {         protected PageBase() {         }         protected void InitPage() {             if (!IsPostBack) {                 BindModule(this, (a, b) => { BindSingleModules(this, b, a); });             }         }         protected void BindSingleModules(Page page, string suffix, Repeater a) {             using (var context = new JGDJEntities()) {                 switch (suffix) {                     case "jgxx": //机关快讯                         BindSingleModuleFromNewsClass(new BindSingleModuleFromNewsClassParams(page, suffix, "机关讯息", context, a, 8, () => { }));                         break;                     case "tpxw": //机关快讯                         BindSingleModuleFromNewsClass(new BindSingleModuleFromNewsClassParams(page, suffix, "图片新闻", context, a, 8, () => { }));                         break;                     case "gwdt": //工委动态                         BindSingleModuleFromNewsClass(new BindSingleModuleFromNewsClassParams(page, suffix, "工委动态", context, a, 8, () => { }));                         break;                     case "topywa": //要闻                         BindSingleModuleFromNewsClass(new BindSingleModuleFromNewsClassParams(page, suffix, "要闻", context, a, 2, () => { }));                         break;                     case "topywb": //要闻                         BindSingleModuleFromNewsClass(new BindSingleModuleFromNewsClassParams(page, suffix, "工委动态", context, a, 3, () => { }));                         break;                     case "gsgg": //公示公告                         BindGsggList(context, a);                         break;                     case "gbrm": //干部任免                         BindSingleModuleFromNewsClass(new BindSingleModuleFromNewsClassParams(page, suffix, "干部任免", context, a, 8, () => { }));                         break;                     case "djbd": //党建宝典                         BindSingleModuleFromNewsClass(new BindSingleModuleFromNewsClassParams(page, suffix, "党建宝典", context, a, 4, () => { }));                         break;                     case "rdjj": //热点聚焦                         BindSingleModuleFromNewsClass(new BindSingleModuleFromNewsClassParams(page, suffix, "机关讯息", context, a, 7, () => { }));                         break;                     case "dyyzh": //党员驿站                         BindSingleModuleFromNewsClass(new BindSingleModuleFromNewsClassParams(page, suffix, "党员驿站", context, a, 4, () => { }));                         break;                     case "qtfc": //群团风采                         BindSingleModuleFromNewsClass(new BindSingleModuleFromNewsClassParams(page, suffix, "群团风采", context, a, 4, () => { }));                         break;                     case "dflzh": //党风廉政                         BindSingleModuleFromNewsClass(new BindSingleModuleFromNewsClassParams(page, suffix, "工委动态", context, a, 6, () => { }));                         break;                     case "sxdzzhjsh": //三党组织建设                         BindSingleModuleFromNewsClass(new BindSingleModuleFromNewsClassParams(page, suffix, "工委动态", context, a, 6, () => { }));                         break;                     case "pic": //焦点图幻灯                         BindPics(context, a, 3);                         break;                     default:                         break;                 }             }         }         

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-12
  • 2021-11-19
  • 2021-08-01
  • 2021-07-05
  • 2021-07-24
猜你喜欢
  • 2021-10-31
  • 2021-09-25
  • 2022-12-23
  • 2022-12-23
  • 2022-02-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案