StrataFrame Forum

Events (BeforeSave/BeforeDelete - AfterSave/AfterDelete)

http://forum.strataframe.net/Topic16570.aspx

By Rogerio Mauri - 5/25/2008

Trent... Bom Dia !!!

(*) I wait that the Portuguese translated with Babel Fish has been intelligible. Smile

I am with doubts in the events: Before(Save, Delete) / After(Save, Delete).

I think that the calls of acceptance of the modifications are not running in the certain order or I am not understanding logical the proposal.

I would like that you evaluated the attached project observing if the statuses of the rows in some phases correspond to the waited result.

It makes tests adding and excluding registers in table two that it is in the list of table one.

It confers the status of rows in the events of the BO. Special attention for the status of rows when the register is excluded in table two.

I make this questioning because I intend to implement processes that affect registers in other tables from launchings in the main table, using for this the control of status of rows with modification. Also, if you will have some example for this, you would be been thankful.

Code area:

        #region SAVE
        private void TbLevelTwoBO_BeforeSave(MicroFour.StrataFrame.Data.BeforeSaveUndoEventArgs e)
        {
            foreach (DataRow row in this.CurrentDataTable.Rows)
            {
                string a = row.RowState.ToString();
            }
        }
        private void TbLevelTwoBO_AfterSave(MicroFour.StrataFrame.Data.AfterSaveUndoEventArgs e)
        {
            foreach (DataRow row in this.CurrentDataTable.Rows)
            {
                string a = row.RowState.ToString();
            }
        }
        #endregion

        #region DELETE
        private void TbLevelTwoBO_BeforeDelete(BeforeDeleteEventArgs e)
        {
            foreach (DataRow row in this.CurrentDataTable.Rows)
            {
                string a = row.RowState.ToString();
            }
        }
        private void TbLevelTwoBO_AfterDelete(AfterDeleteEventArgs e)
        {
            foreach (DataRow row in this.CurrentDataTable.Rows)
            {
                string a = row.RowState.ToString();
            }
        }
        #endregion

By Trent L. Taylor - 5/26/2008

Rogerio,

Sorry, I might have to get Ivan involed on this one.  I really didn't understand what you were trying to accomplish on this one Ermm

However, from looking at your code, I don't really understand what you are trying to do in the BeforeSave by enumerating all of the rows.  This is really the purpose of the CheckRulesOnCurrenRow event and it will allow you to talk to each row individually versus you re-enumerating all of the rows.  You could then check on the CurrentRow.RowState.

We use the Before and After Save events all of the time for a number of different purposes (i.e. updating UI details, performing some type of audit, etc).

Hope this helps Smile

By Rogerio Mauri - 5/26/2008

Ok... Ivan will be able assisting in them