Ejemplo n.º 1
0
        /// <summary>
        /// 插入账单商品
        /// </summary>
        /// <returns>The bill customer.</returns>
        /// <param name="item">Item.</param>
        public int AddBillGoods(BillGoods item)
        {
            item.Id = TimeParser.GetTimeRandom();
            string sql = GenerateSql.ReturnInsertBillGoodsSql(item);

            return(DbHelper.ExecuteSql(sql));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 插入新商品和账单商品
        /// </summary>
        /// <returns>The bill customer and customer.</returns>
        /// <param name="item">Item.</param>
        public int AddBillGoodsAndGoods(string enterpriseId, BillGoods item)
        {
            List <string> sqlList = new List <string>();

            sqlList.Add(GenerateSql.ReturnAddGoodsSql(item.GoodsId, item.GoodsName, enterpriseId));
            sqlList.Add(GenerateSql.ReturnInsertBillGoodsSql(item));
            return(DbHelper.ExecuteSqlTran(sqlList));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新商品(会存在新增和更新二种状态的数据,通过ID来区分)
        /// </summary>
        /// <returns>The bill goods.</returns>
        /// <param name="goods">Goods.</param>
        public int UpdateBillGoods(string enterpriseId, BillGoods goods)
        {
            List <string> sqlList = new List <string>();

            // 没有对应商品ID且输入的商品名称不为空时,插入商品表
            if (goods.GoodsId == "" && goods.GoodsName != "")
            {
                goods.GoodsId = TimeParser.GetTimeRandom();
                sqlList.Add(GenerateSql.ReturnAddGoodsSql(goods.GoodsId, goods.GoodsName, enterpriseId));
            }
            if (goods.IsAdd)
            {
                sqlList.Add(GenerateSql.ReturnInsertBillGoodsSql(goods));
            }
            else
            {
                sqlList.Add(GenerateSql.ReturnUpdateBillGoodsSql(goods));
            }

            return(DbHelper.ExecuteSqlTran(sqlList));
        }
Ejemplo n.º 4
0
        private List <string> UpdateBillGoods(BillGoods goods, Passport passport)
        {
            List <string> sqlList = new List <string>();

            // 没有对应商品ID且输入的商品名称不为空时,插入商品表
            //if (goods.GoodsId == "" && goods.GoodsName != "")
            //{
            //    goods.GoodsId = TimeParser.GetTimeRandom();
            //    sqlList.Add(GenerateSql.ReturnAddGoodsSql(goods.GoodsId, goods.GoodsName));
            //}
            //if (goods.IsNewGoods && goods.GoodsName != "")
            //{
            //    sqlList.Add(GenerateSql.ReturnAddGoodsSql(goods.GoodsId, goods.GoodsName));
            //}
            if (goods.IsAdd)
            {
                sqlList.Add(GenerateSql.ReturnInsertBillGoodsSql(goods));
            }
            else
            {
                sqlList.Add(GenerateSql.ReturnUpdateBillGoodsSql(goods));
            }
            return(sqlList);
        }