473,396 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Passing Validation result between tiers??

I have created a class ValidationResult which
looks like:
class ValidationResult
{
ValidationStatus Status;
ValidationItemCollection Items;
}
The ValidationItem is defined as below:
class ValidationItem
{
ValidationStatus Staus;
string Code; // Error code usually, but can be a warning, info or sth
else
string Message;
}
ValidationStatus is an enumeration which for the moment is defined as:
enum ValidationStatus
{
Success,
Failed
// Later can be added Warning, Info etc.
}
Now the problem is how to pass the ValidationResult object to the UI. I see
3 options:
1. throw an exeception which has a property of type ValidationResult. The UI
then can catch the exception and proceed. Looks a bit messy to me...
Pros: Force the UI to handel the validation.
Cons: Looks like a bad design. UI code would be messy...
2. Fire an event on a "global" object accessible from both UI and
components. "Recomment" the UI to attach an event handler...
Pros: UI code should be better organized...
Cons: UI is not forced to handle the event...
3. Use some kind of queue to add the ValidationResult objects from the
components and poll them from the UI.
Pros: ?
Cons: ?

Any thoughts are welcome.

Thanx,
Albert

Aug 2 '05 #1
4 1572
Instead of this why cant you make the class as static and access the
validationstattus anywhere.It will be an good solution.

"Albert Tollkuçi" wrote:
I have created a class ValidationResult which
looks like:
class ValidationResult
{
ValidationStatus Status;
ValidationItemCollection Items;
}
The ValidationItem is defined as below:
class ValidationItem
{
ValidationStatus Staus;
string Code; // Error code usually, but can be a warning, info or sth
else
string Message;
}
ValidationStatus is an enumeration which for the moment is defined as:
enum ValidationStatus
{
Success,
Failed
// Later can be added Warning, Info etc.
}
Now the problem is how to pass the ValidationResult object to the UI. I see
3 options:
1. throw an exeception which has a property of type ValidationResult. The UI
then can catch the exception and proceed. Looks a bit messy to me...
Pros: Force the UI to handel the validation.
Cons: Looks like a bad design. UI code would be messy...
2. Fire an event on a "global" object accessible from both UI and
components. "Recomment" the UI to attach an event handler...
Pros: UI code should be better organized...
Cons: UI is not forced to handle the event...
3. Use some kind of queue to add the ValidationResult objects from the
components and poll them from the UI.
Pros: ?
Cons: ?

Any thoughts are welcome.

Thanx,
Albert

Aug 2 '05 #2
A static class is variation of the third option.
It can work, but it's not a good OO design...I'm not sure if it's the right
way to go...

"Santhi Maadhaven" <Sa*************@discussions.microsoft.com> wrote in
message news:F9**********************************@microsof t.com...
Instead of this why cant you make the class as static and access the
validationstattus anywhere.It will be an good solution.

"Albert Tollkuçi" wrote:
I have created a class ValidationResult which
looks like:
class ValidationResult
{
ValidationStatus Status;
ValidationItemCollection Items;
}
The ValidationItem is defined as below:
class ValidationItem
{
ValidationStatus Staus;
string Code; // Error code usually, but can be a warning, info or sth
else
string Message;
}
ValidationStatus is an enumeration which for the moment is defined as:
enum ValidationStatus
{
Success,
Failed
// Later can be added Warning, Info etc.
}
Now the problem is how to pass the ValidationResult object to the UI. I
see
3 options:
1. throw an exeception which has a property of type ValidationResult. The
UI
then can catch the exception and proceed. Looks a bit messy to me...
Pros: Force the UI to handel the validation.
Cons: Looks like a bad design. UI code would be messy...
2. Fire an event on a "global" object accessible from both UI and
components. "Recomment" the UI to attach an event handler...
Pros: UI code should be better organized...
Cons: UI is not forced to handle the event...
3. Use some kind of queue to add the ValidationResult objects from the
components and poll them from the UI.
Pros: ?
Cons: ?

Any thoughts are welcome.

Thanx,
Albert

Aug 2 '05 #3
On Tue, 2 Aug 2005 13:45:31 +0200, "Albert Tollkuçi"
<al****@shqiperia.com> wrote:
A static class is variation of the third option.
It can work, but it's not a good OO design...I'm not sure if it's the right
way to go...

"Santhi Maadhaven" <Sa*************@discussions.microsoft.com> wrote in
message news:F9**********************************@microsof t.com...
Instead of this why cant you make the class as static and access the
validationstattus anywhere.It will be an good solution.

