1 / 74

EEP2006 基礎教學講義

EEP2006 基礎教學講義. Andy Kao. 課程大綱 ( 一 ). 課程大綱 ( 二 ). 課程大綱 ( 三 ). .NET & VS2005. .NET 的架構. VS 2005 (C#,VB,J#..). WinForm. ASP.NET. Base Class Library. CLR ( Common Language Runtime ). Windows. 認識 .NET. 是一個高階平台,不是個 OS 是一個方便於程式師的開發平台 更強的 VM 虛擬機概念 ( Managed Code )

Download Presentation

EEP2006 基礎教學講義

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EEP2006基礎教學講義 • Andy Kao

  2. 課程大綱(一)

  3. 課程大綱(二)

  4. 課程大綱(三)

  5. .NET & VS2005

  6. .NET的架構 VS 2005 (C#,VB,J#..) WinForm ASP.NET Base Class Library CLR (Common Language Runtime ) Windows

  7. 認識.NET • 是一個高階平台,不是個 OS • 是一個方便於程式師的開發平台 • 更強的 VM 虛擬機概念 ( Managed Code ) • 強大的資料交換機制 ( SOAP / XML ) • 完整強大的基礎元件庫 ( BCL ) • 更容易的部署及安裝 • 多平台 ( Win / Web / Mobile )

  8. 認識VS 2005 • 支持.NET 2.0 / ASP .NET 2.0 • 多語言 ( VB / C++ / C# / J# ) • 支援完整的SDLC • 內建程式分析與測量工具 • 內建測試工具 • 專案管理控制 • 親和IDE

  9. VS 2005 版本

  10. EEP .NET2006

  11. EEP 2006的概觀 EEP S/D Module EEP 2006 VS 2005 (C#,VB,J#..) ASP.NET WinForm Base Class Library CLR (Common Language Runtime ) Web Windows

  12. EEP2006 A/P Server 架構 Database Server EEP A/P Server 多資料庫管理 Pooling管理 Log管理系統 Method管理 平衡負載管理 Login管理 Bug管理 版本管理 ServiceManager InfoCommand InfoDataSource AutoNum Transaction UpdateComp Microsoft VS 2005 .NET 2.0

  13. Server端元件 • ServiceManager • InfoConnection • InfoCommand • InfoDataSource • UpdateComp • AutoNumber • InfoTransaction • Loginfo

  14. Client端元件 • InfoRefVal • InfoDataTimePicker • InfoComboBox • AutoSeq • MultiLanguage • ClientQuery • InfoDataSet • CacheDataSet • InfoBindingSource • InfoNavigator • DefaultValidate • InfoTextBox • InfoDataGridView

  15. VS 2005 基礎設計

  16. 第一個VS 2005程式 • Solution/Project • cs/Designer.cs/resx • ToolBox/Property/Event • View Code • Say Hello的程式MessageBox.Show("hello ! EEP2006"); • Open Form的程式 • Form Form_temp = new Form2(); • Form_temp.Show();

  17. 基本指令 • Using (namespace) • 變數:Bool,int,long,float,double, • char,string,enum,struct,[] • 運算元: +,-,*,/,>,>,>=,<=,!=,== , • &&,|| • If/else/while/for/switch • Object Access

  18. 一個簡單的程式 • 將TextBox1的文字轉成ASCII碼 • listBox1.Items.Clear(); • for (int i=0;i<textBox1.TextLength;i++) • { string x = textBox1.Text; • listBox1.Items.Add(Convert.ToInt16(x[i])); • }

  19. EEP 2006 單檔設計

  20. EEP2006安裝 • SETUP EEP2006 • initEEP (InfoRemoteModule,Srvtools) • OPEN Solution1.sln • Export Template • EEPServer.EXE • DB Manager • Create System Table

  21. 單檔設計 DB Server A/P Server Client Database select InfoCommand dump Insert/Update/Delete Get Columns UpdateComp Binding InfoDataSet Insert/Update/Delete InfoBindingSource

  22. 單檔Server端開發 • Add Server Project • Server: DB Module define (InfoConnection, InfoCommand, UpdateComp) • Build • Package Manager

  23. 單檔Client端開發 • Add Client Project • Client: Dataset Define (InfoDataSet ,InfoBindingSource, InfoDataGridView, InfoTextBox, InfoNavigator ) • Build • EEP Manager/Menu Item

  24. DefaultValidate控制 • Default: 公司名稱/最近訂單日 • Carryon: 預設上一筆. • 動態Default: 取得日期. • Validate: 連絡人不為空. • Validate: 地址不能都空白(Code) • Range: City設定範圍值. • AutoDisibleControl=True • CloseProtect=True

  25. EEP 2006 一對多設計

  26. 一對多設計 DB Server A/P Server Client Database select Master InfoCommand dump Insert/Update/Delete InfoDataSource InfoDataSet UpdateComp Insert/Update/ Delete Insert/Update/Delete Binding Detail InfoCommand Master InfoBindingSource Relation UpdateComp Detail InfoBindingSource

  27. 一對多Server端開發 • Add Server Project • Server: DB Module define (InfoConnection, InfoCommand, InfoDataSource, UpdateComp) • Build • Package Manager

  28. 一對多Client端開發 • Add Client Project • Client: InfoDataSet Define (InfoDataSet ,Maser InfoBindingSource, • Detail InfoBindingSource, InfoTextBox, InfoDataGridView, InfoNavigator ) • Build • EEP Manager/Menu Item

  29. 運算式與加總 • InfoDataGridView.Columntype: InfoDataGridViewExpressionColumn, • Expression: UnitPrice*quantity • InfoDataGridView.TotalColumns • InfoDataGridView.TotalChanged事件 • if (e.ColumnName == "Amount" && • (infoNavigator1.GetCurrentState() == "Inserting" || infoNavigator1.GetCurrentState() == "Editing") • { • InfoTextBox7.Text = e.TotalValue.ToString(); • }

  30. EEP 2006 使用Wizard

  31. 單檔Wizard • Server Package Wizard • (選擇DBAlias,Table,Columns, • KeyFields) • Client Package Wizard • (選擇RemoteName與Columns)

  32. 一對多Wizard • Server Package Wizard • (選擇DBAlias,一對多Table, Columns,KeyFields) • Client Package Wizard • (選擇RemoteName與Columns)

  33. EEP 2006 關連設計

  34. 使用Left Join • Server端: • InfoCommand: 使用Left Join • UpdateComp: 設定ExceptJoin • Client端: • InfoTextBox/ InfoDataGridView • ReadOnly=True.

  35. 使用RefVal • 兩種連結:DataSource/SelectCommand • DataSource: 連InfoBindingSource->InfoDataSet->InfoCommand • SelectCommand: GLModule共用InfoComand (要設SelectAlias) • 設定DisplayMember, ValueMember • 使用InfoRefValBox, 設定RefVal

  36. EEP 2006 ViewDataSet設計

  37. ViewDataSet優化效能 DB Server A/P Server Client View InfoCommand select dump Database View InfoDataSet select Master InfoCommand Insert/Update/Delete Relations InfoDataSource View InfoDataSet InfoDataSet UpdateComp Insert/Update/Delete Insert/Update/ Delete Binding Detail InfoCommand Master InfoBindingSource Relation UpdateComp Detail InfoBindingSource

  38. ViewDataSet • Server Module: 多貼一個InfoCommand • Add Client Project • Client: 貼一個View的InfoDataSet • & View的InfoBindingSource • & InfoBindingSource.Relations • InfoNavigator.ViewBindingSource

  39. 自動編號設定 • Server: Autonumber • MYGETDATE() • { string ret = System.DateTime.Today.ToString("yyMMdd"); • return ret; } • System Table: SysAutonum • Client: AutoSeq • ServerModify: UpdateComp,InfoDataSet • ServerModifyColumns: UpdateComp • ServerModifyGetMax: UpdateComp

  40. EEP 2006 Transaction設計

  41. Transaction原理 DB Server Database select A/P Server InfoCommand Insert/Delete/Update Active UpdateComp Update (inc/dec/replace) Apply Append Mode: AutoAppend Except Ignore AlwaysAppend Client InfoDataSet

  42. 變更Northwind alter table products add LastOrderedPrice money null alter table customers add LastOrderedDate datetime null alter table customers add FreightAmount money null alter table orders add OrderNo varchar(10) null create table dbo.OrderedLog (SeqID int identity (1,1) NOT NULL, OrderID int NOT NULL, ProductID int NOT NULL, UnitPrice money NOT NULL, Quantity smallint NOT NULL)

  43. Transaction的實例 Orders DB Server A/P Server select Customers Insert/Delete/Update Master InfoCommand Inc OrderedAmout Replace LastOrderedDate Client Order Details Master UpdateComp Active select Detail InfoCommand Apply Insert/Delete/Update Products Inc UnitsOnOrder Replace LastOrderedPrice Master CDS Detail UpdateComp Apply Log Transaction OrderedLog Detail CDS

  44. Transaction設計 • Orders Transaction : Customers • Freight Inc OrderedAmout • Replace LastOrderedDate • Order Details Transaction: Products • Quantity Inc UnitsOnOrder • UnitPrice Replace LastOrderedPrice • AlwaysAppend: OrderedLog

  45. EEP 2006 Server Method設計

  46. Server Method原理 DB Server A/P Server Database select ServiceManager Server Method1 …… Server Method2 …… Server Method3 …… Server Method4 ….. Update Call 同步/非同步 Client InfoCommand

  47. Server Method設計 • 設計Server Method: • public object CallTest(object[] objParam) • {string str = objParam[0].ToString(); • string sql= "select avg(UnitPrice) as AvgPrice from [order details] Where ProductID="; • sql = sql + str; • DataSet Tmp = ExecuteSql("view", sql, true); • string retval=Tmp.Tables[0].Rows[0][‘AvgPrice’].ToString(); • Thread.Sleep(5000); • object ret; • ret = new object[] { 0, retval}; • return ret; } • 定義ServiceManager

  48. Server Method設計 • 同步Client: • private void button1_Click(object sender, EventArgs e) • { object[] param; • param=new object[] {textBox1.Text}; • object[] backParam = CliUtils.CallMethod("STEST2", "CallTest",param); • MessageBox.Show(backParam[1].ToString()); • } • 非同步Client: • public void MyCallBack(object[] oRet) • { MessageBox.Show((string)oRet[1]); • } • object[] backParam = CliUtils.AsyncCallMethod("STEST2", "CallTest",param,MyCallBack);

  49. EEP 2006 WEB設計

  50. 認識ASP .NET • 語言(VB/C#/J#..) • Code Behind技術 • 元件化的方式 • 好的debug環境 • Rander 的技術 • 更強資料連結(ADO .NET與XML) • 更容易的WebService

More Related