public string Add(FullHouse house) { ISqlMapper mapper = MapperHelper.GetMapper(); House_OtherFeeDao hofdao = new House_OtherFeeDao(mapper); RentFeeDao rfdao = new RentFeeDao(mapper); House_CustomerDao hcdao = new House_CustomerDao(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) rfdao.Update(new RentFeeUpdateForm { Entity = new RentFee { Enabled = 0 }, RentFeeQueryForm = new RentFeeQueryForm { ID = rf.ID } }); id = rfdao.Add(house.RentFee); 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 }); } } if (house.Renter != null) hcdao.Add(new House_Customer { HouseOrRoomID = house.House.ID, CustomerID = house.Renter.ID, Type = (int)CustomerType.租客 }); return id; }
public string Add(House_OtherFee ho) { ISqlMapper mapper = MapperHelper.GetMapper(); House_OtherFeeDao dao = new House_OtherFeeDao(mapper); return dao.Add(ho); }