Click here to Skip to main content
15,886,919 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: seeking guideline Pin
Pete O'Hanlon9-Sep-13 1:47
mvePete O'Hanlon9-Sep-13 1:47 
GeneralRe: seeking guideline Pin
Alexito Garcia10-Sep-13 11:28
Alexito Garcia10-Sep-13 11:28 
GeneralRe: seeking guideline Pin
AmitGajjar16-Sep-13 21:08
professionalAmitGajjar16-Sep-13 21:08 
GeneralRe: seeking guideline Pin
crood29-Sep-13 4:25
crood29-Sep-13 4:25 
GeneralRe: seeking guideline Pin
Eddy Vluggen9-Sep-13 8:27
professionalEddy Vluggen9-Sep-13 8:27 
GeneralRe: seeking guideline Pin
crood11-Sep-13 2:01
crood11-Sep-13 2:01 
GeneralRe: seeking guideline Pin
jschell9-Sep-13 10:02
jschell9-Sep-13 10:02 
QuestionLinq to SQL, undo changes or maybe dereference? Pin
Scalee8-Sep-13 9:32
Scalee8-Sep-13 9:32 
This seems like a simple problem but it's a bit hard to explain, but let's try.
Three tables Reservation => Rooms => Services (basically a customer can reserve multiple rooms and request multiple services per room)

Now we have 3 forms:

New/Edit Reservation (Contact details, Overview of rooms) => Only this form saves to the database
New/Edit Rooms (Overview of services)
New/Edit Services

The user makes a new reservation (fills in his contact details), Then adds a room and a service.
And then the user wants to edit the service, here is how i excepted it to go:

C#
function Edit_Service_Click(object sender, EventArgs e)
{
frmServices frm = new frmServices();
//Get current selected row from the services grid
Service srv = (Service)Grid.GetSelectedRow();
//Pass the service to the edit form
frm.Service = srv;

//Override object if user didn't cancel out
if (frm.ShowDialog() == DialogResult.OK)
{
 srv = frm.Service;
}
}


This doesn't work because changes to frm.Service will also directly apply to the "srv" variable (Because it's a reference, right?).
So the question is, how can i pass a child object from a linq to SQL class to another form but let users be able to cancel changes?

The simplest thing to mind seems for frm.Service not to be a reference. Or restore the DataContext to an earlier state.
But i can't find any ways to do this.


Any ideas or questions are very welcome!

Thanks
AnswerRe: Linq to SQL, undo changes or maybe dereference? Pin
Pete O'Hanlon9-Sep-13 1:32
mvePete O'Hanlon9-Sep-13 1:32 
QuestionInterop.Word prob with Arabic Pin
nagham_4ng6-Sep-13 21:25
nagham_4ng6-Sep-13 21:25 
AnswerRe: Interop.Word prob with Arabic Pin
nagham_4ng8-Sep-13 20:20
nagham_4ng8-Sep-13 20:20 
AnswerRe: Interop.Word prob with Arabic Pin
Bernhard Hiller9-Sep-13 0:05
Bernhard Hiller9-Sep-13 0:05 
GeneralRe: Interop.Word prob with Arabic Pin
nagham_4ng9-Sep-13 23:25
nagham_4ng9-Sep-13 23:25 
QuestionRetreive Data from sql server along with headers or column name Pin
ashu20016-Sep-13 18:25
ashu20016-Sep-13 18:25 
AnswerRe: Retreive Data from sql server along with headers or column name Pin
Richard MacCutchan6-Sep-13 23:04
mveRichard MacCutchan6-Sep-13 23:04 
AnswerRe: Retreive Data from sql server along with headers or column name Pin
jschell8-Sep-13 8:29
jschell8-Sep-13 8:29 
GeneralRe: Retreive Data from sql server along with headers or column name Pin
ashu200112-Sep-13 1:44
ashu200112-Sep-13 1:44 
Questionproblem fetching data from excel Pin
Member 102027525-Sep-13 10:07
Member 102027525-Sep-13 10:07 
AnswerRe: problem fetching data from excel Pin
Dave Kreskowiak5-Sep-13 10:53
mveDave Kreskowiak5-Sep-13 10:53 
Questionsuppress filedownload dialog box Pin
Erika Chinchio5-Sep-13 0:23
Erika Chinchio5-Sep-13 0:23 
AnswerRe: suppress filedownload dialog box Pin
Richard MacCutchan5-Sep-13 0:43
mveRichard MacCutchan5-Sep-13 0:43 
GeneralRe: suppress filedownload dialog box Pin
Erika Chinchio5-Sep-13 21:11
Erika Chinchio5-Sep-13 21:11 
GeneralRe: suppress filedownload dialog box Pin
Richard MacCutchan5-Sep-13 21:54
mveRichard MacCutchan5-Sep-13 21:54 
AnswerRe: suppress filedownload dialog box Pin
Bernhard Hiller5-Sep-13 21:21
Bernhard Hiller5-Sep-13 21:21 
GeneralRe: suppress filedownload dialog box Pin
Erika Chinchio6-Sep-13 0:04
Erika Chinchio6-Sep-13 0:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.