SlideShare a Scribd company logo
1 of 45
現在,在 OO 的程式語言框架下,不管是元件、模組 皆由 Class 所以
定義,所以均會使用到 OO 的好處。
會有的差別在於,元件(語言/平台(x64/x86)/OS)的不同、UI 元件、非 UI元件
private void Page_Load(System.Object sender, System.EventArgs e)
{
if (!IsPostBack)
{
RoleFunProperty role = null;
if (ViewState["RoleFunProperty"] == null)
{
RoleFunProperty rfP = new RoleFunProperty();
DataTable dtPermission = sqlDt(Sql);
DataRow dr = null;
foreach (DataRow dr_loopVariable in dtPermission.Rows)
{
dr = dr_loopVariable;
rfP.RF_FunQuery = (dr["RF_FunQuery"] == DBNull.Value ? false : bool.Parse(dr["RF_FunQuery"].ToString()));
rfP.RF_FunAdd = (dr["RF_FunAdd"] == DBNull.Value ? false : bool.Parse(dr["RF_FunAdd"].ToString()));
rfP.RF_FunUpdate = (dr["RF_FunUpdate"] == DBNull.Value ? false : bool.Parse(dr["RF_FunUpdate"].ToString()));
rfP.RF_FunDel = (dr["RF_FunDel"] == DBNull.Value ? false : bool.Parse(dr["RF_FunDel"].ToString()));
rfP.RF_FunPrint = (dr["RF_FunPrint"] == DBNull.Value ? false : bool.Parse(dr["RF_FunPrint"].ToString()));
}
}
else
rfP = (RoleFunProperty)ViewState["RoleFunProperty"];
if (!rfP.RF_FunAdd)
{
btnAdd.Enabled = false;
btnAdd.ToolTip = "目前使用者無新增權限";
}
}
}
protected RoleFunProperty GetFuncPermission()
{
string UR_RMRoleID = Session["UR_RMRoleID"].ToString();
string id = MenuID;
string Sql = "select * from RoleFun RF " + "where RF.RF_RMRoleId='" + UR_RMRoleID + "' " + "AND RF.RF_MCId=" + id;
if (id == null | string.IsNullOrEmpty(id))
{
return null;
}
RoleFunProperty rfP = new RoleFunProperty();
DataTable dtPermission = sqlDt(Sql);
DataRow dr = null;
foreach (DataRow dr_loopVariable in dtPermission.Rows)
{
dr = dr_loopVariable;
rfP.RF_FunQuery = (dr["RF_FunQuery"] == DBNull.Value ? false : bool.Parse(dr["RF_FunQuery"].ToString()));
rfP.RF_FunAdd = (dr["RF_FunAdd"] == DBNull.Value ? false : bool.Parse(dr["RF_FunAdd"].ToString())); rfP.RF_FunUpdate = (dr["RF_FunUpdate"
] == DBNull.Value ? false : bool.Parse(dr["RF_FunUpdate"].ToString()));
rfP.RF_FunDel = (dr["RF_FunDel"] == DBNull.Value ? false : bool.Parse(dr["RF_FunDel"].ToString()));
rfP.RF_FunPrint = (dr["RF_FunPrint"] == DBNull.Value ? false : bool.Parse(dr["RF_FunPrint"].ToString()));
}
return rfP;
}
protected bool GetAddButtonSecurity()
{
RoleFunProperty role = null;
if (ViewState["RoleFunProperty"] == null)
role = GetFuncPermission();
else
role = (RoleFunProperty)ViewState["RoleFunProperty"];
return role.RF_FunAdd;
}
protected RoleFunProperty GetAndKeepFuncPermission()
{
RoleFunProperty role = null;
if (ViewState["RoleFunProperty"] == null)
role = GetFuncPermission();
else
role = (RoleFunProperty)ViewState["RoleFunProperty"];
return role;
}
/// <summary>
/// 取得新增按鈕權限
/// </summary>
/// <returns></returns>
protected bool GetAddButtonSecurity()
{
RoleFunProperty role = GetAndKeepFuncPermission();
return role.RF_FunAdd;
}
/// <summary>
/// 取得修改按鈕權限
/// </summary>
/// <returns></returns>
protected bool GetUpdateButtonSecurity()
{
RoleFunProperty role = GetAndKeepFuncPermission();
return role.RF_FunUpdate;
}
/// <summary>
/// 取得刪除按鈕權限
/// </summary>
/// <returns></returns>
protected bool GetDelButtonSecurity()
{
RoleFunProperty role = GetAndKeepFuncPermission();
return role.RF_FunDel;
}
程式碼不僅較為乾淨
也更具彈性,擴充性、可維護性
也都提高
這裡只有欄位
View
View
• Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC
Application (9 of 10)
http://www.asp.net/mvc/overview/older-versions/getting-started-with-ef-5-using-mvc-
4/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application
http://openhome.cc/Gossip/DesignPattern/
• Learn About ASP.NET MVC
http://www.asp.net/mvc
• Visual Studio UML 軟體工程 (OOA/OOD 塑模化應用程式設計)
http://gelis-dotnet.blogspot.tw/2011/03/visual-studio-2010.html
• Gelis 技術隨筆-架構設計系列
http://www.dotblogs.com.tw/gelis/Tags/%e8%bb%9f%e9%ab%94%e6%9e%b6%e6%a7%8b
%e8%a8%ad%e8%a8%88/default.aspx
如何將現有 Web form 轉換到mvc

