/// <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)); }
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 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)); }