"Albert Tollkuçi" wrote:
I have created a class ValidationResult which
looks like:
class ValidationResult
{
ValidationStatus Status;
ValidationItemCollection Items;
}
The ValidationItem is defined as below:
class ValidationItem
{
ValidationStatus Staus;
string Code; // Error code usually, but can be a warning, info or sth
else
string Message;
}
ValidationStatus is an enumeration which for the moment is defined as:
enum ValidationStatus
{
Success,
Failed
// Later can be added Warning, Info etc.
}
Now the problem is how to pass the ValidationResult object to the UI. I
see
3 options:
1. throw an exeception which has a property of type ValidationResult. The
UI
then can catch the exception and proceed. Looks a bit messy to me...
Pros: Force the UI to handel the validation.
Cons: Looks like a bad design. UI code would be messy...
2. Fire an event on a "global" object accessible from both UI and
components. "Recomment" the UI to attach an event handler...
Pros: UI code should be better organized...
Cons: UI is not forced to handle the event...
3. Use some kind of queue to add the ValidationResult objects from the
components and poll them from the UI.
Pros: ?
Cons: ?

Any thoughts are welcome.

Thanx,
Albert


Forgive my ignorance. Are you talking about windows genuine
validation?
Greg Ro
Aug 2 '05 #4
No, I'm taking about business rules validation.

"Greg Ro" wrote:
On Tue, 2 Aug 2005 13:45:31 +0200, "Albert Tollkuçi"
<al****@shqiperia.com> wrote:
A static class is variation of the third option.
It can work, but it's not a good OO design...I'm not sure if it's the right
way to go...

"Santhi Maadhaven" <Sa*************@discussions.microsoft.com> wrote in
message news:F9**********************************@microsof t.com...
Instead of this why cant you make the class as static and access the
validationstattus anywhere.It will be an good solution.

"Albert Tollkuçi" wrote:

I have created a class ValidationResult which
looks like:
class ValidationResult
{
ValidationStatus Status;
ValidationItemCollection Items;
}
The ValidationItem is defined as below:
class ValidationItem
{
ValidationStatus Staus;
string Code; // Error code usually, but can be a warning, info or sth
else
string Message;
}
ValidationStatus is an enumeration which for the moment is defined as:
enum ValidationStatus
{
Success,
Failed
// Later can be added Warning, Info etc.
}
Now the problem is how to pass the ValidationResult object to the UI. I
see
3 options:
1. throw an exeception which has a property of type ValidationResult. The
UI
then can catch the exception and proceed. Looks a bit messy to me...
Pros: Force the UI to handel the validation.
Cons: Looks like a bad design. UI code would be messy...
2. Fire an event on a "global" object accessible from both UI and
components. "Recomment" the UI to attach an event handler...
Pros: UI code should be better organized...
Cons: UI is not forced to handle the event...
3. Use some kind of queue to add the ValidationResult objects from the
components and poll them from the UI.
Pros: ?
Cons: ?

Any thoughts are welcome.

Thanx,
Albert


Forgive my ignorance. Are you talking about windows genuine
validation?
Greg Ro

Aug 2 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: comp.lang.php | last post by:
On one of my sites, I have a TCL CGI script that has a security hole in spite of it having effective server-side validation (the fact that it's CGI IS its security hole). The front end is a PHP...
3
by: Simon Harvey | last post by:
Hi, In my application I get lots of different sorts of information from databases. As such, a lot of information is stored in DataSets and DataTable objects. Up until now, I have been passing...
2
by: TS | last post by:
If I have custom data entity objects that are simple classes with properties storing data for a particular entity, then I want to pass this object to another server, how does the other server know...
0
by: Boltar | last post by:
Hello, I am trying to use a CustomValidator control to perform client-side validation via a server callback. I have an example below that validates if a textbox contains an odd number. I...
4
by: Albert Tollkuçi | last post by:
I have created a class ValidationResult which looks like: class ValidationResult { ValidationStatus Status; ValidationItemCollection Items; } The ValidationItem is defined as below: class...
3
by: Andy | last post by:
Hi, Have just found a bug in Netscape for some of my Javascript code - works ok in Internet Explorer. Given the following form element: <input type="text" compulsory = "yes" name="an_el"> ...
2
by: grawsha2000 | last post by:
Greetings, I am developing this N-tier business app. The problem I'm facing is when I try to pass business objects (employees, dept..etc) from business tier to data tier,i.e., the add method in...
9
by: =?Utf-8?B?RXZlcnQ=?= | last post by:
Does anybody have a good example/guide for using LINQ in a layered architecture with maybe WCF? Thanks in advance, Evert
4
by: jehugaleahsa | last post by:
Hello: Is it me, or is handling the Validating event for every control on a form extremely annoying? It is especially annoying when my business logic repeats most of the validation. Some things...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.