More Related Content

What's hot

FHIR API for Java programmers by James Agnew
FHIR API for Java programmers by James AgnewFHIR API for Java programmers by James Agnew
FHIR API for Java programmers by James AgnewFHIR Developer Days
 
Connexion jdbc
Connexion jdbcConnexion jdbc
Connexion jdbcInes Ouaz
 
ソーシャルゲームスケールアウトの歴史
ソーシャルゲームスケールアウトの歴史ソーシャルゲームスケールアウトの歴史
ソーシャルゲームスケールアウトの歴史Drecom Co., Ltd.
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
 
중소병원 서비스 디자인 가이드라인
중소병원 서비스 디자인 가이드라인중소병원 서비스 디자인 가이드라인
중소병원 서비스 디자인 가이드라인USABLE 윤
 
[JWAP-2] DI & Spring
[JWAP-2] DI & Spring[JWAP-2] DI & Spring
[JWAP-2] DI & SpringYoung-Ho Cho
 

What's hot (6)

FHIR API for Java programmers by James Agnew
FHIR API for Java programmers by James AgnewFHIR API for Java programmers by James Agnew
FHIR API for Java programmers by James Agnew
 
Connexion jdbc
Connexion jdbcConnexion jdbc
Connexion jdbc
 
ソーシャルゲームスケールアウトの歴史
ソーシャルゲームスケールアウトの歴史ソーシャルゲームスケールアウトの歴史
ソーシャルゲームスケールアウトの歴史
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
중소병원 서비스 디자인 가이드라인
중소병원 서비스 디자인 가이드라인중소병원 서비스 디자인 가이드라인
중소병원 서비스 디자인 가이드라인
 
[JWAP-2] DI & Spring
[JWAP-2] DI & Spring[JWAP-2] DI & Spring
[JWAP-2] DI & Spring
 

Viewers also liked

2016 ModernWeb 分享 - 恰如其分 MySQL 程式設計 (修)
2016 ModernWeb 分享 - 恰如其分 MySQL 程式設計 (修)2016 ModernWeb 分享 - 恰如其分 MySQL 程式設計 (修)
2016 ModernWeb 分享 - 恰如其分 MySQL 程式設計 (修)Win Yu
 
ASP.NET MVC 5 新功能探索
ASP.NET MVC 5 新功能探索ASP.NET MVC 5 新功能探索
ASP.NET MVC 5 新功能探索Will Huang
 
Learning django step 1
Learning django step 1Learning django step 1
Learning django step 1永昇 陳
 
保哥線上講堂:LINQ 快速上手
保哥線上講堂:LINQ 快速上手保哥線上講堂:LINQ 快速上手
保哥線上講堂:LINQ 快速上手Will Huang
 
