private void Button4_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            if (Grid0.Rows.SelectedRows.Count > 0)   //VERIFICA QUE EXISTA UN ROW SELECCIONADO
            {
                int    nSelecRow  = (Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder));
                String sValorGrid = Convert.ToString(Grid0.DataTable.GetValue("CÓDIGO", nSelecRow));
                oUserTable = oCompany.UserTables.Item("SECCIONESCOL");
                if (oUserTable.GetByKey(sValorGrid))
                {
                    int i = oUserTable.Remove();


                    if (i != 0)
                    {
                        oApp.SetStatusBarMessage("Error al eliminar : " + oCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    }
                    else
                    {
                        oApp.SetStatusBarMessage("Edición Eliminada", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                        //oForm = oApp.Forms.Item("fmacted");
                        //oForm.Close();
                        //presiono el boton refrescar
                        Button3_ClickBefore(sboObject, pVal, out BubbleEvent);
                    }
                }
            }
            else
            {
                oApp.SetStatusBarMessage("Error, no has seleccionado una fila", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
            }
        }
Exemple #2
0
    private void DelUDORecord(string Code, string sTable)
    {
        string sErrMsg;

        SAPbobsCOM.UserTable otable = oCompany.UserTables.Item(sTable);
        otable.GetByKey(Code);
        int ret = otable.Remove();

        if (ret != 0)
        {
            oCompany.GetLastError(out ret, out sErrMsg);
            string msg = "{0} - {1}移除失敗!!{2}";
            msg = string.Format(msg, sTable, Code, sErrMsg);
            throw new Exception(msg);
        }
    }