实例介绍
【实例简介】账单记录小工具(无数据库)
记录日常 收支
【实例截图】
【核心代码】
public partial class Form1 : Form
{
private BillServices bs;
public Form1()
{
InitializeComponent();
dateTimePicker2.Value = dateTimePicker2.Value.AddDays(1);
bs = new BillServices();
}
private List<Bill> bill;
private void button1_Click(object sender, EventArgs e)
{
bill = bs.Search(Convert.ToDateTime( dateTimePicker1.Value.ToString("D")), Convert.ToDateTime(dateTimePicker2.Value.ToString("D")), comboBox1.Text, textBox1.Text);
label6.Text = bill.Where(t => t.Type == "支出").Sum(t => t.Money).ToString();
label7.Text = bill.Where(t => t.Type == "收入").Sum(t => t.Money).ToString();
dataGridView1.DataSource = Tools.Tool.ToDataTable(bill);
}
private void button2_Click(object sender, EventArgs e)
{
FrmBill fmb = new FrmBill();
fmb.StartPosition = FormStartPosition.CenterParent;
fmb.SetBillServices(bs, Tools.DoType.新增);
if (fmb.ShowDialog()==DialogResult.OK)
{
button1_Click(null, null);
}
fmb.Dispose();
}
private void button3_Click(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count!=1)
{
MessageBox.Show("请选择一行"); return;
}
Bill b = new Bill();
b.Id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
b.Type = Convert.ToString(dataGridView1.SelectedRows[0].Cells["Type"].Value);
b.Detail = Convert.ToString(dataGridView1.SelectedRows[0].Cells["Detail"].Value);
b.Money = Convert.ToDecimal(dataGridView1.SelectedRows[0].Cells["Money"].Value);
b.Instraction = Convert.ToString(dataGridView1.SelectedRows[0].Cells["Instraction"].Value);
FrmBill fmb = new FrmBill();
fmb.StartPosition = FormStartPosition.CenterParent;
fmb.SetBillServices(bs, Tools.DoType.修改,b);
if (fmb.ShowDialog() == DialogResult.OK)
{
button1_Click(null, null);
}
fmb.Dispose();
}
private void button4_Click(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count != 1)
{
MessageBox.Show("请选择一行"); return;
}
int id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
if (MessageBox.Show("确认删除?", "此删除不可恢复", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
bs.DeleteAsync(id);
button1_Click(null, null);
}
}
}
.
├── BalancePayments
│ ├── BalancePayments
│ │ ├── App.config
│ │ ├── BalancePayments.csproj
│ │ ├── Form1.Designer.cs
│ │ ├── Form1.cs
│ │ ├── Form1.resx
│ │ ├── FrmBill.Designer.cs
│ │ ├── FrmBill.cs
│ │ ├── FrmBill.resx
│ │ ├── Models
│ │ │ ├── Bill.cs
│ │ │ └── OutPut.cs
│ │ ├── Program.cs
│ │ ├── Properties
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ ├── Resources.resx
│ │ │ ├── Settings.Designer.cs
│ │ │ └── Settings.settings
│ │ ├── Services
│ │ │ └── BillServices.cs
│ │ ├── Tools
│ │ │ ├── Common.cs
│ │ │ ├── Log.cs
│ │ │ └── Tool.cs
│ │ ├── bin
│ │ │ ├── Data
│ │ │ │ └── Bill.json
│ │ │ ├── Debug
│ │ │ │ ├── BalancePayments.exe
│ │ │ │ ├── BalancePayments.exe.config
│ │ │ │ ├── BalancePayments.pdb
│ │ │ │ ├── BalancePayments.vshost.exe
│ │ │ │ ├── BalancePayments.vshost.exe.config
│ │ │ │ ├── Newtonsoft.Json.dll
│ │ │ │ └── Newtonsoft.Json.xml
│ │ │ └── Release
│ │ ├── obj
│ │ │ └── Debug
│ │ │ ├── BalancePayments.Form1.resources
│ │ │ ├── BalancePayments.FrmBill.resources
│ │ │ ├── BalancePayments.Properties.Resources.resources
│ │ │ ├── BalancePayments.csproj.FileListAbsolute.txt
│ │ │ ├── BalancePayments.csproj.GenerateResource.Cache
│ │ │ ├── BalancePayments.csprojResolveAssemblyReference.cache
│ │ │ ├── BalancePayments.exe
│ │ │ ├── BalancePayments.pdb
│ │ │ ├── DesignTimeResolveAssemblyReferences.cache
│ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ │ ├── TempPE
│ │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ │ │ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
│ │ └── packages.config
│ ├── BalancePayments.sln
│ └── packages
│ ├── Newtonsoft.Json.13.0.1
│ │ ├── LICENSE.md
│ │ ├── Newtonsoft.Json.13.0.1.nupkg
│ │ └── lib
│ │ ├── net20
│ │ │ ├── Newtonsoft.Json.dll
│ │ │ └── Newtonsoft.Json.xml
│ │ ├── net35
│ │ │ ├── Newtonsoft.Json.dll
│ │ │ └── Newtonsoft.Json.xml
│ │ ├── net40
│ │ │ ├── Newtonsoft.Json.dll
│ │ │ └── Newtonsoft.Json.xml
│ │ ├── net45
│ │ │ ├── Newtonsoft.Json.dll
│ │ │ └── Newtonsoft.Json.xml
│ │ ├── netstandard1.0
│ │ │ ├── Newtonsoft.Json.dll
│ │ │ └── Newtonsoft.Json.xml
│ │ ├── netstandard1.3
│ │ │ ├── Newtonsoft.Json.dll
│ │ │ └── Newtonsoft.Json.xml
│ │ └── netstandard2.0
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ ├── SunnyUI.3.1.1
│ │ ├── LICENSE
│ │ ├── SunnyUI.3.1.1.nupkg
│ │ ├── SunnyUI.png
│ │ └── lib
│ │ ├── net40
│ │ │ └── SunnyUI.dll
│ │ ├── net472
│ │ │ └── SunnyUI.dll
│ │ ├── net5.0-windows7.0
│ │ │ └── SunnyUI.dll
│ │ └── net6.0-windows7.0
│ │ └── SunnyUI.dll
│ └── SunnyUI.Common.3.1.0
│ ├── LICENSE
│ ├── SunnyUI.Common.3.1.0.nupkg
│ ├── SunnyUI.png
│ └── lib
│ ├── net40
│ │ └── SunnyUI.Common.dll
│ ├── net472
│ │ └── SunnyUI.Common.dll
│ ├── net5.0
│ │ └── SunnyUI.Common.dll
│ ├── net6.0
│ │ └── SunnyUI.Common.dll
│ ├── netcoreapp3.1
│ │ └── SunnyUI.Common.dll
│ └── netstandard2.1
│ └── SunnyUI.Common.dll
└── 账单记录小工具(无数据库).rar
37 directories, 76 files
相关软件
网友评论
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)
支持(0) 盖楼(回复)