恰如其分的 MySQL 設計技巧 [Modern Web 2016]
恰如其分的 MySQL 設計技巧 [Modern Web 2016]恰如其分的 MySQL 設計技巧 [Modern Web 2016]
恰如其分的 MySQL 設計技巧 [Modern Web 2016]Yi-Feng Tzeng
 
大型 Web Application 轉移到 微服務的經驗分享
大型 Web Application 轉移到微服務的經驗分享大型 Web Application 轉移到微服務的經驗分享
大型 Web Application 轉移到 微服務的經驗分享Andrew Wu
 
MySQL数据库设计、优化
MySQL数据库设计、优化MySQL数据库设计、优化
MySQL数据库设计、优化Jinrong Ye
 
MySQL技术分享:一步到位实现mysql优化
MySQL技术分享:一步到位实现mysql优化MySQL技术分享:一步到位实现mysql优化
MySQL技术分享:一步到位实现mysql优化Jinrong Ye
 
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練1(20160222)
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練1(20160222)2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練1(20160222)
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練1(20160222)Duran Hsieh
 
無瑕的程式碼 Clean Code 心得分享
無瑕的程式碼 Clean Code 心得分享無瑕的程式碼 Clean Code 心得分享
無瑕的程式碼 Clean Code 心得分享Win Yu
 
團隊開發永遠的痛 談導入團隊開發的共同規範(Final)
團隊開發永遠的痛   談導入團隊開發的共同規範(Final)團隊開發永遠的痛   談導入團隊開發的共同規範(Final)
團隊開發永遠的痛 談導入團隊開發的共同規範(Final)Gelis Wu
 
活用 Application insight
活用 Application insight活用 Application insight
活用 Application insightGelis Wu
 
Css java script 前端網頁設計概論(day2).pics
Css java script 前端網頁設計概論(day2).picsCss java script 前端網頁設計概論(day2).pics
Css java script 前端網頁設計概論(day2).picsGelis Wu
 
企業現代化網站架構
企業現代化網站架構企業現代化網站架構
企業現代化網站架構Gelis Wu
 
面向未来的重构
面向未来的重构面向未来的重构
面向未来的重构Kejun Zhang
 
一拍一产品背后的故事(React实战)
一拍一产品背后的故事(React实战)一拍一产品背后的故事(React实战)
一拍一产品背后的故事(React实战)Kejun Zhang
 
高粒度模块化的前端开发
高粒度模块化的前端开发高粒度模块化的前端开发
高粒度模块化的前端开发iddcn
 
Ued交流会 《用户体验杂谈》
Ued交流会 《用户体验杂谈》Ued交流会 《用户体验杂谈》
Ued交流会 《用户体验杂谈》iddcn
 
N-layer design & development
N-layer design & developmentN-layer design & development
N-layer design & developmentXuefeng Zhang
 

Viewers also liked (20)

2016 ModernWeb 分享 - 恰如其分 MySQL 程式設計 (修)
2016 ModernWeb 分享 - 恰如其分 MySQL 程式設計 (修)2016 ModernWeb 分享 - 恰如其分 MySQL 程式設計 (修)
2016 ModernWeb 分享 - 恰如其分 MySQL 程式設計 (修)
 
ASP.NET MVC 5 新功能探索
ASP.NET MVC 5 新功能探索ASP.NET MVC 5 新功能探索
ASP.NET MVC 5 新功能探索
 
Learning django step 1
Learning django step 1Learning django step 1
Learning django step 1
 
保哥線上講堂:LINQ 快速上手
保哥線上講堂:LINQ 快速上手保哥線上講堂:LINQ 快速上手
保哥線上講堂:LINQ 快速上手
 
恰如其分的 MySQL 設計技巧 [Modern Web 2016]
恰如其分的 MySQL 設計技巧 [Modern Web 2016]恰如其分的 MySQL 設計技巧 [Modern Web 2016]
恰如其分的 MySQL 設計技巧 [Modern Web 2016]
 
大型 Web Application 轉移到 微服務的經驗分享
大型 Web Application 轉移到微服務的經驗分享大型 Web Application 轉移到微服務的經驗分享
大型 Web Application 轉移到 微服務的經驗分享
 
