|
You know that in DB there is a table for each existence.
Person, PhoneType, Phone, Register, Class, Teacher, etc; and for each of them there is a CRUD Form. If one of them will cancel so I would cancel all of the insertion before the current Form.
Did you get what I mean?
In other word I should update all of them if the last Form's DialogResult equals DialogResult.OK and reject all changes if it is DialogResult.Cancel.
Meysam
|
|
|
|
|
Meysam Tolouee wrote: Did you get what I mean?
No.
But now I get the feeling that what you have is quite dreadful. I'm glad you're trying to improve it.
|
|
|
|
|
Let's go forward step by step.
First the user will open and enter personal info about the first student in CustomerUI then he/she will close that. Now the entries will update at FormClosing by user's confirmation.
Second step the user is going to enter information about class registration. Now consider that the student doesn't want to register any more.
At thiss time there is a record in "Person" table in DB that is useless.
Was it clear?
Meysam
|
|
|
|
|
Meysam Tolouee wrote: I have created a CRUD Form for each table
That is a very bad idea; it's not how the user thinks of the task and the schema should not be so exposed to the user.
I also fear for what happens when the user deletes records improperly (not that delete should be allowed anyway).
|
|
|
|
|
I know and it is the reason that I want to improve my project for.
Meysam
|
|
|
|
|
Meysam Tolouee wrote: This question is about how improve my project to be more user friendly.
Have you considered asking your users[^]? Joel also has a nice article on dogfooding, well worth the read.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Sounds like you’re talking about a “transaction”.
Instead of multiple forms, it seems like a single form with multiple “tabs” of related information would be more effective.
Use the form to create a transaction for registering the student by first storing all data that is entered “locally”; in a local copy of the database or as XML on a local drive.
Cancelling the transaction is simple; you don’t commit to the “production” database and just delete the local copy.
If the transaction is complete and the student is to be registered, you post all the local data to the server in one step and then delete the local copy.
|
|
|
|
|
I like your idea and I am going to try it.
Thanks.
Meysam
|
|
|
|
|
I'd implement a menu bar &/or a toolbar. So no matter where the user is in the app (unless in a modal form) they can add a student quickly by selecting the "Add Student..." menu item. I would also include a shortcut for the menu item. I would add all the common tasks a user needs in the menu bar.
"You get that on the big jobs."
|
|
|
|
|
float Width = 47;
textBox1.Text = System.Convert.ToString(Width);
Consider above statements.
after executing this command the content of
textBox1.Text will be 46.99 instead of 47;
I've solved this problem by some functions, but I want to see is there any tuning in C# 2010 that I missed it? thanks
|
|
|
|
|
I'm not sure why you are seeing 46.99. When I run this code, I see 47 written out both times:
float myVal = 47;
string text = Convert.ToString(myVal);
Console.WriteLine(myVal.ToString());
Console.WriteLine(text);
|
|
|
|
|
There is no tuning for this. This is a side effect of trying to store an infinite number of floating point numbers in a finite amount of bits.
Read this[^] for more information.
|
|
|
|
|
0) Avoid float ; try Decimal or double
1) Avoid Convert ; in this case use ToString , perhaps with a format parameter
2) Avoid TextBox for numeric values; use a NumericUpDown
|
|
|
|
|
A project with an output type of class library cannot be started directly.In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project.
While running the program in C# visual studio 2010 I am getting this error...! please tell me how to sort out this error..!
Thanks.
Regards
|
|
|
|
|
You need an executable that calls into that DLL appropriately. If you haven't got one, you have to write on. If you have got one and it's in the same solution, right click on the project name for that executable and select "Set as StartUp project" from the context menu.
|
|
|
|
|
Thank you 
|
|
|
|
|
|
Since I am new to working a C# 2010 desktop application, I have the following questions to ask about how to accomplish the following tasks:
1. I would like to use linq to sql on a sql server 2008 r2 database to pull all the data from one column in one particular table. The value for the one array would be varchar(50) There will be more than one row selected at the time. (What I have seen of linq so far is to pull only one value by using singleordefault.)
2. I then would like to take the values obtained from step number one and load those values into array,collection, or some type of similar object.
Can tell me how to accomplisth this goal and/or point me to a reference that I can use?
|
|
|
|
|
classy_dog wrote: (What I have seen of linq so far is to pull only one value by using
singleordefault.)
There are many operations, such as Take(n) to take n rows, or ToList() to write to a generic List.
|
|
|
|
|
There is also a method ToArray() to return an array instead of a list. One of the advantages of both ToArray and ToList is that it forces immediate execution, instead of the default defered of LINQ. In addition to Take method, there is a Skip method
|
|
|
|
|
Hi
i have a fileupload control in form, and now i want to check the size of file before upload it. i wrote this code but the value of fileSize = 0 all the time. what should i do. can anybody help me?
int fileSize = fuSignature.PostedFile.ContentLength
|
|
|
|
|
ptvce wrote: before upload
You code seems to be the server-side code and will be executed AFTER the file is uploaded. To check the file size before uploading the file, you've to use client side code i.e. JavaScript. But JavaScript does not allow accessing file system due to security reasons. Here[^] is an inelegant approach to do this if you are targeting only IE.
|
|
|
|
|
That code doesn't work because ASP.NET is a server side technology. In other words, you have to transfer the posted file to the server before it can work out how big it is. There are things that you can do, but they generally involve compromises - one trick is to use a flash uploader control which can get access to the users hard disk to retrieve this information. Alternatively, if you know that your clients aren't going to be using Internet Explorer, you can use this function:
<script type='text/javascript'>
function showFileSize() {
var input, file;
if (typeof window.FileReader !== 'function') {
alert('The file API isn't supported by your browser');
return;
}
input = document.getElementById('fileinput'); // Or whatever name your input control is...
if (!input) {
alert('You don't seem to have a file input control');
return;
}
if (!input.files) {
alert('This browser doesn't seem to support files.');
return;
}
if (!input.files[0]) {
alert('You havent picked a file');
return;
}
file = input.files[0];
alert("The file is " + file.size + " bytes");
</script> If your clients have IE, you may have to use an ActiveX control.
A final note - you really should have posted this in the ASP.NET forum.
|
|
|
|
|
I have developed a C# .Net 3.5 Windows service application that works perfectly fine when I run it in Visual Studio, however when I try to install it on a Windows 2008 R2 64-bit server, it fails to start.
The only error that is shown is:
A system error has occurred.
System error 1067 has occurred.
The process terminated unexpectedly.
No more information, nothing at all in the event log. There is no Com+ or similar, just a plain service. (Also tried to remove all logic from the service with no luck).
I've tried to compile all parts with "AnyCPU" and 64-bit without luck. I've tried both the 32-bit and 64-bit installutil.
If I copy the entire folder to a Win7 machine (64bit) and install it in the exact same way, it works like it should.
Any ideas at all on how to resolve this? I'm pretty much out of ideas and without any logs whatsoever, it's hard to find out what it could be.
|
|
|
|
|
Add some logging to your program. You could use a common logging framework like log4net. Good places to start with are the constructor of your service and the OnStart method. You'll see then how far the initialization runs on that machine, and can get an idea about what went wrong.
|
|
|
|