Beispiel #1
0
        public async Task <Response> SaveResident(ResidentRequest residentResquest)
        {
            var residentId            = GetMaterializeResidentId(residentResquest.BlockNumber, residentResquest.HouseNumber);
            var getResidentDuplicated = _securityPaymentContext.ResidentInformation.ToList()
                                        .Find(x => x.ResidentInformationId == residentId);

            if (getResidentDuplicated == null)
            {
                ControlTransactionFields transactionInfo = TransactionInfo.GetTransactionInfo();

                IDbContextTransaction transaction         = _securityPaymentContext.Database.BeginTransaction();
                ResidentInformation   residentInformation = MaterializeGeneralResidentInformation(residentResquest, residentId, transactionInfo);
                PhoneContact          phoneContact        = MaterializeContactInformation(residentResquest, residentId, transactionInfo);
                EmailContact          emailContact        = MaterializeEmailContact(residentResquest, residentId, transactionInfo);
                HouseInformation      houseInformation    = MaterializeHouseInformation(residentResquest, residentId, transactionInfo);

                await _securityPaymentContext.AddAsync <ResidentInformation>(residentInformation);

                await _securityPaymentContext.AddAsync <PhoneContact>(phoneContact);

                await _securityPaymentContext.AddAsync <EmailContact>(emailContact);

                await _securityPaymentContext.AddAsync <HouseInformation>(houseInformation);

                await _securityPaymentContext.SaveChangesAsync();

                transaction.Commit();
                return(new Response {
                    Data = residentInformation
                });
            }
            return(new Response {
                Message = "Failed, the resident already exist!"
            });
        }
Beispiel #2
0
    void Awake()
    {
        counter  = 0;
        addToTax = false;
        isBuilt  = false;

        canUpgradeTo2 = false;
        canUpgradeTo3 = false;

        taxManager = GameObject.FindGameObjectWithTag("Manager").GetComponentInChildren <TaxManager>();
        houseDB    = GameObject.Find("HouseDatabase").GetComponent <HouseDatabase>();
        houseInf   = GameObject.Find("HouseInformation").GetComponent <HouseInformation>();
    }
Beispiel #3
0
        private List <ResidentRequest> GetResidentsCompleteInformation(List <ResidentInformation> getAllResidents)
        {
            var residentsCompleteInformationList = new List <ResidentRequest>();

            foreach (var resident in getAllResidents)
            {
                HouseInformation houseInformation = GetHouseInformationByResidentId(resident.ResidentInformationId);
                EmailContact     emailContact     = GetEmailContactByResidentId(resident.ResidentInformationId);
                PhoneContact     phoneContact     = GetPhoneContactByResidentId(resident.ResidentInformationId);

                var getResidentMaterializeObject = GetResidentMaterializeObject(resident, houseInformation, emailContact, phoneContact);
                residentsCompleteInformationList.Add(getResidentMaterializeObject);
            }
            return(residentsCompleteInformationList);
        }
Beispiel #4
0
 private HouseInformation FillHouseInfo(房屋租赁表 obj, HouseInformation item = null)
 {
     if (obj == null)
     {
         return(new HouseInformation());
     }
     item = new HouseInformation {
         市区   = obj.市区,
         街道1  = obj.街道1,
         街道2  = obj.街道2,
         小区   = obj.小区,
         室厅厨卫 = string.Format("{0}/{1}/{2}/{3}", obj.室, obj.厅, obj.厨, obj.卫),
         面积   = obj.面积 ?? 0
     };
     return(item);
 }
Beispiel #5
0
        public PriceMapResponse GetSoldPriceMapData()
        {
            List <HouseData> RawHouseData = _readContent.GetFileContent();
            double           total        = RawHouseData.Sum(x => x.Price);

            double           max = RawHouseData.Max(x => x.Price);
            PriceMapResponse priceMapResponse = new PriceMapResponse();
            HouseInformation houseInformation;

            priceMapResponse.Houses = new List <HouseInformation>();
            foreach (var house in RawHouseData)
            {
                houseInformation = new HouseInformation()
                {
                    XCoordinates   = house.XCoordinates,
                    YCoordinates   = house.YCoordinates,
                    CostGroupRange = CalculateCostGroupRange(house.Price)
                };

                priceMapResponse.Houses.Add(houseInformation);
            }

            return(priceMapResponse);
        }
Beispiel #6
0
        private HouseInformation GetHouseInformationByResidentId(string residentInformationId)
        {
            HouseInformation houseInformation = _securityPaymentContext.HouseInformation.ToList().FirstOrDefault(x => x.ResidentId == residentInformationId);

            return(houseInformation);
        }
Beispiel #7
0
 private ResidentRequest GetResidentMaterializeObject(ResidentInformation resident, HouseInformation houseInformation, EmailContact emailContact, PhoneContact phoneContact)
 {
     return(new ResidentRequest()
     {
         ResidentInformationId = resident.ResidentInformationId,
         Name = resident.Name,
         LastName = resident.LastName,
         PhoneNumber = phoneContact.PhoneNumber,
         CountryCode = phoneContact.CountryCode,
         Email = emailContact.Email,
         HouseNumber = houseInformation.HouseNumber,
         BlockNumber = houseInformation.BlockNumber
     });
 }