MySQL数据库设计、优化
MySQL数据库设计、优化MySQL数据库设计、优化
MySQL数据库设计、优化
 
MySQL技术分享:一步到位实现mysql优化
MySQL技术分享:一步到位实现mysql优化MySQL技术分享:一步到位实现mysql优化
MySQL技术分享:一步到位实现mysql优化
 
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練1(20160222)
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練1(20160222)2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練1(20160222)
2016年逢甲大學資訊系:ASP.NET MVC 4 教育訓練1(20160222)
 
無瑕的程式碼 Clean Code 心得分享
無瑕的程式碼 Clean Code 心得分享無瑕的程式碼 Clean Code 心得分享
無瑕的程式碼 Clean Code 心得分享
 
團隊開發永遠的痛 談導入團隊開發的共同規範(Final)
團隊開發永遠的痛   談導入團隊開發的共同規範(Final)團隊開發永遠的痛   談導入團隊開發的共同規範(Final)
團隊開發永遠的痛 談導入團隊開發的共同規範(Final)
 
活用 Application insight
活用 Application insight活用 Application insight
活用 Application insight
 
Css java script 前端網頁設計概論(day2).pics
Css java script 前端網頁設計概論(day2).picsCss java script 前端網頁設計概論(day2).pics
Css java script 前端網頁設計概論(day2).pics
 
企業現代化網站架構
企業現代化網站架構企業現代化網站架構
企業現代化網站架構
 
F2e @ douban
F2e @ doubanF2e @ douban
F2e @ douban
 
面向未来的重构
面向未来的重构面向未来的重构
面向未来的重构
 
一拍一产品背后的故事(React实战)
一拍一产品背后的故事(React实战)一拍一产品背后的故事(React实战)
一拍一产品背后的故事(React实战)
 
高粒度模块化的前端开发
高粒度模块化的前端开发高粒度模块化的前端开发
高粒度模块化的前端开发
 
Ued交流会 《用户体验杂谈》
Ued交流会 《用户体验杂谈》Ued交流会 《用户体验杂谈》
Ued交流会 《用户体验杂谈》
 
N-layer design & development
N-layer design & developmentN-layer design & development
N-layer design & development
 

Similar to 如何將現有 Web form 轉換到mvc

Php radomize
Php radomizePhp radomize
Php radomizedo_aki
 
Thumbtack Expertise Days # 5 - Javaz
Thumbtack Expertise Days # 5 - JavazThumbtack Expertise Days # 5 - Javaz
Thumbtack Expertise Days # 5 - JavazAlexey Remnev
 
Native interfaces for R
Native interfaces for RNative interfaces for R
Native interfaces for RSeth Falcon
 
ekb.py - Python VS ...
ekb.py - Python VS ...ekb.py - Python VS ...
ekb.py - Python VS ...it-people
 
deepjs - tools for better programming
deepjs - tools for better programmingdeepjs - tools for better programming
deepjs - tools for better programmingnomocas
 
Javascript fundamentals for php developers
Javascript fundamentals for php developersJavascript fundamentals for php developers
Javascript fundamentals for php developersChris Ramakers
 
A Sceptical Guide to Functional Programming
A Sceptical Guide to Functional ProgrammingA Sceptical Guide to Functional Programming
A Sceptical Guide to Functional ProgrammingGarth Gilmour
 
Thinking Functionally with JavaScript
Thinking Functionally with JavaScriptThinking Functionally with JavaScript
Thinking Functionally with JavaScriptLuis Atencio
 
Javaz. Functional design in Java 8.
Javaz. Functional design in Java 8.Javaz. Functional design in Java 8.
Javaz. Functional design in Java 8.Vadim Dubs
 
JSConf: All You Can Leet
JSConf: All You Can LeetJSConf: All You Can Leet
JSConf: All You Can Leetjohndaviddalton
 
Intro to scala
Intro to scalaIntro to scala
Intro to scalaJoe Zulli
 
05 pig user defined functions (udfs)
05 pig user defined functions (udfs)05 pig user defined functions (udfs)
05 pig user defined functions (udfs)Subhas Kumar Ghosh
 

