I'm sorry Carlos, if you explain what you want to achive and not how you want to achive it I may be able to help. BTW I don;t have any insider knowledge I just dug an found out. everything works the same for DD as none DD as far as populating with data is
concerned.
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
What you need to do is explain the goal you want to achive not say I want to do A, B & C no for instance (using a modern car as an example) lets say you have a car with keyless start and you are asking where do I put the Key instead of saying how do I open
or how do I start the car?
You need with DD the think out of the box and say I want to achive X but I don't car how we achive that :)
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
OK LET'S FORGET ABOUT THIS POST .... THE WAY IT IS RIGHT NOW .... I'll explain in a following post instead .... my English is really lame, sorry
Carlos N. Porras
(El Salvador)
Hi Steve and thanks for your answer.
I do want to apologize for my bad English .... really ... sorry for that !
I was reading what you said and I don't mean to blame you or accuse you of any wrongdoing ... what I have said is (and I will be clear here that when I write that I wasn't answering you but Microsoft's people)
that you are an out of the ordinary skillful, talented and bright guy and that I wouldn't expect to find that kind of "features" in a common guy like me ....
When you mention that you do a lot of debugging and that you don't have insiders in Microsoft to do your job I think that you really get in a very wrong way what I am saying here. so let me be clear on this:
I am not by any mean trying to put you on the spotlight or trying to raise doubts about who you are and about what you do and the way you do thing .... I admire your work !!!
Ok, back in business.... I'll try to be clear but of my question seems to be silly then just try to understand that I must evolve and that that I am very, absolutely lost in what I ask, so that's why I need and
ask for your help and guidance
LET'S SAY I HAVE 3 TABLES : ONE OF THESE TABLES RECEIVES THE OTHER TWO AS FOREIGN KEYS
Let's call the first TABLE MaterialType, the second one will be MaterialBoughtTo
In the first table I will have data like this one: Leather, wool, cotton, plastic, wood, glass, vynil, polyester, paper, wax, etc
In the second table I will have data like these: Beatrice Lopez, Martha Stewart, Kim Baker, Alex Stone, Philippe Stonehouse, Dorothy McGhee, etc.
IN THE THIRD TABLE RawMaterialsStock I will have the following columns (obviously the Primary Key will be there as an identity field)
I will also have in that table 4 additional columns:
materialtype_id_used will hold the value of the materialtype_id used,
materialtype_desc_used will hold the value of the materialtype_desc used,
materialbought_id_used will hold the value of the materialbought_id used,
materialbought_desc_used will hold the value of the materialbought_desc used
plus the fact that the column buyorder_number will hold the same number used in rawmaterialstock_id so that number will become part of the known administrative ID for that specific purchase
So if I have a bought of today from materialtype_id = 1234, materialtype_desc = "Leather", materialbought_id = 5455566, materialbought_desc= "Martha Naughton"
I will have in my RawMaterialsStock the following data:
rawmaterialstock_id: 454545490940 (generated by SQL-Server automatically)
materialtype_id: 1234
materialbought_id: 5455566
buyorder_number: 454545490940 (same as materialbought_id)
bar_code: 343534533-5656,
date_bought: 2012/12/03
amount_bought: 300
expiry_date: 2014/12/31
package_type: 1134 (units)
unit_price: $34.567
tax_exemption: no
bonus_amount: 0
countryorigin_id: 9876 (Pakistan)
account_id: 010101234
qc_id: 3467567657
qc_date: empty (qc not run yet)
inspectyor_id: empty (qc not run yet)
.
.
.
plus
materialtype_id_used: 1234,
materialtype_desc_used: Leather,
materialbought_id_used: 5455566,
materialbought_desc_used: Martha Naughton
SO IN THE END ONE OF MY QUESTIONS WILL BE: How do I achieve recording these data? How to do and when ?
I WANT TO EXPLAIN THE REASON WHY I NEED TO DO THIS:
It could happen that in January 2017 I'd like to review sales performance and run some cost analysis for creating new sales strategies or for creating some kind of cost-reduction program .... so I came to to the
historical record shown here before
It might have happened that the "Leather" was discontinued from the stock and the record is no longer available, it was deleted because the manager doesn't want these old records still be displayed as available
options in your dropdown comboboxes
Also, Martha Naughton is now Martha Kurnikova (she divorced Frank Naughton)
SO I'D LIKE TO REFLECT, I WANT OT MAKE A HARD COPY OF THAT SPECIFIC BOUGHT "TODAY ... 2017/01/15" ... "SHOWING ME THE DATA AS IT WAS ON DECEMBER 3RD 2012"
Best regards and I apologize for being kind of fool or stupid when asking silly questions like this one
It seems that Implementing Audit Trail using Entity Framework Part -1 could be the clue top what I'm looking for ... everything is recorded in DbAudit table ... which is almost what I want ... I will need to learn how to get the labels (it already gives
you the selectedindexes values) of the combobox choiices made
... but is an excellent start. I implemented the solutuon as it is, as it comes into my model and it is already giving me asome answers
DetailId is the identity PK number generated by the sql server.
I want to copy that value and paste it in the yellow field whose label is "Number (Detail)"
.....
2)
In the first combobox it was selected the item Road-150 Red, 56 ...
I want to copy that value to my textbox whose label is "Product"
.......
3)
There was an Order selected in the second combobox S071948
I want to copy that value to my textbnox whose label is "Order"
.......
The goal is to store in the database all the information shown in the figure .... INCLUDING THE INFORMATION CONTAINED IN MY 3 EXTRA TEXTBOXES which represent 3 columns in my table of course
....
Can this be achieved in Dynamic Data? I obviously know it can be done ...
So my real question should be: Is anyone willing to share his or her knowledge in order to "show" how to do it using C#, ASP.Net Dynamic Data code?
yes that can be done no problem there several ways this can be done:
In the DataSource's Inserted event here you also get the Original value and the new value passed in the event args.
In you own custom business logic (this is my prefered way) see this article
here I have suggested this option several time in the forum and I generally use this myself but a much simplified version as thso full version allows rollback of data.
There are other ways but the two above work well with DD, 1. required the code to be added to each custom page but 2. is generic you would need to do a little work to restrict wich data fields are archived but I generally audite every field.
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
Marked as answer by sjnaughton on Dec 11, 2012 12:22 PM
BTW I already included this feature in my project and it works just fine.
The only "issue" with this is that you get 2 sets of data inside your database: an XML file for the old data and a 2nd XML file for the newest data when Updating and NULL and an XML file when Inserting.
Problem is "performance" as I can foresee if I had to put this code into production because if I am going to use this code to populate the "labels" that I also need from the Foreign Keys (This because the XML file
contains only the ID values of the selected comboboxes)
Then I will need to do 2 additional steps if I go live like this when Updating ,
Read the 2 XML files, seeking in the XML three the value of the field that I need and the table name (that is the table name plus the ID of the Foreign Key for that table)
Then I will have to querey the database as to get the label of the corresponding ID value and this should be done several times in order to get all labels that you need for as many Foreign Keys you have in each one of your entities
So I will rephrase my question:
How do I do this at Update time? I s like asking you: How do I save into the XML files the ID codes as well as the labels of those tables
BECAUSE THE BEAUTY OF THAT SOLUTION (as it is) IS THAT IT IS 100% GENERIC AND SAVES DATABASE STRUCTURE AND DATA OF ANY ENTITY IN YOUR MODEL!
sjnaughton
All-Star
27330 Points
5459 Posts
MVP
Re: Passing filter values among forms
Dec 02, 2012 08:32 PM|LINK
I'm sorry Carlos, if you explain what you want to achive and not how you want to achive it I may be able to help. BTW I don;t have any insider knowledge I just dug an found out. everything works the same for DD as none DD as far as populating with data is concerned.
Always seeking an elegant solution.
klca
Member
507 Points
413 Posts
Re: Passing filter values among forms
Dec 03, 2012 02:12 AM|LINK
Hi Steve,
Now I'm lost .... din't get a word of what you said
Carlos N. Porras
(El Salvador)
ToughMan
Participant
1490 Points
635 Posts
Re: Passing filter values among forms
Dec 03, 2012 03:52 AM|LINK
We don't get a word of u, either……
sjnaughton
All-Star
27330 Points
5459 Posts
MVP
Re: Passing filter values among forms
Dec 03, 2012 10:57 AM|LINK
What you need to do is explain the goal you want to achive not say I want to do A, B & C no for instance (using a modern car as an example) lets say you have a car with keyless start and you are asking where do I put the Key instead of saying how do I open or how do I start the car?
You need with DD the think out of the box and say I want to achive X but I don't car how we achive that :)
Always seeking an elegant solution.
klca
Member
507 Points
413 Posts
Re: Passing filter values among forms
Dec 03, 2012 03:30 PM|LINK
OK LET'S FORGET ABOUT THIS POST .... THE WAY IT IS RIGHT NOW .... I'll explain in a following post instead .... my English is really lame, sorry
Carlos N. Porras
(El Salvador)
Hi Steve and thanks for your answer.
I do want to apologize for my bad English .... really ... sorry for that !
I was reading what you said and I don't mean to blame you or accuse you of any wrongdoing ... what I have said is (and I will be clear here that when I write that I wasn't answering you but Microsoft's people) that you are an out of the ordinary skillful, talented and bright guy and that I wouldn't expect to find that kind of "features" in a common guy like me ....
When you mention that you do a lot of debugging and that you don't have insiders in Microsoft to do your job I think that you really get in a very wrong way what I am saying here. so let me be clear on this: I am not by any mean trying to put you on the spotlight or trying to raise doubts about who you are and about what you do and the way you do thing .... I admire your work !!!
Ok, back in business.... I'll try to be clear but of my question seems to be silly then just try to understand that I must evolve and that that I am very, absolutely lost in what I ask, so that's why I need and ask for your help and guidance
LET'S SAY I HAVE 3 TABLES : ONE OF THESE TABLES RECEIVES THE OTHER TWO AS FOREIGN KEYS
Let's call the first TABLE MaterialType, the second one will be MaterialBoughtTo
In the first table I will have data like this one: Leather, wool, cotton, plastic, wood, glass, vynil, polyester, paper, wax, etc
In the second table I will have data like these: Beatrice Lopez, Martha Stewart, Kim Baker, Alex Stone, Philippe Stonehouse, Dorothy McGhee, etc.
IN THE THIRD TABLE RawMaterialsStock I will have the following columns (obviously the Primary Key will be there as an identity field)
rawmaterialstock_id, materialtype_id, materialbought_id, buyorder_number, bar_code, date_bought, amount_bought, expiry_date, package_type, unit_price, tax_exemption, bonus_amount, countryorigin_id, account_id, qc_id, qc_date, inspectyor_id, ... .... ... etc
I will also have in that table 4 additional columns:
plus the fact that the column buyorder_number will hold the same number used in rawmaterialstock_id so that number will become part of the known administrative ID for that specific purchase
So if I have a bought of today from materialtype_id = 1234, materialtype_desc = "Leather", materialbought_id = 5455566, materialbought_desc= "Martha Naughton"
I will have in my RawMaterialsStock the following data:
rawmaterialstock_id: 454545490940 (generated by SQL-Server automatically)
materialtype_id: 1234
materialbought_id: 5455566
buyorder_number: 454545490940 (same as materialbought_id)
bar_code: 343534533-5656,
date_bought: 2012/12/03
amount_bought: 300
expiry_date: 2014/12/31
package_type: 1134 (units)
unit_price: $34.567
tax_exemption: no
bonus_amount: 0
countryorigin_id: 9876 (Pakistan)
account_id: 010101234
qc_id: 3467567657
qc_date: empty (qc not run yet)
inspectyor_id: empty (qc not run yet)
.
.
.
plus
materialtype_id_used: 1234,
materialtype_desc_used: Leather,
materialbought_id_used: 5455566,
materialbought_desc_used: Martha Naughton
SO IN THE END ONE OF MY QUESTIONS WILL BE: How do I achieve recording these data? How to do and when ?
I WANT TO EXPLAIN THE REASON WHY I NEED TO DO THIS:
It could happen that in January 2017 I'd like to review sales performance and run some cost analysis for creating new sales strategies or for creating some kind of cost-reduction program .... so I came to to the historical record shown here before
It might have happened that the "Leather" was discontinued from the stock and the record is no longer available, it was deleted because the manager doesn't want these old records still be displayed as available options in your dropdown comboboxes
Also, Martha Naughton is now Martha Kurnikova (she divorced Frank Naughton)
SO I'D LIKE TO REFLECT, I WANT OT MAKE A HARD COPY OF THAT SPECIFIC BOUGHT "TODAY ... 2017/01/15" ... "SHOWING ME THE DATA AS IT WAS ON DECEMBER 3RD 2012"
Best regards and I apologize for being kind of fool or stupid when asking silly questions like this one
Please help me
Carlos N. Porras
(El Salvador)
klca
Member
507 Points
413 Posts
Re: Passing filter values among forms
Dec 03, 2012 03:31 PM|LINK
Dear Mr. ToughMan
,
I am really sorry with you sir ... My apologies .... please accept them !
Carlos N. Porras
(El Salvador)
klca
Member
507 Points
413 Posts
Re: Passing filter values among forms
Dec 03, 2012 09:02 PM|LINK
Hi Steve,
It seems that Implementing Audit Trail using Entity Framework Part -1 could be the clue top what I'm looking for ... everything is recorded in DbAudit table ... which is almost what I want ... I will need to learn how to get the labels (it already gives you the selectedindexes values) of the combobox choiices made
... but is an excellent start. I implemented the solutuon as it is, as it comes into my model and it is already giving me asome answers
Carlos N. Porras
(El Salvador)
klca
Member
507 Points
413 Posts
Re: Passing filter values among forms
Dec 04, 2012 03:18 AM|LINK
Steve Naughton,
Let's say I have the following screen:
After Updating I'd like to achieve the following:
1)
DetailId is the identity PK number generated by the sql server.
I want to copy that value and paste it in the yellow field whose label is "Number (Detail)"
.....
2)
In the first combobox it was selected the item Road-150 Red, 56 ...
I want to copy that value to my textbox whose label is "Product"
.......
3)
There was an Order selected in the second combobox S071948
I want to copy that value to my textbnox whose label is "Order"
.......
The goal is to store in the database all the information shown in the figure .... INCLUDING THE INFORMATION CONTAINED IN MY 3 EXTRA TEXTBOXES which represent 3 columns in my table of course
....
Can this be achieved in Dynamic Data? I obviously know it can be done ...
So my real question should be: Is anyone willing to share his or her knowledge in order to "show" how to do it using C#, ASP.Net Dynamic Data code?
........
Carlos N. Porras
(El Salvador)
sjnaughton
All-Star
27330 Points
5459 Posts
MVP
Re: Passing filter values among forms
Dec 04, 2012 09:43 AM|LINK
yes that can be done no problem there several ways this can be done:
There are other ways but the two above work well with DD, 1. required the code to be added to each custom page but 2. is generic you would need to do a little work to restrict wich data fields are archived but I generally audite every field.
Always seeking an elegant solution.
klca
Member
507 Points
413 Posts
Re: Passing filter values among forms
Dec 04, 2012 12:51 PM|LINK
Hi Steve and thanks,
BTW I already included this feature in my project and it works just fine.
The only "issue" with this is that you get 2 sets of data inside your database: an XML file for the old data and a 2nd XML file for the newest data when Updating and NULL and an XML file when Inserting.
Problem is "performance" as I can foresee if I had to put this code into production because if I am going to use this code to populate the "labels" that I also need from the Foreign Keys (This because the XML file contains only the ID values of the selected comboboxes)
Then I will need to do 2 additional steps if I go live like this when Updating ,
So I will rephrase my question:
How do I do this at Update time? I s like asking you: How do I save into the XML files the ID codes as well as the labels of those tables
BECAUSE THE BEAUTY OF THAT SOLUTION (as it is) IS THAT IT IS 100% GENERIC AND SAVES DATABASE STRUCTURE AND DATA OF ANY ENTITY IN YOUR MODEL!
.... which is marvelously great !
Carlos N. Porras
(El Salvador)