This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I am currently running Lightspeed 5.0. The application was written using 4.0. It is a Visual Studio 2012 C# app. The model is interfacing with MS SQL 2012 Std. I imagine this is an easy one, but I've not found the answer yet. The app creates a work order. When the work order is saved, the creation screen goes away and control goes back to a list of current workorders. The only way I've found so far to update that list is to get out and come back in. What is the best way to update the data listing without having to close out and reopen? Thank you! |
|
|
How are you populating the list of work orders? If you just fetch the set again via a query it would include your new entity. Are you caching that list anywhere after first loading it?
|
|
|
Jeremy, Thank you, got it fixed! One more issue, hope it's the last! App is WPF. On the work order creation screen, there are several combo boxes and text boxes. When I am creating a new work order, one of the first actions by the user is to select the client. How can I autofill the text boxes for the clients address, city, state, phone, etc based on what the user has selected as the client? Do you know of any example code? I've not found any that is working with Lightspeed. Thanks! |
|
|
This is somewhat for you to decide how you want to solve it because it will depend a bit on what you are already doing but here are some thoughts. Excuse any ignorance regarding WPF as Im afraid Im not much of a WPF expert but I assume you have an event handler for when the selection change is triggered where you will have a reference to the bound client instance (e.g. you are databinding a list of Client instances to the drop down). If the text-boxes are readonly you should be able to handle this by setting a databinding on each textbox against the selected value e.g. set your Binding to specify the named element of the combo box and then just data-bind against the required property of the selected item. Otherwise in your event handler you just overwrite these manually, e.g. textbox.Text = comboBox.SelectedItem.AppropriateProperty.
|
|
|
Jeremy,
I know I'm missing something here, probably simple.
When stepping thru the code, when I get to this point, by burrowing down on the SelectedItem, I can see the data I want to retrieve. I have tried multiple options in the commented out line, but cannot seem to access the data. When I continue the step thru, the very next code to be executed is:
"Name" is the value selected in the combobox, and it operates as it should. However, I have not been able to get the "Address1", "City", "State", "Zip" to obtain values or determined how to have the appropriate " [System.Diagnostics.DebuggerNonUserCode]" code run for those variables. As the proper record has already been selected, based on the combobox selection, how do I access the other values in the selected record? If you have any ideas on this, I would be very grateful! Thanks,! |
|
|
Are Address1, City, State and Zip just standard entity properties (the same as Name)? If so there should be no difference between these (either in the way they are generated or the underlying behavior for them). [System.Diagnostics.DebuggerNonUserCode] is just a marker attribute so the Visual Studio debugger steps over that code if you have the "Just My Code" option set so that has no actual runtime impact. In terms of your code example, dont you just want to use the value of cmdClient.SelectedValue.ToString() or an equivalent?
|
|
|
Jeremy, Yes, they are treated the same as Name and they are from the same record. In the code, cmdClient.SelectedValue.ToString() will put the Client name into the combobox. The get/set routine sets _name to Name when the code is run. However, I'm not sure how to execute the get/set routine for _address1 to Address1, etc. When walking thru the code, I can see the correct data in the _address1 and the other fields in the selected client record. When I try to assign the value using the .Selected options, it tells me _address1, Address1, etc are not valid fields. I think it's something simple I'm not understanding, but haven't been able to track it down! Thanks, Earl |
|
|
Jeremy, Thank you for the help! Placing the following in the ComboBox_SelectionChanged module seems to have done it!
Thank you for your help and patience! Been a lifesaver! Thanks, Earl |
|