private void SetTotalText(ZongJie zj) { if (zj != null) { this.txtCount.Text = zj.list.Count.ToString(); this.txtFlightTM.Text = zj.totalfly.ToString(); this.txtTaxiTM.Text = (zj.totaltaxi + zj.totaltrain).ToString(); this.txtOtherTM.Text = zj.totalqita.ToString(); this.txtZhusuTM.Text = zj.totalzhusu.ToString(); this.txtAllowanceTM.Text = zj.totalbutie.ToString(); this.txtTotalTM.Text = zj.totalzongshu.ToString(); } }
public void deserialize_zongjie(string path) { using (FileStream fs = new FileStream(path, FileMode.Open)) { BinaryFormatter bf = new BinaryFormatter(); FileInfo fi = new FileInfo(path); if (fi.Length == 0) { initializeZongJie(this.zongjie); return; } ZongJie zj = bf.Deserialize(fs) as ZongJie; this.zongjie = zj; fs.Close(); } }
public void initializeZongJie(ZongJie zongjie) { if (zongjie.list == null) { zongjie.list = new List <travelInfo>(); } zongjie.jiekuan = 0; zongjie.title = string.Empty; zongjie.addrowcount = 0; zongjie.baoxiaojine = 0; zongjie.totalbutie = 0; zongjie.totalfly = 0; zongjie.totalqita = 0; zongjie.totaltaxi = 0; zongjie.totaltrain = 0; zongjie.totalzhusu = 0; zongjie.totalzongshu = 0; }
//点击excel的时候读取tmp文件夹中的相对应文件。 private void dataGridView_LoadData(string tmppath) { try { this.dataGridView1.Rows.Clear(); bll.deserialize_zongjie(tmppath); ZongJie zj = bll.getZongJie(); bll.addTitle(Path.GetFileNameWithoutExtension(tmppath)); borrowM = bll.getZongJie().jiekuan; foreach (travelInfo tv in zj.list) { addToGridView(tv); } SetTotalText(zj); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void DataGridView_LoadData(ZongJie zj, string tmppath) { try { zj = bll.getZongJie(); bll.addTitle(Path.GetFileNameWithoutExtension(tmppath)); borrowM = bll.getZongJie().jiekuan; dataGridView1.Rows.Clear(); if (zj.list.Count == 0) { return; } foreach (travelInfo tv in zj.list) { addToGridView(tv); } SetTotalText(bll.getZongJie()); } catch (Exception ex) { MessageBox.Show(ex.Message); throw; } }
public travelInfoDAL() { zongjie = new ZongJie(); initializeZongJie(zongjie); }