首页 \ 问答 \ 如何在OOP中建立类似银行的账户?(How to model a banking-like account in OOP?)

如何在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
更新时间:2023-11-08 12:11

最满意答案

您需要在相同/不同的计算机上安装并运行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.

enter image description hereenter image description here

相关问答

更多
  • 如果你想用SonarQube和Jenkins分析一个项目,这里是你需要的: SonarQube服务器正常运行 Jenkins服务器启动并运行Jenkins的SonarQube扫描仪,安装并配置为指向您的SonarQube服务器 配置为对您的项目运行SonarQube分析的作业: 使用默认和标准的SonarQube扫描仪(适用于大多数项目) 使用MSBuild的SonarQube扫描仪(用于.NET解决方案) 对基于Maven的项目使用后构建操作 关于Jenkins文档页面的SonarQube扫描仪详细介绍了 ...
  • 这里有几件不同的事情。 当您在Jenkins外部运行分析时,我猜测您将其作为已在该计算机上缓存SVN凭据的用户运行。 所以分析的“责备”部分隐含地像你一样运行。 当您在Jenkins中检查项目时,您明确地为作业提供凭据,并且这些凭据明确用于作业的该部分 。 当您在Jenkins中运行分析时,当您在Jenkins之外运行分析时,该部分作业无法访问正在使用的缓存凭据。 它也无法访问您为结帐提供Jenkins的凭据。 代替。 您需要进入SonarQube服务器并将这些凭证配置到项目中(您也可以将它们作为分析参数传 ...
  • 经过几次参数修改后,我的修复只是重新启动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 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)