HELP! EpiUltraGrid to edit the SerialNumber Table

But such approach makes 'update management' impossible. I mean that you are writing each UltraGrid change immediately to database.
i.e. we have three rows in ultragrid, user is selecting two of them an mark them (checkbox), after that user is clicking save button. In this place some routine should check the balance of modified rows, if balance is zero then writes the changes to db, if not then shows some messgae to user. It will also save a network traffic :).

regards

Grzegorz Szczepañski

--- In vantage@yahoogroups.com, "bw2868bond" <bwalker@...> wrote:
>
> Well, after a value gets changed in a cell in the ultragrid, an AfterCellUpdate event is fired. That is the indicator that something changed and the data in the database needs to be changed. Because the data in the ultragrid was retrieved by a list lookup and is not able to be written back to the db we have to use the adapter GetById method to retrieve data that can be written back to db. In this case the GetByID method requires the PartNum and SerialNumber values to retrieve the record and the 'Field' variable holds the column name of the cell that was updated in the ultragrid.
>
> So we get an adapter object, connect it to the db, get the record we want, change the value of the column in the retrieved row, then update the db and dispose of the adapter object.
>
> I use this code to maintain UD table fields from an ultragrid on a custom sheet in the Part Maint. screen - I just adapted it to the grid name and adapter required for this case.
>
> --- In vantage@yahoogroups.com, "tomojmail" <phoenix_@> wrote:
> >
> > bw2868bond,
> > could you explain what is updating the Update method in your example and waht is updating the update method in general?.
> > Is it a current EpiDataView or CurrentDataSet or maybe something else?
> >
> > I want to display one of the tables in the grid (no problem), modify some rows (don;t know how to make one colum editable - but probably I will be able to find out) - update to database the modified rows (I don't know how to do this).
> >
> > I have a separate thread for this - but no answers.
> >
> > --- In vantage@yahoogroups.com, "bw2868bond" <bwalker@> wrote:
> > >
> > > You will have to add AD and IF assemblies in assembly manager for SerialNumber dll
> > >
> > > The code below is untested it may or may not work - but it gives you a start anyway
> > >
> > >
> > > Private Sub ugdSerialNumbers_AfterCellUpdate(ByVal Sender As Object, ByVal Args As Infragistics.Win.UltraWinGrid.CellEventArgs) Handles ugdEpiCustom1.AfterCellUpdate
> > >
> > > dim adPN as string = args.cell.row.cells("PartNum").value
> > > dim adSN as string = args.cell.row.cells("SerialNumber").value
> > > dim field As String = args.cell.column.key
> > > Dim adSerialNumberAdapter As SerialNoAdapter = New SerialNoAdapter(oTrans)
> > > adSerialNumberAdapter.BOConnect()
> > >
> > > Dim Success As Boolean = adSerialNumberAdapter.GetByID(adPN, adSN)
> > > if Success then
> > > adSerialNumberAdapter.SerialNoData.Tables("SerialNo").Rows(0)(field) = args.cell.row.cells(field).value
> > > adSerialNumberAdapter.Update()
> > > End If
> > >
> > > adSerialNumberAdapter.Dispose()
> > > End Sub
> > >
> > > --- In vantage@yahoogroups.com, "keithfwalter@" <keithfwalter@> wrote:
> > > >
> > > > I have customized the job entry form with an EpiUltraGrid that I populate using the code below. The goal is to list all of the serial numbers assigned to that job, and edit some of that data. How can I populate this grid with SerialNumber data that is editable? Any ideas and tips would be appreciated!
> > > >
> > > > Thanks,
> > > > Keith
> > > >
> > > >
> > > > Private Sub edvJobHead_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvJobHead.EpiViewNotification
> > > > '// ** Argument Properties and Uses **
> > > > '// view.dataView(args.Row)("[FieldName]")
> > > > '// args.Row, args.Column, args.Sender, args.NotifyType
> > > > '// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow,
> > > > NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
> > > > Try
> > > > If (args.Row > -1) Then
> > > >
> > > > Dim ds As DataSet
> > > > Dim opts as SearchOptions
> > > > Opts = new SearchOptions(SearchMode.AutoSearch)
> > > > opts.DataSetMode = DataSetMode.ListDataSet
> > > > opts.SelectMode = SelectMode.MultiSelect
> > > > opts.PreLoadSearchFilter = "JobNum = '" &
> > > > edvJobHead.dataview(edvJobHead.Row)("JobNum").ToString() & "'"
> > > > ds = Epicor.Mfg.UI.FrameWork.ProcessCaller.LaunchSearch(oTrans,
> > > > "SerialNoAdapter", opts)
> > > >
> > > > ugdSerialNumbers.DataSource = ds.Tables(0)
> > > >
> > > > Else
> > > > ugdSerialNumbers.DataSource = Nothing
> > > > End If
> > > > Catch ex as exception
> > > > MsgBox(ex.message)
> > > > End try
> > > > End Sub
> > > >
> > >
> >
>
I have customized the job entry form with an EpiUltraGrid that I populate using the code below. The goal is to list all of the serial numbers assigned to that job, and edit some of that data. How can I populate this grid with SerialNumber data that is editable? Any ideas and tips would be appreciated!

Thanks,
Keith


Private Sub edvJobHead_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvJobHead.EpiViewNotification
'// ** Argument Properties and Uses **
'// view.dataView(args.Row)("[FieldName]")
'// args.Row, args.Column, args.Sender, args.NotifyType
'// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow,
NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
Try
If (args.Row > -1) Then

Dim ds As DataSet
Dim opts as SearchOptions
Opts = new SearchOptions(SearchMode.AutoSearch)
opts.DataSetMode = DataSetMode.ListDataSet
opts.SelectMode = SelectMode.MultiSelect
opts.PreLoadSearchFilter = "JobNum = '" &
edvJobHead.dataview(edvJobHead.Row)("JobNum").ToString() & "'"
ds = Epicor.Mfg.UI.FrameWork.ProcessCaller.LaunchSearch(oTrans,
"SerialNoAdapter", opts)

ugdSerialNumbers.DataSource = ds.Tables(0)

Else
ugdSerialNumbers.DataSource = Nothing
End If
Catch ex as exception
MsgBox(ex.message)
End try
End Sub
You will have to add AD and IF assemblies in assembly manager for SerialNumber dll

The code below is untested it may or may not work - but it gives you a start anyway


Private Sub ugdSerialNumbers_AfterCellUpdate(ByVal Sender As Object, ByVal Args As Infragistics.Win.UltraWinGrid.CellEventArgs) Handles ugdEpiCustom1.AfterCellUpdate

dim adPN as string = args.cell.row.cells("PartNum").value
dim adSN as string = args.cell.row.cells("SerialNumber").value
dim field As String = args.cell.column.key
Dim adSerialNumberAdapter As SerialNoAdapter = New SerialNoAdapter(oTrans)
adSerialNumberAdapter.BOConnect()

Dim Success As Boolean = adSerialNumberAdapter.GetByID(adPN, adSN)
if Success then
adSerialNumberAdapter.SerialNoData.Tables("SerialNo").Rows(0)(field) = args.cell.row.cells(field).value
adSerialNumberAdapter.Update()
End If

adSerialNumberAdapter.Dispose()
End Sub

--- In vantage@yahoogroups.com, "keithfwalter@..." <keithfwalter@...> wrote:
>
> I have customized the job entry form with an EpiUltraGrid that I populate using the code below. The goal is to list all of the serial numbers assigned to that job, and edit some of that data. How can I populate this grid with SerialNumber data that is editable? Any ideas and tips would be appreciated!
>
> Thanks,
> Keith
>
>
> Private Sub edvJobHead_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvJobHead.EpiViewNotification
> '// ** Argument Properties and Uses **
> '// view.dataView(args.Row)("[FieldName]")
> '// args.Row, args.Column, args.Sender, args.NotifyType
> '// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow,
> NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
> Try
> If (args.Row > -1) Then
>
> Dim ds As DataSet
> Dim opts as SearchOptions
> Opts = new SearchOptions(SearchMode.AutoSearch)
> opts.DataSetMode = DataSetMode.ListDataSet
> opts.SelectMode = SelectMode.MultiSelect
> opts.PreLoadSearchFilter = "JobNum = '" &
> edvJobHead.dataview(edvJobHead.Row)("JobNum").ToString() & "'"
> ds = Epicor.Mfg.UI.FrameWork.ProcessCaller.LaunchSearch(oTrans,
> "SerialNoAdapter", opts)
>
> ugdSerialNumbers.DataSource = ds.Tables(0)
>
> Else
> ugdSerialNumbers.DataSource = Nothing
> End If
> Catch ex as exception
> MsgBox(ex.message)
> End try
> End Sub
>
bw2868bond,
could you explain what is updating the Update method in your example and waht is updating the update method in general?.
Is it a current EpiDataView or CurrentDataSet or maybe something else?

I want to display one of the tables in the grid (no problem), modify some rows (don;t know how to make one colum editable - but probably I will be able to find out) - update to database the modified rows (I don't know how to do this).

I have a separate thread for this - but no answers.

--- In vantage@yahoogroups.com, "bw2868bond" <bwalker@...> wrote:
>
> You will have to add AD and IF assemblies in assembly manager for SerialNumber dll
>
> The code below is untested it may or may not work - but it gives you a start anyway
>
>
> Private Sub ugdSerialNumbers_AfterCellUpdate(ByVal Sender As Object, ByVal Args As Infragistics.Win.UltraWinGrid.CellEventArgs) Handles ugdEpiCustom1.AfterCellUpdate
>
> dim adPN as string = args.cell.row.cells("PartNum").value
> dim adSN as string = args.cell.row.cells("SerialNumber").value
> dim field As String = args.cell.column.key
> Dim adSerialNumberAdapter As SerialNoAdapter = New SerialNoAdapter(oTrans)
> adSerialNumberAdapter.BOConnect()
>
> Dim Success As Boolean = adSerialNumberAdapter.GetByID(adPN, adSN)
> if Success then
> adSerialNumberAdapter.SerialNoData.Tables("SerialNo").Rows(0)(field) = args.cell.row.cells(field).value
> adSerialNumberAdapter.Update()
> End If
>
> adSerialNumberAdapter.Dispose()
> End Sub
>
> --- In vantage@yahoogroups.com, "keithfwalter@" <keithfwalter@> wrote:
> >
> > I have customized the job entry form with an EpiUltraGrid that I populate using the code below. The goal is to list all of the serial numbers assigned to that job, and edit some of that data. How can I populate this grid with SerialNumber data that is editable? Any ideas and tips would be appreciated!
> >
> > Thanks,
> > Keith
> >
> >
> > Private Sub edvJobHead_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvJobHead.EpiViewNotification
> > '// ** Argument Properties and Uses **
> > '// view.dataView(args.Row)("[FieldName]")
> > '// args.Row, args.Column, args.Sender, args.NotifyType
> > '// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow,
> > NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
> > Try
> > If (args.Row > -1) Then
> >
> > Dim ds As DataSet
> > Dim opts as SearchOptions
> > Opts = new SearchOptions(SearchMode.AutoSearch)
> > opts.DataSetMode = DataSetMode.ListDataSet
> > opts.SelectMode = SelectMode.MultiSelect
> > opts.PreLoadSearchFilter = "JobNum = '" &
> > edvJobHead.dataview(edvJobHead.Row)("JobNum").ToString() & "'"
> > ds = Epicor.Mfg.UI.FrameWork.ProcessCaller.LaunchSearch(oTrans,
> > "SerialNoAdapter", opts)
> >
> > ugdSerialNumbers.DataSource = ds.Tables(0)
> >
> > Else
> > ugdSerialNumbers.DataSource = Nothing
> > End If
> > Catch ex as exception
> > MsgBox(ex.message)
> > End try
> > End Sub
> >
>
Well, after a value gets changed in a cell in the ultragrid, an AfterCellUpdate event is fired. That is the indicator that something changed and the data in the database needs to be changed. Because the data in the ultragrid was retrieved by a list lookup and is not able to be written back to the db we have to use the adapter GetById method to retrieve data that can be written back to db. In this case the GetByID method requires the PartNum and SerialNumber values to retrieve the record and the 'Field' variable holds the column name of the cell that was updated in the ultragrid.

So we get an adapter object, connect it to the db, get the record we want, change the value of the column in the retrieved row, then update the db and dispose of the adapter object.

I use this code to maintain UD table fields from an ultragrid on a custom sheet in the Part Maint. screen - I just adapted it to the grid name and adapter required for this case.

--- In vantage@yahoogroups.com, "tomojmail" <phoenix_@...> wrote:
>
> bw2868bond,
> could you explain what is updating the Update method in your example and waht is updating the update method in general?.
> Is it a current EpiDataView or CurrentDataSet or maybe something else?
>
> I want to display one of the tables in the grid (no problem), modify some rows (don;t know how to make one colum editable - but probably I will be able to find out) - update to database the modified rows (I don't know how to do this).
>
> I have a separate thread for this - but no answers.
>
> --- In vantage@yahoogroups.com, "bw2868bond" <bwalker@> wrote:
> >
> > You will have to add AD and IF assemblies in assembly manager for SerialNumber dll
> >
> > The code below is untested it may or may not work - but it gives you a start anyway
> >
> >
> > Private Sub ugdSerialNumbers_AfterCellUpdate(ByVal Sender As Object, ByVal Args As Infragistics.Win.UltraWinGrid.CellEventArgs) Handles ugdEpiCustom1.AfterCellUpdate
> >
> > dim adPN as string = args.cell.row.cells("PartNum").value
> > dim adSN as string = args.cell.row.cells("SerialNumber").value
> > dim field As String = args.cell.column.key
> > Dim adSerialNumberAdapter As SerialNoAdapter = New SerialNoAdapter(oTrans)
> > adSerialNumberAdapter.BOConnect()
> >
> > Dim Success As Boolean = adSerialNumberAdapter.GetByID(adPN, adSN)
> > if Success then
> > adSerialNumberAdapter.SerialNoData.Tables("SerialNo").Rows(0)(field) = args.cell.row.cells(field).value
> > adSerialNumberAdapter.Update()
> > End If
> >
> > adSerialNumberAdapter.Dispose()
> > End Sub
> >
> > --- In vantage@yahoogroups.com, "keithfwalter@" <keithfwalter@> wrote:
> > >
> > > I have customized the job entry form with an EpiUltraGrid that I populate using the code below. The goal is to list all of the serial numbers assigned to that job, and edit some of that data. How can I populate this grid with SerialNumber data that is editable? Any ideas and tips would be appreciated!
> > >
> > > Thanks,
> > > Keith
> > >
> > >
> > > Private Sub edvJobHead_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvJobHead.EpiViewNotification
> > > '// ** Argument Properties and Uses **
> > > '// view.dataView(args.Row)("[FieldName]")
> > > '// args.Row, args.Column, args.Sender, args.NotifyType
> > > '// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow,
> > > NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
> > > Try
> > > If (args.Row > -1) Then
> > >
> > > Dim ds As DataSet
> > > Dim opts as SearchOptions
> > > Opts = new SearchOptions(SearchMode.AutoSearch)
> > > opts.DataSetMode = DataSetMode.ListDataSet
> > > opts.SelectMode = SelectMode.MultiSelect
> > > opts.PreLoadSearchFilter = "JobNum = '" &
> > > edvJobHead.dataview(edvJobHead.Row)("JobNum").ToString() & "'"
> > > ds = Epicor.Mfg.UI.FrameWork.ProcessCaller.LaunchSearch(oTrans,
> > > "SerialNoAdapter", opts)
> > >
> > > ugdSerialNumbers.DataSource = ds.Tables(0)
> > >
> > > Else
> > > ugdSerialNumbers.DataSource = Nothing
> > > End If
> > > Catch ex as exception
> > > MsgBox(ex.message)
> > > End try
> > > End Sub
> > >
> >
>