|
ok
I will let you know shortly whats going on
thanks a lot
Roni
|
|
|
|
|
Hi Henry
I have tried the code that you supplied but it's not showing the number in the button e.g. Soup
|
|
|
|
|
I explained that this was just for the first part - getting the number from the user.
I also explained that without storing this value, it was not possible to add it to the button.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
Oh ok sorry I didnt understand that
|
|
|
|
|
Think about a situation where the user of your application goes to the 'Manage->Stock In' screen and adds to the Soup, Olives and several other items. How can all that information be passed back so that it is available to the Soup button, the Olives button and all the others. Without a massive List<> or array it cannot really be done.
It might just be possible if there was a Dictionary<foodItem, quantity> with global scope so that both the 'Stock In' Form and the 'Starter Button UC' could 'see' it but then you would have a situation where the buttons for the items selected by the user (Soup, Olives etc) would have a number but none of the other buttons would. Which would look very odd! (I could show you how to do it this way, but I would not be helping you properly. I would be showing you bad practices, which I don't like doing.)
Also, so that the numbers would appear next time the app was started there would have to be some mechanism to serialize the dictionary when the app closed and deserialize it when the app starts up again. Very messy. It is a Database backed Application so use the Database instead. As things are, you are moving to the situation that causes applications to get to the stage where no-one can maintain them because there are work-arounds to get round the work-arounds to get round the work-arounds, and so on.
You should pause now and consider ALL of the features that you are going to want in this app and design a Database that will be able to cope with them. While you are paused you should also consider the fact that your project is getting incredibly large, not over all but the number of files it contains. There is a very strong case here for removing all of the Data Access code from the current forms and putting it into a separate project. The Forms and UCs would then call a method in that project and have a DataTable, or List/Array depending on their needs, returned that they would work with.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
Hi Henry
Ok can you advise me how to do it and what to do next
kind regards
roni
|
|
|
|
|
Hi Roni,
Well, as I said in my last message think about all of the things that you want the application to do and decide which parts of each of those things you want to do for real and which of them you want to only do partially and simulate the rest. A lot of this will depend on if your application is for use in the real world or just for your education/amusement or whatever.
To use this 'showing the in-stock number on the buttons' feature as an example. (this is how I see it BTW, you may see it differently)
1 You want the number displayed.
2 It therefore makes sense for it to be there when the app starts up.
3 For that to happen the numbers should either be stored somehow and real numbers used or they should be totally made up so that every button gets say 10 at start up.
4 Should the number decrease every time that item is ordered.
5 If they decrease, what should happen when the number reaches zero. Should it automatically get topped back up to 10 or should the user have to do something. If automatic will they be real stock or just a number. If automatic and it is real stock what happens if there are none in stock to top up the button with. If the user has to do something should it be like it is now or might it be better if there was a context menu for each button with a 'Replenish Stock' item that would put up the InputBox type thing so that the user just tops up that button.
And so on. Once you have decided all these things you will have a better idea of what needs to be done.
As far as the separate project for the Data Access stuff is concerned. There are currently 4/5 or even more places where a OleDbConnection is created, used and then disposed. There should be just one method that returns an OleDbConnection when it is called (just for example lets say it is called GetConnection(). The ConnectionString should be stored in the *.config file (encrypted) and that should be the only one that is used. If a particular Form needs a list of the Starters it should call a method called something like GetCourseMenuData() and pass in a string "Starter" and get back a List, an Array or a DataTable with the data it needs. If another Form/UC needs the Desserts it should call GetCourseMenuData("Dessert"). GetCourseMenuData() should call GetConnection() and dispose of it when it is done. There should be no need to call GetConnection() from any of the Forms or UCs in the User Interface part of the Application.
By doing these things when there is a problem with getting a connection you know that the bug/problem can only be in one place in your code.
Have a think about it and let me know when you are ready to start and which part you want to start on. Even if you decide to carry on as it is now, I will try to help where I can.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
Hi Henry
Going back to step number 4 of your last question,
-As a matter of fact yes the number has to be decreased on the button every time the user orders that item,
and on step 5:
-Well basically when it reaches zero to disable that button (such as enable = false), or draw sort of X (diagonally) accross that button,
-It doesnt have to be topped up automatically.
Let me explain in another way....
Say for instance the Manager asks the chef in the kitchen about food items, and the Chef sas to the Manager I have only 10 soups for dinner,
What the Manager should do then notify all the waiters that there are only 10 soups for dinner,
And then the Manager should go to the computer system (in this case my project for insatance)
Click the:
-Manage button, then
-StockIn button, then
-Select Starter Button (the items get displayed to datagridview)
-Double click the particular datagridview cell (in this case the Soup)
-Insert qty num for that item (such as 10)
-And that number should be displayed inside the Soup Button.
(a) Now if all 10 soups get ordered (for instance by customers) the number should be decreased untill reaches zero and enable = false that button.
This what the DatagridView should look like before Manager takes action...
===============================================================
FoodName FoodType Qty In Stock Status
===============================================================
Olives Starter 0 <Allways on Stock>
Soup Starter 0 <Allways on Stock>
etc... etc... etc... etc...
===============================================================
This what the DatagridView should look like after Manager takes action...
===============================================================
FoodName FoodType Qty In Stock Status
===============================================================
Olives Starter 0 <Allways on Stock>
Soup Starter 10 <Controlled>
etc... etc... etc... etc...
===============================================================
(b) But in the mean time (this is reverse scenario) if Chef can manage to make more soup for that dinner and tells the Manager that he has enough soup, then the manager should go back do the same procedure and enable = true the soup button.
And finally this what the DatagridView should look like (read step (b)) when Manager takes action....
===============================================================
FoodName FoodType Qty In Stock Status
===============================================================
Olives Starter 0 <Allways on Stock>
Soup Starter 0 <Allways on Stock>
etc... etc... etc... etc...
===============================================================
in the mean time I would like to carry on as it is now I hope you dont get upset
Kind regards
roni
|
|
|
|
|
Hi Roni,
Just to let you know that I have seen your latest message.
I've been too busy today but I have had a couple of ideas and I'll try them out tomorrow before contacting you.
In the mean time, if you don't already know, it would help if you tested the buttons to see if they will take a two line text, so that you can have 'Soup' on the top line and the number on the next one.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
Hi Henry
I just cam back from work.
I read your message and I tried the code last night and today aswell but it doesn't show the number on button...
Kind regards
roni
|
|
|
|
|
Hi Henry
Are you online
Roni
|
|
|
|
|
Hi Roni,
Yes.
I was going to call you later.
What can I do for you?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
Im trying to sort this datagridview for a quite sometime and its doing my heading...
|
|
|
|
|
Well, as I said the other day I have had two ideas.
1) Add a column to the Food Table and the Drink Table 'QtyInStock' to hold the information. Although as I don't know how you calculate(?) the data for the Status field I can't advise on that at the moment.
2) Implement a Dictionary (or similar Collection) to hold the information and read it in when the application starts and write it out to disk when the app closes.
Both of these will involve quite complex changes to the code.
With 1), to make it work properly you would have to at least do part of what I mentioned a while ago and move the Data access stuff out into a separate project so that you can then be sure that both the StartersUC (and MainsUC and DessertUC etc.) and the Stock-In form are guaranteed to be looking at the same DataSet/DataTable so that when you update the data in Stock-In the UCs get notified and can update their buttons. Similarly when the buttons decrease the number the next time you go to Stock-In it sees the new figures.
With 2) to ensure that all the Forms/UCs etc. that need to are looking at the same collection it would have to be implemented as a Singleton Class. There is also the Serialization and Deserialization to be dealt with.
As I say, both will require substantial changes to the existing code because the application was not designed from the start to allow for this sort of thing. It has sort of just grown little bits to deal with specific problems in isolation, not as a part of the whole application. It is nobody's fault. It is a result of having asked for help about a specific thing, getting a helpful response and coding to that. The problem is that the responders had no idea how their suggestions would impact on the other parts, because they did not know about them.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
Hi Henry
How are you, just wanted to say hello...
kind regards
roni
|
|
|
|
|
Hi there Roni,
Sorry for the delay in replying. I moved your message somewhere safe so I could reply later and forgot where I put it.
I'm OK. Hope you are too.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
Hi Henry
How are you, I hope you ok too
roni
|
|
|
|
|
Hi Henry
are you still online
I need to ask you something if possible
kind regards
roni
|
|
|
|
|
you know the datagridview I have the one with qty in stock and status,
how can populate this two columns with data? Is ther a loop to use or something else...
This is what datagridview looks when I click the starter button
===============================================================
FoodName FoodType Qty In Stock Status
===============================================================
Olives Starter
Soup Starter
Caprese Starter
Bruschetta Starter
Mushroom Starter
Antipasto Starter
Scallops Starter
Calamari Starter
Crab Avocado Starter
Pizza Bread Starter
===============================================================
And this is what datagridview should look like when when generating the other to column template...
=================================================================
FoodName FoodType Qty In Stock Status
=================================================================
Olives Starter 0 Allways On Stock
Soup Starter 0 Allways On Stock
Caprese Starter 0 Allways On Stock
Bruschetta Starter 0 Allways On Stock
Mushroom Starter 0 Allways On Stock
Antipasto Starter 0 Allways On Stock
Scallops Starter 0 Allways On Stock
Calamari Starter 0 Allways On Stock
Crab Avocado Starter 0 Allways On Stock
Pizza Bread Starter 0 Allways On Stock
=================================================================
here is the code of cmdStarter_Click even button....
private DataGridViewTextBoxColumn ColFoodQtyStock = new DataGridViewTextBoxColumn();
private DataGridViewTextBoxColumn ColFoodStatus = new DataGridViewTextBoxColumn();
private void cmdStarters_Click(object sender, EventArgs e)
{
OleDbConnectionStringBuilder connBuilder = new OleDbConnectionStringBuilder();
connBuilder.DataSource = @"C:\Users\AP_AE\Desktop\DTPOS_APP\DataBase\DtposMenu.accdb";
connBuilder.Provider = "Microsoft.ACE.OLEDB.12.0";
connBuilder.Add("Jet OLEDB:Engine Type", "5");
string foodTypeSql = @"SELECT FoodName, FoodType FROM Food WHERE FoodType = @foodType";
using (OleDbConnection conn = new OleDbConnection(connBuilder.ConnectionString))
{
dataGridView1.Columns.Clear();
dataGridView1.RowTemplate.Height = 60;
dataGridView1.Visible = true;
dataGridView2.Visible = false;
try
{
OleDbCommand foodsCommand = new OleDbCommand(foodTypeSql, conn);
OleDbParameter foodType = foodsCommand.Parameters.Add("@foodType", OleDbType.VarChar, 15);
OleDbDataAdapter foodsDa = new OleDbDataAdapter(foodsCommand);
DataSet ds = new DataSet();
conn.Open();
foodType.Value = "Starter";
foodsDa.Fill(ds, "Food_table");
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "Food_table";
dataGridView1.Columns.AddRange(ColFoodQtyStock, ColFoodStatus);
DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle1.Font = new Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dataGridView1.Columns[0].Width = 420;
this.dataGridView1.Columns[1].Width = 180;
this.dataGridView1.Columns[2].Width = 300;
this.dataGridView1.Columns[3].Width = 308;
ColFoodStatus.HeaderText = "Status";
ColFoodStatus.Name = "ColFoodStatus";
ColFoodQtyStock.HeaderText = "Quantity In Stock";
ColFoodQtyStock.Name = "ColFoodQtyStock";
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex);
}
}
}
|
|
|
|
|
Hi,
I've got a strange issue that I need a little help with understanding fully. I've posted this on the Inno setup list a few days ago with no response so I thought I'd ask here as well.
There are functions in my application to allow users to select a file in the view of the application and then selectively either open it in another editor application (user configurable) or open Windows Explorer with the file selected. I'm using a ProcessStartInfo object passed to the Process.Start(processStartInfo) method.
This is all working as expected when I run in debug/release from within VS. It also works as expected if I go to either the Release or Debug folders and launch the application outside of Visual Studio. Neither Visual Studio nor the application is running as admin. If I copy either of these to another location on the same machine and launch the app it also works as expected.
As soon as I build the installer and run the install (built using Inno Setup) these functions stop working. This led me to believe that UAC is the issue but what I've tried baring that in mind has only served to confuse me further.
I have an older installer for the same application, if I install this one the functions work as expected! Also, without running as admin. This application code hasn't been touched between these two different versions / installers. The Inno build script is also identical between the two installers.
The difference is that the new one was built on my new Windows 7 (64 bit) dev machine, the old installer was built on my old WinXP dev machine. Both are being installed the Windows 7 machine. The other difference is that I'm using the much newer latest build of Inno itself with the new InnoIDE but I can't imagine that contributing to the weirdness.
Basically, I'm confused as to where to go to fix this, does the setup / script need to change or should I be looking to the app source code for changes to solve this issue? Why does the old installer / app work?
The really odd thing is that even running the new version (post installing it) as admin doesn't fix the issue, it appears that the OS still denies my application the right to launch external programs.
Any pointers on this would be great, I'm really at a loss as to where to go from here.
Thanks in advance,
|
|
|
|
|
If anyone has any pointers on this it would be really appreciated.
Cheers,
|
|
|
|
|
i have a programm that it should have in it's output a file with .url suffix ...
when double click on file , browser open and go to that adress in the URL property in .url properties files ...
but i don,t know haw i can set this file property with coding in c# ...
plz help me
|
|
|
|
|
|
Hello ,
I am read File and I want to get information from each 256 byte and from each 256 byte I want to divided each 16 byte in order and get my Info?
Here's Sample of Converted 256 Byte
------------------------------------------
01 1C 09 0A 0A 0B 1C 09 0A 0A 0C 00 01 00 00 01 01 1C 09 0A 0A 0C 1C 09 0A 0A 0D 80 01 00 00 02 02 1C 09 0A 0A 0D 1C 09 0A 0A 0E 00 02 00 00 03 03 1C 09 0A 0A 0E 1C 09 0A 0A 0F 80 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Here's My Logic but I can not do it using code.
I want to Read All bytes and if Number of Byte equal to 256 I will go to Nested loop to Read 16 byte from previous 256 byte and Get Info
|
|
|
|
|
Sorry, but you need to explain this.
You tell us, you´re reading 256 byte (I assume you use a byte array ...). Where is the problem with access to the last 16 byte you read?
|
|
|
|