Similar to 如何將現有 Web form 轉換到mvc (20)

Txjs
TxjsTxjs
Txjs
 
What's New In C# 7
What's New In C# 7What's New In C# 7
What's New In C# 7
 
Php & my sql
Php & my sqlPhp & my sql
Php & my sql
 
Php radomize
Php radomizePhp radomize
Php radomize
 
Thumbtack Expertise Days # 5 - Javaz
Thumbtack Expertise Days # 5 - JavazThumbtack Expertise Days # 5 - Javaz
Thumbtack Expertise Days # 5 - Javaz
 
Native interfaces for R
Native interfaces for RNative interfaces for R
Native interfaces for R
 
ekb.py - Python VS ...
ekb.py - Python VS ...ekb.py - Python VS ...
ekb.py - Python VS ...
 
deepjs - tools for better programming
deepjs - tools for better programmingdeepjs - tools for better programming
deepjs - tools for better programming
 
Beyond java8
Beyond java8Beyond java8
Beyond java8
 
Javascript fundamentals for php developers
Javascript fundamentals for php developersJavascript fundamentals for php developers
Javascript fundamentals for php developers
 
Quebec pdo
Quebec pdoQuebec pdo
Quebec pdo
 
A Sceptical Guide to Functional Programming
A Sceptical Guide to Functional ProgrammingA Sceptical Guide to Functional Programming
A Sceptical Guide to Functional Programming
 
Thinking Functionally with JavaScript
Thinking Functionally with JavaScriptThinking Functionally with JavaScript
Thinking Functionally with JavaScript
 
Functional programming with php7
Functional programming with php7Functional programming with php7
Functional programming with php7
 
Javaz. Functional design in Java 8.
Javaz. Functional design in Java 8.Javaz. Functional design in Java 8.
Javaz. Functional design in Java 8.
 
The most exciting features of PHP 7.1
The most exciting features of PHP 7.1The most exciting features of PHP 7.1
The most exciting features of PHP 7.1
 
JSConf: All You Can Leet
JSConf: All You Can LeetJSConf: All You Can Leet
JSConf: All You Can Leet
 
Quebec pdo
Quebec pdoQuebec pdo
Quebec pdo
 
Intro to scala
Intro to scalaIntro to scala
Intro to scala
 
05 pig user defined functions (udfs)
05 pig user defined functions (udfs)05 pig user defined functions (udfs)
05 pig user defined functions (udfs)
 

More from Gelis Wu

Blazor in NET 8 的重大改變___________________
Blazor in NET 8 的重大改變___________________Blazor in NET 8 的重大改變___________________
Blazor in NET 8 的重大改變___________________Gelis Wu
 
.NET 7 升級教戰手冊_V1.0.pdf
.NET 7 升級教戰手冊_V1.0.pdf.NET 7 升級教戰手冊_V1.0.pdf
.NET 7 升級教戰手冊_V1.0.pdfGelis Wu
 
顧問養成秘技 - 顧問服務實戰.pptx
顧問養成秘技 - 顧問服務實戰.pptx顧問養成秘技 - 顧問服務實戰.pptx
顧問養成秘技 - 顧問服務實戰.pptxGelis Wu
 
Net 6 的 blazor 開發新視界
Net 6 的 blazor 開發新視界Net 6 的 blazor 開發新視界
Net 6 的 blazor 開發新視界Gelis Wu
 
軟體架構設計的技術養成之路
軟體架構設計的技術養成之路軟體架構設計的技術養成之路
軟體架構設計的技術養成之路Gelis Wu
 
深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例
深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例
深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例Gelis Wu
 
Blazor Component 開發實戰
Blazor Component 開發實戰Blazor Component 開發實戰
Blazor Component 開發實戰Gelis Wu
 
實踐 Clean Architecture(實作高可用性的軟件架構)
實踐 Clean Architecture(實作高可用性的軟件架構)實踐 Clean Architecture(實作高可用性的軟件架構)
實踐 Clean Architecture(實作高可用性的軟件架構)Gelis Wu
 
