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 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
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
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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">
...
|
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...
|
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
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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...
| |