business-logic

How to call DataAnnotations in business layer (ASP.NET)?

I would like to use the DataAnnotations on my transfer objects. However how do I call them in the business layer to verify the input? Is this by some method call or reflection? I do not use ASP.NET but standard ASP.NET and would like to call the data annotations in the business layer. ...

Design question - how atomic should a business layer method be?

This issue is technology agnostic, but I am working with C# and ASP.NET and will use this for the pseudo code. Which is the better approach, and why? Encapsulate logging, transaction and exception handling: protected void Page_Load(object sender, EventArgs e) { SomeBusinessClass.SomeBusinessMethod(); } public class SomeBusinessClas...

Business Logic Classes Naming

I have a business layer that has some business objects/POCOs/entities/whatever. I also have some repositories for the data access. Up until this point, I've been accessing the repositories directly from my UI layer. I'm at a point where I actually need some more classes that aren't straight CRUD, so I'm going to create some business logi...

Business logic and services

In a three-tier/multitier architecture (UI/Logic/DAO/Domain model), can services be considered as belonging to the business logic layer or are they situated as something separate ? ...

Average pricing implementation in a POS application?

I am developing a POS (Point of Sale) application which should be able to calculate average price. Here is the deal, i don't know what it is and how it is calculated for consumer products. I just got this requirement. All i know is this, that there is no way to know from which particular stock of goods, an item was sold from (i.e. when s...

What are essential framework services for a mid-sized company?

I create .NET applications for a mid-sized manufacturing company. I would like to create a number of "framework" web services that can be employed by most of my applications. What web services have you found to be useful for reuse within such an environment? UPDATE: applications will do everything from e-commerce with external custom...

Business rules in the repository?

Let's assume that an application has all necessary business rules in the model / presentation layer and that they work fine. My question is one of whether or not redundant business rules (i.e. a span of two dates cannot overlap any other existing spans) should be used in a repository like SQL Server. Is it necessary/beneficial to add a...

Table Module / Table Gateway - Where to put code for loading from gateways?

Not sure if there is a "correct" answer to this, so I've flagged it as community wiki. Apologies for the long pre-amble. I am building a modestly sized web application in .Net, and have settled on a table based architecture. My DAL layer consists of a set of TableGateway classes that handle loading/saving data to the database - these re...

Business Layer Logic (BLL) is about data?

I think BLL is about Data. It should not include a method called SendEmail. BLL is a place for caching data, manipulating it, doing calculations related to business. Sending email is a business process but the code which actually send the email should be outside of BLL namespace. Is BLL only about data ? ...

C# Business objects and collections

I'm having difficulty wrapping my head around business objects or more specifically, business object collections. Here's a quick example of what i'm trying to do. If i have an Incident Object, this object can have a number of people involved and each of those Person objects can have multiple notes. Notes can't exist without a Person ob...

Should you Unit Test Business Logic methods that consists primarily of a query?

I have a business logic layer with a broad spectrum of classes and their corresponding methods. Creating a Unit Test for a method is generally a given but, in some cases, the method really just returns a set of matching records from the database. It seems kind of silly to write a Unit Test by, say, storing five matching records and then...

What pattern/patterns work best for developing rule/decision engine

I am working on a decision engine / rule evaluation engine. For example: Input: Customer and all the offences done by the customer Output: Consequences of the offences A sample case would be: Input: Customer(Jhonny Chimpo, 999-00-1111), Offences ( Broke window, slapped boss, kicked team lead in his groin) Output: Gets pink slip So ...

How to separate model from gui ?

Hello I hope this is not something very trivial and obvious. I have some similar programs that I am working at. In each program I have to implement future about saving projects. I came with following design : Project -- Program1Project -- Program2Project The base class Project : class Project { public: void NewProject(); vo...

Add working hours to timestamp

Hi, I need to add working hours to a timestamp. Working hours are from 8am to 6pm. Lets say we have 2pm and I have to add 6 hours. Result should be 10am... any guesses? Thanks. ...

Code improvements for implementing business logic

I had asked this question previously on SO. This is related to it. We have code base similar to this: IRecipie FindRecipiesYouCanMake(IEnumerable<Ingredientes> stuff, Cook cook) { if(stuff.Any(s=>s.Eggs && s.Flour) && cook.DinerCook) { if(s=>s.Sugar) return new Pancake("Yum"); if(s=>s.Salt) return new Omlette("Yay"); } /*....

Where to put restrictions on entities when separating Business layer from Data Layer

I am attempting to create the the business and data layers for my big ASP.NET MVC application. As this is the first time for me attempting a project of this scale I am reading some books and trying to take good care at separating things out properly. Usually my applications mix the business logic and data access layers, and multiple bu...

Is this how a modern news site would handle it's sql/business logic?

Basically, the below image represents the components on the homepage of a site I'm working on, which will have news components all over the place. The sql snippets envision how I think they should work, I would really appreciate some business logic advice from people who've worked with news sites before though. Here's how I envision it: ...

Pointers towards developing a quick and dirty business app.

Some people have approached me lately about creating a business app for them (I'm a computer tech student specializing in programming, with a bit of experience in systems and driver programming) and it does sound simple, but I don't really have much of an idea how or where to start. It should be a small-ish app with a database backend. ...

How do I go about handling the shifting of news articles in regards to main, featured, and category areas?

Consider a template such as this ( questions posted below ): Let's say I posted an article about the Superbowl and tagged it in the Sports category. In my articles table I have a flag for featured or not, and a flag for main article. So if I check the main flag it shows up as the main article. If I post another main article a day late...

I need to know the disadvantages do keep Business Layer in Procedures ...

In my work, i have a friend that insists to keep the business logic inside the database using stored procedures ... What are the arguments that i can use to convince him not to do such thing? The reason he want to do this is because we have multiple systems with diferent plataforms (Web Application in .NET with VB.NET and another Deskt...