This question is locked. New answers and comments are not allowed.
Hi there,
In my silverlight application I need to save in database one object of type "ASSUNTOS". However I don´t know way, the application give this error and don´t save.
Submit Operaton failed exception has been thrown by the target of an Invocation. (in image).
And here are my code to do that:
public void DF_EditEnding(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndingEventArgs e)
{
this.VisibilidadeBotoes = Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Add |
Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Edit |
Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Delete |
Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Commit |
Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Cancel;
if (e.EditAction == Telerik.Windows.Controls.Data.DataForm.EditAction.Commit)
{
if (this.novoItem)
{
bool i;
Assuntos assuntos = new Assuntos();
assuntos.IdProp = -1;
assuntos.ReuniaoIdProp = AppGlobais.Globais.reuniaoGlobal.IdProp;
assuntos.DesignacaoProp = AssuntoSeleccionado.DesignacaoProp;
assuntos.ConteudoProp = AssuntoSeleccionado.ConteudoProp;
assuntos.ConclusoesProp = AssuntoSeleccionado.ConclusoesProp;
assuntos.EmVotacaoProp = AssuntoSeleccionado.EmVotacaoProp;
assuntos.NumeracaoProp = AssuntoSeleccionado.NumeracaoProp;
assuntos.AprovadoProp = 1;
assuntos.AprovadoEmProp = DateTime.Now;
assuntos.AprovadoPorProp = AppGlobais.Globais.participanteReuniao.IdProp;
assuntos.ActivoProp = 0;
assuntos.ImportadoDocumentoProp = AssuntoSeleccionado.ImportadoDocumentoProp;
assuntos.PossuiVotacaoProp = AssuntoSeleccionado.PossuiVotacaoProp;
assuntos.TipoassuntoIdProp = AssuntoSeleccionado.TipoassuntosProp.IdProp;
assuntos.SugeridoEmProp = AssuntoSeleccionado.SugeridoEmProp;
assuntos.SugeridoPorProp = AppGlobais.Globais.participanteReuniao.IdProp;
assuntos.SitProp = 1;
assuntos.InsDataProp = DateTime.Now;
assuntos.InsUserProp = AppGlobais.Globais.Utilizador.LoginProp;
assuntos.AltDataProp = null;
assuntos.AltUserProp = null;
assuntos.VersaoProp = 0;
assuntos.PossuiTomadaConhecimentoProp = AssuntoSeleccionado.PossuiTomadaConhecimentoProp;
assuntoGuardado = assuntos;
if (assuntos.AprovadoProp == 1)
{
assuntos.AprovadoEmProp = DateTime.Now;
assuntos.AprovadoPorProp = AppGlobais.Globais.participanteReuniao.IdProp;
}
AppGlobais.Globais.ContextoSGA.Assuntos.Add(assuntos);
BloquearLeituraEscritaDados = true;
this.novoItem = false;
}
And in EditEnded I do the submit:
public void DF_EditEnded(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndedEventArgs e)
{
this.VisibilidadeBotoes = Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Add |
Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Edit |
Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Delete;
if (e.EditAction == Telerik.Windows.Controls.Data.DataForm.EditAction.Commit)
{
AppGlobais.Globais.ContextoSGA.SubmitChanges(SubmitCompleted, null);
}
else
{
this.AppGlobais.Globais.ContextoSGA.RejectChanges();
Please I need really help here.
Thanks in advance.
Nelson Silva
In my silverlight application I need to save in database one object of type "ASSUNTOS". However I don´t know way, the application give this error and don´t save.
Submit Operaton failed exception has been thrown by the target of an Invocation. (in image).
And here are my code to do that:
public void DF_EditEnding(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndingEventArgs e)
{
this.VisibilidadeBotoes = Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Add |
Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Edit |
Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Delete |
Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Commit |
Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Cancel;
if (e.EditAction == Telerik.Windows.Controls.Data.DataForm.EditAction.Commit)
{
if (this.novoItem)
{
bool i;
Assuntos assuntos = new Assuntos();
assuntos.IdProp = -1;
assuntos.ReuniaoIdProp = AppGlobais.Globais.reuniaoGlobal.IdProp;
assuntos.DesignacaoProp = AssuntoSeleccionado.DesignacaoProp;
assuntos.ConteudoProp = AssuntoSeleccionado.ConteudoProp;
assuntos.ConclusoesProp = AssuntoSeleccionado.ConclusoesProp;
assuntos.EmVotacaoProp = AssuntoSeleccionado.EmVotacaoProp;
assuntos.NumeracaoProp = AssuntoSeleccionado.NumeracaoProp;
assuntos.AprovadoProp = 1;
assuntos.AprovadoEmProp = DateTime.Now;
assuntos.AprovadoPorProp = AppGlobais.Globais.participanteReuniao.IdProp;
assuntos.ActivoProp = 0;
assuntos.ImportadoDocumentoProp = AssuntoSeleccionado.ImportadoDocumentoProp;
assuntos.PossuiVotacaoProp = AssuntoSeleccionado.PossuiVotacaoProp;
assuntos.TipoassuntoIdProp = AssuntoSeleccionado.TipoassuntosProp.IdProp;
assuntos.SugeridoEmProp = AssuntoSeleccionado.SugeridoEmProp;
assuntos.SugeridoPorProp = AppGlobais.Globais.participanteReuniao.IdProp;
assuntos.SitProp = 1;
assuntos.InsDataProp = DateTime.Now;
assuntos.InsUserProp = AppGlobais.Globais.Utilizador.LoginProp;
assuntos.AltDataProp = null;
assuntos.AltUserProp = null;
assuntos.VersaoProp = 0;
assuntos.PossuiTomadaConhecimentoProp = AssuntoSeleccionado.PossuiTomadaConhecimentoProp;
assuntoGuardado = assuntos;
if (assuntos.AprovadoProp == 1)
{
assuntos.AprovadoEmProp = DateTime.Now;
assuntos.AprovadoPorProp = AppGlobais.Globais.participanteReuniao.IdProp;
}
AppGlobais.Globais.ContextoSGA.Assuntos.Add(assuntos);
BloquearLeituraEscritaDados = true;
this.novoItem = false;
}
And in EditEnded I do the submit:
public void DF_EditEnded(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndedEventArgs e)
{
this.VisibilidadeBotoes = Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Add |
Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Edit |
Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Delete;
if (e.EditAction == Telerik.Windows.Controls.Data.DataForm.EditAction.Commit)
{
AppGlobais.Globais.ContextoSGA.SubmitChanges(SubmitCompleted, null);
}
else
{
this.AppGlobais.Globais.ContextoSGA.RejectChanges();
Please I need really help here.
Thanks in advance.
Nelson Silva