該準備從 .NET Framework 4.x 遷移至 .NET Core 3.0 了嗎?
該準備從 .NET Framework 4.x 遷移至 .NET Core 3.0 了嗎?該準備從 .NET Framework 4.x 遷移至 .NET Core 3.0 了嗎?
該準備從 .NET Framework 4.x 遷移至 .NET Core 3.0 了嗎?Gelis Wu
 
專業顧問的技能成長日記
專業顧問的技能成長日記專業顧問的技能成長日記
專業顧問的技能成長日記Gelis Wu
 
你的軟體架構夠敏捷嗎?
你的軟體架構夠敏捷嗎?你的軟體架構夠敏捷嗎?
你的軟體架構夠敏捷嗎?Gelis Wu
 
使用 .NET Standard 開發跨平台應用程式
使用 .NET Standard 開發跨平台應用程式使用 .NET Standard 開發跨平台應用程式
使用 .NET Standard 開發跨平台應用程式Gelis Wu
 
一個 ASP.NET Core 2.1 開發指南
一個 ASP.NET Core 2.1 開發指南一個 ASP.NET Core 2.1 開發指南
一個 ASP.NET Core 2.1 開發指南Gelis Wu
 
前端大型系統的基石 TypeScript
前端大型系統的基石 TypeScript前端大型系統的基石 TypeScript
前端大型系統的基石 TypeScriptGelis Wu
 
Dot netstandard2.0與.net的未來發展
Dot netstandard2.0與.net的未來發展Dot netstandard2.0與.net的未來發展
Dot netstandard2.0與.net的未來發展Gelis Wu
 
客製化的 Web api 的框架設計
客製化的 Web api 的框架設計客製化的 Web api 的框架設計
客製化的 Web api 的框架設計Gelis Wu
 
Asp.net identity 2.0
Asp.net identity 2.0Asp.net identity 2.0
Asp.net identity 2.0Gelis Wu
 
Asp.net mvc 基礎
Asp.net mvc 基礎Asp.net mvc 基礎
Asp.net mvc 基礎Gelis Wu
 
架構設計好簡單系列 設計符合團隊的範本精靈 (Project template)
架構設計好簡單系列   設計符合團隊的範本精靈 (Project template)架構設計好簡單系列   設計符合團隊的範本精靈 (Project template)
架構設計好簡單系列 設計符合團隊的範本精靈 (Project template)Gelis Wu
 
Azure PaaS (WebApp & SQL Database) workshop solution
Azure PaaS (WebApp & SQL Database) workshop solutionAzure PaaS (WebApp & SQL Database) workshop solution
Azure PaaS (WebApp & SQL Database) workshop solutionGelis Wu
 

More from Gelis Wu (20)

Blazor in NET 8 的重大改變___________________
Blazor in NET 8 的重大改變___________________Blazor in NET 8 的重大改變___________________
Blazor in NET 8 的重大改變___________________
 
.NET 7 升級教戰手冊_V1.0.pdf
.NET 7 升級教戰手冊_V1.0.pdf.NET 7 升級教戰手冊_V1.0.pdf
.NET 7 升級教戰手冊_V1.0.pdf
 
顧問養成秘技 - 顧問服務實戰.pptx
顧問養成秘技 - 顧問服務實戰.pptx顧問養成秘技 - 顧問服務實戰.pptx
顧問養成秘技 - 顧問服務實戰.pptx
 
Net 6 的 blazor 開發新視界
Net 6 的 blazor 開發新視界Net 6 的 blazor 開發新視界
Net 6 的 blazor 開發新視界
 
軟體架構設計的技術養成之路
軟體架構設計的技術養成之路軟體架構設計的技術養成之路
軟體架構設計的技術養成之路
 
深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例
深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例
深入淺出領域驅動設計:以 .NET 5 與線上房貸申請系統為例
 
Blazor Component 開發實戰
Blazor Component 開發實戰Blazor Component 開發實戰
Blazor Component 開發實戰
 
實踐 Clean Architecture(實作高可用性的軟件架構)
實踐 Clean Architecture(實作高可用性的軟件架構)實踐 Clean Architecture(實作高可用性的軟件架構)
實踐 Clean Architecture(實作高可用性的軟件架構)
 
