Beispiel #1
0
        /// <summary>
        /// Updates the given pObjRecord.
        /// </summary>
        /// <remarks>
        /// Ranaya, 26/05/2017.
        /// </remarks>
        /// <exception cref="TableException">
        /// Thrown when a Table error condition occurs.
        /// </exception>
        /// <param name="pObjRecord">
        /// The object record.
        /// </param>
        /// <returns>
        /// An int.
        /// </returns>

        public int Update(T pObjRecord)
        {
            SAPbobsCOM.UserTable lObjUserTable = GetUserTable();

            try
            {
                if (lObjUserTable.GetByKey(pObjRecord.GetKey()))
                {
                    lObjUserTable = PopulateUserTable(lObjUserTable, pObjRecord);
                    return(lObjUserTable.Update());
                }
                else
                {
                    throw new TableException(string.Format("No existe el registro '{0}'.", pObjRecord.GetKey()));
                }
            }
            catch (Exception e)
            {
                throw new TableException(e.Message, e);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjUserTable);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Removes the given pStrDocEntry.
        /// </summary>
        /// <remarks>
        /// Ranaya, 26/05/2017.
        /// </remarks>
        /// <exception cref="TableException">
        /// Thrown when a Table error condition occurs.
        /// </exception>
        /// <param name="pStrDocEntry">
        /// The String Document entry to remove.
        /// </param>
        /// <returns>
        /// An int.
        /// </returns>

        public int Remove(string pStrCode)
        {
            SAPbobsCOM.UserTable lObjUserTable = GetUserTable();

            try
            {
                if (lObjUserTable.GetByKey(pStrCode))
                {
                    return(lObjUserTable.Remove());
                }
                else
                {
                    throw new TableException(string.Format("No existe el registro '{0}'.", pStrCode));
                }
            }
            catch (Exception e)
            {
                throw new TableException(e.Message, e);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjUserTable);
            }
        }