如何在OOP中建立类似银行的账户?(How to model a banking-like account in OOP?)
我正在使用WPF构建一个现金管理软件用于学习目的,我在为每个交易完成后能够正确建立现金账户模型时遇到一些麻烦。
这是我现在拥有的摘要版本:
帐户类:
public class Account { public long Id { get; set; } public string Name { get; set; } public decimal StartingBalance { get; set; } }
类别类:
public class Category { public long Id { get; set; } public string Name { get; set; } }
交易类:
public class Transaction { public long Id { get; set; } public DateTime Date { get; set; } public Account Account { get; set; } public Category Category { get; set; } public string Description { get; set; } public decimal TransactionValue { get; set; } }
我想要实现的是,仅使用WPF绑定功能,填充数据网格并查看给定日期间隔和帐户的以下数据:
Date Account Category Description Value Balance 02/02/10 A1 C1 D1 22.30 230.00 02/03/10 A1 C1 D2 -30.00 200.00
我希望能够选择“所有帐户”选项,并在余额列中查看所有帐户余额的总和。
代码工作正常,直到现在,但我没有数据网格中的Balance字段也没有看到一个优雅的方式来模拟这个,我需要你的帮助guyz!
非常感谢您的帮助。
I'm building a cash management software using WPF for learning purposes, and I'm having some troubles to properly model a cash account so that I can see the balance, after each transaction.
Here's a summarized version of what I have now:
An account class:
public class Account { public long Id { get; set; } public string Name { get; set; } public decimal StartingBalance { get; set; } }
A category class:
public class Category { public long Id { get; set; } public string Name { get; set; } }
A transaction class:
public class Transaction { public long Id { get; set; } public DateTime Date { get; set; } public Account Account { get; set; } public Category Category { get; set; } public string Description { get; set; } public decimal TransactionValue { get; set; } }
What I want to achive is, using only the WPF binding capabilities, populate a datagrid and view the following data for a given date interval and account:
Date Account Category Description Value Balance 02/02/10 A1 C1 D1 22.30 230.00 02/03/10 A1 C1 D2 -30.00 200.00
And I would like to be able to select an option "All Accounts" and see in the balance column the sum of the balance of all accounts.
The code is working fine until now, but I don't have the Balance field in the datagrid neither can see an elegant way to model this, I need your help guyz!
Thanks a lot for the help.
原文:https://stackoverflow.com/questions/4466074
最满意答案
您需要在相同/不同的计算机上安装并运行SonarQube。 您还需要Jenkins中的SonarQube插件,它将连接SonarQube以存储结果。
Sonar-runner将是分析器,它将在您的代码库上运行分析。 您需要在本地计算机上安装sonar-runner,并且必须在Jenkins系统配置中指定其路径。
有关详细信息,请在下面的屏幕截图中找到。
You need SonarQube installed and running on same/different machine. also you require SonarQube plugin in Jenkins which will connect SonarQube for Storing results.
Sonar-runner will be analyzer which will run analysis on your codebase. You need to install sonar-runner on your local machine and have to specify its path in Jenkins system configuration.
Please find below the screenshots for detail purpose.
相关问答
更多-
如果你想用SonarQube和Jenkins分析一个项目,这里是你需要的: SonarQube服务器正常运行 Jenkins服务器启动并运行Jenkins的SonarQube扫描仪,安装并配置为指向您的SonarQube服务器 配置为对您的项目运行SonarQube分析的作业: 使用默认和标准的SonarQube扫描仪(适用于大多数项目) 使用MSBuild的SonarQube扫描仪(用于.NET解决方案) 对基于Maven的项目使用后构建操作 关于Jenkins文档页面的SonarQube扫描仪详细介绍了 ...
-
这里有几件不同的事情。 当您在Jenkins外部运行分析时,我猜测您将其作为已在该计算机上缓存SVN凭据的用户运行。 所以分析的“责备”部分隐含地像你一样运行。 当您在Jenkins中检查项目时,您明确地为作业提供凭据,并且这些凭据明确用于作业的该部分 。 当您在Jenkins中运行分析时,当您在Jenkins之外运行分析时,该部分作业无法访问正在使用的缓存凭据。 它也无法访问您为结帐提供Jenkins的凭据。 代替。 您需要进入SonarQube服务器并将这些凭证配置到项目中(您也可以将它们作为分析参数传 ...
-
在sonar-runner和jenkins中覆盖了sonar.jdbc.url参数(sonar.jdbc.url parameter overwritten in sonar-runner and jenkins)[2022-11-12]
经过几次参数修改后,我的修复只是重新启动Jenkins salve代理......由于这不是一个完整的解释,欢迎任何有更多细节的人发布另一个答案。 After several parameter modifications, my fix was simply to restart the Jenkins salve agent... As this is not a complete explanation, anyone with more details is welcome to post anot ... -
如果在Windows奴隶上运行Jenkins的声纳 - 跑步者,请不要在任何密码字段中包含&符号(&)。 我的sonar.password有这个角色。 这将导致其余的声纳 - 跑步者参数被忽略。 此设置是在Jenkins系统配置的Sonar设置中配置的。 对不起,我的问题无法确定,但如果有人有这个奇怪的问题,他们应该检查他们的密码字段。 我最终不得不编辑我的声纳 - 跑步者批处理脚本以显示参数,以便找到问题。 If running sonar-runner from Jenkins on a windows ...
-
经过几个小时的挫折,我发现我必须在/ etc / profile文件中添加环境变量。 export SONAR_RUNNER_HOME = / opt / sonar-runner export PATH = $ PATH:$ SONAR_RUNNER_HOME / bin after hours of frustration, it turned out i had to add environment variable in the /etc/profile file. export SONAR_RUN ...
-
你的sonar-project.properties配置文件中有一个拼写错误。 'sonar.source'而不是'sonar.sources' There is a typo in your sonar-project.properties configuration file. 'sonar.source' instead of 'sonar.sources'
-
好。 所以,如果我理解得很好: 在插件管理器中进入管理Jenkins' - >'管理插件' - >选项卡'Installed',可以在安装的插件中看到'Jenkins Sonar插件'。 - >注意有一个SonarGraph插件不适合。 请确认你有这个: http : //i.stack.imgur.com/SNZLG.jpg 你说你可以在詹金斯安装声纳服务器部分。 我明白你参考这个文档http://docs.codehaus.org/display/SONAR/Configuring+SonarQube+ ...
-
您必须摆脱在Jenkins作业配置中的“ Task to run的Task to run字段中设置的Sonar_5.0_new标签。 You must get rid of the Sonar_5.0_new label that you set on the Task to run field in your Jenkins job configuration.
-
您应该省略sonar-runner调用的DFServer属性。 另请参见此处的SO解释: 自SonarQube 5.2以来,批处理方面不再支持任务 You should omit the DFServer attribute to the sonar-runner call. See also this explanation on SO here: Tasks are no more supported on batch side since SonarQube 5.2
-
您需要在相同/不同的计算机上安装并运行SonarQube。 您还需要Jenkins中的SonarQube插件,它将连接SonarQube以存储结果。 Sonar-runner将是分析器,它将在您的代码库上运行分析。 您需要在本地计算机上安装sonar-runner,并且必须在Jenkins系统配置中指定其路径。 有关详细信息,请在下面的屏幕截图中找到。 You need SonarQube installed and running on same/different machine. also you r ...