該準備從 .NET Framework 4.x 遷移至 .NET Core 3.0 了嗎?
該準備從 .NET Framework 4.x 遷移至 .NET Core 3.0 了嗎?該準備從 .NET Framework 4.x 遷移至 .NET Core 3.0 了嗎?
該準備從 .NET Framework 4.x 遷移至 .NET Core 3.0 了嗎?
 
專業顧問的技能成長日記
專業顧問的技能成長日記專業顧問的技能成長日記
專業顧問的技能成長日記
 
你的軟體架構夠敏捷嗎?
你的軟體架構夠敏捷嗎?你的軟體架構夠敏捷嗎?
你的軟體架構夠敏捷嗎?
 
使用 .NET Standard 開發跨平台應用程式
使用 .NET Standard 開發跨平台應用程式使用 .NET Standard 開發跨平台應用程式
使用 .NET Standard 開發跨平台應用程式
 
一個 ASP.NET Core 2.1 開發指南
一個 ASP.NET Core 2.1 開發指南一個 ASP.NET Core 2.1 開發指南
一個 ASP.NET Core 2.1 開發指南
 
前端大型系統的基石 TypeScript
前端大型系統的基石 TypeScript前端大型系統的基石 TypeScript
前端大型系統的基石 TypeScript
 
Dot netstandard2.0與.net的未來發展
Dot netstandard2.0與.net的未來發展Dot netstandard2.0與.net的未來發展
Dot netstandard2.0與.net的未來發展
 
客製化的 Web api 的框架設計
客製化的 Web api 的框架設計客製化的 Web api 的框架設計
客製化的 Web api 的框架設計
 
Asp.net identity 2.0
Asp.net identity 2.0Asp.net identity 2.0
Asp.net identity 2.0
 
Asp.net mvc 基礎
Asp.net mvc 基礎Asp.net mvc 基礎
Asp.net mvc 基礎
 
架構設計好簡單系列 設計符合團隊的範本精靈 (Project template)
架構設計好簡單系列   設計符合團隊的範本精靈 (Project template)架構設計好簡單系列   設計符合團隊的範本精靈 (Project template)
架構設計好簡單系列 設計符合團隊的範本精靈 (Project template)
 
Azure PaaS (WebApp & SQL Database) workshop solution
Azure PaaS (WebApp & SQL Database) workshop solutionAzure PaaS (WebApp & SQL Database) workshop solution
Azure PaaS (WebApp & SQL Database) workshop solution
 

Recently uploaded

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 

Recently uploaded (20)

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 

