NHibernate is a small item (5)

xiaoxiao2021-03-06  42

After writing the data layer, you must write the business layer. In fact, this little item can be merged together, but in order to reflect an N layer concept, I also separated it out, Anyway, there is not much code to write.

Using

System;

Using

System.collections;

Using

Guestbook.data;

Using

Guestbook.dal;

Namespace

Guestbook.bll

{/ ** ////

/// GuestBookbll's summary description. /// public class guest cookbll {public void addguestbook (GuestBooks GB) {IF ((gb.Title.trim () == String.empty) || (gb.username.trim () == String.empty ))); Guestbookdal Dal = new guestbookdal (); Dal.AddGuestBook (GB);} public void updateguestbook (GuestBooks GB, INT ID) {IF ((gb.title.trim () == String.empty) || gb.username.Trim () == string.Empty)) return; guestbookdal dal = new guestbookdal (); dal.updateGuestBook (gb, Id);} public void DelGuestBook (guestbooks gb) {guestbookdal dal = new guestbookdal (); Dal.delsTbook (GB);}}}

Using

System;

Using

System.collections;

Using

Guestbook.data;

Using

Guestbook.dal;

Namespace

Guestbook.bll

{/ ** ////

/// Usersbll's summary description. /// public class usersbll {public users login (string username, string password) {// Simple business verification if ((username.trim () == string.empty) || (Password.trim () == String.empty)) Return Null; usersdal Dal = new usersdal (); user = Dal.login (username, password); return user;} public void useradd (useer) {ix ((user.name.trim) () == String.empty) || (User.Password.trim () == String.empty)) Return; usersdal Dal = new usersdal (); Dal.Adduser (user);}}} just added some very Simple verification, there is also a feature that doesn't want to complete on the web, just add it here, huh, huh

Compile, continue to test with NUNIT,

Green, cool! ! ! ! ! ! ! ! ! ! ! ! !

转载请注明原文地址:https://www.9cbs.com/read-68739.html

New Post(0)