博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
自己使用的一个.NET轻量开发结构
阅读量:6077 次
发布时间:2019-06-20

本文共 25120 字,大约阅读时间需要 83 分钟。

三个文件夹,第一个是放置前端部分,第二个是各种支持的类文件,第三个是单元测试文件。

 

Core文件类库

放置的是与数据库做交互的文件,以及一些第三方类库,还有与数据库连接的文件

1.Lasy.Validator是一个基于Attribute验证器,我觉得这种验证方式在挺便捷的,具体可以在这里查看到2.ToJson是一个将数据转换成json格式的字符串的一个类库,很便捷3.NPinyin是一个将中文转换成拼音的一个类别

app.config是一个连接数据库的配置文件,两个数据库一个是测试用的,一个是调试用的

点击core文件夹进入数据库操作

1.DataAccess

DataAccess中主要就是一些数据库的增删改查操作了

Connection.cs是连接数据的文件,主要根据前端文件夹下面的bin文件中的XML文件来操作是连接哪个数据库,用XML就可以很方便的不重新编译直接换数据库

Production
1 using System; 2 using System.Web; 3 using System.Xml; 4 using QuyouCore.Core.Domain; 5 using QuyouCore.Properties; 6  7 namespace QuyouCore.Core.DataAccess.Impl 8 { 9     public class Connection10     {11         public Connection()12         {13             ConnString = GetCurrentConnectionString();14         }15         public ClubDataContext GetClubContext()16         {17             var vcd = new ClubDataContext(ConnString);18             //vcd.Log = new DebuggerWriter();19             return vcd;20         }21         public string GetCurrentConnectionString()22         {23             var connString = string.Empty;24             try25             {26                 var doc = new XmlDocument();27                 doc.Load(HttpContext.Current.Request.PhysicalApplicationPath + "bin/ConnectionStringToUse.xml");28                 var xnl = doc.GetElementsByTagName("environment");29                 var xe = (XmlElement)xnl[0];30                 switch (xe.InnerText.ToLower())31                 {32                     case "local":33                         connString = Settings.Default.ClubConnectionString;34                         break;35                     case "production":36                         connString = Settings.Default.ClubServerConnectionString;37                         break;38                     case "test":39                         connString = Settings.Default.ClubTestConnectionString;40                         break;41                 }42             }43             catch (Exception e)44             {45                 connString = Settings.Default.ClubTestConnectionString;46             }47             return connString;48         }49 50         public string ConnString51         {52             get;53             set;54         }55     }56 }

BaseRepository.cs文件是做一些通用的Linq查询语句,还有就是写Log操作,将各个查询语句记录下来,便于调试,这里用到的Log工具是log4net

using System.Collections.Generic;using System.Data.Linq;using System.Linq;using QuyouCore.Core.Domain;using QuyouCore.Core.Enum;using QuyouCore.Core.Util;using System;using System.Linq.Expressions;namespace QuyouCore.Core.DataAccess.Impl{    public class BaseRepository    {        protected BaseRepository()        {            Conn = new Connection();            DataContext = new RepositoryContext(Conn.ConnString);        }        #region Properties        ///         /// Gets or sets the data context.        ///         /// 
The data context.
private RepositoryContext DataContext { get; set; } protected Connection Conn { get; set; } #endregion #region Entity and metadata functions /// /// 分页 /// protected DataPageList
GetEntitiesByPage
(IQueryable query, int page, int size, DataContext context) { context.Log = FileLog.Out; var data = DataPageList
.Create
(query, page, size); WriteLog(FileLog.FileInfo.ToString()); return data; } ///
/// 根据条件获取一条数据 /// protected TEntity GetEntity
(Expression
> queryFunc) where TEntity : class //Entity { DataContext.Log = FileLog.Out; var results = from entity in DataContext.GetTable
() select entity; results = results.Where(queryFunc); var result = results.FirstOrDefault(); WriteLog(FileLog.FileInfo.ToString()); return result; } ///
/// 根据条件获取数据信息列 /// protected List
GetEntities
(Expression
> queryFunc) where TEntity : class //Entity { DataContext.Log = FileLog.Out; var query = from entity in DataContext.GetTable
() select entity; query = query.Where(queryFunc); var results = query.ToList(); WriteLog(FileLog.FileInfo.ToString()); return results; } protected List
GetEntities
(IQueryable
query) where TEntity : class //Entity { DataContext.Log = FileLog.Out; var results = query.ToList(); WriteLog(FileLog.FileInfo.ToString()); return results; } protected IQueryable
GetQueryEntities
(Expression
> queryFunc) where TEntity : class //Entity { var query = from entity in DataContext.GetTable
() select entity; return query.Where(queryFunc); } ///
/// 获取所有数据 /// protected List
GetEntities
() where TEntity : class //Entity { DataContext.Log = FileLog.Out; var query = from entity in DataContext.GetTable
() select entity; var results = query.ToList(); WriteLog(FileLog.FileInfo.ToString()); return results; } #endregion protected void WriteLog(string log) { WriteLog(log, EnumLog.Level.Info); } protected void WriteLog(string log, EnumLog.Level level) { switch (level) { case EnumLog.Level.Debug: LogHelper.GetInstance().Debug(log); break; case EnumLog.Level.Error: LogHelper.GetInstance().Error(log); break; case EnumLog.Level.Warn: LogHelper.GetInstance().Warn(log); break; case EnumLog.Level.Fatal: LogHelper.GetInstance().Fatal(log); break; case EnumLog.Level.Info: LogHelper.GetInstance().Info(log); break; default: LogHelper.GetInstance().Info(log); break; } //LogHelper.GetInstance().Logger.Repository.Shutdown(); } }}

下面的代码是一些简单的增删改查,但是一些比较难的SQL语句,有时候比较棘手,你可以使用一个翻译工具,将SQL转换成,叫做Linqer,使用操作也很简单,操作界面如图。

using System.Collections.Generic;using System.Linq;using QuyouCore.Core.Domain;namespace QuyouCore.Core.DataAccess.Impl{    public class KeywordRepository : BaseRepository, IKeywordRepository    {        public int Insert(tb_Keyword data)        {            using (var cd = Conn.GetClubContext())            {                cd.tb_Keyword.InsertOnSubmit(data);                cd.SubmitChanges();                return data.KeywordTypeId;            }        }        ///         /// 根据主键更新表内容        ///         public void Update(tb_Keyword data)        {            using (var cd = Conn.GetClubContext())            {                var update = cd.tb_Keyword.Single(t => t.KeywordId == data.KeywordId);                update.KeywordTypeId = data.KeywordTypeId;                update.Name = data.Name;                update.Pinyin = data.Pinyin;                cd.SubmitChanges();            }        }        ///         /// 根据编号将信息更新为删除状态        ///         public void Delete(int id)        {            using (var cd = Conn.GetClubContext())            {                var update = cd.tb_Keyword.Single(t => t.KeywordId == id);                update.Active = false;                cd.SubmitChanges();            }        }        public List
GetKeywordsByTypeId(tb_Keyword data) { return GetEntities
( t => t.Active == data.Active && t.KeywordTypeId == data.KeywordTypeId ); } }}

 

2.Domain

Domain文件里面的Club.dml内容是自动生成的

在这里面还放了一些,数据库表格的扩展字段以及一个分页类DataPageList.cs

namespace QuyouCore.Core.Domain{    public partial class tb_Keyword    {        //public static readonly string TableName = "tb_Keyword";        //public static readonly string ColumnKeywordId = "KeywordId";        //public static readonly string ColumnKeywordTypeId = "KeywordTypeId";        //public static readonly string ColumnName = "Name";        //public static readonly string ColumnAddTime = "AddTime";    }}
1 using System.Collections;  2 using System.Collections.Generic;  3 using System.Linq;  4   5 namespace QuyouCore.Core.Domain  6 {  7     ///   8     /// 数据列表  9     ///  10     /// 
类型
11 public class DataPageList
: IEnumerable 12 { 13 #region 成员变量 14 15 private System.Linq.IQueryable
query; 16 private int allRecordCount; 17 private int thisPageRecordCount; 18 private int pageSize; 19 private int pageCount; 20 private int indexPage; 21 private bool canFirstPage; 22 private bool canPrevPage; 23 private bool canNextPage; 24 private bool canLastpage; 25 private List
listValue; 26 27 #endregion 28 29 30 #region 构造函数 31 32 //私有构造函数,只能通过内部构造 33 private DataPageList(System.Linq.IQueryable
Query, int IndexPage, int PageSize) 34 { 35 query = Query; 36 indexPage = IndexPage; 37 pageSize = PageSize; 38 PageAttrList = new List
(); 39 Update(); 40 } 41 42 private DataPageList(System.Linq.IQueryable
Query) 43 : this(Query, 1, 0) 44 { 45 } 46 47 #endregion 48 49 50 #region 属性 51 52 public int AllRecordCount 53 { 54 get { return allRecordCount; } 55 } 56 57 public int ThisPageRecordCount 58 { 59 get { return thisPageRecordCount; } 60 } 61 62 public int PageSize 63 { 64 get { return pageSize; } 65 set { pageSize = value; } 66 } 67 68 public int PageCount 69 { 70 get { return pageCount; } 71 } 72 73 public int IndexPage 74 { 75 get { return indexPage; } 76 set { indexPage = value; } 77 } 78 79 public bool CanFirstPage 80 { 81 get { return canFirstPage; } 82 } 83 84 public bool CanPrevPage 85 { 86 get { return canPrevPage; } 87 } 88 89 public bool CanNextPage 90 { 91 get { return canNextPage; } 92 } 93 94 public bool CanLastPage 95 { 96 get { return canLastpage; } 97 } 98 99 public List
Value100 {101 get { return listValue; }102 }103 104 public class PageAttr105 {106 public int Page { get; set; }107 }108 109 public List
PageAttrList110 {111 get; set;112 }113 #endregion114 115 #region 索引器116 117 public T this[int index]118 {119 get { return listValue[index]; }120 set { listValue[index] = value; }121 }122 123 #endregion124 125 #region 公开方法126 127 /**/128 129 ///
130 /// 创建自身实例131 /// 132 ///
类型,如果此处为匿名类型,请用var 定义实体,且类后的T为object(其实什么也不重要,只是用于可以调用当前类的静态方法)
133 ///
Linq查询语句134 ///
元素类型135 ///
开始页136 ///
每页大小137 ///
138 public static DataPageList
Create
(System.Linq.IQueryable Query, int IndexPage, int PageSize)139 {140 System.Linq.IQueryable
query = (System.Linq.IQueryable
) Query;141 return new DataPageList
(query, IndexPage, PageSize);142 }143 144 //public static DataPageList
Create
(System.Linq.IQueryable Query, int IndexPage, int PageSize)145 //{146 // return Create
(Query, IndexPage, PageSize);147 //}148 149 /**/150 151 ///
152 /// 更新数据153 /// 154 public virtual void Update()155 {156 allRecordCount = query.Count();157 PageAttrList.Clear();158 if (pageSize > 0)159 {160 query = query.Skip((indexPage - 1) * pageSize).Take(pageSize);161 thisPageRecordCount = query.Count();162 //计算分页结果163 pageCount = (allRecordCount%pageSize == 0) ? (allRecordCount/pageSize) : allRecordCount/pageSize + 1;164 if (indexPage > 1) canFirstPage = true;165 canPrevPage = true;166 if (indexPage < pageCount) canNextPage = true;167 canLastpage = true;168 }169 else170 {171 thisPageRecordCount = allRecordCount;172 pageCount = indexPage = 1;173 canFirstPage = canPrevPage = canNextPage = canLastpage = false;174 }175 for (var cur = 1; cur <= pageCount; cur++)176 {177 PageAttrList.Add(new PageAttr {Page = cur});178 }179 listValue = query.ToList();180 }181 182 /**/183 184 ///
185 /// 实现枚举接口,不过返回的是object186 /// 187 ///
188 public IEnumerator GetEnumerator()189 {190 return listValue.GetEnumerator();191 }192 193 #endregion194 }195 }

 

3.Entity

这里面打算放的是一些额外的数据字段,例如一些方法的参数集合、公共的JSON返回格式等

Prompt.cs就是返回JSON格式的

1 using System.Collections.Generic; 2 using LitJson; 3 namespace QuyouCore.Core.Entity 4 { 5     public class Prompt 6     { 7         public int Number 8         { 9             get; set;10         }11 12         public string Msg13         {14             get;15             set;16         }17 18         public static string ToJson(int number, string msg)19         {20             var prompt = new Prompt {Number = number, Msg = msg};21             return JsonMapper.ToJson(prompt);22         }23 24         public static string ToJson
(int number, string msg, List
data)25 {26 var prompt = new PromptTemplate
{ Number = number, Msg = msg, DataList = data };27 return JsonMapper.ToJson(prompt);28 }29 }30 }

 

4.Enum

这里放的是一些数据字典

namespace QuyouCore.Core.Enum{    public class EnumLog    {        public enum Level        {            Fatal = 1,            Error = 2,            Warn = 3,            Debug = 4,            Info = 5        }    }}

 

5.Service

这里面放了一些业务逻辑,比如根据条件查询等,因为打算在API、Web、Wap上面共用代码,所以就想把一些通用的逻辑整合在一起,这里用到了一种单例模式,使用的工具是StructureMap

1 using System.Collections.Generic; 2 using Lasy.Validator; 3 using QuyouCore.Core.Entity; 4 using QuyouCore.Core.Enum; 5 using StructureMap; 6  7 namespace QuyouCore.Core.Service.Impl 8 { 9     public abstract class BaseService10     {11         protected abstract IContainer ConfigureDependencies();//单例配置化12         13         protected string PromptToJson(int prompt)14         {15             return Prompt.ToJson(prompt, EnumCommon.GetPrompt()[prompt]);16         }17 18         protected string PromptToJson
(int prompt, List
dataList)19 {20 return Prompt.ToJson(prompt, EnumCommon.GetPrompt()[prompt], dataList);21 }22 23 ///
24 /// 用Attribute做字段验证25 /// 26 ///
27 ///
28 ///
29 protected string ValidateParameters
(Dictionary
dict)30 {31 var validator = new Validator(typeof(T));32 if (!validator.Validate(dict).BoolResult)33 {34 return validator.Validate(dict).ErrorStringWithoutFormat;35 }36 return string.Empty;37 }38 }39 }
1 using System.Collections.Generic; 2 using QuyouCore.Core.DataAccess; 3 using QuyouCore.Core.DataAccess.Impl; 4 using QuyouCore.Core.Domain; 5 using StructureMap; 6 using QuyouCore.Core.Util; 7 namespace QuyouCore.Core.Service.Impl 8 { 9     public class KeywordService : BaseService, IKeywordService10     {11         protected override IContainer ConfigureDependencies()12         {13             return new Container(x =>14             {15                 x.For
().Use
();16 x.For
().Use
();17 });18 }19 private IKeywordTypeRepository InitKeywordTypeRepository()20 {21 var container = ConfigureDependencies();22 return container.GetInstance
();23 }24 private IKeywordRepository InitKeywordRepository()25 {26 var container = ConfigureDependencies();27 return container.GetInstance
();28 }29 30 public string Insert(tb_Keyword data)31 {32 var keywordRepository = InitKeywordRepository();33 var result = keywordRepository.Insert(data);34 return PromptToJson(result > 0 ? Const.PromptSuccess : Const.PromptFailure);35 }36 37 public string Update(tb_Keyword data)38 {39 var keywordRepository = InitKeywordRepository();40 keywordRepository.Update(data);41 return PromptToJson(Const.PromptSuccess);42 }43 44 public string Delete(int id)45 {46 var keywordRepository = InitKeywordRepository();47 keywordRepository.Delete(id);48 return PromptToJson(Const.PromptSuccess);49 }50 51 public string GetSelectedKeywords(tb_KeywordType data)52 {53 var typeRepository = InitKeywordTypeRepository();54 var keywordRepository = InitKeywordRepository();55 56 data.Active = true;57 data.ParentTypeId = 0;58 //根据线路类型 版块 类别查询出关键字类别59 var allTypes = new List
(); //一级 二级的关键字类别 现在只分到二级 TODO60 var types = typeRepository.GetSelectedTypesByParentId(data);61 foreach (var tbKeywordType in types)62 {63 allTypes.Add(tbKeywordType);64 data.ParentTypeId = tbKeywordType.KeywordTypeId;65 var children = typeRepository.GetSelectedTypesByParentId(data);66 if (children.Count <= 0) continue;67 allTypes.AddRange(children);68 }69 70 //查询关键字内容71 //var allKeywords = new List
();72 var allKeywords = new List
();73 var condition = new tb_Keyword {Active = true};74 foreach (var tbKeywordType in allTypes)75 {76 //allKeywords.Add(new tb_Keyword77 //{78 // KeywordTypeName = tbKeywordType.Name,79 // IsKeywordType = true,80 // Pinyin = string.Empty,81 // Name = string.Empty82 //});83 condition.KeywordTypeId = tbKeywordType.KeywordTypeId;84 var keywords = keywordRepository.GetKeywordsByTypeId(condition);85 if (keywords.Count <= 0)86 {87 allKeywords.Add(tbKeywordType);88 continue;89 }90 tbKeywordType.Keywords = keywords;91 allKeywords.Add(tbKeywordType);92 }93 return PromptToJson(Const.PromptSuccess, allKeywords);94 }95 }96 }

 

6.Util

主要放些小工具类,比如Log写工具、cookie操作、图片压缩类等

 

Tests文件类库

健壮的代码是需要有单元测试来做保障的,所以单元测试必不可少。用到的工具是NUnit,测试的点可以发挥大家的想象力。怎么测都行。

 

1 using System; 2 using NUnit.Framework; 3 using QuyouCore.Core.DataAccess; 4 using QuyouCore.Core.DataAccess.Impl; 5 using QuyouCore.Core.Domain; 6 using StructureMap; 7  8 namespace QuyouTests.core.DataAccess 9 {10     [TestFixture]11     public class KeywordRepositoryTest12     {13         private IKeywordRepository _keywordModel;14 15         [TestFixtureSetUp]16         public void Init()17         {18             var container = new Container(x => x.For
().Use
());19 _keywordModel = container.GetInstance
();20 }21 22 [Test]23 public void TestInsert()24 {25 var data = new tb_Keyword26 {27 KeywordTypeId = 1,28 Name = "塔里木",29 AddTime = DateTime.Now,30 Pinyin = "talimu",31 Active = true32 };33 var result = _keywordModel.Insert(data);34 Assert.Greater(result, 0);35 }36 37 [Test]38 public void TestUpdate()39 {40 var data = new tb_Keyword41 {42 KeywordId = 1,43 KeywordTypeId = 2,44 Name = "莫干山",45 Pinyin = "moganshan"46 };47 _keywordModel.Update(data);48 }49 50 [Test]51 public void TestDelete()52 {53 _keywordModel.Delete(1);54 }55 }56 }

 

Quyou文件夹

这里就是与页面操作的代码,脚本、CSS等都在里面

Presenter文件夹里面的类是用于操作界面逻辑,以及过滤传过来的数据

1 using System;  2 using NPinyin;  3 using Quyou.admin.Interface;  4 using QuyouCore.Core.Domain;  5 using QuyouCore.Core.Entity;  6 using QuyouCore.Core.Service;  7 using QuyouCore.Core.Service.Impl;  8 using QuyouCore.Core.Util;  9 using StructureMap; 10 using System.Collections.Generic; 11  12 namespace Quyou.admin.Presenter 13 { 14     public class KeywordAjaxPresenter : BasePresenter, IKeywordAjaxPresenter 15     { 16         protected override IContainer ConfigureDependencies() 17         { 18             return new Container(x => 19             { 20                 x.For
().Use
(); 21 x.For
().Use
(); 22 }); 23 } 24 25 private IKeywordTypeService InitKeywordTypeService() 26 { 27 var container = ConfigureDependencies(); 28 return container.GetInstance
(); 29 } 30 31 private IKeywordService InitKeywordService() 32 { 33 var container = ConfigureDependencies(); 34 return container.GetInstance
(); 35 } 36 37 private string ValidInsertOrUpdate(KeywordTypetData input) 38 { 39 input.PlayClass = FilterParamters(input.PlayClass); 40 input.PlayModel = FilterParamters(input.PlayModel); 41 input.PlayType = FilterParamters(input.PlayType); 42 input.Name = FilterParamters(input.Name); 43 input.Sort = FilterParamters(input.Sort); 44 input.ParentTypeId = FilterParamters(input.ParentTypeId); 45 var dict = new Dictionary
46 { 47 { "PlayClass", input.PlayClass}, 48 { "PlayModel", input.PlayModel}, 49 { "PlayType", input.PlayType}, 50 { "Name", input.Name}, 51 { "Sort", input.Sort}, 52 { "ParentTypeId", input.ParentTypeId} 53 }; 54 if (!string.IsNullOrEmpty(input.KeywordTypeId)) 55 { 56 input.KeywordTypeId = FilterParamters(input.KeywordTypeId); 57 dict.Add("KeywordTypeId", input.KeywordTypeId); 58 } 59 return ValidateParameters
(dict); 60 } 61 public string InsertKeywordType(KeywordTypetData input) 62 { 63 var valid = ValidInsertOrUpdate(input); 64 if (valid.Length > 0) 65 return valid; 66 67 var keywordType = new tb_KeywordType 68 { 69 PlayClass = int.Parse(input.PlayClass), 70 PlayModel = int.Parse(input.PlayModel), 71 PlayType = int.Parse(input.PlayType), 72 Name = input.Name, 73 AddTime = DateTime.Now, 74 Sort = int.Parse(input.Sort), 75 ParentTypeId = int.Parse(input.ParentTypeId), 76 Active = true 77 }; 78 79 var keywordTypeService = InitKeywordTypeService(); 80 return keywordTypeService.Insert(keywordType); 81 } 82 83 ///
84 /// 修改关键字类别 85 /// 86 ///
87 ///
88 public string EditKeywordType(KeywordTypetData input) 89 { 90 var valid = ValidInsertOrUpdate(input); 91 if (valid.Length > 0) 92 return valid; 93 94 var keywordType = new tb_KeywordType 95 { 96 KeywordTypeId = int.Parse(input.KeywordTypeId), 97 PlayClass = int.Parse(input.PlayClass), 98 PlayModel = int.Parse(input.PlayModel), 99 PlayType = int.Parse(input.PlayType),100 Name = input.Name,101 Sort = int.Parse(input.Sort),102 ParentTypeId = int.Parse(input.ParentTypeId)103 };104 105 var keywordTypeService = InitKeywordTypeService();106 return keywordTypeService.Update(keywordType);107 }108 109 ///
110 /// 删除关键字类别111 /// 112 ///
113 ///
114 public string DelKeywordType(KeywordTypetData input)115 {116 input.KeywordTypeId = FilterParamters(input.KeywordTypeId);117 var dict = new Dictionary
118 {119 { "KeywordTypeId", input.KeywordTypeId}120 };121 var valid = ValidateParameters
(dict);122 if (valid.Length > 0)123 return valid;124 var keywordTypeService = InitKeywordTypeService();125 return keywordTypeService.Delete(int.Parse(input.KeywordTypeId));126 }127 128 ///
129 /// 添加关键字130 /// 131 ///
132 ///
133 public string InsertKeyword(KeywordtData input)134 {135 input.KeywordTypeId = FilterParamters(input.KeywordTypeId);136 input.Name = FilterParamters(input.Name);137 138 var dict = new Dictionary
139 {140 { "KeywordTypeId", input.KeywordTypeId},141 { "Name", input.Name}142 };143 var valid = ValidateParameters
(dict);144 if (valid.Length > 0)145 return valid;146 147 var keyword = new tb_Keyword148 {149 KeywordTypeId = int.Parse(input.KeywordTypeId),150 Name = input.Name,151 AddTime = DateTime.Now,152 Pinyin = Pinyin.GetPinyin(input.Name),153 Active = true154 };155 156 var keywordService = InitKeywordService();157 return keywordService.Insert(keyword);158 }159 160 ///
161 /// 修改关键字162 /// 163 ///
164 ///
165 public string EditKeyword(KeywordtData input)166 {167 input.KeywordId = FilterParamters(input.KeywordId);168 input.KeywordTypeId = FilterParamters(input.KeywordTypeId);169 input.Name = FilterParamters(input.Name);170 171 var dict = new Dictionary
172 {173 { "KeywordTypeId", input.KeywordTypeId},174 { "Name", input.Name},175 { "KeywordId", input.KeywordId}176 };177 var valid = ValidateParameters
(dict);178 if (valid.Length > 0)179 return valid;180 181 var keyword = new tb_Keyword182 {183 KeywordId = int.Parse(input.KeywordId),184 KeywordTypeId = int.Parse(input.KeywordTypeId),185 Name = input.Name,186 Pinyin = Pinyin.GetPinyin(input.Name),187 };188 189 var keywordService = InitKeywordService();190 return keywordService.Update(keyword);191 }192 193 ///
194 /// 删除关键字195 /// 196 ///
197 ///
198 public string DelKeyword(KeywordtData input)199 {200 input.KeywordId = FilterParamters(input.KeywordId);201 var dict = new Dictionary
202 {203 { "KeywordId", input.KeywordId}204 };205 var valid = ValidateParameters
(dict);206 if (valid.Length > 0)207 return valid;208 var keywordService = InitKeywordService();209 return keywordService.Delete(int.Parse(input.KeywordId));210 }211 212 ///
213 /// 获取关键字列表214 /// 215 ///
216 ///
217 public string GetKeywords(KeywordTypetData input)218 {219 int playClass, playModel, playType;220 int.TryParse(input.PlayClass, out playClass);221 int.TryParse(input.PlayModel, out playModel);222 int.TryParse(input.PlayType, out playType);223 var keywordType = new tb_KeywordType224 {225 PlayClass = playClass,226 PlayModel = playModel,227 PlayType = playType228 };229 var keywordService = InitKeywordService();230 return keywordService.GetSelectedKeywords(keywordType);231 }232 233 ///
234 /// 显示错误信息的JSON提示235 /// 236 ///
237 public string ShowErrorJson()238 {239 return PromptToJson(Const.PromptFailure);240 }241 }242 }

 

 

 

Linqer下载:

结构可以在这里下载,代码都是不能运行的,主要就是展示下结构

转载地址:http://tlxgx.baihongyu.com/

你可能感兴趣的文章
astah-professional-7_2_0安装
查看>>
函数是对象-有属性有方法
查看>>
uva 10107 - What is the Median?
查看>>
Linux下基本栈溢出攻击【转】
查看>>
c# 连等算式都在做什么
查看>>
使用c:forEach 控制5个换行
查看>>
java web轻量级开发面试教程摘录,java web面试技巧汇总,如何准备Spring MVC方面的面试...
查看>>
使用ansible工具部署ceph
查看>>
linux系列博文---->深入理解linux启动运行原理(一)
查看>>
Android反编译(一) 之反编译JAVA源码
查看>>
结合当前公司发展情况,技术团队情况,设计一个适合的技术团队绩效考核机制...
查看>>
python-45: opener 的使用
查看>>
cad图纸转换完成的pdf格式模糊应该如何操作?
查看>>
Struts2与Struts1区别
查看>>
网站内容禁止复制解决办法
查看>>
Qt多线程
查看>>
我的友情链接
查看>>
想说一点东西。。。。
查看>>
css知多少(8)——float上篇
查看>>
NLB网路负载均衡管理器详解
查看>>