如何將現有 Web form 轉換到mvc

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. 現在,在 OO 的程式語言框架下,不管是元件、模組 皆由 Class 所以 定義,所以均會使用到 OO 的好處。 會有的差別在於,元件(語言/平台(x64/x86)/OS)的不同、UI 元件、非 UI元件
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. private void Page_Load(System.Object sender, System.EventArgs e) { if (!IsPostBack) { RoleFunProperty role = null; if (ViewState["RoleFunProperty"] == null) { RoleFunProperty rfP = new RoleFunProperty(); DataTable dtPermission = sqlDt(Sql); DataRow dr = null; foreach (DataRow dr_loopVariable in dtPermission.Rows) { dr = dr_loopVariable; rfP.RF_FunQuery = (dr["RF_FunQuery"] == DBNull.Value ? false : bool.Parse(dr["RF_FunQuery"].ToString())); rfP.RF_FunAdd = (dr["RF_FunAdd"] == DBNull.Value ? false : bool.Parse(dr["RF_FunAdd"].ToString())); rfP.RF_FunUpdate = (dr["RF_FunUpdate"] == DBNull.Value ? false : bool.Parse(dr["RF_FunUpdate"].ToString())); rfP.RF_FunDel = (dr["RF_FunDel"] == DBNull.Value ? false : bool.Parse(dr["RF_FunDel"].ToString())); rfP.RF_FunPrint = (dr["RF_FunPrint"] == DBNull.Value ? false : bool.Parse(dr["RF_FunPrint"].ToString())); } } else rfP = (RoleFunProperty)ViewState["RoleFunProperty"]; if (!rfP.RF_FunAdd) { btnAdd.Enabled = false; btnAdd.ToolTip = "目前使用者無新增權限"; } } }
  • 29. protected RoleFunProperty GetFuncPermission() { string UR_RMRoleID = Session["UR_RMRoleID"].ToString(); string id = MenuID; string Sql = "select * from RoleFun RF " + "where RF.RF_RMRoleId='" + UR_RMRoleID + "' " + "AND RF.RF_MCId=" + id; if (id == null | string.IsNullOrEmpty(id)) { return null; } RoleFunProperty rfP = new RoleFunProperty(); DataTable dtPermission = sqlDt(Sql); DataRow dr = null; foreach (DataRow dr_loopVariable in dtPermission.Rows) { dr = dr_loopVariable; rfP.RF_FunQuery = (dr["RF_FunQuery"] == DBNull.Value ? false : bool.Parse(dr["RF_FunQuery"].ToString())); rfP.RF_FunAdd = (dr["RF_FunAdd"] == DBNull.Value ? false : bool.Parse(dr["RF_FunAdd"].ToString())); rfP.RF_FunUpdate = (dr["RF_FunUpdate" ] == DBNull.Value ? false : bool.Parse(dr["RF_FunUpdate"].ToString())); rfP.RF_FunDel = (dr["RF_FunDel"] == DBNull.Value ? false : bool.Parse(dr["RF_FunDel"].ToString())); rfP.RF_FunPrint = (dr["RF_FunPrint"] == DBNull.Value ? false : bool.Parse(dr["RF_FunPrint"].ToString())); } return rfP; }
  • 30. protected bool GetAddButtonSecurity() { RoleFunProperty role = null; if (ViewState["RoleFunProperty"] == null) role = GetFuncPermission(); else role = (RoleFunProperty)ViewState["RoleFunProperty"]; return role.RF_FunAdd; }
  • 31. protected RoleFunProperty GetAndKeepFuncPermission() { RoleFunProperty role = null; if (ViewState["RoleFunProperty"] == null) role = GetFuncPermission(); else role = (RoleFunProperty)ViewState["RoleFunProperty"]; return role; }
  • 32. /// <summary> /// 取得新增按鈕權限 /// </summary> /// <returns></returns> protected bool GetAddButtonSecurity() { RoleFunProperty role = GetAndKeepFuncPermission(); return role.RF_FunAdd; } /// <summary> /// 取得修改按鈕權限 /// </summary> /// <returns></returns> protected bool GetUpdateButtonSecurity() { RoleFunProperty role = GetAndKeepFuncPermission(); return role.RF_FunUpdate; } /// <summary> /// 取得刪除按鈕權限 /// </summary> /// <returns></returns> protected bool GetDelButtonSecurity() { RoleFunProperty role = GetAndKeepFuncPermission(); return role.RF_FunDel; } 程式碼不僅較為乾淨 也更具彈性,擴充性、可維護性 也都提高
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 44. • Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application (9 of 10) http://www.asp.net/mvc/overview/older-versions/getting-started-with-ef-5-using-mvc- 4/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application http://openhome.cc/Gossip/DesignPattern/ • Learn About ASP.NET MVC http://www.asp.net/mvc • Visual Studio UML 軟體工程 (OOA/OOD 塑模化應用程式設計) http://gelis-dotnet.blogspot.tw/2011/03/visual-studio-2010.html • Gelis 技術隨筆-架構設計系列 http://www.dotblogs.com.tw/gelis/Tags/%e8%bb%9f%e9%ab%94%e6%9e%b6%e6%a7%8b %e8%a8%ad%e8%a8%88/default.aspx

Editor's Notes

  1. 我不斷的強調,概念夠的程式設計者,即便撰寫 Web Form,也會很好維護,所以,課程的重點也在於架構設計,並不在於 WebForm 或是 MVC,因為不管是哪一種,我們都希望是一個妥善的、經過分析、設計、職責分離,彼此偶和度低,容易維護、擴展的網站。也不會把它當成 WinForm 來開發。