Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
C#
[BrowsableAttribute(false)]
[BindableAttribute(false)]
public override string Text { get; set; }
?
Posted
Updated 19-Jan-15 11:15am
v3
Comments
[no name] 15-Jan-15 18:27pm    
YourBLL class seems to be disapeard and the question is "code fromated" :(
Sergey Alexandrovich Kryukov 15-Jan-15 18:39pm    
What "Forms" if this is DAL and BLL, that is, no UI? Those architectures were devices to isolate layers, especially UI, not to puzzle you with connectivity between the layer... :-)
—SA
PIEBALDconsult 15-Jan-15 19:01pm    
Why, in Bob's name, does the GetNewCaseNumber method call DatabaseFactory.CreateDatabase ?
The DAL should hold an instance of that and set it in its constructor. It should (generally) not be called more than once per run.
Mycroft Holmes 15-Jan-15 20:37pm    
What happens if your user cancels the case creation process? You have a crappy record already created in the database.

You need to redesign your application.
DAL - creates a connection to the database on startup and handles all interaction to the database.

BLL - basically reflects the IU needs. For example you should have a class that handles the case functionality. When you want to create a new case it should...
clear down all the current content (incase the was a viewed case)
populated all the defaults for a new case
wait for the user to input the information (nothing in the database yet)

When the user saves the case THEN you validate the content and write it to the database.
 
Share this answer
 
Comments
Mycroft Holmes 15-Jan-15 22:05pm    
Ok redesign the app may be a bit strong but you need to address the issue where you are creating the database object BEFORE the user has saved the case.

Assuming the case number is an identity field in SQL Server I used to return the @Scope_Identity() after the insert.

These days I return the entire object eg Select * from CaseView where ID = @Scope_Identity()

Because I use a view this gives me the associated fields for the UI (FK description fields etc).
Mycroft Holmes 16-Jan-15 19:05pm    
But you already have all the bits, in your BLL method you call the static DAL method and it returns the string response from ExecuteScalar.
string sResponse = DALNamespace.GetNewCaseNumber(Date, CaseType);

Where DAL is the namespace for your static DAL class

I must be missing something, this is too simple to be the problem.
added property to my UI, used it from there.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 29-Apr-15 19:36pm    
Sorry, this is not an answer. Such posts are considered as abuse. You could simply informs the readers using comments or "Improve question". I would advise to remove this post, to avoid abuse reports.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900