private void initBll() { catBll = BLLLoader.GetMemberCardCategoryBll(); cardBll = BLLLoader.GetMemberCardBll(); recordBll = BLLLoader.GetMemberCardRecordBll(); logBll = BLLLoader.GetSaleLogBll(); }
private void FrmAddLog_Load(object sender, EventArgs e) { bll = BLLLoader.GetSaleLogBll(); goodsbll = BLLLoader.GetGoodsBll(); List <Goods> items = goodsbll.GetAllGoods(); this.cmbGoods.DisplayMember = "Name"; this.cmbGoods.ValueMember = "Id"; this.cmbGoods.DataSource = items; }
/// <summary> /// 加载销售记录 /// </summary> /// <param name="begin">起始时间</param> /// <param name="end">截止时间</param> private void loadSaleLogs(DateTime begin, DateTime end) { if (saleBll == null) { saleBll = BLLLoader.GetSaleLogBll(); } List <SaleLog> result = saleBll.GetAllSaleLogsByDate(begin, end); this.dgvSalelogs.Rows.Clear(); foreach (SaleLog log in result) { this.dgvSalelogs.Rows.Add(new String[] { log.Id.ToString(), TimeStamp.ConvertIntDateTime(log.CreatedAt).ToString(), log.Summary, log.Money.ToString() }); } }
private void synData() { if (isSyn) { return; } isSyn = true; if (bll == null) { bll = BLLLoader.GetSaleLogBll(); } IniFile ini = new IniFile(Application.StartupPath + "/" + "syn.ini"); String last_id = ini.IniReadValue("data", "LastID"); int lastId = String.IsNullOrEmpty(last_id) ? 0 : Convert.ToInt32(last_id); //生成文件名 DateTime now = DateTime.Now; String fileName = String.Format("{0}/runtime/logs/{1}/{2}/{3}.log", Application.StartupPath, now.Year, now.Month, now.Day); //获取数据 List <SaleLog> logs = bll.GetSaleLogsByLastId(lastId); FileTools.Writer(fileName, String.Format("[{0}]本次共加载数据 {1} 条", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), logs.Count)); for (int i = 0; i < logs.Count; i++) { switch (logs[i].GoodsId) { case 0: logs[i].GoodsId = 24; break; case -1: logs[i].GoodsId = 18; break; case -2: logs[i].GoodsId = 19; break; case -3: switch (Convert.ToInt32(logs[i].Remark)) { case 6: logs[i].GoodsId = 21; break; case 7: logs[i].GoodsId = 22; break; case 8: logs[i].GoodsId = 23; break; } break; } } if (logs.Count < 1) { return; } //添加至Mysql String result = "失败"; if (bll.AddLog(logs)) { ini.IniWriteValue("data", "LastID", logs[logs.Count - 1].Id.ToString()); result = "成功"; } //FileTools.Writer(fileName, String.Format("[{0}]同步ID为 {1} 的数据结果为:{2}", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), log.Id, result)); isSyn = false; }