Exemple #1
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));
        }
Exemple #2
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);
        }