Example #1
0
        private List <string> UpdateBillCustomer(BillCustomer item, Passport passport)
        {
            List <string> sqlList = new List <string>();

            // 没有对应客户ID且输入的客户名称不为空时,插入客户表
            //if (item.CustomerId == "" && item.CustomerNickName != "")
            //{
            //    item.CustomerId = TimeParser.GetTimeRandom();
            //    sqlList.Add(GenerateSql.ReturnAddCustomerSql(item.CustomerId, item.CustomerNickName));
            //}
            //if (item.IsNewCustomer && item.CustomerNickName != "")
            //{
            //    sqlList.Add(GenerateSql.ReturnAddCustomerSql(item.CustomerId, item.CustomerNickName));
            //}
            if (item.IsAdd)
            {
                sqlList.Add(GenerateSql.ReturnInsertBillCustomerSql(item));
            }
            else
            {
                sqlList.Add(GenerateSql.ReturnUpdateBillCustomerSql(item));
            }
            if (item.GoodsList != null && item.GoodsList.Count > 0)
            {
                item.GoodsList.ForEach(goods =>
                {
                    sqlList.AddRange(UpdateBillGoods(goods, passport));
                });
            }
            return(sqlList);
        }
Example #2
0
        /// <summary>
        /// 插入账单客户
        /// </summary>
        /// <returns>The bill customer.</returns>
        /// <param name="item">Item.</param>
        public int AddBillCustomer(BillCustomer item)
        {
            item.Id = TimeParser.GetTimeRandom();
            string sql = GenerateSql.ReturnInsertBillCustomerSql(item);

            return(DbHelper.ExecuteSql(sql));
        }
Example #3
0
        /// <summary>
        /// 插入新客户和账单客户
        /// </summary>
        /// <returns>The bill customer and customer.</returns>
        /// <param name="item">Item.</param>
        public int AddBillCustomerAndCustomer(string enterpriseId, BillCustomer item)
        {
            List <string> sqlList = new List <string>();

            sqlList.Add(GenerateSql.ReturnAddCustomerSql(item.CustomerId, item.CustomerNickName, enterpriseId));
            sqlList.Add(GenerateSql.ReturnInsertBillCustomerSql(item));
            return(DbHelper.ExecuteSqlTran(sqlList));
        }
Example #4
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));
        }
Example #5
0
        /// <summary>
        /// 更新账单下的客户和商品(会存在新增和更新二种状态的数据,通过ID来区分)
        /// </summary>
        /// <returns>The bill.</returns>
        /// <param name="item">Item.</param>
        public int UpdateBillCustomerGoods(Passport passport, Bill item)
        {
            List <string> sqlList = new List <string>();

            sqlList.Add(GenerateSql.ReturnUpdateBillSql(item));
            if (item.CustomerList != null && item.CustomerList.Count > 0)
            {
                item.CustomerList.ForEach(customer =>
                {
                    sqlList.AddRange(UpdateBillCustomer(customer, passport));
                });
            }
            return(DbHelper.ExecuteSqlTran(sqlList));
        }
Example #6
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));
        }
Example #7
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);
        }
Example #8
0
 public int Add(User user)
 {
     return(LoginHelper.ExecuteSql(GenerateSql.ReturnAddUserSql(user)));
 }
Example #9
0
 public int UpdatePassword(string userName, string password)
 {
     return(LoginHelper.ExecuteSql(GenerateSql.ReturnChangePasswordSql(userName, password)));
 }
Example #10
0
 public bool CheckPassword(string userName, string password)
 {
     return(LoginHelper.Exists(GenerateSql.ReturnCheckPasswordSql(userName, password)));
 }
Example #11
0
 public int WxBindOpenId(User user)
 {
     DbHelper.ExecuteSql(GenerateSql.ReturnWxUnBindByOpenIdSql(user.OpenId));
     return(DbHelper.ExecuteSql(GenerateSql.ReturnWxBindOpenIdSql(user.UserName, user.OpenId)));
 }
Example #12
0
 public MySqlDataReader WxLogin(User user)
 {
     return(LoginHelper.ExecuteReader(GenerateSql.ReturnWxLoginSql(user.OpenId)));
 }
Example #13
0
 public MySqlDataReader Login(User user)
 {
     return(LoginHelper.ExecuteReader(GenerateSql.ReturnCheckPasswordSql(user.UserName, user.Password)));
 }
Example #14
0
 /// <summary>
 /// 更新账单
 /// </summary>
 /// <returns>The bill.</returns>
 /// <param name="item">Item.</param>
 public int UpdateBill(Bill item)
 {
     return(DbHelper.ExecuteSql(GenerateSql.ReturnUpdateBillSql(item)));
 }