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); }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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)); }
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); }
public int Add(User user) { return(LoginHelper.ExecuteSql(GenerateSql.ReturnAddUserSql(user))); }
public int UpdatePassword(string userName, string password) { return(LoginHelper.ExecuteSql(GenerateSql.ReturnChangePasswordSql(userName, password))); }
public bool CheckPassword(string userName, string password) { return(LoginHelper.Exists(GenerateSql.ReturnCheckPasswordSql(userName, password))); }
public int WxBindOpenId(User user) { DbHelper.ExecuteSql(GenerateSql.ReturnWxUnBindByOpenIdSql(user.OpenId)); return(DbHelper.ExecuteSql(GenerateSql.ReturnWxBindOpenIdSql(user.UserName, user.OpenId))); }
public MySqlDataReader WxLogin(User user) { return(LoginHelper.ExecuteReader(GenerateSql.ReturnWxLoginSql(user.OpenId))); }
public MySqlDataReader Login(User user) { return(LoginHelper.ExecuteReader(GenerateSql.ReturnCheckPasswordSql(user.UserName, user.Password))); }
/// <summary> /// 更新账单 /// </summary> /// <returns>The bill.</returns> /// <param name="item">Item.</param> public int UpdateBill(Bill item) { return(DbHelper.ExecuteSql(GenerateSql.ReturnUpdateBillSql(item))); }