Exemplo n.º 1
0
 private void initBll()
 {
     catBll    = BLLLoader.GetMemberCardCategoryBll();
     cardBll   = BLLLoader.GetMemberCardBll();
     recordBll = BLLLoader.GetMemberCardRecordBll();
     logBll    = BLLLoader.GetSaleLogBll();
 }
Exemplo n.º 2
0
 private void initBll()
 {
     BllFactory.DLLBasePath = Application.StartupPath;
     recordBll   = BllFactory.GetMemberCardRecordBll();
     catBll      = BllFactory.GetMemberCardCategoryBll();
     catValueBll = BllFactory.GetMemberCardCategoryValueBll();
     cardBll     = BllFactory.GetMemberCardBll();
     saleBll     = BllFactory.GetSaleLogBll();
 }
Exemplo n.º 3
0
        private void FrmSaleLog_Load(object sender, EventArgs e)
        {
            BllFactory.DLLBasePath = Application.StartupPath;
            bll      = BllFactory.GetReportBll();
            logBll   = BllFactory.GetSaleLogBll();
            goodsBll = BllFactory.GetGoodsBll();
            catBll   = BllFactory.GetGoodsCategoryBll();

            loadData();
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            String msg = null;

            if (String.IsNullOrEmpty(this.txtFee.Text.Trim()))
            {
                msg = "请填写销售金额!";
            }
            else if (Convert.ToDecimal(this.txtFee.Text.Trim()) < 1)
            {
                msg = "销售金额必须大于0元!";
            }

            if (!String.IsNullOrEmpty(msg))
            {
                MessageBox.Show(msg, "保存失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            SaleLog log = new SaleLog();

            log.CreatedAt = TimeStamp.GetNowTimeStamp();
            log.Money     = Convert.ToDecimal(this.txtFee.Text.Trim());
            log.GoodsId   = this.goods.Id;
            log.MemberNo  = "";
            log.Summary   = String.Format("{0}出售了{1}元的{2}",
                                          DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                          this.txtFee.Text.Trim(),
                                          this.goods.Name);

            ISaleLogBLL logBll = BllFactory.GetSaleLogBll();

            if (!logBll.AddLog(log))
            {
                MessageBox.Show("商品销售记录失败!", "保存失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            callback(log.Summary);
            this.Close();
        }
Exemplo n.º 6
0
        /// <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()
                });
            }
        }
Exemplo n.º 7
0
        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;
        }