| | |
| | | if (UpdateCustomerStatus(db, entity.Id, "B")) |
| | | return 1; |
| | | break; |
| | | case "2": |
| | | if (InsertCustomer(db, entity)) |
| | | return 1; |
| | | break; |
| | | case "3": |
| | | if (DeleteCustomer(db, entity.Id)) |
| | | return 1; |
| | | break; |
| | | case "2": |
| | | case "4": |
| | | if (InsertOrUpdate(db, entity)) |
| | | return 1; |
| | |
| | | |
| | | private bool DeleteCustomer(SqlSugarScope db, decimal customerId) |
| | | { |
| | | var deleteById = db.Deleteable<MesCustomer>().In(customerId) |
| | | .ExecuteCommand(); |
| | | var deleteById = db.Deleteable<MesCustomer>() |
| | | .Where(s => s.Id == customerId).ExecuteCommand(); |
| | | if (deleteById > 0) |
| | | return true; |
| | | |
| | |
| | | LastupdateDate = DateTime.Now, |
| | | Company = "1000", |
| | | Factory = "1000", |
| | | DataType = customer.FDocumentStatus |
| | | DataType = customer.FDocumentStatus, |
| | | Type = customer.Type |
| | | }; |
| | | } |
| | | |
| | |
| | | List<MesCustomer> customerList) |
| | | { |
| | | var ids = customerList.Select(it => it.Id).ToArray(); |
| | | var deleteByIds = db.Deleteable<MesCustomer>().In(ids).ExecuteCommand(); |
| | | var deleteByIds = db.Deleteable<MesCustomer>() |
| | | .Where(s => ids.Contains(s.Id)).ExecuteCommand(); |
| | | if (deleteByIds > 0) |
| | | return true; |
| | | |
| | |
| | | |
| | | var insert = db.Insertable(entity).ExecuteCommand(); |
| | | |
| | | if (insert > 0) |
| | | return true; |
| | | |
| | | return false; |
| | | return insert > 0; |
| | | } |
| | | |
| | | private bool InsertOrUpdateBatch(SqlSugarScope db, |
| | | List<MesCustomer> customerList) |
| | | { |
| | | foreach (var entity in customerList) |
| | | if (!InsertOrUpdate(db, entity)) |
| | | return false; |
| | | |
| | | return true; |
| | | return customerList.All(entity => InsertOrUpdate(db, entity)); |
| | | } |
| | | } |