18日站立会议
今日站立会议,未照相,各自完善了代码,我将自己的代码进行了完善和修改,在原来的基础上进行了部分的修改
public partial class Form当日消费情况 : Form
{
public Form当日消费情况()
{
InitializeComponent();
}
bool flag = false;
private void Form当日消费情况_Load(object sender, EventArgs e)
{
label1.Text = "消费情况如下";
string str = dateTimePicker1.Text;
string sFile = null;
if (Directory.Exists(Test.path + @"\文本数据\" + str.Substring(0, 8)))
{
string sp = Test.path + @"\文本数据\" + str.Substring(0, 8) + @"\" + str.Substring(8) + @".txt";
if (File.Exists(sp))
{
using (FileStream fs = new FileStream(sp, FileMode.OpenOrCreate, FileAccess.Read))
{
byte[] buffer = new byte[1024 * 1024 * 5];
int x = fs.Read(buffer, 0, buffer.Length);
sFile = Encoding.Default.GetString(buffer, 0, x);
}
if (sFile == null)
{
textBox1.Text = "0";//日常用品
textBox2.Text = "0";//学习用品
textBox3.Text = "0";//电话卡
textBox4.Text = "0";//饮食
textBox5.Text = "0";//衣服
textBox6.Text = "0";//其他
}
else
{
string[] sNew = sFile.Split(Environment.NewLine.ToCharArray());
foreach (string s in sNew)
{
if (s == "")
{
continue;
}
string[] text = s.Split('\t');
//刷新消费情况总和
if (text[1] == "日常用品")
textBox1.Text = (Convert.ToDouble(textBox1.Text) + Convert.ToDouble(text[2])).ToString();
if (text[1] == "学习用品")
textBox2.Text = (Convert.ToDouble(textBox2.Text) + Convert.ToDouble(text[2])).ToString();
if (text[1] == "话费")
textBox3.Text = (Convert.ToDouble(textBox3.Text) + Convert.ToDouble(text[2])).ToString();
if (text[1] == "饮食")
textBox4.Text = (Convert.ToDouble(textBox4.Text) + Convert.ToDouble(text[2])).ToString();
if (text[1] == "衣服")
textBox5.Text = (Convert.ToDouble(textBox5.Text) + Convert.ToDouble(text[2])).ToString();
if (text[1] == "其他")
textBox6.Text = (Convert.ToDouble(textBox6.Text) + Convert.ToDouble(text[2])).ToString();
}
}
}
else