From 4c5675663d7e06a9049a95186b1772a097dd215b Mon Sep 17 00:00:00 2001 From: lahma Date: Sat, 25 Jul 2009 13:16:55 +0000 Subject: [PATCH] Visual updates to Northwind demo, some refactoring --- .../Dao/NHibernate/HibernateCustomerDao.cs | 2 +- .../Dao/NHibernate/HibernateOrderDao.cs | 11 +- .../Dao/NHibernate/HibernateProductDao.cs | 11 +- .../Spring.Northwind.Dao.NHibernate.csproj | 5 + .../Spring.Northwind.Dao/Dao/ICustomerDao.cs | 3 + .../src/Spring.Northwind.Dao/Dao/IDao.cs | 5 + .../src/Spring.Northwind.Dao/Dao/IOrderDao.cs | 8 +- .../Spring.Northwind.Dao/Dao/IProductDao.cs | 3 + .../Dao/ISupportsDeleteDao.cs | 8 + .../Spring.Northwind.Dao/Dao/ISupportsSave.cs | 7 +- .../Service/FulfillmentService.cs | 2 +- .../App_Data/NORTHWND.MDF | Bin 4063232 -> 4063232 bytes .../App_Data/NORTHWND_log.ldf | Bin 1048576 -> 1048576 bytes .../App_Themes/Spring/Spring.skin | 6 + .../src/Spring.Northwind.Web/CSS/style.css | 293 ++++++++++-------- .../Spring.Northwind.Web/CustomerEditor.aspx | 50 +-- .../CustomerEditor.aspx.cs | 94 +++--- .../Spring.Northwind.Web/CustomerList.aspx | 2 + .../Spring.Northwind.Web/CustomerOrders.aspx | 12 + .../CustomerOrders.aspx.cs | 104 +++---- .../Spring.Northwind.Web/CustomerView.aspx | 51 +-- .../Spring.Northwind.Web/CustomerView.aspx.cs | 6 +- .../src/Spring.Northwind.Web/Default.aspx | 15 +- .../Spring.Northwind.Web/Img/bg-spring.png | Bin 0 -> 2834 bytes .../src/Spring.Northwind.Web/Img/footern.gif | Bin 0 -> 540 bytes .../Shared/MasterPage.master | 78 ++--- .../src/Spring.Northwind.Web/Web.config | 6 +- .../src/Spring.Northwind.Web/Web.xml | 5 + .../NorthwindIntegrationTests.cs | 6 +- 29 files changed, 452 insertions(+), 341 deletions(-) create mode 100644 examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/App_Themes/Spring/Spring.skin create mode 100644 examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Img/bg-spring.png create mode 100644 examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Img/footern.gif diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/HibernateCustomerDao.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/HibernateCustomerDao.cs index 799bbe6b..496cefb0 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/HibernateCustomerDao.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/HibernateCustomerDao.cs @@ -64,7 +64,7 @@ namespace Spring.Northwind.Dao.NHibernate } [Transaction(ReadOnly = false)] - public void SaveOrUpdate(Customer customer) + public void Update(Customer customer) { Session.SaveOrUpdate(customer); } diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/HibernateOrderDao.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/HibernateOrderDao.cs index 5046f3d2..bee54b7b 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/HibernateOrderDao.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/HibernateOrderDao.cs @@ -26,34 +26,41 @@ using Spring.Data.NHibernate.Generic; using Spring.Data.NHibernate.Support; using Spring.Northwind.Domain; +using Spring.Stereotype; +using Spring.Transaction.Interceptor; #endregion namespace Spring.Northwind.Dao.NHibernate { + [Repository] public class HibernateOrderDao : HibernateDao, IOrderDao { + [Transaction(ReadOnly = true)] public Order Get(int orderId) { return Session.Get(orderId); - } + [Transaction(ReadOnly = true)] public IList GetAll() { return GetAll(); } + [Transaction] public int Save(Order order) { return (int) Session.Save(order); } - public void SaveOrUpdate(Order order) + [Transaction] + public void Update(Order order) { Session.SaveOrUpdate(order); } + [Transaction] public void Delete(Order order) { Session.Delete(order); diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/HibernateProductDao.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/HibernateProductDao.cs index f1922c92..f256cb8f 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/HibernateProductDao.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/HibernateProductDao.cs @@ -25,34 +25,41 @@ using System.Collections.Generic; using Spring.Data.NHibernate.Support; using Spring.Northwind.Domain; +using Spring.Stereotype; +using Spring.Transaction.Interceptor; #endregion namespace Spring.Northwind.Dao.NHibernate { + [Repository] public class HibernateProductDao : HibernateDao, IProductDao { + [Transaction(ReadOnly = true)] public Product Get(int productId) { return Session.Get(productId); - } + [Transaction(ReadOnly = true)] public IList GetAll() { return GetAll(); } + [Transaction] public int Save(Product product) { return (int) Session.Save(product); } - public void SaveOrUpdate(Product product) + [Transaction] + public void Update(Product product) { Session.SaveOrUpdate(product); } + [Transaction] public void Delete(Product product) { Session.Delete(product); diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Spring.Northwind.Dao.NHibernate.csproj b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Spring.Northwind.Dao.NHibernate.csproj index 74f1729c..04289f59 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Spring.Northwind.Dao.NHibernate.csproj +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Spring.Northwind.Dao.NHibernate.csproj @@ -36,6 +36,10 @@ False ..\..\..\..\..\bin\net\2.0\debug\Common.Logging.dll + + False + ..\..\lib\net\2.0\FluentNHibernate.dll + False ..\..\..\..\..\lib\NHibernate21\net\2.0\Iesi.Collections.dll @@ -61,6 +65,7 @@ ..\..\..\..\..\bin\net\2.0\debug\Spring.Data.NHibernate21.dll + diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/ICustomerDao.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/ICustomerDao.cs index 35bcc6f3..10d1320b 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/ICustomerDao.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/ICustomerDao.cs @@ -28,6 +28,9 @@ using Spring.Northwind.Domain; namespace Spring.Northwind.Dao { + /// + /// Customer related DAO operations interface. + /// public interface ICustomerDao : IDao, ISupportsDeleteDao, ISupportsSave { } diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/IDao.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/IDao.cs index a816c18b..fa28fa8b 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/IDao.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/IDao.cs @@ -2,6 +2,11 @@ using System.Collections.Generic; namespace Spring.Northwind.Dao { + /// + /// Generic DAO interface with minimum retrieval methods. + /// + /// Entity to operate with. + /// Entity id type. public interface IDao { /// diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/IOrderDao.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/IOrderDao.cs index 2eb70993..be17ec76 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/IOrderDao.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/IOrderDao.cs @@ -28,10 +28,10 @@ using Spring.Northwind.Domain; namespace Spring.Northwind.Dao { - public interface IOrderDao : IDao, ISupportsDeleteDao + /// + /// Order related DAO operations interface. + /// + public interface IOrderDao : IDao, ISupportsDeleteDao, ISupportsSave { - int Save(Order order); - - void SaveOrUpdate(Order order); } } diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/IProductDao.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/IProductDao.cs index e0507aaa..abed8690 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/IProductDao.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/IProductDao.cs @@ -28,6 +28,9 @@ using Spring.Northwind.Domain; namespace Spring.Northwind.Dao { + /// + /// Product related DAO operations interface. + /// public interface IProductDao : IDao, ISupportsDeleteDao, ISupportsSave { diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/ISupportsDeleteDao.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/ISupportsDeleteDao.cs index 057cba87..8a475226 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/ISupportsDeleteDao.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/ISupportsDeleteDao.cs @@ -1,7 +1,15 @@ namespace Spring.Northwind.Dao { + /// + /// Role interface for DAOs that support deletion of entities. + /// + /// Entity type. public interface ISupportsDeleteDao { + /// + /// Deletes the entity. + /// + /// Entity to delete. void Delete(TEntity entity); } } \ No newline at end of file diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/ISupportsSave.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/ISupportsSave.cs index a40b3093..9bcbdc06 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/ISupportsSave.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Dao/ISupportsSave.cs @@ -1,5 +1,10 @@ namespace Spring.Northwind.Dao { + /// + /// Role interface for DAOs that support saves and updates to entities. + /// + /// Entity type. + /// Entity id type. public interface ISupportsSave { /// @@ -13,6 +18,6 @@ namespace Spring.Northwind.Dao /// Saves or updates the entity. Behavior depends on the current state of entity's ID. /// /// Entity to save or update. - void SaveOrUpdate(TEntity entity); + void Update(TEntity entity); } } \ No newline at end of file diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Service/Service/FulfillmentService.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Service/Service/FulfillmentService.cs index e5f1fa59..68da4f9d 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Service/Service/FulfillmentService.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Service/Service/FulfillmentService.cs @@ -96,7 +96,7 @@ namespace Spring.Northwind.Service order.ShippedDate = DateTime.Now; //Update shipment date - OrderDao.SaveOrUpdate(order); + OrderDao.Update(order); //Other operations...Decrease product quantity... etc } diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/App_Data/NORTHWND.MDF b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/App_Data/NORTHWND.MDF index ec83fdede5f9ba346e8026bcf514273ae62f0bd3..0ef778c77194cde06392829794c8851fb24b9c8d 100644 GIT binary patch delta 280 zcmWl|#|?r27=Y3IV(+~xU@zFk?hr2E!9ff+2k_t`CTwG531U3?`I2W@AF=+QVrb&t z^|xtXG&zg7kJDFC<$7~;p@#~+^wG}%gA6gu2&0TK&IFT8G0hCK%rVabi!8Cs3ahNK uPL&#UHrQl~ZFbmYk9`g}q`?u#oN&q+=Ui|}lPj*d;g&n@d9WS*sJ?#r^>cgx delta 280 zcmWl|#|?r27=Y3IV(+~xU@zFk?hr2E!5JKYn*(@o5fipC!W71npD%fq^%3j;DTXHQ zU4NVQMU%6L`#60SRjxNj7ka4BOCS9VFvt+Yj4;X=<4iEg6w}Nw%N+A8u*ee2tgy-& v>r|;xXM;_)*k*@a_SoluLmC`$%n7HQan1#oG`ZrM8*aJdo(J2}kLv3O$FFlr diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/App_Data/NORTHWND_log.ldf b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/App_Data/NORTHWND_log.ldf index fcbbdf4a63c639b03e6419b9c40785551abfe2d5..fa529836f1bb941c4dcb2fa5a96c98d2f54bfee7 100644 GIT binary patch delta 1795 zcmZ|LL1+^}6b9g#ZKg?WO%qbJpth@*3L=W_!9&E>s(5K>K`GdSIeRJ+V<;i4rH(xa zT350NqT-==D>a7*J!zqygdV(jkyUD~HMVJt@gTI$%-fmn7!yb!yYKz)z0b0GEvxr_ z+%ZQ<$S#K4riVgviBk=@Y<~)O;*5=3FJR+kU>mCnCo)eq_|JR$WAG4r8H!_H`EzVI zc%DqzOM8w_50QK#(*K{{H1Bn0uM=XI+DEYQAnf9*7@1`wx709usV};d^z@%3_Vxe| zvPX?qETe7GpTS-pJfz9}9J}U+jJPlQ(Gt4?jle zEpo0{WUy&jyfaYBnX||~@|piFyt7C@#$TLh59vIpDn#NfwBRLlu~IgxH|8WJ$i+HA z6Fg|eiQXk=@Uk;JN%o&jiku{Z4R4?^bdDt@5YOY|4fcgk4)t^g#J2JYLidbR%zoW> zvfw@>Coul%L@C>Gg%#}dJyLx23wR_EY^b~F_vKLPd}EDE+VAomT-MkwewUkGAK!7! zb14d!@j5OYA7GL}z@^9`SmrpK!v{#0AK;=YJQtb3XR=w+MU`nm!et#?ir@ksNdz0} zF8X~r)Uq9{aT)i!Y=Fx;+r{r9`}mIQo=Zu%Wa_v)IT{j^VnJ{zaR`=~fpho(>9Pqf zs={-T34A7-C0$gR79?EC;8Fq?@JJ%qPZjibm>NZh#7j>Jd+d|#l)D6$L Gt>$0PgQx5O delta 345 zcmZo@aA;_7m|!#cfs?>w0Vk1-2^P$Z_a;B&lV>cN%*gM?$he8+KO;zXyTb$a^Nf@4 zu`2?_IBXb^R4tl(kgId@1yTKp0j!%71f1dOi^1xruPYJ8z|;1Cx9tJnvIqPM0Dx$K8~^|S diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/App_Themes/Spring/Spring.skin b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/App_Themes/Spring/Spring.skin new file mode 100644 index 00000000..0a92e794 --- /dev/null +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/App_Themes/Spring/Spring.skin @@ -0,0 +1,6 @@ + + + + + + diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CSS/style.css b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CSS/style.css index 8314f473..784e77f6 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CSS/style.css +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CSS/style.css @@ -1,129 +1,166 @@ -body { - margin: 0px; - padding: 0px; - background-color: #dfeac1; - text-align: center; -} - -.logo { - position:relative; - top:-8px; - left:22px; - float:left; -} - -#ad { - float:right; - position:relative; - right: 22px; - top:-8px; -} - - - -.navigation { - position:relative; - left: 25px; - font-family: Verdana, Arial, Helvetica, sans; - font-size: 12px; - color: #000000; - text-decoration: none; - width:150px; -} -.navigation a, .navigation a:active, .navigation a:visited { - font-family: Verdana, Arial, Helvetica, sans; - font-size: 12px; - color: #7E7E7E; - text-decoration: none; -} -.navigation a:hover { - font-family: Verdana, Arial, Helvetica, sans; - font-size: 12px; - color: #000000; - text-decoration: none; -} - - -h4.navbar { - position:relative; - left: 0px; - font-family: Verdana, Arial, Helvetica, sans; - font-size: 12px; - color: #5F5F5F; - text-decoration: none; - margin-bottom: 2px; -} -h1 { - font-family: Verdana, Arial, Helvetica, sans; - font-size: 14px; - font-weight: normal; - color: #90A720; -} -a, a:active, a:visited { - font-family: Verdana, Arial, Helvetica, sans; - font-size: 12px; - color: #606060; - text-decoration: underline; -} -a:hover { - font-family: Verdana, Arial, Helvetica, sans; - font-size: 12px; - color: #000000; -} -b { - font-family: Verdana, Arial, Helvetica, sans; - font-size: 12px; - font-weight: bold; - color: #606060; -} -i { - font-family: Verdana, Arial, Helvetica, sans; - font-size: 12px; - color: #606060; -} - -table { - font-family: Verdana, Arial, Helvetica, sans; - font-size: 12px; - color: #606060; -} -.news { - border: 1px solid; - border-color: #C9C9C9; - padding: 12px; - font-family: Verdana, Arial, Helvetica, sans; - font-size: 12px; - color: #606060; - background-color: #F5F5F5; - margin-top: 20px; - margin-bottom: 20px; -} -.news b { - font-family: Verdana, Arial, Helvetica, sans; - font-size: 11px; - font-weight: normal; - color: #90A720; -} -.news u { - font-family: Verdana, Arial, Helvetica, sans; - font-size: 12px; - font-weight: bold; - color: #606060; - text-decoration: none; -} -li { - margin-bottom: 12px; -} - -li.newslist { - margin-bottom: 2px; -} - -ul.newslist { - margin-left: 10px; - margin-top: 10px; -} -ul { - margin-left: 25px; - margin-top: 10px; +body { + margin: 0px; + padding: 0px; + background-color: #dfeac1; + text-align: center; + text-decoration: none; +} + +.logo { + position:relative; + top:-8px; + left:22px; + float:left; +} + +.headerText +{ + color: White; + left: 350px; + top: 50px; + font-family: Verdana; + font-size: 150%; + font-weight: bold; + position: absolute; +} + +fieldset { + border: 1px solid #CCA383; + width: 60%; + background: LightGoldenrodYellow; + padding: 3px; + padding-bottom: 10px; +} + +fieldset legend { + background: PaleGoldenrod; + padding: 6px; + font-weight: bold; +} + +.formLabelCell +{ + text-align: left; + padding-left: 10px; + padding-right: 30px; + font-weight: bold; +} + +.formValueCell +{ + text-align: left; +} + +.actionPanel +{ + margin: 30px; + border: 1px solid #CCA383; + width: 50%; + background: LightGoldenrodYellow; + text-align: center; + padding: 5px; +} + +#headerCell +{ + background: url(../img/header-spring.png); + height: 150px; + width: 719px; +} + +#contentCell +{ + background-image: url(../img/bg-spring.png); + text-align: left; + vertical-align: top; +} + +#footerCell +{ + background-image: url(../img/footern.gif); + text-align: center; + height: 29px; +} + +.datagrid +{ + border: solid 1px Tan; + margin-left: 10px; +} + +.datagrid-header +{ + font-weight: bold; + background-color: Tan; +} + +.datagid-item +{ + background-color: LightGoldenrodYellow; +} + +.datagrid-alt-item +{ + background-color: PaleGoldenrod; +} + +.datagrid-footer +{ + font-weight: bold; + background-color: Tan; +} + +h1 { + font-family: Verdana, Arial, Helvetica, sans; + font-size: 14px; + font-weight: normal; + color: #90A720; +} +a, a:active, a:visited { + font-family: Verdana, Arial, Helvetica, sans; + font-size: 12px; + color: #606060; + text-decoration: underline; +} +a:hover { + font-family: Verdana, Arial, Helvetica, sans; + font-size: 12px; + color: #000000; +} +b { + font-family: Verdana, Arial, Helvetica, sans; + font-size: 12px; + font-weight: bold; + color: #606060; +} +i { + font-family: Verdana, Arial, Helvetica, sans; + font-size: 12px; + color: #606060; +} + +table { + font-family: Verdana, Arial, Helvetica, sans; + font-size: 12px; + color: #606060; +} +.news { + border: 1px solid; + border-color: #C9C9C9; + padding: 12px; + font-family: Verdana, Arial, Helvetica, sans; + font-size: 12px; + color: #606060; + background-color: #F5F5F5; + margin-top: 20px; + margin-bottom: 20px; +} + +li { + margin-bottom: 12px; +} + +ul { + margin-left: 25px; + margin-top: 10px; } \ No newline at end of file diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerEditor.aspx b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerEditor.aspx index 63ff4870..7061a2a4 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerEditor.aspx +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerEditor.aspx @@ -2,22 +2,36 @@ Inherits="CustomerEditor" %> - - - - - - - - - - -
- ID: -
- Contact: -
-
- +

