コード例 #1
0
        /**
         * Busca el primer registro que coincida con los datos enviados
         * @param Viewrecibo obj
         * @return Retorna el mismo objeto pero con los datos consultados
         */
        public Viewrecibo buscarPrimeroViewrecibo(Viewrecibo obj)
        {
            List <Viewrecibo> lista = null;

            try {
                ViewreciboDao dao = new ViewreciboDao();
                conn  = conexion.conection();
                lista = dao.searchMatching(conn, obj);
                if (lista != null && lista.Count > 0)
                {
                    obj = (Viewrecibo)lista[0];
                }
                else
                {
                    obj.ID = -1;
                }
            } catch (Exception e) {
                obj.ID = -1;
            } finally {
                if (conn != null && conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(obj);
        }
コード例 #2
0
        public void delete(SqlConnection conn, Viewrecibo valueObject)
        {
            SqlCommand stmt = null;
            String     sql  = "";

            try {
                sql  = "DELETE FROM VIEW_RECIBO WHERE (ID = @ID )";
                stmt = new SqlCommand(sql, conn);
                stmt.Parameters.AddWithValue("@ID", valueObject.ID);

                int rowcount = databaseUpdate(stmt);
                if (rowcount == 0)
                {
                    throw new Exception("Object could not be deleted! (PrimaryKey not found)");
                }
                if (rowcount > 1)
                {
                    throw new Exception("PrimaryKey Error when updating DB! (Many objects were deleted!)");
                }
            } finally {
                if (stmt != null)
                {
                    stmt.Dispose();
                }
            }
        }
コード例 #3
0
        /**
         * Busca los registros que coincidan con los datos enviados
         * @param Viewrecibo obj
         * @return Retorna la lista de los registros que coinciden
         */
        public Viewrecibo[] buscarViewrecibo(Viewrecibo obj, int pagina, int numRegPagina)
        {
            Viewrecibo[]      result = null;
            List <Viewrecibo> lista  = null;

            if (pagina > 0 && numRegPagina > 0)
            {
                pagina--;
                int limInf = 0;
                int limSup = 0;
                limInf = pagina * numRegPagina + 1;
                limSup = (pagina + 1) * numRegPagina;
                try {
                    ViewreciboDao dao = new ViewreciboDao();
                    conn  = conexion.conection();
                    lista = dao.searchMatching(conn, obj, limInf, limSup);
                    if (lista != null && lista.Count > 0)
                    {
                        result = lista.ToArray();
                    }
                } catch (Exception e) {
                    result = null;
                } finally {
                    if (conn != null && conn.State == System.Data.ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }
            return(result);
        }
コード例 #4
0
        /**
         * Inserta nuevo registro en la tabla
         * @param Viewrecibo obj
         * @return Retorna el mismo objeto pero con la llave primaria configurada
         */
        public Viewrecibo crearViewrecibo(Viewrecibo obj)
        {
            List <Viewrecibo> lista   = null;
            Viewrecibo        obj_new = new Viewrecibo();

            try {
                ViewreciboDao dao = new ViewreciboDao();
                conn = conexion.conection();
                dao.create(conn, obj);
                //verificar existencia
                obj_new.ID = obj.ID;
                lista      = dao.searchMatching(conn, obj_new);
                if (lista != null && lista.Count > 0)
                {
                    obj_new = (Viewrecibo)lista[0];
                }
                else
                {
                    obj_new.ID = -1;
                }
            } catch (Exception e) {
                obj_new.ID = -1;
            } finally {
                if (conn != null && conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(obj_new);
        }
コード例 #5
0
 public int contarBusquedaViewrecibo(Viewrecibo obj)
 {
     if (autenticacion != null && autenticacion.esValido())
     {
         return(gestionViewrecibo.contarBusquedaViewrecibo(obj));
     }
     return(-1);
 }
コード例 #6
0
 public bool editarViewrecibo(Viewrecibo obj)
 {
     if (autenticacion != null && autenticacion.esValido())
     {
         return(gestionViewrecibo.editarViewrecibo(obj));
     }
     return(false);
 }
コード例 #7
0
 public Viewrecibo[] buscarViewrecibo(Viewrecibo obj)
 {
     if (autenticacion != null && autenticacion.esValido())
     {
         return(gestionViewrecibo.buscarViewrecibo(obj));
     }
     return(null);
 }
コード例 #8
0
 public Viewrecibo[] buscarPaginacionViewrecibo(Viewrecibo obj, int pag, int numReg)
 {
     if (autenticacion != null && autenticacion.esValido())
     {
         return(gestionViewrecibo.buscarViewrecibo(obj, pag, numReg));
     }
     return(null);
 }
コード例 #9
0
 private void buscarRecibo()
 {
     try
     {
         if (!String.IsNullOrEmpty(txtNumRecibo.Text))
         {
             iniciarValores();
             recibo = new Viewrecibo();
             recibo.NUMERO_RECIBO = txtNumRecibo.Text.Trim();
             recibo = serviciosViewrecibo.buscarPrimeroViewrecibo(recibo);
             if (recibo != null && recibo.ID > 0)
             {
                 if (!String.IsNullOrEmpty(recibo.ESTADO) && recibo.ESTADO == "LIQUIDADO")
                 {
                     lblCliente.Text     = recibo.NOMBRES + " " + recibo.APELLIDOS;
                     lblValorRecibo.Text = "$" + recibo.VALOR;
                     lblTipoPago.Text    = recibo.TIPO_PAGO;
                     grdFormaPago.Rows[0].Cells["valor"].Value = recibo.VALOR;
                     calcularDiferencia();
                     btnPagar.Enabled = true;
                 }
                 else
                 {
                     btnPagar.Enabled     = false;
                     btnVerRecibo.Enabled = false;
                     MessageBox.Show("El recibo No." + recibo.NUMERO_RECIBO + " no se encuentra en estado LIQUIDADO", "Recibo incorrecto", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
             else
             {
                 btnPagar.Enabled     = false;
                 btnVerRecibo.Enabled = false;
                 MessageBox.Show("El recibo de número " + txtNumRecibo.Text.Trim() + " no fue encontrado", "No encontrado", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         else
         {
             txtNumRecibo.Focus();
             MessageBox.Show("Debe digitar el número de recibo", "Campo requerido", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception exp)
     {
     }
 }
コード例 #10
0
        public int contarBusquedaViewrecibo(Viewrecibo obj)
        {
            int cantidad = -1;

            try {
                ViewreciboDao dao = new ViewreciboDao();
                conn     = conexion.conection();
                cantidad = dao.countSearchMatching(conn, obj);
            } catch (Exception e) {
                cantidad = -1;
            } finally {
                if (conn != null && conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(cantidad);
        }
コード例 #11
0
        /**
         * Edita un registro en la tabla
         * @param Viewrecibo obj
         * @return boolean indicando si se realizo o no la actualizacion
         */
        public bool editarViewrecibo(Viewrecibo obj)
        {
            bool resultado;

            resultado = false;
            try {
                ViewreciboDao dao = new ViewreciboDao();
                conn = conexion.conection();
                dao.save(conn, obj);
                resultado = true;
            } catch (Exception e) {
                resultado = false;
            } finally {
                if (conn != null && conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(resultado);
        }
コード例 #12
0
        /**
         * Busca los registros que coincidan con los datos enviados
         * @param Viewrecibo obj
         * @return Retorna la lista de los registros que coinciden
         */
        public Viewrecibo[] buscarViewrecibo(Viewrecibo obj)
        {
            Viewrecibo[]      result = null;
            List <Viewrecibo> lista  = null;

            try {
                ViewreciboDao dao = new ViewreciboDao();
                conn  = conexion.conection();
                lista = dao.searchMatching(conn, obj);
                if (lista != null && lista.Count > 0)
                {
                    result = lista.ToArray();
                }
            } catch (Exception e) {
                result = null;
            } finally {
                if (conn != null && conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(result);
        }
コード例 #13
0
        private List <Viewrecibo> listQuery(SqlCommand stmt)
        {
            List <Viewrecibo> searchResults = new List <Viewrecibo>();
            SqlDataReader     reader        = null;

            try {
                int intt = 0; long longg = 0; double doublee = 0; DateTime datee;
                reader = stmt.ExecuteReader();
                while (reader.Read())
                {
                    Viewrecibo temp = createValueObject();

                    temp.ID                  = reader["ID"] != null && int.TryParse(reader["ID"].ToString(), out intt) ? intt : 0;
                    temp.NUMERO_RECIBO       = reader["NUMERO_RECIBO"] != null ? reader["NUMERO_RECIBO"].ToString() : null;
                    temp.VALOR               = reader["VALOR"] != null && double.TryParse(reader["VALOR"].ToString(), out doublee) ? doublee : 0;
                    temp.ID_CLIENTE          = reader["ID_CLIENTE"] != null && int.TryParse(reader["ID_CLIENTE"].ToString(), out intt) ? intt : 0;
                    temp.NOMBRES             = reader["NOMBRES"] != null ? reader["NOMBRES"].ToString() : null;
                    temp.APELLIDOS           = reader["APELLIDOS"] != null ? reader["APELLIDOS"].ToString() : null;
                    temp.ID_ESTADO           = reader["ID_ESTADO"] != null && int.TryParse(reader["ID_ESTADO"].ToString(), out intt) ? intt : 0;
                    temp.ESTADO              = reader["ESTADO"] != null ? reader["ESTADO"].ToString() : null;
                    temp.ID_TIPO_LIQUIDACION = reader["ID_TIPO_LIQUIDACION"] != null && int.TryParse(reader["ID_TIPO_LIQUIDACION"].ToString(), out intt) ? intt : 0;
                    temp.TIPO_PAGO           = reader["TIPO_PAGO"] != null ? reader["TIPO_PAGO"].ToString() : null;
                    searchResults.Add(temp);
                }
            }
            finally {
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
                if (stmt != null)
                {
                    stmt.Dispose();
                }
            }
            return(searchResults);
        }
コード例 #14
0
 public int contarBusquedaViewrecibo(Viewrecibo obj)
 {
     return(gestionViewrecibo.contarBusquedaViewrecibo(obj));
 }
コード例 #15
0
 public Viewrecibo[] buscarPaginacionViewrecibo(Viewrecibo obj, int pag, int numReg)
 {
     return(gestionViewrecibo.buscarViewrecibo(obj, pag, numReg));
 }
コード例 #16
0
 public Viewrecibo[] buscarViewrecibo(Viewrecibo obj)
 {
     return(gestionViewrecibo.buscarViewrecibo(obj));
 }
コード例 #17
0
 public Viewrecibo buscarPrimeroViewrecibo(Viewrecibo obj)
 {
     return(gestionViewrecibo.buscarPrimeroViewrecibo(obj));
 }
コード例 #18
0
        public void create(SqlConnection conn, Viewrecibo valueObject)
        {
            String     sql  = "";
            SqlCommand stmt = null;

            try {
                sql = "INSERT INTO VIEW_RECIBO ( ID," +
                      " NUMERO_RECIBO, VALOR, ID_CLIENTE," +
                      " NOMBRES, APELLIDOS, ID_ESTADO," +
                      " ESTADO, ID_TIPO_LIQUIDACION, TIPO_PAGO" +
                      ")" +
                      "VALUES ( @ID, @NUMERO_RECIBO, @VALOR, @ID_CLIENTE, @NOMBRES, @APELLIDOS, @ID_ESTADO, @ESTADO, @ID_TIPO_LIQUIDACION, @TIPO_PAGO)";
                stmt = new SqlCommand(sql, conn);
                stmt.Parameters.AddWithValue("@ID", valueObject.ID);
                if (valueObject.NUMERO_RECIBO != null && valueObject.NUMERO_RECIBO.Length <= 0)
                {
                    stmt.Parameters.AddWithValue("@NUMERO_RECIBO", valueObject.NUMERO_RECIBO);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@NUMERO_RECIBO", DBNull.Value);
                }
                if (valueObject.VALOR != 0)
                {
                    stmt.Parameters.AddWithValue("@VALOR", valueObject.VALOR);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@VALOR", DBNull.Value);
                }
                if (valueObject.ID_CLIENTE != 0)
                {
                    stmt.Parameters.AddWithValue("@ID_CLIENTE", valueObject.ID_CLIENTE);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@ID_CLIENTE", DBNull.Value);
                }
                if (valueObject.NOMBRES != null && valueObject.NOMBRES.Length <= 0)
                {
                    stmt.Parameters.AddWithValue("@NOMBRES", valueObject.NOMBRES);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@NOMBRES", DBNull.Value);
                }
                if (valueObject.APELLIDOS != null && valueObject.APELLIDOS.Length <= 0)
                {
                    stmt.Parameters.AddWithValue("@APELLIDOS", valueObject.APELLIDOS);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@APELLIDOS", DBNull.Value);
                }
                if (valueObject.ID_ESTADO != 0)
                {
                    stmt.Parameters.AddWithValue("@ID_ESTADO", valueObject.ID_ESTADO);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@ID_ESTADO", DBNull.Value);
                }
                if (valueObject.ESTADO != null && valueObject.ESTADO.Length <= 0)
                {
                    stmt.Parameters.AddWithValue("@ESTADO", valueObject.ESTADO);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@ESTADO", DBNull.Value);
                }
                if (valueObject.ID_TIPO_LIQUIDACION != 0)
                {
                    stmt.Parameters.AddWithValue("@ID_TIPO_LIQUIDACION", valueObject.ID_TIPO_LIQUIDACION);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@ID_TIPO_LIQUIDACION", DBNull.Value);
                }
                if (valueObject.TIPO_PAGO != null && valueObject.TIPO_PAGO.Length <= 0)
                {
                    stmt.Parameters.AddWithValue("@TIPO_PAGO", valueObject.TIPO_PAGO);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@TIPO_PAGO", DBNull.Value);
                }



                databaseUpdate(stmt);
            } finally {
                if (stmt != null)
                {
                    stmt.Dispose();
                }
            }
        }
コード例 #19
0
        public List <Viewrecibo> searchMatching(SqlConnection conn, Viewrecibo valueObject, int limiteInf, int limiteSup)
        {
            List <Viewrecibo> searchResults = new List <Viewrecibo>();
            bool   first = true;
            String sql   = "SELECT * FROM VIEW_RECIBO WHERE 1=1 ";

            if (valueObject.ID != null && valueObject.ID != 0)
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND ID= " + valueObject.ID + " ";
            }

            if (!String.IsNullOrEmpty(valueObject.NUMERO_RECIBO))
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND NUMERO_RECIBO= '" + valueObject.NUMERO_RECIBO + "' ";
            }

            if (valueObject.VALOR != null && valueObject.VALOR != 0)
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND VALOR= " + valueObject.VALOR + " ";
            }

            if (valueObject.ID_CLIENTE != null && valueObject.ID_CLIENTE != 0)
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND ID_CLIENTE= " + valueObject.ID_CLIENTE + " ";
            }

            if (!String.IsNullOrEmpty(valueObject.NOMBRES))
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND NOMBRES= '" + valueObject.NOMBRES + "' ";
            }

            if (!String.IsNullOrEmpty(valueObject.APELLIDOS))
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND APELLIDOS= '" + valueObject.APELLIDOS + "' ";
            }

            if (valueObject.ID_ESTADO != null && valueObject.ID_ESTADO != 0)
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND ID_ESTADO= " + valueObject.ID_ESTADO + " ";
            }

            if (!String.IsNullOrEmpty(valueObject.ESTADO))
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND ESTADO= '" + valueObject.ESTADO + "' ";
            }

            if (valueObject.ID_TIPO_LIQUIDACION != null && valueObject.ID_TIPO_LIQUIDACION != 0)
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND ID_TIPO_LIQUIDACION= " + valueObject.ID_TIPO_LIQUIDACION + " ";
            }

            if (!String.IsNullOrEmpty(valueObject.TIPO_PAGO))
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND TIPO_PAGO= '" + valueObject.TIPO_PAGO + "' ";
            }

            sql += ") AS CONSULTA WHERE RowNumber >=" + limiteInf + " AND RowNumber <=" + limiteSup;

            if (first)
            {
                searchResults = new List <Viewrecibo>();
            }
            else
            {
                searchResults = listQuery(new SqlCommand(sql, conn));
            }

            return(searchResults);
        }
コード例 #20
0
        public int countSearchMatching(SqlConnection conn, Viewrecibo valueObject)
        {
            bool   first = true;
            String sql   = "SELECT COUNT(*) FROM VIEW_RECIBO WHERE 1=1 ";

            if (valueObject.ID != null && valueObject.ID != 0)
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND ID= " + valueObject.ID + " ";
            }

            if (!String.IsNullOrEmpty(valueObject.NUMERO_RECIBO))
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND NUMERO_RECIBO= '" + valueObject.NUMERO_RECIBO + "' ";
            }

            if (valueObject.VALOR != null && valueObject.VALOR != 0)
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND VALOR= " + valueObject.VALOR + " ";
            }

            if (valueObject.ID_CLIENTE != null && valueObject.ID_CLIENTE != 0)
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND ID_CLIENTE= " + valueObject.ID_CLIENTE + " ";
            }

            if (!String.IsNullOrEmpty(valueObject.NOMBRES))
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND NOMBRES= '" + valueObject.NOMBRES + "' ";
            }

            if (!String.IsNullOrEmpty(valueObject.APELLIDOS))
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND APELLIDOS= '" + valueObject.APELLIDOS + "' ";
            }

            if (valueObject.ID_ESTADO != null && valueObject.ID_ESTADO != 0)
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND ID_ESTADO= " + valueObject.ID_ESTADO + " ";
            }

            if (!String.IsNullOrEmpty(valueObject.ESTADO))
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND ESTADO= '" + valueObject.ESTADO + "' ";
            }

            if (valueObject.ID_TIPO_LIQUIDACION != null && valueObject.ID_TIPO_LIQUIDACION != 0)
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND ID_TIPO_LIQUIDACION= " + valueObject.ID_TIPO_LIQUIDACION + " ";
            }

            if (!String.IsNullOrEmpty(valueObject.TIPO_PAGO))
            {
                if (first)
                {
                    first = false;
                }
                sql += "AND TIPO_PAGO= '" + valueObject.TIPO_PAGO + "' ";
            }

            SqlCommand    stmt    = null;
            SqlDataReader result  = null;
            int           allRows = 0;

            try {
                stmt   = new SqlCommand(sql, conn);
                result = stmt.ExecuteReader();
                if (result.Read())
                {
                    allRows = int.Parse(result[0].ToString());
                }
            } finally {
                if (!result.IsClosed)
                {
                    result.Close();
                }
                if (stmt != null)
                {
                    stmt.Dispose();
                }
            }
            return(allRows);
        }
コード例 #21
0
        public void save(SqlConnection conn, Viewrecibo valueObject)
        {
            SqlCommand stmt = null;
            String     sql  = "";

            try {
                sql = "UPDATE VIEW_RECIBO SET  NUMERO_RECIBO = @NUMERO_RECIBO , VALOR = @VALOR , ID_CLIENTE = @ID_CLIENTE ," +
                      " NOMBRES = @NOMBRES , APELLIDOS = @APELLIDOS , ID_ESTADO = @ID_ESTADO ," +
                      " ESTADO = @ESTADO , ID_TIPO_LIQUIDACION = @ID_TIPO_LIQUIDACION , TIPO_PAGO = @TIPO_PAGO " +
                      " WHERE (ID= @ID)";
                stmt = new SqlCommand(sql, conn);
                if (valueObject.NUMERO_RECIBO != null && valueObject.NUMERO_RECIBO.Length <= 0)
                {
                    stmt.Parameters.AddWithValue("@NUMERO_RECIBO", valueObject.NUMERO_RECIBO);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@NUMERO_RECIBO", DBNull.Value);
                }
                if (valueObject.VALOR != 0)
                {
                    stmt.Parameters.AddWithValue("@VALOR", valueObject.VALOR);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@VALOR", DBNull.Value);
                }
                if (valueObject.ID_CLIENTE != 0)
                {
                    stmt.Parameters.AddWithValue("@ID_CLIENTE", valueObject.ID_CLIENTE);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@ID_CLIENTE", DBNull.Value);
                }
                if (valueObject.NOMBRES != null && valueObject.NOMBRES.Length <= 0)
                {
                    stmt.Parameters.AddWithValue("@NOMBRES", valueObject.NOMBRES);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@NOMBRES", DBNull.Value);
                }
                if (valueObject.APELLIDOS != null && valueObject.APELLIDOS.Length <= 0)
                {
                    stmt.Parameters.AddWithValue("@APELLIDOS", valueObject.APELLIDOS);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@APELLIDOS", DBNull.Value);
                }
                if (valueObject.ID_ESTADO != 0)
                {
                    stmt.Parameters.AddWithValue("@ID_ESTADO", valueObject.ID_ESTADO);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@ID_ESTADO", DBNull.Value);
                }
                if (valueObject.ESTADO != null && valueObject.ESTADO.Length <= 0)
                {
                    stmt.Parameters.AddWithValue("@ESTADO", valueObject.ESTADO);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@ESTADO", DBNull.Value);
                }
                if (valueObject.ID_TIPO_LIQUIDACION != 0)
                {
                    stmt.Parameters.AddWithValue("@ID_TIPO_LIQUIDACION", valueObject.ID_TIPO_LIQUIDACION);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@ID_TIPO_LIQUIDACION", DBNull.Value);
                }
                if (valueObject.TIPO_PAGO != null && valueObject.TIPO_PAGO.Length <= 0)
                {
                    stmt.Parameters.AddWithValue("@TIPO_PAGO", valueObject.TIPO_PAGO);
                }
                else
                {
                    stmt.Parameters.AddWithValue("@TIPO_PAGO", DBNull.Value);
                }
                stmt.Parameters.AddWithValue("@ID", valueObject.ID);

                int rowcount = databaseUpdate(stmt);
                if (rowcount == 0)
                {
                    throw new Exception("Object could not be saved! (PrimaryKey not found)");
                }
            } finally {
                if (stmt != null)
                {
                    stmt.Dispose();
                }
            }
        }