380 likes | 537 Views
Core . NET Programmer Guide. by Hendi Wibowo. Application Architecture. System Requirement. Database Server DBMS (MS SQL Server 200 8 or later running on Windows Server Family OS) Optimal requirement for hardware and network Application Server
E N D
Core.NETProgrammer Guide by HendiWibowo
System Requirement • Database Server • DBMS (MS SQL Server 2008 or later running on Windows Server Family OS) • Optimal requirement for hardware and network • Application Server • Web Server (IIS 7 or later running on Windows Server Family OS) • Crystal Report 11 Runtime + Designer (opt) • Optimal requirement for hardware and network • Client • Browser IE 7 running on Windows Family OS • Optimal requirement for hardware and network
MVC as Point of View • Modeller : a set of classes and interfaces that can be used to retrieve data from database • Viewer : a set of classes and template page (*.aspx and *.ascx) to present data. Can be used to develop form entry and Gridview page • Controller : a set of classes must be created by programmer to control viewer and modeller.
Software Factories • A software factory may include processes, templates, IDE configurations and views • the methodology starts by identifying and classifying architectural styles for frequently encountered families of solutions, such as web portals, smart clients and connected systems (Experience) • Software Factories supply reusable assets to help users enact the processes. Assets : documents, such as patterns, guidelines and check lists, some are tools, such as designers, wizards, and scripts, some are assets used by tools, such as templates, models and configuration files, and some are executables, such as libraries, frameworks and sample code • The assets are delivered in a structured and installable package called a software factory template (Starter Kit)
Konsep OOP dalam Core.NET • Encapsulation • Interface • Abstract Class • Class • Object • Property • Method • Constructor/Destructor • Object Creation • Inheritance • Override • Overload • Polymorphisme • Pemanggilan Pesan
2. Create XML File 1. Create A New Class extends from IDataControl 3. Edit dao.config and SqlMap.config 5. Build dll and deploy 4. Edit Page Controller
JtahunControl dc = new JtahunControl(); IList list = dc.View(“All”); <?xml version="1.0" encoding="utf-8" ?> <sqlMap namespace="Jtahun" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <alias> <typeAlias alias="Jtahun" type="Valid49.BO.JtahunControl" /> </alias> <resultMaps> <resultMap id="return-result" class="Jtahun"> <result property="Kdtahun" column="KDTAHUN"/> <result property="Nmtahun" column="NMTAHUN"/> </resultMap> </resultMaps> <statements> <select id="QueryByAllJtahun" parameterClass="Jtahun" resultMap="return-result"> SELECT KDTAHUN.NMTAHUN FROM JTAHUN order by KDTAHUN </select> </statements> </sqlMap>
Core.NET • CoreNET.Common.Base (Base Class/Interface) • CoreNET.Common.BO(Adapter into Modeller) • CoreNET.Common.UI (Adapter into View) • CoreNET.Common.Controls(collection of default controller ) • CoreNET.Common.Utils (collection of function/method)
Modeller • Base Classes • BaseBO • BaseParameter • BaseContextDao • BaseDataControl, BaseDataControlUI, BaseDataControlUIEntry, BaseDataControlValidateEntry • Interfaces • IDataControl, IDataControlUI, IDataControlUIEntry • Configuration File • SQLMap.config (to register XML Query files) • Dao.config (to register DaoProxy) • XML Query files create by programmers to define SQL query to access database
Viewer • Base Classes • BaseViewList, BaseViewListLookup, BaseViewListTreeLookup • ViewListProperties • ParameterRow • User Control *.ascx • FormEntry.ascx • ViewList.ascx • ViewList2.ascx • Pages (as template or base page) *.aspx • PageAAA.aspx • PageReport1x.aspx • SiteMap and Mapper • Menu.sitemap to register url menu with formatted query string • Utility.cs to map menu and controller class
Controller • to control viewer and modeller • created by programmers, inheritance from abstract class BaseDataControl and implements IDataControl
Simple Page : Fitur • Menampilkandata dalambentuk table yang terdiridaribeberapakolom • Menampilkan parameter untukmemfilter data yang akanditampilkan • Menyediakanfasilitasuntukmengisi, mengeditdanmenghapus data; untukpengisian data bisadalambentuk form entry, table lookup atau tree view/drilldown lookup • Menyimpan data (export) kedalam format csv • Merekam data (log) yang terlibatdalamaktifitaspengisian, pengeditandanhapus data olehpenggunatertentu • Mencetakinformasiperbaris data table atauseluruh data padahalamantersebut • Memungkinkanvalidasi data yang kompleks • Menampilkan tab control
Simple Page : How To • GetProperties() : untukmendefinisikan property tabel • GetColumns() : untukmenampilkan data dalambentuk table yang terdiridaribeberapakolom • GetFilters() : untukmendefinisikan filter data yang akanditampilkan , yang biasanyadigunakanpada query untukmendefinisikankondisi WHERE
GetProperties (1) • TitlePage : Judul page yg muncul pada browser • TitleList : Judul yang muncul pada panel grid • TitleFilter: Judul yang muncul pada panel filter • WidthPage: lebar page • WidthForm: lebar form entry • PageSize: jumlah baris yang muncul pada grid • PrimaryKeys: field-field yang merupakan primary key dari tabel • ReadOnlyFields: field-field yang readonly ketika tambah/edit/hapus • AllowNulls: field-field yang jika kosong berisi nilai null • FindFields : label yang muncul pada combo pencarian • Footers : definisi footer; eg. (0, 2, 1) • ModeGrid: memunculkan edit, delete/tree di grid • ModePage: memunculkan tombol tambah di page • RefreshFilter: true jika ketika memilih data di grid, merefresh filter • EntryStyle: pilihan style pengisian : form entry, lookup entry, tree lookup entry
GetProperties (2) • Fitur Entry Style Form : • PageEntry : jumlah entry dalam form entry • Fitur Entry Style Lookup : • LookupLabelQuery: • LookupFindFields : • WidthLookup(s) : • Fitur Entry Style Tree View : • LookupLabelQuery : • TreeNodeType : • ClickStyle : • Fitur Export : • CanExport : • ExportFields:
GetProperties (3) • Fitur Log : • LogFields : • Fitur Report : Pada page dapatditampilkantombolcetak di setiapbarisGridViewatausebuahtombolcetakpada page untukmencetak data di page tersebut • ModePageReport : • RptName : • FiturValidasi • ForceOtentikasi : • TglNotValidFields : • ValidateCol : • FiturTabControl • TitleLinks : • Fitur Master-Detail • RefreshParent : • DefaultTabListDetil : • ForcePageSize
Path • Sipkd (website) • App_Data (XML-Query Files location, mapped in SQLMap.config/*.xml) • Ascx (User control location/*.ascx) • Bin (referenced library/*.dll) • pPage (Page file location/*.aspx) • pSistem (Common page file location/*.aspx) • MyLibrary (library) • DataControl (Controller location/*.cs)
Create Menu • Create Controller (or generate from table of database using Core.NET Gen) • Create XML-Query Files (or generate from table of database using Core.NET Gen) • Define sitemap • Define mapper
Setting Option • Define entry WEBSET : • KDSET = ’alokas’ (option code) • MODEENTRY=0 or 1 (0 if typed, 1 if selected) • VALLIST= ’Bulanan=B;Triwulan=T’ (if mode entry = 1) • VALSET = ’B’ (value) • VALDESC=’Periodisasi Alokasi Kas’ (description) • Add KDSET in WEBSET.xml, statement QueryBy[Suffix]Webset, egQueryByDmWebset <select id="QueryByDmWebset" extends="BaseQueryWebset" parameterClass="Webset" resultMap="return-result"> where A.KDSET in (‘alokas') order by A.VALDESC </select> • Define Constant in Webset.cs public const string ALOKAS = "alokas"; • Call setting if (WebsetControl.GetValset(HttpContext.Current,WebsetControl.ALOKAS) == ‘B’ ){}