資源簡介
三層+MVC模式開發的asp.net項目,對user表進行增刪改查,user表為ID,Name,Title簡單三列,方便新手學習和實踐
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?Dapper;
using?System.Data;
using?Sem.Model.Entities;
namespace?Sem.DAL.Entities
{
????///?
????///?管理類
????///?此代碼由CsCreator?For?Dapper.Net?于2017/9/24?14:00:14自動生成
????///?
????public?partial?class?UserDal
????{
????????///?
????????///??添加新的St_User對象
????????///?此代碼由?CodeGen?For?Dapper.Net?于?2017/9/24?14:00:14?自動生成
????????///?
????????public?int?AddUser(User?theUser)
????????{
????????????string?sql?=?@“insert?into?St_User(?IDNametitle)
values(@ID@Name@title)“;
????????????using?(IDbConnection?conn?=?ConnectionFactory.getConnection())
????????????{
????????????????return?conn.Execute(sql?theUser);
????????????}
????????}
????????///?
????????///??查找User對象是否存在
????????///?此代碼由?CodeGen?For?Dapper.Net?于?2017/9/24?14:00:14?自動生成
????????///?
????????///?查詢參數,進行精確匹配查找
????????public?bool?IsExistUser(User?theUser)
????????{
????????????string?sql?=?“select?count(*)?from?St_User?where?ID=@ID?and?Name=@Name?and?title=@title“;
????????????using?(IDbConnection?conn?=?ConnectionFactory.getConnection())
????????????{
????????????????return?conn.ExecuteScalar(sql?theUser)?>?0???true?:?false;
????????????}
????????}
????????///?
????????///??刪除User對象
????????///?此代碼由?CodeGen?For?Dapper.Net?于?2017/9/24?14:00:14?自動生成
????????///?
????????///?查詢參數,進行精確匹配查找
????????public?int?DelUser(string?ID)
????????{
????????????string?sql?=?@“delete?from?St_User?where?ID=@ID“;
????????????using?(IDbConnection?conn?=?ConnectionFactory.getConnection())
????????????{
????????????????return?conn.Execute(sql?new?{?ID?});
????????????}
????????}
????????///?
????????///??更新St_User對象
????????///?
????????public?int?UpdateUser(User?theUser)
????????{
????????????string?sql?=?@“update?St_User?set?Name=@Name?title=@title?where?ID=@ID“;
????????????using?(IDbConnection?conn?=?ConnectionFactory.getConnection())
????????????{
????????????????return?conn.Execute(sql?theUser);
????????????}
????????}
????????///?
????????///??查找User對象
????????///?此代碼由?CodeGen?For?Dapper.Net?于?2017/9/24?14:00:14?自動生成
????????///?
????????///?查詢參數,進行精確匹配查找
????????public?User?GetUser(string?ID)
????????{
????????????string?sql?=?@“select?*?from?St_User?where?ID=@ID“;
????????????using?(IDbConnection?conn?=?ConnectionFactory.getConnection())
????????????{
????????????????return?conn.QuerySingleOrDefault(sql?new?{?ID?});
????????????}
????????}
????????public?User?GetUser()
????????{
????????????string?sql?=?@“select?top(1)*?from?St_User?order?by?ID?desc“;
????????????using?(IDbConnection?conn?=?ConnectionFactory.getConnection())
????????????{
????????????????return?conn.QuerySingleOrDefault(sql);
????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-09-24?13:55??SemWeb\
?????目錄???????????0??2017-09-24?13:46??SemWeb\packages\
?????目錄???????????0??2017-09-24?13:40??SemWeb\packages\Antlr.3.4.1.9004\
?????文件??????145532??2017-09-24?13:40??SemWeb\packages\Antlr.3.4.1.9004\Antlr.3.4.1.9004.nupkg
?????文件?????????894??2017-09-24?13:40??SemWeb\packages\Antlr.3.4.1.9004\Antlr.3.4.1.9004.nuspec
?????目錄???????????0??2017-09-24?13:40??SemWeb\packages\Antlr.3.4.1.9004\lib\
?????文件??????102912??2017-09-24?13:40??SemWeb\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll
?????文件??????431616??2017-09-24?13:40??SemWeb\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.pdb
?????目錄???????????0??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\
?????文件??????374152??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\bootstrap.3.3.7.nupkg
?????文件????????1101??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\bootstrap.3.3.7.nuspec
?????目錄???????????0??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\
?????目錄???????????0??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\
?????文件???????26132??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap-theme.css
?????文件???????47706??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap-theme.css.map
?????文件???????23409??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap-theme.min.css
?????文件???????25648??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap-theme.min.css.map
?????文件??????146010??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap.css
?????文件??????389287??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap.css.map
?????文件??????121200??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap.min.css
?????文件??????542194??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap.min.css.map
?????目錄???????????0??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\fonts\
?????文件???????20127??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\fonts\glyphicons-halflings-regular.eot
?????文件??????108738??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\fonts\glyphicons-halflings-regular.svg
?????文件???????45404??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\fonts\glyphicons-halflings-regular.ttf
?????文件???????23424??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\fonts\glyphicons-halflings-regular.woff
?????文件???????18028??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\fonts\glyphicons-halflings-regular.woff2
?????目錄???????????0??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\sc
?????文件???????69707??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\sc
?????文件???????37045??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\sc
?????目錄???????????0??2017-09-24?13:42??SemWeb\packages\Bootstrap.Less.3.3.7\
............此處省略823個文件信息
評論
共有 條評論