SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

En vedette

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
 
Ab Testing
Ab TestingAb Testing
Ab Testingnewegg
 
API Token 入門
API Token 入門API Token 入門
API Token 入門Andrew Wu
 
軟體開發之路甘苦談(Gelis)
軟體開發之路甘苦談(Gelis)軟體開發之路甘苦談(Gelis)
軟體開發之路甘苦談(Gelis)Gelis Wu
 
Whoscall 的 Realtime Monitoring 經驗分享
Whoscall 的 Realtime Monitoring 經驗分享Whoscall 的 Realtime Monitoring 經驗分享
Whoscall 的 Realtime Monitoring 經驗分享William Yeh
 
Mac os Terminal 常用指令與小技巧
Mac os Terminal 常用指令與小技巧Mac os Terminal 常用指令與小技巧
Mac os Terminal 常用指令與小技巧Chen Liwei
 

En vedette (20)

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
 
簡單創
簡單創簡單創
簡單創
 
Ab Testing
Ab TestingAb Testing
Ab Testing
 
API Token 入門
API Token 入門API Token 入門
API Token 入門
 
軟體開發之路甘苦談(Gelis)
軟體開發之路甘苦談(Gelis)軟體開發之路甘苦談(Gelis)
軟體開發之路甘苦談(Gelis)
 
Whoscall 的 Realtime Monitoring 經驗分享
Whoscall 的 Realtime Monitoring 經驗分享Whoscall 的 Realtime Monitoring 經驗分享
Whoscall 的 Realtime Monitoring 經驗分享
 
Mac os Terminal 常用指令與小技巧
Mac os Terminal 常用指令與小技巧Mac os Terminal 常用指令與小技巧
Mac os Terminal 常用指令與小技巧
 

Similaire à 如何將現有 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
 

Similaire à 如何將現有 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)
 

Plus de 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
 
架構設計好簡單系列 設計符合團隊的範本精靈 (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
 
Visual studio 2010 塑模化應用程式講座v4
Visual studio 2010 塑模化應用程式講座v4Visual studio 2010 塑模化應用程式講座v4
Visual studio 2010 塑模化應用程式講座v4Gelis Wu
 

Plus de 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
 
架構設計好簡單系列 設計符合團隊的範本精靈 (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
 
Visual studio 2010 塑模化應用程式講座v4
Visual studio 2010 塑模化應用程式講座v4Visual studio 2010 塑模化應用程式講座v4
Visual studio 2010 塑模化應用程式講座v4
 

Dernier

CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 

Dernier (20)

CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 

如何將現有 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

Notes de l'éditeur

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