public string Update(FullHouse house) { ISqlMapper mapper = MapperHelper.GetMapper(); House_OtherFeeDao hofdao = new House_OtherFeeDao(mapper); House_CustomerDao hcdao = new House_CustomerDao(mapper); CustomerDao customerdao = new CustomerDao(mapper); RentFeeDao rfdao = new RentFeeDao(mapper); RentFee rf = null; house.RentFee.HouseOrRoomID = house.House.ID; if (!string.IsNullOrEmpty(house.RentFee.ID)) rf = rfdao.Query(new RentFeeQueryForm { HouseOrRoomID = house.House.ID, Enabled = 1, IsDeleted = 0 }).FirstOrDefault(); string id = house.RentFee.ID; if (rf == null) id = rfdao.Add(house.RentFee); else rfdao.Update(new RentFeeUpdateForm { Entity = house.RentFee, RentFeeQueryForm = new RentFeeQueryForm { ID = id }, }); hofdao.Delete(new House_OtherFeeQueryForm { HouseOrRoomID = house.House.ID }); if (house.OtherFees != null) { foreach (var of in house.OtherFees) { hofdao.Add(new House_OtherFee { HouseOrRoomID = house.House.ID, OtherFeeID = of.ID, Type = (int)HouseOrRoomType.House }); } } hcdao.Delete(new House_CustomerQueryForm { HouseOrRoomID = house.House.ID, Type = (int)CustomerType.租客 }); if (house.Renter != null) hcdao.Add(new House_Customer { HouseOrRoomID = house.House.ID, CustomerID = house.Renter.ID, Type = (int)CustomerType.租客 }); return id; }
public bool Delete(House_OtherFeeQueryForm form) { ISqlMapper mapper = MapperHelper.GetMapper(); House_OtherFeeDao dao = new House_OtherFeeDao(mapper); return dao.Delete(form); }