实现表单编辑和审核所有编辑的最佳方式?

发布于 2024-10-12 17:32:54 字数 577 浏览 1 评论 0原文

我正在开始一个新项目,该项目需要允许对表单进行编辑,但要跟踪原始内容以及谁做了什么编辑以及在哪里进行的(ps,除了 Visual Studio 2010 和 Microsoft SQL 之外,我无法使用任何额外的软件Server Management Studio 因此没有必要建议任何添加软件,这纯粹是一个代码或表格设计问题)。

我是一个完美主义者,我知道实现这一目标的一些可能途径可能会改变我的整体项目设计,但我不确定我关于如何实现这一点的想法是否是最好的,所以我想听听其他人对以下想法的意见和您对解决上述问题的最快最有效方法的想法。

想法:-

  1. 我将其设置为当他们编辑时,它会显示从文本框到单选按钮的所有现有数据范围,甚至一些下拉菜单和它们拥有的值,然后在提交时它将复制原始记录通过 Id 进入实现表,创建新记录,然后从主表中删除原始记录。

  2. 我想出了某种方法可以将 X 条评论添加到表单的任何部分,并且每个评论都会在底部记录来自 win auth 的时间戳和用户名。

编辑 - 我的目的是获得各种解决方案,但我想一旦我能够开始该项目的编辑部分,如果给定的单个解决方案有效,那么我会将其标记为正确。

I'm starting a new project which will need to allow edits on forms but to keep track of the original and who did what edits and where (p.s. I wouldn't be able to use any extra software other than visual studio 2010 and Microsoft SQL Server Management Studio so no point suggesting any addition software, this is purely a code or table design minded question) .

I'm a perfectionist and I know some possible routes to achieve this will prob change my overall project design but I'm not sure if the ideas I have on how to implement this are best so I like to hear others opinions on below ideas and your own ideas on the quickest most effective way to implement above problem.

Ideas:-

  1. I'd set it up so that when they edit it would display all existing ranges of data from textboxs to radiobuttons and even some drop downs and the value which they had and then on submit it would copy the original record via the Id into a achieve table, create the new record and then delete the original from the main table.

  2. I figure some way to add X amount of comments to any section of the form and each would have a timestamp and username from win auth recorded at the bottom.

Edit - My intention was to get a variety of solutions but I suppose once I'm able to start on the editing section of this project if the single solution given works then I'll mark that correct.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

享受孤独 2024-10-19 17:32:54

我不确定这是否是您正在寻找的,但我需要记录对数据的所有更改(出于审计原因),而我实现此目的的方法是在 SQL Server 中创建一个新的“历史记录”表,该表将存储记录 ID、更改者的用户名、他们是否添加/修改/删除某些内容以及何时发生等。

在数据库中添加/编辑/删除内容的代码中,我总是调用 ObjectContext.SaveChanges (我使用实体框架4)所以我实现的是此方法的扩展,它使用 ObjectStateManager 的各个部分来获取有关已更改的实体所需的信息,并将详细信息插入历史表中。然后,您只需查询数据库中的该表即可显示已更改内容的详细信息。

I'm not sure whether this is what you are looking for but I have the need to log all changes to data (for audit reasons) and the way I have implemented this is to create a new 'History' table in SQL Server that will store the record ID, username of person who changed it, whether they added/modified/deleted something and when this happened etc.

In the code to add/edit/delete things in my database I always call ObjectContext.SaveChanges (I use Entity Framework 4) so what I have implemented is an extension to this method that uses various parts of the ObjectStateManager to get the information required about the entity that has changed and inserts the details into the History table. You then just need to query this table in the database to display details of what has changed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文