private void button1_Click(object sender, EventArgs e) { bl = new Banlance(vip); bl.ExecAdd((int)numericUpDown1.Value, BanlanceType.充值); textBox4.Text = (Convert.ToInt32(textBox4.Text) + numericUpDown1.Value).ToString(); dataGridView1.DataSource = bl.ShowHistory(); SetdataGridViewHeaderCell(); }
private void button1_Click(object sender, EventArgs e) { vip.VipCard = textBox1.Text.Trim(); vip.UserName = textBox2.Text.Trim(); vip.VipType = comboBox1.SelectedItem.ToString().Trim(); vip.PhoneNumber = textBox5.Text.Trim(); vip.Balance = Convert.ToInt32(textBox6.Text.Trim()); if (Type == "新增") { vip.CreateTime = DateTime.Now.ToLocalTime().ToString(); vip.AddVipUser(vip); Banlance bl = new Banlance(vip); bl.ExecAdd(Convert.ToInt32(textBox6.Text.Trim()), BanlanceType.办理); } else { vip.EditVipUser(vip); } this.DialogResult = DialogResult.OK; }
//结算 public void Settlement(DataTable dt, int TotalPrice) { //删除库存 Banlance bl = new Banlance(vinfo); vinfo.Balance -= TotalPrice; bl.ExecAdd(TotalPrice, BanlanceType.消费); vinfo.EditVipUser(vinfo); //写入文件 RecordsConsumption ls = new RecordsConsumption(); ls.VipCard = vinfo.VipCard; ls.Vtype = vinfo.VipType; ls.UserName = vinfo.UserName; ls.PhoneNumber = vinfo.PhoneNumber; ls.Banlance = vinfo.PhoneNumber; ls.ls = new List <ConsumptionInfo>(); ConsumptionInfo cinfo; for (int i = 0; i < dt.Rows.Count; i++) { cinfo = new ConsumptionInfo(); cinfo.Goods = dt.Rows[i]["Goods"].ToString(); cinfo.GoodsNumber = dt.Rows[i]["GoodsNumber"].ToString(); cinfo.TotalPrice = dt.Rows[i]["TotalPrice"].ToString(); cinfo.UnitPrice = dt.Rows[i]["UnitPrice"].ToString(); ls.ls.Add(cinfo); } ls.ConsumptionTime = DateTime.Now.ToLocalTime().ToString(); string filediry = filedir + @"/" + ls.VipCard; string fileurl = filediry + $"/{DateTime.Now.ToString("yyyyMMddhhmmss")}.txt"; FileCreate.FileAndDirCreate(FileType.directory, filediry); //FileCreate.FileAndDirCreate(FileType.File, fileurl); File.WriteAllText(fileurl, JsonConvert.SerializeObject(ls)); }