+ Update customer information

+
+ +
+ Customer details + + + + + + + + + + + + +
+ ID: +
+ Contact: +
+
+
+
+ +
diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerEditor.aspx.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerEditor.aspx.cs index 6920e3de..ce673e79 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerEditor.aspx.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerEditor.aspx.cs @@ -1,69 +1,63 @@ using System; -using System.Web; using Spring.Northwind.Dao; using Spring.Northwind.Domain; using Spring.Web.UI; public partial class CustomerEditor : Page { - private ICustomerEditController customerEditController; - private ICustomerDao customerDao; + private ICustomerEditController customerEditController; + private ICustomerDao customerDao; - public ICustomerDao CustomerDao - { - set { this.customerDao = value; } - } - - public ICustomerEditController CustomerEditController - { - set { this.customerEditController = value; } - } - - public Customer CurrentCustomer - { - get + public ICustomerDao CustomerDao { - //return (Customer) Session[typeof(CustomerEditor).FullName + ".Customer"]; - return customerEditController.CurrentCustomer; + set { customerDao = value; } } - } -// public static void Edit( Customer customer ) -// { -// HttpContext.Current.Session[typeof(CustomerEditor).FullName + ".Customer"] = customer; -// } + public ICustomerEditController CustomerEditController + { + set { customerEditController = value; } + } - public CustomerEditor() - { - this.InitializeControls+=new EventHandler(Page_InitializeControls); - this.DataBound+=new EventHandler(Page_DataBound); - this.DataUnbound+=new EventHandler(Page_DataUnbound); - } + public Customer CurrentCustomer + { + get + { + return customerEditController.CurrentCustomer; + } + } - override protected void InitializeDataBindings() - { - base.InitializeDataBindings(); + public CustomerEditor() + { + InitializeControls += Page_InitializeControls; + DataBound += Page_DataBound; + DataUnbound += Page_DataUnbound; + } - // do the "one time" setup for databinding - } + override protected void InitializeDataBindings() + { + base.InitializeDataBindings(); - private void Page_DataBound(object sender, EventArgs e) - { - // perform custom tasks for binding data from model to the form - } + // do the "one time" setup for databinding + } - private void Page_DataUnbound(object sender, EventArgs e) - { - // perform custom tasks for unbinding data from form to the model - } + private void Page_DataBound(object sender, EventArgs e) + { + // perform custom tasks for binding data from model to the form + } - private void Page_InitializeControls(object sender, EventArgs e) - { - btnSave.Click += new EventHandler(BtnSave_Click); - } + private void Page_DataUnbound(object sender, EventArgs e) + { + // perform custom tasks for unbinding data from form to the model + } - private void BtnSave_Click(object sender, EventArgs e) - { - customerDao.SaveOrUpdate(CurrentCustomer); - } + private void Page_InitializeControls(object sender, EventArgs e) + { + btnSave.Click += BtnSave_Click; + } + + private void BtnSave_Click(object sender, EventArgs e) + { + customerDao.Update(CurrentCustomer); + Response.Redirect("~/CustomerView.aspx"); + } } diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerList.aspx b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerList.aspx index f38883b0..9863da94 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerList.aspx +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerList.aspx @@ -3,6 +3,8 @@ +

Customers in database

+ + +

Orders for customer

+ +
+ + + + + +
diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerOrders.aspx.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerOrders.aspx.cs index b65bfc77..dfa2f028 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerOrders.aspx.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerOrders.aspx.cs @@ -3,66 +3,64 @@ using System.Collections; using System.Web.UI.WebControls; using Spring.Northwind.Domain; -public partial class CustomerOrders:Spring.Web.UI.Page +public partial class CustomerOrders : Spring.Web.UI.Page { - private ICustomerEditController customerEditController; + private ICustomerEditController customerEditController; - public ICustomerEditController CustomerEditController - { - set { this.customerEditController = value; } - } - - public Customer SelectedCustomer - { - get + public ICustomerEditController CustomerEditController { - return this.customerEditController.CurrentCustomer; + set { customerEditController = value; } } - } - public CustomerOrders() - { - this.InitializeControls+=new EventHandler(Page_InitializeControls); - this.DataBound+=new EventHandler(Page_DataBound); - this.DataUnbound+=new EventHandler(Page_DataUnbound); - } - - override protected void InitializeDataBindings() - { - base.InitializeDataBindings(); - - // do the "one time" setup for databinding - } - - private void Page_DataBound(object sender, EventArgs e) - { - // perform custom tasks for binding data from model to the form - } - - private void Page_DataUnbound(object sender, EventArgs e) - { - // perform custom tasks for unbinding data from form to the model - } - - private void Page_InitializeControls(object sender, EventArgs e) - { - // create/initialize controls here - customerOrders.DataSource = SelectedCustomer.Orders; - if (!IsPostBack) + public Customer SelectedCustomer { - customerOrders.DataBind(); + get { return customerEditController.CurrentCustomer; } } - else - { - customerOrders.ItemCreated+=new DataGridItemEventHandler( this.CustomerList_ItemCreated ); - } - } - private void CustomerList_ItemCreated(object sender, DataGridItemEventArgs e) - { - if(e.Item.DataSetIndex > -1) + public CustomerOrders() { - e.Item.DataItem = ((IList)customerOrders.DataSource)[e.Item.DataSetIndex]; + InitializeControls += Page_InitializeControls; + DataBound += Page_DataBound; + DataUnbound += Page_DataUnbound; } - } -} + + protected override void InitializeDataBindings() + { + base.InitializeDataBindings(); + + // do the "one time" setup for databinding + } + + private void Page_DataBound(object sender, EventArgs e) + { + // perform custom tasks for binding data from model to the form + } + + private void Page_DataUnbound(object sender, EventArgs e) + { + // perform custom tasks for unbinding data from form to the model + } + + private void Page_InitializeControls(object sender, EventArgs e) + { + // create/initialize controls here + customerOrders.DataSource = SelectedCustomer.Orders; + customerName.Text = SelectedCustomer.CompanyName; + if (!IsPostBack) + { + customerOrders.DataBind(); + } + else + { + customerOrders.ItemCreated += CustomerList_ItemCreated; + } + } + + private void CustomerList_ItemCreated(object sender, DataGridItemEventArgs e) + { + if (e.Item.DataSetIndex > -1) + { + e.Item.DataItem = ((IList) customerOrders.DataSource)[e.Item.DataSetIndex]; + } + } +} \ No newline at end of file diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerView.aspx b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerView.aspx index 71cf3653..7d02181c 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerView.aspx +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerView.aspx @@ -1,25 +1,32 @@ -<%@ Page Language="C#" MasterPageFile="~/Shared/MasterPage.master" CodeFile="CustomerEditor.aspx.cs" - Inherits="CustomerEditor" %> +<%@ Page Language="C#" MasterPageFile="~/Shared/MasterPage.master" CodeFile="CustomerView.aspx.cs" + Inherits="CustomerView" %> - -
- - - - - - - - - -
- ID: -
- Contact: -
-
-
- +
+ +
+ Customer details + + + + + + + + + +
+ ID: + <%= CurrentCustomer.Id %> +
+ Contact: + <%= CurrentCustomer.ContactName %> +
+
+
+ +
diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerView.aspx.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerView.aspx.cs index 7e958131..d150b512 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerView.aspx.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/CustomerView.aspx.cs @@ -55,11 +55,7 @@ public partial class CustomerView : Page private void Page_InitializeControls(object sender, EventArgs e) { - btnSave.Click += new EventHandler(BtnSave_Click); + } - private void BtnSave_Click(object sender, EventArgs e) - { - customerDao.SaveOrUpdate(CurrentCustomer); - } } diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Default.aspx b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Default.aspx index 9943ba9d..99e348a7 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Default.aspx +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Default.aspx @@ -1,2 +1,13 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> -<%Response.Redirect("CustomerList.aspx");%> +<%@ Page Language="C#" MasterPageFile="~/Shared/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> + + + +

Welcome to Spring.NET Northwind sample application!

+ +

+This sample demostrates Spring.NET NHibernate integration and concepts. All data access is done using NHibernate and +all transactions are automatically handled by Spring.NET. +

+ +Proceed to customer listing » +
\ No newline at end of file diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Img/bg-spring.png b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Img/bg-spring.png new file mode 100644 index 0000000000000000000000000000000000000000..fdb377cd712d805fce02bc83c84390a7501ed50b GIT binary patch literal 2834 zcmV+t3+?oYP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16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/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Img/footern.gif b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Img/footern.gif new file mode 100644 index 0000000000000000000000000000000000000000..8375fea1e23a55170fa0689ebff32c4545a226f4 GIT binary patch literal 540 zcmZ?wbhEHbJkO-WaD;*3;p?N%-(Pt9`S!!tN1nbr`|ivA&);AC{`39*t3%&@zJ2rQ z)}OyW{{R2?;=|=<@6LVt{_Os%ga7~kXCN9V{$v5G)d7(pI~iF2E2uaHX3oo4wJzuN zz5<=|CAs%2*1fNJ|Np>(0uLRj{u5U-JiV;uUszG%wKi(~jWuQ2DSbO0Y^d+ z+=L)c0zH#%`Z9~qhEIfA}J$`b5@u~pR)7Nj_Zee|)#K`{c>$mUIxp_Z& zvvBbBiH(bo_bWJe{n0qU$W*5h zJabjd$xTa7Pd7+DHOF)Fva_=-ieKG1xq12d`3}uovR+$OTwLriSu6I`mX(*62Q2oQ z>$P>&)zuN3v+kbSy88P1gu`93-rLsP+?;WFRqW|)Yj1BaczkNE_x5#ncUOFVb@%l4 z_4oHTFmucK?AY+|aEGvV+?gF4A0MBf>^;wC=ccEpXBcPSJF|21^YaUwyXAa$ZFzZl SMeyplv%9utpHO6Aum%8T797_A literal 0 HcmV?d00001 diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Shared/MasterPage.master b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Shared/MasterPage.master index 8e9ea2f4..7edee251 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Shared/MasterPage.master +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Shared/MasterPage.master @@ -7,52 +7,38 @@
-
- - - - - - - - - - - - -
- -
- - - - - - - - - - - - - -
-
-
-
- - - - - -
-
-
-
-
-
+ +
+
+ + + + + + + + + + + + +
+ +
+ Goes Northwind
with NHibernate +
+
+
+ + + +
+
+
+
diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Web.config b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Web.config index 883c8916..d4cdec1e 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Web.config +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Web.config @@ -65,8 +65,10 @@ - - + + + + diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Web.xml b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Web.xml index 7883e61d..56782857 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Web.xml +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web/Web.xml @@ -34,6 +34,11 @@ + + + + + diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/test/Spring.Northwind.IntegrationTests/IntegrationTests/NorthwindIntegrationTests.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/test/Spring.Northwind.IntegrationTests/IntegrationTests/NorthwindIntegrationTests.cs index c45316a2..8471710f 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/test/Spring.Northwind.IntegrationTests/IntegrationTests/NorthwindIntegrationTests.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/test/Spring.Northwind.IntegrationTests/IntegrationTests/NorthwindIntegrationTests.cs @@ -20,8 +20,6 @@ #region Imports -using System; -using System.Collections; using System.Data; using NHibernate; using NUnit.Framework; @@ -99,7 +97,7 @@ namespace Spring.Northwind.IntegrationTests c.CompanyName = "SpringSource"; - customerDao.SaveOrUpdate(c); + customerDao.Update(c); c = customerDao.Get("MPOLL"); Assert.AreEqual(c.Id, "MPOLL"); @@ -149,7 +147,7 @@ namespace Spring.Northwind.IntegrationTests Assert.AreEqual(831, orderDao.GetAll().Count); order.ShipCity = "Sao Paulo"; - orderDao.SaveOrUpdate(order); + orderDao.Update(order); order = orderDao.Get(orderId); Assert.AreEqual("PICCO", order.Customer.Id);